Merge branch 'c8' into a8
This commit is contained in:
commit
cb5787e83c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
SOURCES/scap-security-guide-0.1.52-2.el7_9-rhel6.tar.bz2
|
||||
SOURCES/scap-security-guide-0.1.57.tar.bz2
|
||||
SOURCES/scap-security-guide-0.1.60.tar.bz2
|
||||
|
@ -1,2 +1,2 @@
|
||||
b22b45d29ad5a97020516230a6ef3140a91d050a SOURCES/scap-security-guide-0.1.52-2.el7_9-rhel6.tar.bz2
|
||||
d78bdc956df4301c3b3bbb2f9f24d809d7b1d08c SOURCES/scap-security-guide-0.1.57.tar.bz2
|
||||
6768818c9bd6f9f35596f2fe23c50ffe52b974c3 SOURCES/scap-security-guide-0.1.60.tar.bz2
|
||||
|
@ -1,23 +1,15 @@
|
||||
diff --git a/rhel8/CMakeLists.txt b/rhel8/CMakeLists.txt
|
||||
index d61689c97..5e444a101 100644
|
||||
diff --git a/products/rhel8/CMakeLists.txt b/products/rhel8/CMakeLists.txt
|
||||
index 5258591c7f..cc4b9c5720 100644
|
||||
--- a/products/rhel8/CMakeLists.txt
|
||||
+++ b/products/rhel8/CMakeLists.txt
|
||||
@@ -14,15 +14,9 @@ ssg_build_html_table_by_ref(${PRODUCT} "cis")
|
||||
ssg_build_html_table_by_ref(${PRODUCT} "pcidss")
|
||||
ssg_build_html_table_by_ref(${PRODUCT} "anssi")
|
||||
@@ -11,7 +11,6 @@ ssg_build_product(${PRODUCT})
|
||||
ssg_build_html_ref_tables("${PRODUCT}" "table-${PRODUCT}-{ref_id}refs" "anssi;cis;cui;nist;pcidss")
|
||||
|
||||
-ssg_build_html_nistrefs_table(${PRODUCT} "standard")
|
||||
ssg_build_html_nistrefs_table(${PRODUCT} "ospp")
|
||||
ssg_build_html_nistrefs_table(${PRODUCT} "stig")
|
||||
ssg_build_html_profile_table("table-${PRODUCT}-nistrefs-ospp" "${PRODUCT}" "ospp" "nist")
|
||||
-ssg_build_html_profile_table("table-${PRODUCT}-nistrefs-standard" "${PRODUCT}" "standard" "nist")
|
||||
ssg_build_html_profile_table("table-${PRODUCT}-nistrefs-stig" "${PRODUCT}" "stig" "nist")
|
||||
|
||||
-ssg_build_html_anssirefs_table(${PRODUCT} "bp28_minimal")
|
||||
-ssg_build_html_anssirefs_table(${PRODUCT} "bp28_intermediary")
|
||||
-ssg_build_html_anssirefs_table(${PRODUCT} "bp28_enhanced")
|
||||
-ssg_build_html_anssirefs_table(${PRODUCT} "bp28_high")
|
||||
-
|
||||
ssg_build_html_cce_table(${PRODUCT})
|
||||
|
||||
ssg_build_html_srgmap_tables(${PRODUCT} "stig" ${DISA_SRG_TYPE})
|
||||
ssg_build_html_profile_table("table-${PRODUCT}-anssirefs-bp28_minimal" "${PRODUCT}" "anssi_bp28_minimal" "anssi")
|
||||
diff --git a/products/rhel8/profiles/cjis.profile b/rhel8/profiles/cjis.profile
|
||||
index 035d2705b..c6475f33e 100644
|
||||
--- a/products/rhel8/profiles/cjis.profile
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 628cbacb76e9950528359038cf3237ac7166f0b7 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 14 Mar 2022 12:57:26 +0100
|
||||
Subject: [PATCH] Reorder reference in alphabetical order.
|
||||
|
||||
---
|
||||
.../integrity/crypto/configure_bind_crypto_policy/rule.yml | 2 +-
|
||||
.../software/integrity/crypto/configure_crypto_policy/rule.yml | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml
|
||||
index e58c950..8d73d9d 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml
|
||||
@@ -29,8 +29,8 @@ identifiers:
|
||||
references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1
|
||||
nist: SC-13,SC-12(2),SC-12(3)
|
||||
- stigid@rhel8: RHEL-08-010020
|
||||
srg: SRG-OS-000423-GPOS-00187,SRG-OS-000426-GPOS-00190
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: |-
|
||||
BIND is installed and the BIND config file doesn't contain the
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml
|
||||
index 5eea87a..a5a8df3 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml
|
||||
@@ -65,8 +65,8 @@ references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1,CIP-007-3 R7.1
|
||||
nist: AC-17(a),AC-17(2),CM-6(a),MA-4(6),SC-13,SC-12(2),SC-12(3)
|
||||
ospp: 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
|
||||
- stigid@rhel8: RHEL-08-010020
|
||||
srg: SRG-OS-000396-GPOS-00176,SRG-OS-000393-GPOS-00173,SRG-OS-000394-GPOS-00174
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: 'cryptographic policy is not configured or is configured incorrectly'
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,199 +0,0 @@
|
||||
From 2cbc694687190cadb155c5582f93a8cf91ebdc4c Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Thu, 26 Aug 2021 15:04:46 +0200
|
||||
Subject: [PATCH] Bug 1942281 - Set postfix rules to notapplicable when package
|
||||
is not installed
|
||||
|
||||
---
|
||||
.../rule.yml | 2 ++
|
||||
.../rule.yml | 2 ++
|
||||
.../services/mail/postfix_harden_os/group.yml | 2 ++
|
||||
.../rule.yml | 3 ++-
|
||||
products/rhel8/profiles/stig.profile | 4 +---
|
||||
products/rhel9/profiles/stig.profile | 4 +---
|
||||
shared/applicability/general.yml | 5 +++++
|
||||
.../installed_env_has_postfix_package.xml | 20 +++++++++++++++++++
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 3 ++-
|
||||
.../profile_stability/rhel8/stig_gui.profile | 3 ++-
|
||||
11 files changed, 39 insertions(+), 10 deletions(-)
|
||||
create mode 100644 shared/checks/oval/installed_env_has_postfix_package.xml
|
||||
|
||||
diff --git a/linux_os/guide/services/mail/postfix_client/postfix_client_configure_relayhost/rule.yml b/linux_os/guide/services/mail/postfix_client/postfix_client_configure_relayhost/rule.yml
|
||||
index 0faafeb0c2f..4b440e79845 100644
|
||||
--- a/linux_os/guide/services/mail/postfix_client/postfix_client_configure_relayhost/rule.yml
|
||||
+++ b/linux_os/guide/services/mail/postfix_client/postfix_client_configure_relayhost/rule.yml
|
||||
@@ -21,3 +21,5 @@ ocil: |-
|
||||
Run the following command to ensure postfix routes mail to this system:
|
||||
<pre>$ grep relayhost /etc/postfix/main.cf</pre>
|
||||
If properly configured, the output should show only <tt>{{{ xccdf_value("var_postfix_relayhost") }}}</tt>.
|
||||
+
|
||||
+platform: postfix
|
||||
diff --git a/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/rule.yml b/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/rule.yml
|
||||
index 096020ef687..579db484976 100644
|
||||
--- a/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/rule.yml
|
||||
+++ b/linux_os/guide/services/mail/postfix_client/postfix_network_listening_disabled/rule.yml
|
||||
@@ -42,3 +42,5 @@ ocil: |-
|
||||
Run the following command to ensure postfix accepts mail messages from only the local system:
|
||||
<pre>$ grep inet_interfaces /etc/postfix/main.cf</pre>
|
||||
If properly configured, the output should show only <tt>{{{ xccdf_value("var_postfix_inet_interfaces") }}}</tt>.
|
||||
+
|
||||
+platform: postfix
|
||||
diff --git a/linux_os/guide/services/mail/postfix_harden_os/group.yml b/linux_os/guide/services/mail/postfix_harden_os/group.yml
|
||||
index 19b662508bd..8a415425e7d 100644
|
||||
--- a/linux_os/guide/services/mail/postfix_harden_os/group.yml
|
||||
+++ b/linux_os/guide/services/mail/postfix_harden_os/group.yml
|
||||
@@ -6,3 +6,5 @@ description: |-
|
||||
The guidance in this section is appropriate for any host which is
|
||||
operating as a site MTA, whether the mail server runs using Sendmail, Postfix,
|
||||
or some other software.
|
||||
+
|
||||
+platform: postfix
|
||||
diff --git a/linux_os/guide/services/mail/postfix_harden_os/postfix_server_cfg/postfix_server_relay/postfix_prevent_unrestricted_relay/rule.yml b/linux_os/guide/services/mail/postfix_harden_os/postfix_server_cfg/postfix_server_relay/postfix_prevent_unrestricted_relay/rule.yml
|
||||
index 9b4c7656a85..75e4133b119 100644
|
||||
--- a/linux_os/guide/services/mail/postfix_harden_os/postfix_server_cfg/postfix_server_relay/postfix_prevent_unrestricted_relay/rule.yml
|
||||
+++ b/linux_os/guide/services/mail/postfix_harden_os/postfix_server_cfg/postfix_server_relay/postfix_prevent_unrestricted_relay/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: ol7,ol8,rhel7,rhel8,wrlinux1019
|
||||
+prodtype: ol7,ol8,rhel7,rhel8,rhel9,wrlinux1019
|
||||
|
||||
title: 'Prevent Unrestricted Mail Relaying'
|
||||
|
||||
@@ -19,6 +19,7 @@ severity: medium
|
||||
identifiers:
|
||||
cce@rhel7: CCE-80512-7
|
||||
cce@rhel8: CCE-84054-6
|
||||
+ cce@rhel9: CCE-87232-5
|
||||
|
||||
references:
|
||||
disa: CCI-000366
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index d31b251645b..5e9a2216fcd 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1160,9 +1160,7 @@ selections:
|
||||
- sysctl_net_core_bpf_jit_harden
|
||||
|
||||
# RHEL-08-040290
|
||||
- # /etc/postfix/main.cf does not exist on default installation resulting in error during remediation
|
||||
- # there needs to be a new platform check to identify when postfix is installed or not
|
||||
- # - postfix_prevent_unrestricted_relay
|
||||
+ - postfix_prevent_unrestricted_relay
|
||||
|
||||
# RHEL-08-040300
|
||||
- aide_verify_ext_attributes
|
||||
diff --git a/products/rhel9/profiles/stig.profile b/products/rhel9/profiles/stig.profile
|
||||
index a40d848ee67..8d60468528d 100644
|
||||
--- a/products/rhel9/profiles/stig.profile
|
||||
+++ b/products/rhel9/profiles/stig.profile
|
||||
@@ -1030,9 +1030,7 @@ selections:
|
||||
- sysctl_net_ipv4_conf_all_rp_filter
|
||||
|
||||
# RHEL-08-040290
|
||||
- # /etc/postfix/main.cf does not exist on default installation resulting in error during remediation
|
||||
- # there needs to be a new platform check to identify when postfix is installed or not
|
||||
- # - postfix_prevent_unrestricted_relay
|
||||
+ - postfix_prevent_unrestricted_relay
|
||||
|
||||
# RHEL-08-040300
|
||||
- aide_verify_ext_attributes
|
||||
diff --git a/shared/applicability/general.yml b/shared/applicability/general.yml
|
||||
index 6e3ecfd9bf9..4163a07cbad 100644
|
||||
--- a/shared/applicability/general.yml
|
||||
+++ b/shared/applicability/general.yml
|
||||
@@ -44,6 +44,11 @@ cpes:
|
||||
title: "Package pam is installed"
|
||||
check_id: installed_env_has_pam_package
|
||||
|
||||
+ - postfix:
|
||||
+ name: "cpe:/a:postfix"
|
||||
+ title: "Package postfix is installed"
|
||||
+ check_id: installed_env_has_postfix_package
|
||||
+
|
||||
- sssd:
|
||||
name: "cpe:/a:sssd"
|
||||
title: "Package sssd-common is installed"
|
||||
diff --git a/shared/checks/oval/installed_env_has_postfix_package.xml b/shared/checks/oval/installed_env_has_postfix_package.xml
|
||||
new file mode 100644
|
||||
index 00000000000..95ad355147b
|
||||
--- /dev/null
|
||||
+++ b/shared/checks/oval/installed_env_has_postfix_package.xml
|
||||
@@ -0,0 +1,20 @@
|
||||
+<def-group>
|
||||
+
|
||||
+ <definition class="inventory"
|
||||
+ id="installed_env_has_postfix_package" version="1">
|
||||
+ <metadata>
|
||||
+ <title>Package postfix is installed</title>
|
||||
+ <affected family="unix">
|
||||
+ <platform>multi_platform_all</platform>
|
||||
+ </affected>
|
||||
+ <description>Checks if package postfix is installed.</description>
|
||||
+ <reference ref_id="cpe:/a:postfix" source="CPE" />
|
||||
+ </metadata>
|
||||
+ <criteria>
|
||||
+ <criterion comment="Package postfix is installed" test_ref="test_env_has_postfix_installed" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ {{{ oval_test_package_installed(package='postfix', evr='', test_id='test_env_has_postfix_installed') }}}
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index ee4c156b79c..29fe687600c 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -1314,7 +1314,6 @@ CCE-87228-3
|
||||
CCE-87229-1
|
||||
CCE-87230-9
|
||||
CCE-87231-7
|
||||
-CCE-87232-5
|
||||
CCE-87233-3
|
||||
CCE-87234-1
|
||||
CCE-87235-8
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index ba596f86f83..ca0097b844b 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -64,8 +64,8 @@ selections:
|
||||
- accounts_user_home_paths_only
|
||||
- accounts_user_interactive_home_directory_defined
|
||||
- accounts_user_interactive_home_directory_exists
|
||||
-- aide_check_audit_tools
|
||||
- agent_mfetpd_running
|
||||
+- aide_check_audit_tools
|
||||
- aide_scan_notification
|
||||
- aide_verify_acls
|
||||
- aide_verify_ext_attributes
|
||||
@@ -304,6 +304,7 @@ selections:
|
||||
- partition_for_var_log_audit
|
||||
- partition_for_var_tmp
|
||||
- postfix_client_configure_mail_alias
|
||||
+- postfix_prevent_unrestricted_relay
|
||||
- require_emergency_target_auth
|
||||
- require_singleuser_auth
|
||||
- root_permissions_syslibrary_files
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 9db93027011..3533208c4a5 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -75,8 +75,8 @@ selections:
|
||||
- accounts_user_home_paths_only
|
||||
- accounts_user_interactive_home_directory_defined
|
||||
- accounts_user_interactive_home_directory_exists
|
||||
-- aide_check_audit_tools
|
||||
- agent_mfetpd_running
|
||||
+- aide_check_audit_tools
|
||||
- aide_scan_notification
|
||||
- aide_verify_acls
|
||||
- aide_verify_ext_attributes
|
||||
@@ -315,6 +315,7 @@ selections:
|
||||
- partition_for_var_log_audit
|
||||
- partition_for_var_tmp
|
||||
- postfix_client_configure_mail_alias
|
||||
+- postfix_prevent_unrestricted_relay
|
||||
- require_emergency_target_auth
|
||||
- require_singleuser_auth
|
||||
- root_permissions_syslibrary_files
|
@ -1,240 +0,0 @@
|
||||
From bb5c2983be3b11c3cd1070cf1d3daca27cb700ee Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 19 Aug 2021 08:02:55 -0500
|
||||
Subject: [PATCH] Add a new rules RHEL-08-010001 and RHEL-07-020019
|
||||
|
||||
---
|
||||
.../agent_mfetpd_running/oval/shared.xml | 16 ++++++
|
||||
.../agent_mfetpd_running/rule.yml | 39 ++++++++++++++
|
||||
.../group.yml | 7 +++
|
||||
.../package_mcafeetp_installed/rule.yml | 51 +++++++++++++++++++
|
||||
products/rhel7/profiles/stig.profile | 2 +
|
||||
products/rhel8/profiles/stig.profile | 4 ++
|
||||
shared/references/cce-redhat-avail.txt | 4 --
|
||||
.../data/profile_stability/rhel8/stig.profile | 2 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 2 +
|
||||
9 files changed, 123 insertions(+), 4 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/rule.yml
|
||||
create mode 100644 linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml
|
||||
create mode 100644 linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/oval/shared.xml b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..9900d8bd724
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/oval/shared.xml
|
||||
@@ -0,0 +1,16 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Ensure that McAfee Endpoint Security for Linux (ENSL) is running.") }}}
|
||||
+ <criteria>
|
||||
+ <criterion comment="McAfee ENSL is running" test_ref="test_{{{ rule_id }}}"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+ <unix:process58_test check="all" id="test_{{{ rule_id }}}" comment="is mfetpd running" version="1">
|
||||
+ <unix:object object_ref="obj_{{{ rule_id }}}"/>
|
||||
+ </unix:process58_test>
|
||||
+
|
||||
+ <unix:process58_object id="obj_{{{ rule_id }}}" version="1">
|
||||
+ <unix:command_line operation="pattern match">^mfetpd.*$</unix:command_line>
|
||||
+ <unix:pid datatype="int" operation="greater than">0</unix:pid>
|
||||
+ </unix:process58_object>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/rule.yml b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..32c934467da
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/agent_mfetpd_running/rule.yml
|
||||
@@ -0,0 +1,39 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel7,rhel8
|
||||
+
|
||||
+title: 'Ensure McAfee Endpoint Security for Linux (ENSL) is running'
|
||||
+
|
||||
+description: |-
|
||||
+ Install McAfee Endpoint Security for Linux antivirus software
|
||||
+ which is provided for DoD systems and uses signatures to search for the
|
||||
+ presence of viruses on the filesystem.
|
||||
+
|
||||
+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: high
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel7: CCE-86262-3
|
||||
+ cce@rhel8: CCE-86261-5
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001233
|
||||
+ nist: SI-2(2)
|
||||
+ srg: SRG-OS-000191-GPOS-00080
|
||||
+ stigid@rhel7: RHEL-07-020019
|
||||
+ stigid@rhel8: RHEL-08-010001
|
||||
+
|
||||
+ocil_clause: 'virus scanning software is not running'
|
||||
+
|
||||
+ocil: |-
|
||||
+ To verify that McAfee Endpoint Security for Linux is
|
||||
+ running, run the following command:
|
||||
+ <pre>$ sudo ps -ef | grep -i mfetpd</pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to McAfee Endpoint Security for Linux (ENSL) being 3rd party software,
|
||||
+ automated remediation is not available for this configuration check.
|
||||
diff --git a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml
|
||||
new file mode 100644
|
||||
index 00000000000..f2e4e89851a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml
|
||||
@@ -0,0 +1,7 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: 'McAfee Endpoint Security for Linux (ENSL)'
|
||||
+
|
||||
+description: |-
|
||||
+ McAfee Endpoint Security for Linux (ENSL) is a suite of software applications
|
||||
+ used to monitor, detect, and defend computer networks and systems.
|
||||
diff --git a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..16587792eff
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml
|
||||
@@ -0,0 +1,51 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel7,rhel8
|
||||
+
|
||||
+title: 'Install McAfee Endpoint Security for Linux (ENSL)'
|
||||
+
|
||||
+description: |-
|
||||
+ Install McAfee Endpoint Security for Linux antivirus software
|
||||
+ which is provided for DoD systems and uses signatures to search for the
|
||||
+ presence of viruses on the filesystem.
|
||||
+
|
||||
+ {{{ describe_package_install(package="mcafeetp") }}}
|
||||
+
|
||||
+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: high
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel7: CCE-86257-3
|
||||
+ cce@rhel8: CCE-86260-7
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001233
|
||||
+ nist: SI-2(2)
|
||||
+ srg: SRG-OS-000191-GPOS-00080
|
||||
+ stigid@rhel7: RHEL-07-020019
|
||||
+ stigid@rhel8: RHEL-08-010001
|
||||
+
|
||||
+ocil_clause: 'the package is not installed'
|
||||
+
|
||||
+ocil: '{{{ ocil_package(package="mcafeetp") }}}'
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to McAfee Endpoint Security for Linux (ENSL) being 3rd party software,
|
||||
+ automated remediation is not available for this configuration check.
|
||||
+
|
||||
+platform: machine
|
||||
+
|
||||
+template:
|
||||
+ name: package_installed
|
||||
+ vars:
|
||||
+ pkgname: mcafeetp
|
||||
+ backends:
|
||||
+ bash: "off"
|
||||
+ ansible: "off"
|
||||
+ anaconda: "off"
|
||||
+ puppet: "off"
|
||||
+ blueprint: "off"
|
||||
diff --git a/products/rhel7/profiles/stig.profile b/products/rhel7/profiles/stig.profile
|
||||
index f5761c891f2..9ca13600057 100644
|
||||
--- a/products/rhel7/profiles/stig.profile
|
||||
+++ b/products/rhel7/profiles/stig.profile
|
||||
@@ -316,3 +316,5 @@ selections:
|
||||
- file_permissions_var_log_audit
|
||||
- sysctl_net_ipv4_conf_all_rp_filter
|
||||
- sysctl_net_ipv4_conf_default_rp_filter
|
||||
+ - package_mcafeetp_installed
|
||||
+ - agent_mfetpd_running
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 9dc9360e899..36f384621ae 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -84,6 +84,10 @@ selections:
|
||||
# RHEL-08-010000
|
||||
- installed_OS_is_vendor_supported
|
||||
|
||||
+ # RHEL-08-010001
|
||||
+ - package_mcafeetp_installed
|
||||
+ - agent_mfetpd_running
|
||||
+
|
||||
# RHEL-08-010010
|
||||
- security_patches_up_to_date
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 3b24e19da06..08013e6de22 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -372,12 +372,8 @@ CCE-86253-2
|
||||
CCE-86254-0
|
||||
CCE-86255-7
|
||||
CCE-86256-5
|
||||
-CCE-86257-3
|
||||
CCE-86258-1
|
||||
CCE-86259-9
|
||||
-CCE-86260-7
|
||||
-CCE-86261-5
|
||||
-CCE-86262-3
|
||||
CCE-86263-1
|
||||
CCE-86264-9
|
||||
CCE-86265-6
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index e9ba0f0adbf..f3e6c4fa1a1 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -65,6 +65,7 @@ selections:
|
||||
- accounts_user_interactive_home_directory_defined
|
||||
- accounts_user_interactive_home_directory_exists
|
||||
- aide_check_audit_tools
|
||||
+- agent_mfetpd_running
|
||||
- aide_scan_notification
|
||||
- aide_verify_acls
|
||||
- aide_verify_ext_attributes
|
||||
@@ -280,6 +281,7 @@ selections:
|
||||
- package_gssproxy_removed
|
||||
- package_iprutils_removed
|
||||
- package_krb5-workstation_removed
|
||||
+- package_mcafeetp_installed
|
||||
- package_opensc_installed
|
||||
- package_openssh-server_installed
|
||||
- package_policycoreutils_installed
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index c8540f9392e..b5b60349a83 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -76,6 +76,7 @@ selections:
|
||||
- accounts_user_interactive_home_directory_defined
|
||||
- accounts_user_interactive_home_directory_exists
|
||||
- aide_check_audit_tools
|
||||
+- agent_mfetpd_running
|
||||
- aide_scan_notification
|
||||
- aide_verify_acls
|
||||
- aide_verify_ext_attributes
|
||||
@@ -291,6 +292,7 @@ selections:
|
||||
- package_gssproxy_removed
|
||||
- package_iprutils_removed
|
||||
- package_krb5-workstation_removed
|
||||
+- package_mcafeetp_installed
|
||||
- package_opensc_installed
|
||||
- package_openssh-server_installed
|
||||
- package_policycoreutils_installed
|
@ -1,118 +0,0 @@
|
||||
From 386f9787ceac9b0fc732bcd5fd5f7174254922b3 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 15 Jul 2021 14:33:44 -0500
|
||||
Subject: [PATCH] Update 'Configure Notification of Post-AIDE Scan Details'
|
||||
|
||||
Added
|
||||
- Ansible fix for this rule
|
||||
- Configurable email for sending notification email for AIDE alerts
|
||||
---
|
||||
.../aide_scan_notification/ansible/shared.yml | 28 +++++++++++++++++++
|
||||
.../aide_scan_notification/bash/shared.sh | 18 ++++++++----
|
||||
.../aide/aide_scan_notification/rule.yml | 2 ++
|
||||
.../var_aide_scan_notification_email.var | 16 +++++++++++
|
||||
4 files changed, 58 insertions(+), 6 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/software/integrity/software-integrity/var_aide_scan_notification_email.var
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/ansible/shared.yml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..5c11fc1719e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/ansible/shared.yml
|
||||
@@ -0,0 +1,28 @@
|
||||
+# platform = Red Hat Enterprise Linux 7,Red Hat Enterprise Linux 8,Red Hat Virtualization 4,multi_platform_wrlinux,multi_platform_ol,multi_platform_sle
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+{{% if product in ["sle12", "sle15"] %}}
|
||||
+ {{% set aide_path = "/usr/bin/aide" %}}
|
||||
+{{% else %}}
|
||||
+ {{% set aide_path = "/usr/sbin/aide" %}}
|
||||
+{{% endif %}}
|
||||
+
|
||||
+- (xccdf-var var_aide_scan_notification_email)
|
||||
+
|
||||
+- name: "Ensure AIDE is installed"
|
||||
+ package:
|
||||
+ name: "{{ item }}"
|
||||
+ state: present
|
||||
+ with_items:
|
||||
+ - aide
|
||||
+
|
||||
+- name: "{{{ rule_title }}}"
|
||||
+ cron:
|
||||
+ name: "run AIDE check"
|
||||
+ minute: 05
|
||||
+ hour: 04
|
||||
+ weekday: 0
|
||||
+ user: root
|
||||
+ job: '{{{aide_path}}} --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" {{ var_aide_scan_notification_email }}'
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/bash/shared.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/bash/shared.sh
|
||||
index 2f129e568b2..3cb8b72a0bd 100644
|
||||
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/bash/shared.sh
|
||||
@@ -1,6 +1,16 @@
|
||||
# platform = multi_platform_all
|
||||
|
||||
+. /usr/share/scap-security-guide/remediation_functions
|
||||
+
|
||||
{{{ bash_package_install("aide") }}}
|
||||
+{{{ bash_instantiate_variables("var_aide_scan_notification_email") }}}
|
||||
+{{% if product in ["sle12", "sle15"] %}}
|
||||
+ {{% set aide_path = "/usr/bin/aide" %}}
|
||||
+{{% else %}}
|
||||
+ {{% set aide_path = "/usr/sbin/aide" %}}
|
||||
+{{% endif %}}
|
||||
+
|
||||
+
|
||||
|
||||
CRONTAB=/etc/crontab
|
||||
CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly'
|
||||
@@ -14,11 +24,7 @@ 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*root@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then
|
||||
-{{% if product in ["sle12", "sle15"] %}}
|
||||
- echo '0 5 * * * root /usr/bin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost' >> $CRONTAB
|
||||
-{{% else %}}
|
||||
- echo '0 5 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost' >> $CRONTAB
|
||||
-{{% endif %}}
|
||||
+if ! grep -qR '^.*{{{aide_path}}}\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then
|
||||
+ echo "0 5 * * * root {{{ aide_path }}} --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB
|
||||
fi
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/rule.yml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/rule.yml
|
||||
index 51dae72ee6d..cb35c5c642d 100644
|
||||
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_scan_notification/rule.yml
|
||||
@@ -57,3 +57,5 @@ ocil: |-
|
||||
<pre>$ grep aide /etc/crontab</pre>
|
||||
The output should return something similar to the following:
|
||||
<pre>05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost</pre>
|
||||
+ The email address that the notifications are sent to can be changed by overriding
|
||||
+ <pre><sub idref="var_aide_scan_notification_email" /></pre>.
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/var_aide_scan_notification_email.var b/linux_os/guide/system/software/integrity/software-integrity/var_aide_scan_notification_email.var
|
||||
new file mode 100644
|
||||
index 00000000000..75b9f5d2650
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/var_aide_scan_notification_email.var
|
||||
@@ -0,0 +1,16 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: Integrity Scan Notification Email Address
|
||||
+
|
||||
+description: |-
|
||||
+ Specify the email address for designated personnel if baseline
|
||||
+ configurations are changed in an unauthorized manner.
|
||||
+
|
||||
+type: string
|
||||
+
|
||||
+operator: equals
|
||||
+
|
||||
+interactive: true
|
||||
+
|
||||
+options:
|
||||
+ default: root@localhost
|
@ -1,375 +0,0 @@
|
||||
From f027c56e45e703663c25dea18f78111d5d8a7e0f Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 19 Aug 2021 11:16:08 -0500
|
||||
Subject: [PATCH] Added rule for RHEL-08-010400
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 27 +++++++++++++
|
||||
.../bash/shared.sh | 33 +++++++++++++++
|
||||
.../oval/shared.xml | 30 ++++++++++++++
|
||||
.../sssd_certificate_verification/rule.yml | 40 +++++++++++++++++++
|
||||
.../tests/correct_value.pass.sh | 6 +++
|
||||
.../tests/correct_with_others_before.pass.sh | 6 +++
|
||||
.../tests/not_configured.fail.sh | 5 +++
|
||||
.../tests/partial_config.fail.sh | 6 +++
|
||||
.../tests/wrong_section.fail.sh | 6 +++
|
||||
.../tests/wrong_value.fail.sh | 6 +++
|
||||
...rtificate_verification_digest_function.var | 20 ++++++++++
|
||||
products/rhel8/profiles/stig.profile | 2 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 4 +-
|
||||
.../profile_stability/rhel8/stig_gui.profile | 4 +-
|
||||
15 files changed, 193 insertions(+), 3 deletions(-)
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/rule.yml
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_value.pass.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_with_others_before.pass.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/tests/not_configured.fail.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/tests/partial_config.fail.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_section.fail.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/var_sssd_certificate_verification_digest_function.var
|
||||
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/ansible/shared.yml b/linux_os/guide/services/sssd/sssd_certificate_verification/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..8e36f0974fd
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/ansible/shared.yml
|
||||
@@ -0,0 +1,27 @@
|
||||
+# platform = multi_platform_fedora,multi_platform_rhel
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = medium
|
||||
+
|
||||
+- name: Ensure that "certificate_verification" is not set in /etc/sssd/sssd.conf
|
||||
+ ini_file:
|
||||
+ path: /etc/sssd/sssd.conf
|
||||
+ section: sssd
|
||||
+ option: certificate_verification
|
||||
+ state: absent
|
||||
+
|
||||
+- name: 'Ensure that "certificate_verification" is not set in /etc/sssd/conf.d/*.conf'
|
||||
+ ini_file:
|
||||
+ path: /etc/sssd/conf.d/*.conf
|
||||
+ section: sssd
|
||||
+ option: certificate_verification
|
||||
+ state: absent
|
||||
+
|
||||
+- name: Ensure that "certificate_verification" is set
|
||||
+ ini_file:
|
||||
+ path: /etc/sssd/conf.d/certificate_verification.conf
|
||||
+ section: sssd
|
||||
+ option: certificate_verification
|
||||
+ value: "ocsp_dgst = sha1"
|
||||
+ state: present
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/bash/shared.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..8f9e5514480
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/bash/shared.sh
|
||||
@@ -0,0 +1,33 @@
|
||||
+# platform = multi_platform_rhel,multi_platform_fedora
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = medium
|
||||
+
|
||||
+# include our remediation functions library
|
||||
+. /usr/share/scap-security-guide/remediation_functions
|
||||
+
|
||||
+{{{ bash_instantiate_variables("var_sssd_certificate_verification_digest_function") }}}
|
||||
+
|
||||
+found=false
|
||||
+for f in /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf; do
|
||||
+ if [ ! -e "$f" ]; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ cert=$( awk '/^\s*\[/{f=0} /^\s*\[sssd\]/{f=1} f{nu=gensub("^\\s*certificate_verification\\s*=\\s*ocsp_dgst\\s*=\\s*(\\w+).*","\\1",1); if($0!=nu){cert=nu}} END{print cert}' "$f" )
|
||||
+ if [ -n "$cert" ] ; then
|
||||
+ if [ "$cert" != $var_sssd_certificate_verification_digest_function ] ; then
|
||||
+ sed -i "s/^certificate_verification\s*=.*/certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function/" "$f"
|
||||
+ fi
|
||||
+ found=true
|
||||
+ fi
|
||||
+done
|
||||
+
|
||||
+if ! $found ; then
|
||||
+ SSSD_CONF="/etc/sssd/conf.d/certificate_verification.conf"
|
||||
+ mkdir -p $( dirname $SSSD_CONF )
|
||||
+ touch $SSSD_CONF
|
||||
+ chown root:root $SSSD_CONF
|
||||
+ chmod 600 $SSSD_CONF
|
||||
+ echo -e "[sssd]\ncertificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" >> $SSSD_CONF
|
||||
+fi
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/oval/shared.xml b/linux_os/guide/services/sssd/sssd_certificate_verification/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..77736f54f03
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/oval/shared.xml
|
||||
@@ -0,0 +1,30 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("SSSD should be configured with the correct ocsp_dgst
|
||||
+ digest function") }}}
|
||||
+ <criteria>
|
||||
+ <criterion comment="check value of certificate_verification in sssd configuration"
|
||||
+ test_ref="test_{{{rule_id}}}" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="test the value of
|
||||
+ certificate_verification in sssd configuration" id="test_{{{rule_id}}}" version="1">
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}" />
|
||||
+ <ind:state state_ref="state_{{{rule_id}}}" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}" version="1">
|
||||
+ <ind:filepath operation="pattern match">^/etc/sssd/(sssd|conf\.d/.*)\.conf$</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^[\s]*\[sssd](?:[^\n\[]*\n+)+?[\s]*certificate_verification\s*=\s*ocsp_dgst\s*=\s*(\w+)$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_state comment="value of certificate_verification" id="state_{{{rule_id}}}" version="1">
|
||||
+ <ind:subexpression operation="equals" var_check="all"
|
||||
+ var_ref="var_sssd_certificate_verification_digest_function" />
|
||||
+ </ind:textfilecontent54_state>
|
||||
+
|
||||
+ <external_variable comment="certificate_verification value" datatype="string"
|
||||
+ id="var_sssd_certificate_verification_digest_function" version="1" />
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/rule.yml b/linux_os/guide/services/sssd/sssd_certificate_verification/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..182e75a2aab
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/rule.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Certificate certificate status checking in SSSD'
|
||||
+
|
||||
+description: |-
|
||||
+ Multifactor solutions that require devices separate from information systems gaining access include,
|
||||
+ for example, hardware tokens providing time-based or challenge-response authenticators and smart cards.
|
||||
+ By configuring <tt>certificate_verification</tt> to <tt>ocsp_dgst=sha1</tt> sures that certificates for
|
||||
+ multifactor solutions are checked via Online Certificate Status Protocol (OCSP).
|
||||
+
|
||||
+rationale: |-
|
||||
+ Enusring that multifactor solutions certificates are checked via Online Certificate Status Protocol (OCSP)
|
||||
+ ensures the security of the system.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-86120-3
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001948
|
||||
+ nist: IA-2(11)
|
||||
+ srg: SRG-OS-000375-GPOS-00160,SRG-OS-000377-GPOS-00162
|
||||
+ stigid@rhel8: RHEL-08-010400
|
||||
+
|
||||
+
|
||||
+ocil_clause: 'certificate_verification in sssd is not configured'
|
||||
+
|
||||
+ocil: |-
|
||||
+ Check to see if Online Certificate Status Protocol (OCSP)
|
||||
+ is enabled and using the proper digest value on the system with the following command:
|
||||
+ <pre>$ sudo grep certificate_verification /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf | grep -v "^#"</pre>
|
||||
+ If configured properly, output should look like
|
||||
+ <pre>
|
||||
+ certificate_verification = ocsp_dgst=sha1
|
||||
+ </pre>
|
||||
+ The "sssd" service must be restarted for the changes to take effect. To restart the "sssd" service, run the following command:
|
||||
+ <pre>$ sudo systemctl restart sssd.service</pre>
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_value.pass.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..24c19f44fdc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# packages = sssd-common
|
||||
+
|
||||
+mkdir -p /etc/sssd/conf.d
|
||||
+touch /etc/sssd/sssd.conf
|
||||
+echo -e "[sssd]\ncertificate_verification = ocsp_dgst=sha1" >> /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_with_others_before.pass.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_with_others_before.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..982450fc81b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/correct_with_others_before.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# packages = sssd-common
|
||||
+
|
||||
+mkdir -p /etc/sssd/conf.d
|
||||
+touch /etc/sssd/sssd.conf
|
||||
+echo -e "[sssd]\ndifferent_option = test\ncertificate_verification = ocsp_dgst=sha1" >> /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/tests/not_configured.fail.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/not_configured.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed011f9d4bc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/not_configured.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# packages = sssd-common
|
||||
+
|
||||
+mkdir -p /etc/sssd/conf.d
|
||||
+touch /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/tests/partial_config.fail.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/partial_config.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..3c7c468b9d5
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/partial_config.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# packages = sssd-common
|
||||
+
|
||||
+mkdir -p /etc/sssd/conf.d
|
||||
+touch /etc/sssd/sssd.conf
|
||||
+echo -e "[sssd]\ncertificate_verification = ocsp_dgst=" >> /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_section.fail.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_section.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..635ca4bebcc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_section.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# packages = sssd-common
|
||||
+
|
||||
+mkdir -p /etc/sssd/conf.d
|
||||
+touch /etc/sssd/sssd.conf
|
||||
+echo -e "[ssd]\ncertificate_verification = ocsp_dgst=sha1" >> /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_value.fail.sh b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..93f363edc04
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_certificate_verification/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# packages = sssd-common
|
||||
+
|
||||
+mkdir -p /etc/sssd/conf.d
|
||||
+touch /etc/sssd/sssd.conf
|
||||
+echo -e "[sssd]\ncertificate_verification = ocsp_dgst=sha256" >> /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/var_sssd_certificate_verification_digest_function.var b/linux_os/guide/services/sssd/var_sssd_certificate_verification_digest_function.var
|
||||
new file mode 100644
|
||||
index 00000000000..cdbd0a13576
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/var_sssd_certificate_verification_digest_function.var
|
||||
@@ -0,0 +1,20 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: 'SSSD certificate_verification option'
|
||||
+
|
||||
+description: |-
|
||||
+ Value of the certificate_verification option in
|
||||
+ the SSSD config.
|
||||
+
|
||||
+type: string
|
||||
+
|
||||
+operator: equals
|
||||
+
|
||||
+interactive: true
|
||||
+
|
||||
+options:
|
||||
+ sha1: sha1
|
||||
+ sha256: sha256
|
||||
+ sha384: sha384
|
||||
+ sha512: sha512
|
||||
+ default: sha1
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 9dc9360e899..5b1f709faaf 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -70,6 +70,7 @@ selections:
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
- var_auditd_disk_full_action=halt
|
||||
+ - var_sssd_certificate_verification_digest_function=sha1
|
||||
|
||||
### Enable / Configure FIPS
|
||||
- enable_fips_mode
|
||||
@@ -275,6 +276,7 @@ selections:
|
||||
- install_smartcard_packages
|
||||
|
||||
# RHEL-08-010400
|
||||
+ - sssd_certificate_verification
|
||||
|
||||
# RHEL-08-010410
|
||||
- package_opensc_installed
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 3b24e19da06..81f94f7dbca 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -236,7 +236,6 @@ CCE-86116-1
|
||||
CCE-86117-9
|
||||
CCE-86118-7
|
||||
CCE-86119-5
|
||||
-CCE-86120-3
|
||||
CCE-86121-1
|
||||
CCE-86122-9
|
||||
CCE-86123-7
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index e9ba0f0adbf..baef93bba64 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -342,6 +342,7 @@ selections:
|
||||
- sshd_set_keepalive_0
|
||||
- sshd_use_strong_rng
|
||||
- sshd_x11_use_localhost
|
||||
+- sssd_certificate_verification
|
||||
- sssd_enable_certmap
|
||||
- sssd_enable_smartcards
|
||||
- sssd_offline_cred_expiration
|
||||
@@ -410,6 +411,7 @@ selections:
|
||||
- sshd_approved_macs=stig
|
||||
- sshd_approved_ciphers=stig
|
||||
- sshd_idle_timeout_value=10_minutes
|
||||
+- var_accounts_authorized_local_users_regex=rhel8
|
||||
- var_accounts_passwords_pam_faillock_deny=3
|
||||
- var_accounts_passwords_pam_faillock_fail_interval=900
|
||||
- var_accounts_passwords_pam_faillock_unlock_time=never
|
||||
@@ -425,7 +427,7 @@ selections:
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
- var_auditd_disk_full_action=halt
|
||||
-- var_accounts_authorized_local_users_regex=rhel8
|
||||
+- var_sssd_certificate_verification_digest_function=sha1
|
||||
- var_system_crypto_policy=fips
|
||||
- var_sudo_timestamp_timeout=always_prompt
|
||||
title: DISA STIG for Red Hat Enterprise Linux 8
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index c8540f9392e..237f66c721f 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -353,6 +353,7 @@ selections:
|
||||
- sshd_set_keepalive_0
|
||||
- sshd_use_strong_rng
|
||||
- sshd_x11_use_localhost
|
||||
+- sssd_certificate_verification
|
||||
- sssd_enable_certmap
|
||||
- sssd_enable_smartcards
|
||||
- sssd_offline_cred_expiration
|
||||
@@ -420,6 +421,7 @@ selections:
|
||||
- sshd_approved_macs=stig
|
||||
- sshd_approved_ciphers=stig
|
||||
- sshd_idle_timeout_value=10_minutes
|
||||
+- var_accounts_authorized_local_users_regex=rhel8
|
||||
- var_accounts_passwords_pam_faillock_deny=3
|
||||
- var_accounts_passwords_pam_faillock_fail_interval=900
|
||||
- var_accounts_passwords_pam_faillock_unlock_time=never
|
||||
@@ -435,7 +437,7 @@ selections:
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
- var_auditd_disk_full_action=halt
|
||||
-- var_accounts_authorized_local_users_regex=rhel8
|
||||
+- var_sssd_certificate_verification_digest_function=sha1
|
||||
- var_system_crypto_policy=fips
|
||||
- var_sudo_timestamp_timeout=always_prompt
|
||||
title: DISA STIG with GUI for Red Hat Enterprise Linux 8
|
@ -1,151 +0,0 @@
|
||||
From 278f3b476291d69e45da4dcdfca5a308646224f2 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 19 Jul 2021 09:49:57 -0500
|
||||
Subject: [PATCH 1/2] Add more checks for bios_enable_execution_restrictions to
|
||||
ensure we don't miss anything
|
||||
|
||||
---
|
||||
.../oval/shared.xml | 18 ++++++++++++++++++
|
||||
.../rule.yml | 3 ++-
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
5 files changed, 23 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..622a183f99f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml
|
||||
@@ -0,0 +1,18 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="bios_enable_execution_restrictions" version="2">
|
||||
+ {{{ oval_metadata("The NX (no-execution) bit flag should be set on the system.") }}}
|
||||
+ <criteria>
|
||||
+ <criterion comment="NX bit is set" test_ref="test_NX_cpu_support" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="CPUs support for NX bit" id="test_NX_cpu_support" version="1">
|
||||
+ <ind:object object_ref="obj_NX_cpu_support" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_NX_cpu_support" version="1">
|
||||
+ <ind:filepath>/proc/cpuinfo</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^flags[\s]+:.*[\s]+nx[\s]+.*$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
index 4ca003520ac..b037e374f5b 100644
|
||||
--- a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
@@ -14,7 +14,7 @@ rationale: |-
|
||||
Computers with the ability to prevent this type of code execution frequently put an option in the BIOS that will
|
||||
allow users to turn the feature on or off at will.
|
||||
|
||||
-severity: unknown
|
||||
+severity: medium
|
||||
|
||||
identifiers:
|
||||
cce@rhel7: CCE-27099-1
|
||||
@@ -31,5 +31,6 @@ references:
|
||||
iso27001-2013: A.12.1.2,A.12.5.1,A.12.6.2,A.14.2.2,A.14.2.3,A.14.2.4
|
||||
nist: SC-39,CM-6(a)
|
||||
nist-csf: PR.IP-1
|
||||
+ stig@rhel8: RHEL-08-010420
|
||||
|
||||
platform: machine
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 5a0a520ee0a..6372d13cfc9 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -260,6 +260,7 @@ selections:
|
||||
- package_opensc_installed
|
||||
|
||||
# RHEL-08-010420
|
||||
+ - bios_enable_execution_restrictions
|
||||
|
||||
# RHEL-08-010421
|
||||
- grub2_page_poison_argument
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 4be3cf93c25..32f1a24a7a4 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -74,6 +74,7 @@ selections:
|
||||
- auditd_log_format
|
||||
- auditd_name_format
|
||||
- banner_etc_issue
|
||||
+- bios_enable_execution_restrictions
|
||||
- chronyd_client_only
|
||||
- chronyd_no_chronyc_network
|
||||
- chronyd_or_ntpd_set_maxpoll
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 20b8a54861e..d6a27c67dc0 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -85,6 +85,7 @@ selections:
|
||||
- auditd_log_format
|
||||
- auditd_name_format
|
||||
- banner_etc_issue
|
||||
+- bios_enable_execution_restrictions
|
||||
- chronyd_client_only
|
||||
- chronyd_no_chronyc_network
|
||||
- chronyd_or_ntpd_set_maxpoll
|
||||
|
||||
From dac8111b4d89a31cbaa5648f876bd58575a93e86 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 19 Jul 2021 09:51:34 -0500
|
||||
Subject: [PATCH 2/2] Add oval check for bios_enable_execution_restrictions
|
||||
|
||||
---
|
||||
.../oval/shared.xml | 24 ++++++++++++++++++-
|
||||
1 file changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml
|
||||
index 622a183f99f..7cc448f8cce 100644
|
||||
--- a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/oval/shared.xml
|
||||
@@ -1,8 +1,10 @@
|
||||
<def-group>
|
||||
<definition class="compliance" id="bios_enable_execution_restrictions" version="2">
|
||||
{{{ oval_metadata("The NX (no-execution) bit flag should be set on the system.") }}}
|
||||
- <criteria>
|
||||
+ <criteria operator="AND">
|
||||
<criterion comment="NX bit is set" test_ref="test_NX_cpu_support" />
|
||||
+ <criterion comment="No log messages about NX being disabled" test_ref="test_messages_nx_active" />
|
||||
+ <criterion comment="NX is not disabled in the kernel command line" test_ref="test_noexec_cmd_line" />
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
@@ -10,9 +12,29 @@
|
||||
<ind:object object_ref="obj_NX_cpu_support" />
|
||||
</ind:textfilecontent54_test>
|
||||
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="none_exist" id="test_messages_nx_active" version="1" comment="No log messages about NX being disabled">
|
||||
+ <ind:object object_ref="obj_messages_nx_active" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="none_exist" id="test_noexec_cmd_line" version="1" comment="NX is not disabled in the kernel command line">
|
||||
+ <ind:object object_ref="obj_noexec_cmd_line" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
<ind:textfilecontent54_object id="obj_NX_cpu_support" version="1">
|
||||
<ind:filepath>/proc/cpuinfo</ind:filepath>
|
||||
<ind:pattern operation="pattern match">^flags[\s]+:.*[\s]+nx[\s]+.*$</ind:pattern>
|
||||
<ind:instance datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_messages_nx_active" version="1">
|
||||
+ <ind:filepath>/var/log/messages</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^.+protection: disabled.+</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_noexec_cmd_line" version="1">
|
||||
+ <ind:filepath>/proc/cmdline</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">.+noexec[0-9]*=off.+</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
</def-group>
|
@ -1,47 +0,0 @@
|
||||
From 4ac2a6db67e03e616b26d39fb0620d4656bac65b Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 14 Jul 2021 13:19:42 -0500
|
||||
Subject: [PATCH] Add RHEL-08-010590 STIG to existing rule
|
||||
|
||||
---
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
tests/data/profile_stability/rhel8/stig.profile | 1 +
|
||||
tests/data/profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 2508008d511..fef1965fb1d 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -341,6 +341,7 @@ selections:
|
||||
- mount_option_nodev_nonroot_local_partitions
|
||||
|
||||
# RHEL-08-010590
|
||||
+ - mount_option_home_noexec
|
||||
|
||||
# RHEL-08-010600
|
||||
- mount_option_nodev_removable_partitions
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 765487c6f16..843d8eb7d0a 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -156,6 +156,7 @@ selections:
|
||||
- mount_option_dev_shm_nodev
|
||||
- mount_option_dev_shm_noexec
|
||||
- mount_option_dev_shm_nosuid
|
||||
+- mount_option_home_noexec
|
||||
- mount_option_home_nosuid
|
||||
- mount_option_nodev_nonroot_local_partitions
|
||||
- mount_option_nodev_remote_filesystems
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 9fd80aac727..6dd0f08b142 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -167,6 +167,7 @@ selections:
|
||||
- mount_option_dev_shm_nodev
|
||||
- mount_option_dev_shm_noexec
|
||||
- mount_option_dev_shm_nosuid
|
||||
+- mount_option_home_noexec
|
||||
- mount_option_home_nosuid
|
||||
- mount_option_nodev_nonroot_local_partitions
|
||||
- mount_option_nodev_remote_filesystems
|
@ -1,153 +0,0 @@
|
||||
From 6eeef4054d707b8b255e9fa600c4c7babffbf5f7 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 2 Aug 2021 08:37:04 -0500
|
||||
Subject: [PATCH] Add rule for RHEL-08-020090
|
||||
|
||||
---
|
||||
.../sssd/sssd_enable_certmap/rule.yml | 58 +++++++++++++++++++
|
||||
.../sssd_enable_certmap/tests/default.fail.sh | 4 ++
|
||||
.../tests/with_section.pass.sh | 7 +++
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
7 files changed, 72 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_enable_certmap/tests/default.fail.sh
|
||||
create mode 100644 linux_os/guide/services/sssd/sssd_enable_certmap/tests/with_section.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml b/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..0614a2f4a0
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml
|
||||
@@ -0,0 +1,58 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Enable Certmap in SSSD'
|
||||
+
|
||||
+description: |-
|
||||
+ SSSD should be configured to verify the certificate of the user or group. To set this up
|
||||
+ ensure that section like <tt>certmap/testing.test/rule_name</tt> is setup in
|
||||
+ <tt>/etc/sssd/sssd.conf</tt>. For example
|
||||
+ <pre>
|
||||
+ [certmap/testing.test/rule_name]
|
||||
+ matchrule =<SAN>.*EDIPI@mil
|
||||
+ maprule = (userCertificate;binary={cert!bin})
|
||||
+ domains = testing.test
|
||||
+ </pre>
|
||||
+
|
||||
+rationale: |-
|
||||
+ Without mapping the certificate used to authenticate to the user account, the ability to
|
||||
+ determine the identity of the individual user or group will not be available for forensic
|
||||
+ analysis.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-86060-1
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-000187
|
||||
+ nist: IA-5 (2) (c)
|
||||
+ stigid@rhel8: RHEL-08-020090
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Automatic remediation of this control is not available, since all of the settings in
|
||||
+ in the certmap need to be customized.
|
||||
+
|
||||
+ocil_clause: 'Certmap is not configured in SSSD'
|
||||
+
|
||||
+ocil: |-
|
||||
+ To verify Certmap is enabled in SSSD, run the following command:
|
||||
+ <pre>$ cat sudo cat /etc/sssd/sssd.conf</pre>
|
||||
+ If configured properly, output should contain section like the following
|
||||
+ <pre>
|
||||
+ [certmap/testing.test/rule_name]
|
||||
+ matchrule =<SAN>.*EDIPI@mil
|
||||
+ maprule = (userCertificate;binary={cert!bin})
|
||||
+ domains = testing.test
|
||||
+ </pre>
|
||||
+
|
||||
+template:
|
||||
+ name: lineinfile
|
||||
+ vars:
|
||||
+ path: '/etc/sssd/sssd.conf'
|
||||
+ text: '^\[certmap\/.+\/.+\]$'
|
||||
+ backends:
|
||||
+ ansible: "off"
|
||||
+ bash: "off"
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_enable_certmap/tests/default.fail.sh b/linux_os/guide/services/sssd/sssd_enable_certmap/tests/default.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..1e31c0da19
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_enable_certmap/tests/default.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+touch /etc/sssd/sssd.conf
|
||||
+sed -i "s/\[certmap.*//g" /etc/sssd/sssd.conf
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_enable_certmap/tests/with_section.pass.sh b/linux_os/guide/services/sssd/sssd_enable_certmap/tests/with_section.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..911e095f5d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/sssd/sssd_enable_certmap/tests/with_section.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+cat >> /etc/sssd/sssd.conf<< EOF
|
||||
+[certmap/testing.test/rule_name]
|
||||
+matchrule =<SAN>.*EDIPI@mil
|
||||
+maprule = (userCertificate;binary={cert!bin})
|
||||
+domains = testing.test
|
||||
+EOF
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index f17a7b88b1..ec0a3b1753 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -503,6 +503,7 @@ selections:
|
||||
# RHEL-08-020080
|
||||
|
||||
# RHEL-08-020090
|
||||
+ - sssd_enable_certmap
|
||||
|
||||
# RHEL-08-020100
|
||||
- accounts_password_pam_retry
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 73d025484e..e80557f033 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -186,7 +186,6 @@ CCE-86056-9
|
||||
CCE-86057-7
|
||||
CCE-86058-5
|
||||
CCE-86059-3
|
||||
-CCE-86060-1
|
||||
CCE-86061-9
|
||||
CCE-86062-7
|
||||
CCE-86063-5
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 236e595604..bffa509b69 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -275,6 +275,7 @@ selections:
|
||||
- sshd_set_keepalive_0
|
||||
- sshd_use_strong_rng
|
||||
- sshd_x11_use_localhost
|
||||
+- sssd_enable_certmap
|
||||
- sssd_enable_smartcards
|
||||
- sssd_offline_cred_expiration
|
||||
- sudo_remove_no_authenticate
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 9973b5adef..c84ac75c7b 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -286,6 +286,7 @@ selections:
|
||||
- sshd_set_keepalive_0
|
||||
- sshd_use_strong_rng
|
||||
- sshd_x11_use_localhost
|
||||
+- sssd_enable_certmap
|
||||
- sssd_enable_smartcards
|
||||
- sssd_offline_cred_expiration
|
||||
- sudo_remove_no_authenticate
|
@ -1,194 +0,0 @@
|
||||
From 2af7d6d8f86f80dbac088d115a50162cfc28c542 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Tue, 27 Jul 2021 07:49:50 -0500
|
||||
Subject: [PATCH] Add rule for RHEL-08-020300
|
||||
|
||||
---
|
||||
.../accounts_password_pam_dictcheck/rule.yml | 45 +++++++++++++++++++
|
||||
.../tests/disabled.fail.sh | 3 ++
|
||||
.../tests/enable.pass.sh | 3 ++
|
||||
.../tests/not_defined.fail.sh | 3 ++
|
||||
.../var_password_pam_dictcheck.var | 16 +++++++
|
||||
products/rhel8/profiles/stig.profile | 2 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 2 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 2 +
|
||||
9 files changed, 76 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/disabled.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/enable.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/not_defined.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/var_password_pam_dictcheck.var
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..2990150c0a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
@@ -0,0 +1,45 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Ensure PAM Enforces Password Requirements - Prevent the Use of Dictionary Words'
|
||||
+
|
||||
+description: |-
|
||||
+ The pam_pwquality module's <tt>dictcheck</tt> check if passwords contains dictionary words. When
|
||||
+ <tt>dictcheck</tt> is set to <tt>1</tt> passwords will be checked for dictionary words.
|
||||
+
|
||||
+rationale: |-
|
||||
+ 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.
|
||||
+ <br /><br />
|
||||
+ Password complexity is one factor of several that determines how long it takes to crack a password. The more
|
||||
+ complex the password, the greater the number of possible combinations that need to be tested before the
|
||||
+ password is compromised.
|
||||
+ <br /><br />
|
||||
+ Passwords with dictionary words may be more vulnerable to password-guessing attacks.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-86233-4
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-000366
|
||||
+ nist: IA-5(c),IA-5(1)(a),CM-6(a),IA-5(4)
|
||||
+ stigid@rhel8: RHEL-08-020300
|
||||
+
|
||||
+ocil_clause: 'dictcheck is not found or not equal to the required value'
|
||||
+
|
||||
+ocil: |-
|
||||
+ To check if dictionary words are disallowed run the following command:
|
||||
+ <pre>$ sudo grep dictcheck /etc/security/pwquality.conf /etc/pwquality.conf.d/*.conf</pre>
|
||||
+ The <tt>dictcheck</tt> parameter should be equal to 1. The value should look like
|
||||
+ <pre>dictcheck=1</pre>
|
||||
+
|
||||
+
|
||||
+template:
|
||||
+ name: accounts_password
|
||||
+ vars:
|
||||
+ variable: dictcheck
|
||||
+ operation: equals
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/disabled.fail.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/disabled.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..cb84c6d968
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/disabled.fail.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+echo "dictcheck=0" > /etc/security/pwquality.conf
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/enable.pass.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/enable.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..ceb9f7ec44
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/enable.pass.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+echo "dictcheck=1" > /etc/security/pwquality.conf
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/not_defined.fail.sh b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/not_defined.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..57e54b6623
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/tests/not_defined.fail.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+sed -i s/dictcheck.+//g /etc/security/pwquality.conf
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/var_password_pam_dictcheck.var b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/var_password_pam_dictcheck.var
|
||||
new file mode 100644
|
||||
index 0000000000..26452c3a8e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/var_password_pam_dictcheck.var
|
||||
@@ -0,0 +1,16 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: dictcheck
|
||||
+
|
||||
+description: |-
|
||||
+ Prevent the use of dictionary words for passwords.
|
||||
+
|
||||
+type: number
|
||||
+
|
||||
+operator: equals
|
||||
+
|
||||
+interactive: false
|
||||
+
|
||||
+options:
|
||||
+ 1: 1
|
||||
+ default: 1
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index bf410c2087..f17a7b88b1 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -45,6 +45,7 @@ selections:
|
||||
- var_password_pam_minlen=15
|
||||
- var_password_pam_ocredit=1
|
||||
- var_password_pam_dcredit=1
|
||||
+ - var_password_pam_dictcheck=1
|
||||
- var_password_pam_ucredit=1
|
||||
- var_password_pam_lcredit=1
|
||||
- var_password_pam_retry=3
|
||||
@@ -567,6 +568,7 @@ selections:
|
||||
- sssd_offline_cred_expiration
|
||||
|
||||
# RHEL-08-020300
|
||||
+ - accounts_password_pam_dictcheck
|
||||
|
||||
# RHEL-08-020310
|
||||
- accounts_logon_fail_delay
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 0b794d5c2a..dae4495b2d 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -362,7 +362,6 @@ CCE-86229-2
|
||||
CCE-86230-0
|
||||
CCE-86231-8
|
||||
CCE-86232-6
|
||||
-CCE-86233-4
|
||||
CCE-86234-2
|
||||
CCE-86235-9
|
||||
CCE-86236-7
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index ddfa13e731..236e595604 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -35,6 +35,7 @@ selections:
|
||||
- accounts_password_all_shadowed_sha512
|
||||
- accounts_password_minlen_login_defs
|
||||
- accounts_password_pam_dcredit
|
||||
+- accounts_password_pam_dictcheck
|
||||
- accounts_password_pam_difok
|
||||
- accounts_password_pam_lcredit
|
||||
- accounts_password_pam_maxclassrepeat
|
||||
@@ -332,6 +333,7 @@ selections:
|
||||
- var_password_pam_minlen=15
|
||||
- var_password_pam_ocredit=1
|
||||
- var_password_pam_dcredit=1
|
||||
+- var_password_pam_dictcheck=1
|
||||
- var_password_pam_ucredit=1
|
||||
- var_password_pam_lcredit=1
|
||||
- var_password_pam_retry=3
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 017ab8c0e3..9973b5adef 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -46,6 +46,7 @@ selections:
|
||||
- accounts_password_all_shadowed_sha512
|
||||
- accounts_password_minlen_login_defs
|
||||
- accounts_password_pam_dcredit
|
||||
+- accounts_password_pam_dictcheck
|
||||
- accounts_password_pam_difok
|
||||
- accounts_password_pam_lcredit
|
||||
- accounts_password_pam_maxclassrepeat
|
||||
@@ -342,6 +343,7 @@ selections:
|
||||
- var_password_pam_minlen=15
|
||||
- var_password_pam_ocredit=1
|
||||
- var_password_pam_dcredit=1
|
||||
+- var_password_pam_dictcheck=1
|
||||
- var_password_pam_ucredit=1
|
||||
- var_password_pam_lcredit=1
|
||||
- var_password_pam_retry=3
|
@ -1,220 +0,0 @@
|
||||
From d6f7334d642fb311d32d7a171c460cd05e6625b8 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Fri, 6 Aug 2021 10:48:46 -0500
|
||||
Subject: [PATCH] Add rule for RHEL-08-020320
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 0
|
||||
.../bash/shared.sh | 2 +-
|
||||
.../oval/shared.xml | 2 +-
|
||||
.../accounts_authorized_local_users/rule.yml | 12 +++++++++---
|
||||
.../tests/bad_user.fail.sh | 2 ++
|
||||
.../tests/default.pass.sh | 16 ++++++++++++++++
|
||||
...var_accounts_authorized_local_users_regex.var | 1 +
|
||||
products/rhel8/profiles/stig.profile | 3 ++-
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
tests/data/profile_stability/rhel8/stig.profile | 2 ++
|
||||
.../profile_stability/rhel8/stig_gui.profile | 2 ++
|
||||
11 files changed, 36 insertions(+), 7 deletions(-)
|
||||
rename linux_os/guide/system/{software/sap_host => accounts/accounts-restrictions}/accounts_authorized_local_users/ansible/shared.yml (100%)
|
||||
rename linux_os/guide/system/{software/sap_host => accounts/accounts-restrictions}/accounts_authorized_local_users/bash/shared.sh (95%)
|
||||
rename linux_os/guide/system/{software/sap_host => accounts/accounts-restrictions}/accounts_authorized_local_users/oval/shared.xml (98%)
|
||||
rename linux_os/guide/system/{software/sap_host => accounts/accounts-restrictions}/accounts_authorized_local_users/rule.yml (88%)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/bad_user.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/default.pass.sh
|
||||
rename linux_os/guide/system/{software/sap_host => accounts/accounts-restrictions}/var_accounts_authorized_local_users_regex.var (81%)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/ansible/shared.yml
|
||||
similarity index 100%
|
||||
rename from linux_os/guide/system/software/sap_host/accounts_authorized_local_users/ansible/shared.yml
|
||||
rename to linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/ansible/shared.yml
|
||||
diff --git a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/bash/shared.sh b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/bash/shared.sh
|
||||
similarity index 95%
|
||||
rename from linux_os/guide/system/software/sap_host/accounts_authorized_local_users/bash/shared.sh
|
||||
rename to linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/bash/shared.sh
|
||||
index c342acf36d1..fedb02d84ce 100644
|
||||
--- a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/bash/shared.sh
|
||||
@@ -10,7 +10,7 @@ default_os_user="root"
|
||||
for username in $( sed 's/:.*//' /etc/passwd ) ; do
|
||||
if [[ ! "$username" =~ ($default_os_user|$var_accounts_authorized_local_users_regex) ]];
|
||||
then
|
||||
- userdel $username ;
|
||||
+ userdel $username ;
|
||||
fi
|
||||
done
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/oval/shared.xml b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/oval/shared.xml
|
||||
similarity index 98%
|
||||
rename from linux_os/guide/system/software/sap_host/accounts_authorized_local_users/oval/shared.xml
|
||||
rename to linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/oval/shared.xml
|
||||
index 4e42081d0dc..c56799ded20 100644
|
||||
--- a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/oval/shared.xml
|
||||
@@ -32,6 +32,6 @@
|
||||
var_ref="var_accounts_authorized_local_users_regex"></ind:subexpression>
|
||||
</ind:textfilecontent54_state>
|
||||
|
||||
- <external_variable id="var_accounts_authorized_local_users_regex" version="1" datatype="string"
|
||||
+ <external_variable id="var_accounts_authorized_local_users_regex" version="1" datatype="string"
|
||||
comment="accounts authorized local users on operating system"/>
|
||||
</def-group>
|
||||
diff --git a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/rule.yml
|
||||
similarity index 88%
|
||||
rename from linux_os/guide/system/software/sap_host/accounts_authorized_local_users/rule.yml
|
||||
rename to linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/rule.yml
|
||||
index ddbda30afe6..e2311f6a5c3 100644
|
||||
--- a/linux_os/guide/system/software/sap_host/accounts_authorized_local_users/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: ol7,sle12,sle15
|
||||
+prodtype: ol7,sle12,sle15,fedora,rhel8
|
||||
|
||||
title: 'Only Authorized Local User Accounts Exist on Operating System'
|
||||
|
||||
@@ -26,11 +26,10 @@ rationale: |-
|
||||
severity: medium
|
||||
|
||||
identifiers:
|
||||
+ cce@rhel8: CCE-85987-6
|
||||
cce@sle12: CCE-83195-8
|
||||
cce@sle15: CCE-85561-9
|
||||
|
||||
-severity: medium
|
||||
-
|
||||
references:
|
||||
disa: CCI-000366
|
||||
nist@sle12: CM-6(b),CM-6.1(iv)
|
||||
@@ -41,6 +40,13 @@ references:
|
||||
|
||||
ocil_clause: 'there are unauthorized local user accounts on the system'
|
||||
|
||||
+{{% if 'rhel' in product %}}
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Automatic remediation of this control is not available. Due the unique
|
||||
+ requirements of each system.
|
||||
+{{% endif %}}
|
||||
+
|
||||
ocil: |-
|
||||
To verify that there are no unauthorized local user accounts, run the following command:
|
||||
<pre>$ less /etc/passwd </pre>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/bad_user.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/bad_user.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..6dabaff6bc6
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/bad_user.fail.sh
|
||||
@@ -0,0 +1,2 @@
|
||||
+#! /bin/bash
|
||||
+adduser testuser
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/default.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/default.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..d942f81d04f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/accounts_authorized_local_users/tests/default.pass.sh
|
||||
@@ -0,0 +1,16 @@
|
||||
+#! /bin/bash
|
||||
+# platform = multi_platform_rhel
|
||||
+
|
||||
+var_accounts_authorized_local_users_regex="^(root|bin|daemon|adm|lp|sync|shutdown|halt|mail|operator|games|ftp|nobody|pegasus|systemd-bus-proxy|systemd-network|dbus|polkitd|abrt|unbound|tss|libstoragemgmt|rpc|colord|usbmuxd$|pcp|saslauth|geoclue|setroubleshoot|rtkit|chrony|qemu|radvd|rpcuser|nfsnobody|pulse|gdm|gnome-initial-setup|postfix|avahi|ntp|sshd|tcpdump|oprofile|uuidd)$"
|
||||
+
|
||||
+# never delete the root user
|
||||
+default_os_user="root"
|
||||
+
|
||||
+# delete users that is in /etc/passwd but neither in default_os_user
|
||||
+# nor in var_accounts_authorized_local_users_regex
|
||||
+for username in $( sed 's/:.*//' /etc/passwd ) ; do
|
||||
+ if [[ ! "$username" =~ ($default_os_user|$var_accounts_authorized_local_users_regex) ]];
|
||||
+ then
|
||||
+ echo $username ;
|
||||
+ fi
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/software/sap_host/var_accounts_authorized_local_users_regex.var b/linux_os/guide/system/accounts/accounts-restrictions/var_accounts_authorized_local_users_regex.var
|
||||
similarity index 81%
|
||||
rename from linux_os/guide/system/software/sap_host/var_accounts_authorized_local_users_regex.var
|
||||
rename to linux_os/guide/system/accounts/accounts-restrictions/var_accounts_authorized_local_users_regex.var
|
||||
index 81626307321..2f456764617 100644
|
||||
--- a/linux_os/guide/system/software/sap_host/var_accounts_authorized_local_users_regex.var
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/var_accounts_authorized_local_users_regex.var
|
||||
@@ -22,5 +22,6 @@ operator: pattern match
|
||||
interactive: true
|
||||
|
||||
options:
|
||||
+ rhel8: "^(root|bin|daemon|adm|lp|sync|shutdown|halt|mail|operator|games|ftp|nobody|pegasus|systemd-bus-proxy|systemd-network|dbus|polkitd|abrt|unbound|tss|libstoragemgmt|rpc|colord|usbmuxd$|pcp|saslauth|geoclue|setroubleshoot|rtkit|chrony|qemu|radvd|rpcuser|nfsnobody|pulse|gdm|gnome-initial-setup|postfix|avahi|ntp|sshd|tcpdump|oprofile|uuidd|systemd-resolve|systemd-coredump|sssd|rngd)$"
|
||||
ol7forsap: "^(root|bin|daemon|adm|lp|sync|shutdown|halt|mail|operator|games|ftp|nobody|pegasus|systemd-bus-proxy|systemd-network|dbus|polkitd|abrt|unbound|tss|libstoragemgmt|rpc|colord|usbmuxd$|pcp|saslauth|geoclue|setroubleshoot|rtkit|chrony|qemu|radvd|rpcuser|nfsnobody|pulse|gdm|gnome-initial-setup|postfix|avahi|ntp|sshd|tcpdump|oprofile|uuidd)$"
|
||||
saponol7 : "^(root|bin|daemon|adm|lp|sync|shutdown|halt|mail|operator|games|ftp|nobody|pegasus|systemd-bus-proxy|systemd-network|dbus|polkitd|abrt|unbound|tss|libstoragemgmt|rpc|colord|usbmuxd$|pcp|saslauth|geoclue|setroubleshoot|rtkit|chrony|qemu|radvd|rpcuser|nfsnobody|pulse|gdm|gnome-initial-setup|postfix|avahi|ntp|sshd|tcpdump|oprofile|uuidd|[a-z][a-z0-9][a-z0-9]adm|ora[a-z][a-z0-9][a-z0-9]|sapadm|oracle)$"
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index f66b2a24a75..ec2929e8dc4 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -54,6 +54,7 @@ selections:
|
||||
- sshd_approved_macs=stig
|
||||
- sshd_approved_ciphers=stig
|
||||
- sshd_idle_timeout_value=10_minutes
|
||||
+ - var_accounts_authorized_local_users_regex=rhel8
|
||||
- var_accounts_passwords_pam_faillock_deny=3
|
||||
- var_accounts_passwords_pam_faillock_fail_interval=900
|
||||
- var_accounts_passwords_pam_faillock_unlock_time=never
|
||||
@@ -576,7 +577,7 @@ selections:
|
||||
- accounts_logon_fail_delay
|
||||
|
||||
# RHEL-08-020320
|
||||
- # - accounts_authorized_local_users
|
||||
+ - accounts_authorized_local_users
|
||||
|
||||
# RHEL-08-020330
|
||||
- sshd_disable_empty_passwords
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 1d54e8ec15f..3047c2d9b92 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -115,7 +115,6 @@ CCE-85983-5
|
||||
CCE-85984-3
|
||||
CCE-85985-0
|
||||
CCE-85986-8
|
||||
-CCE-85987-6
|
||||
CCE-85988-4
|
||||
CCE-85989-2
|
||||
CCE-85990-0
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index fcae79f6d88..9496f1e1d1d 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -27,6 +27,7 @@ selections:
|
||||
- account_emergency_expire_date
|
||||
- account_temp_expire_date
|
||||
- account_unique_id
|
||||
+- accounts_authorized_local_users
|
||||
- accounts_have_homedir_login_defs
|
||||
- accounts_logon_fail_delay
|
||||
- accounts_max_concurrent_login_sessions
|
||||
@@ -358,6 +359,7 @@ selections:
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
- var_auditd_disk_full_action=halt
|
||||
+- var_accounts_authorized_local_users_regex=rhel8
|
||||
- var_system_crypto_policy=fips
|
||||
- var_sudo_timestamp_timeout=always_prompt
|
||||
title: DISA STIG for Red Hat Enterprise Linux 8
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 2bbd1881f51..9e0c648a5f8 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -38,6 +38,7 @@ selections:
|
||||
- account_emergency_expire_date
|
||||
- account_temp_expire_date
|
||||
- account_unique_id
|
||||
+- accounts_authorized_local_users
|
||||
- accounts_have_homedir_login_defs
|
||||
- accounts_logon_fail_delay
|
||||
- accounts_max_concurrent_login_sessions
|
||||
@@ -368,6 +369,7 @@ selections:
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
- var_auditd_disk_full_action=halt
|
||||
+- var_accounts_authorized_local_users_regex=rhel8
|
||||
- var_system_crypto_policy=fips
|
||||
- var_sudo_timestamp_timeout=always_prompt
|
||||
title: DISA STIG with GUI for Red Hat Enterprise Linux 8
|
@ -1,211 +0,0 @@
|
||||
From 8455c8556a6d828b15ebc62cf511e484dd626a36 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Fri, 16 Jul 2021 13:16:12 -0500
|
||||
Subject: [PATCH] Add rules for RHEL-08-030610
|
||||
|
||||
Added two rules, one for each of the paths mentioned in the STIG.
|
||||
---
|
||||
.../rule.yml | 35 ++++++++++++++++++
|
||||
.../tests/correct_permissions.pass.sh | 6 ++++
|
||||
.../tests/incorrect_permissions.fail.sh | 6 ++++
|
||||
.../rule.yml | 36 +++++++++++++++++++
|
||||
.../tests/correct_permissions.pass.sh | 6 ++++
|
||||
.../tests/incorrect_permissions.fail.sh | 6 ++++
|
||||
products/rhel8/profiles/stig.profile | 2 ++
|
||||
shared/references/cce-redhat-avail.txt | 2 --
|
||||
.../data/profile_stability/rhel8/stig.profile | 2 ++
|
||||
.../profile_stability/rhel8/stig_gui.profile | 2 ++
|
||||
10 files changed, 101 insertions(+), 2 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/rule.yml
|
||||
create mode 100644 linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/correct_permissions.pass.sh
|
||||
create mode 100644 linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/incorrect_permissions.fail.sh
|
||||
create mode 100644 linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/rule.yml
|
||||
create mode 100644 linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/correct_permissions.pass.sh
|
||||
create mode 100644 linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/incorrect_permissions.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/rule.yml b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..1cde3ded5f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/rule.yml
|
||||
@@ -0,0 +1,35 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Verify Permissions on /etc/audit/auditd.conf'
|
||||
+
|
||||
+description: |-
|
||||
+ {{{ describe_file_permissions(file="/etc/audit/auditd.conf", perms="0640") }}}
|
||||
+
|
||||
+
|
||||
+rationale: |-
|
||||
+ Without the capability to restrict the roles and individuals that can select which events
|
||||
+ are audited, unauthorized personnel may be able to prevent the auditing of critical
|
||||
+ events. 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.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85871-2
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-000171
|
||||
+ nist: AU-12(b)
|
||||
+ srg: SRG-OS-000063-GPOS-00032
|
||||
+ stigid@rhel8: RHEL-08-030610
|
||||
+
|
||||
+template:
|
||||
+ name: file_permissions
|
||||
+ vars:
|
||||
+ filepath: /etc/audit/auditd.conf
|
||||
+ allow_stricter_permissions: "true"
|
||||
+ filemode: '0640'
|
||||
diff --git a/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/correct_permissions.pass.sh b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/correct_permissions.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..8c9b782920
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/correct_permissions.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+export TESTFILE=/etc/audit/auditd.conf
|
||||
+mkdir -p /etc/audit/
|
||||
+touch $TESTFILE
|
||||
+chmod 0640 $TESTFILE
|
||||
diff --git a/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/incorrect_permissions.fail.sh b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/incorrect_permissions.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..a460e0dddd
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_auditd/tests/incorrect_permissions.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+export TESTFILLE=/etc/audit/auditd.conf
|
||||
+mkdir -p /etc/audit/
|
||||
+touch $TESTFILLE
|
||||
+chmod 0644 $TESTFILLE
|
||||
diff --git a/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/rule.yml b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..34e1f30367
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/rule.yml
|
||||
@@ -0,0 +1,36 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Verify Permissions on /etc/audit/rules.d/*.rules'
|
||||
+
|
||||
+description: |-
|
||||
+ {{{ describe_file_permissions(file="/etc/audit/rules.d/*.rules", perms="0640") }}}
|
||||
+
|
||||
+
|
||||
+rationale: |-
|
||||
+ Without the capability to restrict the roles and individuals that can select which events
|
||||
+ are audited, unauthorized personnel may be able to prevent the auditing of critical
|
||||
+ events. 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.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85875-3
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-000171
|
||||
+ nist: AU-12(b)
|
||||
+ srg: SRG-OS-000063-GPOS-00032
|
||||
+ stigid@rhel8: RHEL-08-030610
|
||||
+
|
||||
+template:
|
||||
+ name: file_permissions
|
||||
+ vars:
|
||||
+ filepath: /etc/audit/rules.d/
|
||||
+ file_regex: ^.*rules$
|
||||
+ allow_stricter_permissions: "true"
|
||||
+ filemode: '0640'
|
||||
diff --git a/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/correct_permissions.pass.sh b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/correct_permissions.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..b0a20248c3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/correct_permissions.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+export TESTFILE=/etc/audit/rules.d/test_rule.rules
|
||||
+mkdir -p /etc/audit/rules.d/
|
||||
+touch $TESTFILE
|
||||
+chmod 0640 $TESTFILE
|
||||
diff --git a/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/incorrect_permissions.fail.sh b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/incorrect_permissions.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..c7fd3a95e9
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/file_permissions_etc_audit_rulesd/tests/incorrect_permissions.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+export TESTFILLE=/etc/audit/rules.d/test_rule.rules
|
||||
+mkdir -p /etc/audit/rules.d/
|
||||
+touch $TESTFILLE
|
||||
+chmod 0644 $TESTFILLE
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 26d0aa9922..5a0a520ee0 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -801,6 +801,8 @@ selections:
|
||||
- configure_usbguard_auditbackend
|
||||
|
||||
# RHEL-08-030610
|
||||
+ - file_permissions_etc_audit_auditd
|
||||
+ - file_permissions_etc_audit_rulesd
|
||||
|
||||
# RHEL-08-030620
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index ae3375fd4d..24e8149168 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -11,11 +11,9 @@ CCE-85867-0
|
||||
CCE-85868-8
|
||||
CCE-85869-6
|
||||
CCE-85870-4
|
||||
-CCE-85871-2
|
||||
CCE-85872-0
|
||||
CCE-85873-8
|
||||
CCE-85874-6
|
||||
-CCE-85875-3
|
||||
CCE-85876-1
|
||||
CCE-85877-9
|
||||
CCE-85878-7
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index a1de1f5561..4be3cf93c2 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -123,6 +123,8 @@ selections:
|
||||
- file_ownership_var_log_audit
|
||||
- file_permission_user_init_files
|
||||
- file_permissions_binary_dirs
|
||||
+- file_permissions_etc_audit_auditd
|
||||
+- file_permissions_etc_audit_rulesd
|
||||
- file_permissions_home_directories
|
||||
- file_permissions_library_dirs
|
||||
- file_permissions_sshd_private_key
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index b7d2be3af3..20b8a54861 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -134,6 +134,8 @@ selections:
|
||||
- file_ownership_var_log_audit
|
||||
- file_permission_user_init_files
|
||||
- file_permissions_binary_dirs
|
||||
+- file_permissions_etc_audit_auditd
|
||||
+- file_permissions_etc_audit_rulesd
|
||||
- file_permissions_home_directories
|
||||
- file_permissions_library_dirs
|
||||
- file_permissions_sshd_private_key
|
@ -1,327 +0,0 @@
|
||||
From 065b6e540a2aa437ddf5239c97ed4e1fddf43b50 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 26 Jul 2021 09:00:49 -0500
|
||||
Subject: [PATCH] Update rule aide_check_audit_tools for RHEL-08-030650
|
||||
|
||||
---
|
||||
.../aide_check_audit_tools/ansible/shared.yml | 27 ++++++++++++------
|
||||
.../aide_check_audit_tools/bash/shared.sh | 25 +++++++++++++++++
|
||||
.../aide_check_audit_tools/oval/shared.xml | 20 +++++++++++++
|
||||
.../aide/aide_check_audit_tools/rule.yml | 28 ++++++++++++-------
|
||||
.../tests/correct.pass.sh | 15 ++++++++++
|
||||
.../tests/correct_with_selinux.pass.sh | 12 ++++++++
|
||||
.../tests/not_config.fail.sh | 14 ++++++++++
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
11 files changed, 126 insertions(+), 19 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct.pass.sh
|
||||
create mode 100644 linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct_with_selinux.pass.sh
|
||||
create mode 100644 linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/not_config.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/ansible/shared.yml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/ansible/shared.yml
|
||||
index 73afaeff869..edef272183d 100644
|
||||
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/ansible/shared.yml
|
||||
@@ -1,18 +1,29 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,multi_platform_rhel
|
||||
# reboot = false
|
||||
# strategy = restrict
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
-- name: Install aide package
|
||||
- zypper:
|
||||
- name: aide
|
||||
- state: latest
|
||||
+{{% if 'rhel' not in product %}}
|
||||
+{{% set aide_string = 'p+i+n+u+g+s+b+acl+selinux+xattrs+sha512' %}}
|
||||
+{{% else %}}
|
||||
+{{% set aide_string = 'p+i+n+u+g+s+b+acl+xattrs+sha512' %}}
|
||||
+{{% endif %}}
|
||||
+
|
||||
+
|
||||
+
|
||||
+- name: Ensure aide is installed
|
||||
+ package:
|
||||
+ name: "{{ item }}"
|
||||
+ state: present
|
||||
+ with_items:
|
||||
+ - aide
|
||||
+
|
||||
|
||||
- name: Set audit_tools fact
|
||||
set_fact:
|
||||
audit_tools:
|
||||
- - /usr/sbin/audispd
|
||||
+ {{% if 'rhel' not in product %}}- /usr/sbin/audispd{{% endif %}}
|
||||
- /usr/sbin/auditctl
|
||||
- /usr/sbin/auditd
|
||||
- /usr/sbin/augenrules
|
||||
@@ -24,11 +35,11 @@
|
||||
lineinfile:
|
||||
path: /etc/aide.conf
|
||||
regexp: ^{{ item }}\s
|
||||
- line: "{{ item }} p+i+n+u+g+s+b+acl+selinux+xattrs+sha512"
|
||||
+ line: "{{ item }} {{{ aide_string }}}"
|
||||
with_items: "{{ audit_tools }}"
|
||||
|
||||
- name: Configure AIDE to properly protect audit tools
|
||||
lineinfile:
|
||||
path: /etc/aide.conf
|
||||
- line: "{{ item }} p+i+n+u+g+s+b+acl+selinux+xattrs+sha512"
|
||||
+ line: "{{ item }} {{{ aide_string }}}"
|
||||
with_items: "{{ audit_tools }}"
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/bash/shared.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..0875eeec648
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/bash/shared.sh
|
||||
@@ -0,0 +1,25 @@
|
||||
+# platform = multi_platform_rhel
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+. /usr/share/scap-security-guide/remediation_functions
|
||||
+
|
||||
+{{{ bash_package_install("aide") }}}
|
||||
+
|
||||
+{{% set configString = "p+i+n+u+g+s+b+acl+xattrs+sha512" %}}
|
||||
+{{% set configFile = "/etc/aide.conf" %}}
|
||||
+{{% for file in (
|
||||
+ "/usr/sbin/auditctl",
|
||||
+ "/usr/sbin/auditd",
|
||||
+ "/usr/sbin/ausearch",
|
||||
+ "/usr/sbin/aureport",
|
||||
+ "/usr/sbin/autrace",
|
||||
+ "/usr/sbin/augenrules" ) %}}
|
||||
+
|
||||
+if grep -i '^.*{{{file}}}.*$' {{{ configFile }}}; then
|
||||
+sed -i "s#.*{{{file}}}.*#{{{file}}} {{{ configString }}}#" {{{ configFile }}}
|
||||
+else
|
||||
+echo "{{{ file }}} {{{ configString }}}" >> {{{ configFile }}}
|
||||
+fi
|
||||
+{{% endfor %}}
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/oval/shared.xml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/oval/shared.xml
|
||||
index 32e6325a3ab..22c6276a1f5 100644
|
||||
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/oval/shared.xml
|
||||
@@ -8,13 +8,19 @@
|
||||
<criterion comment="ausearch is checked in /etc/aide.conf" test_ref="test_aide_verify_ausearch" />
|
||||
<criterion comment="aureport is checked in /etc/aide.conf" test_ref="test_aide_verify_aureport" />
|
||||
<criterion comment="autrace is checked in /etc/aide.conf" test_ref="test_aide_verify_autrace" />
|
||||
+ {{% if 'rhel' not in product %}}
|
||||
<criterion comment="audispd is checked in /etc/aide.conf" test_ref="test_aide_verify_audispd" />
|
||||
+ {{% endif %}}
|
||||
<criterion comment="augenrules is checked in /etc/aide.conf" test_ref="test_aide_verify_augenrules" />
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
<ind:textfilecontent54_state id="state_aide_check_attributes" version="1">
|
||||
+ {{% if 'rhel' not in product %}}
|
||||
<ind:subexpression operation="equals">p+i+n+u+g+s+b+acl+selinux+xattrs+sha512</ind:subexpression>
|
||||
+ {{% else %}}
|
||||
+ <ind:subexpression operation="pattern match">p\+i\+n\+u\+g\+s\+b\+acl(|\+selinux)\+xattrs\+sha512</ind:subexpression>
|
||||
+ {{% endif %}}
|
||||
</ind:textfilecontent54_state>
|
||||
|
||||
<ind:textfilecontent54_test id="test_aide_verify_auditctl"
|
||||
@@ -95,6 +101,20 @@
|
||||
<ind:instance datatype="int" operation="equals">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
+ <ind:textfilecontent54_test id="test_aide_verify_rsyslogd"
|
||||
+ comment="rsyslogd is checked in /etc/aide.conf" check="all"
|
||||
+ check_existence="all_exist" version="1">
|
||||
+ <ind:object object_ref="object_aide_verify_rsyslogd" />
|
||||
+ <ind:state state_ref="state_aide_check_attributes" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+ <ind:textfilecontent54_object id="object_aide_verify_rsyslogd"
|
||||
+ version="1">
|
||||
+ <ind:filepath>/etc/aide.conf</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^/usr/sbin/rsyslogd\s+([^\n]+)$</ind:pattern>
|
||||
+ <ind:instance datatype="int" operation="equals">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+
|
||||
<ind:textfilecontent54_test id="test_aide_verify_augenrules"
|
||||
comment="augenrules is checked in /etc/aide.conf" check="all"
|
||||
check_existence="all_exist" version="1">
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/rule.yml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/rule.yml
|
||||
index 126ee756cc0..17a95bf4b31 100644
|
||||
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/rule.yml
|
||||
@@ -1,11 +1,11 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: sle12,sle15,ubuntu2004
|
||||
+prodtype: sle12,sle15,ubuntu2004,rhel8,fedora
|
||||
|
||||
title: 'Configure AIDE to Verify the Audit Tools'
|
||||
|
||||
description: |-
|
||||
- The SUSE operating system file integrity tool must be configured to protect the integrity of the audit tools.
|
||||
+ 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
|
||||
@@ -31,32 +31,40 @@ rationale: |-
|
||||
severity: medium
|
||||
|
||||
identifiers:
|
||||
+ cce@rhel8: CCE-85964-5
|
||||
cce@sle12: CCE-83204-8
|
||||
cce@sle15: CCE-85610-4
|
||||
|
||||
references:
|
||||
disa: CCI-001496
|
||||
- nist@sle12: AU-9(3),AU-9(3).1
|
||||
+ nist: AU-9(3),AU-9(3).1
|
||||
srg: SRG-OS-000278-GPOS-00108
|
||||
+ stigid@rhel8: RHEL-08-030650
|
||||
stigid@sle12: SLES-12-010540
|
||||
stigid@sle15: SLES-15-030630
|
||||
stigid@ubuntu2004: UBTU-20-010205
|
||||
|
||||
ocil_clause: 'integrity checks of the audit tools are missing or incomplete'
|
||||
|
||||
+{{% if 'rhel' not in product %}}
|
||||
+{{% set aide_string = 'p+i+n+u+g+s+b+acl+selinux+xattrs+sha512' %}}
|
||||
+{{% else %}}
|
||||
+{{% set aide_string = 'p+i+n+u+g+s+b+acl+xattrs+sha512' %}}
|
||||
+{{% endif %}}
|
||||
+
|
||||
ocil: |-
|
||||
Check that AIDE is properly configured to protect the integrity of the
|
||||
audit tools by running the following command:
|
||||
|
||||
<pre># sudo cat /etc/aide.conf | grep /usr/sbin/au
|
||||
|
||||
- /usr/sbin/auditctl p+i+n+u+g+s+b+acl+selinux+xattrs+sha512
|
||||
- /usr/sbin/auditd p+i+n+u+g+s+b+acl+selinux+xattrs+sha512
|
||||
- /usr/sbin/ausearch p+i+n+u+g+s+b+acl+selinux+xattrs+sha512
|
||||
- /usr/sbin/aureport p+i+n+u+g+s+b+acl+selinux+xattrs+sha512
|
||||
- /usr/sbin/autrace p+i+n+u+g+s+b+acl+selinux+xattrs+sha512
|
||||
- /usr/sbin/audispd p+i+n+u+g+s+b+acl+selinux+xattrs+sha512
|
||||
- /usr/sbin/augenrules p+i+n+u+g+s+b+acl+selinux+xattrs+sha512</pre>
|
||||
+ /usr/sbin/auditctl {{{ aide_string }}}
|
||||
+ /usr/sbin/auditd {{{ aide_string }}}
|
||||
+ /usr/sbin/ausearch {{{ aide_string }}}
|
||||
+ /usr/sbin/aureport {{{ aide_string }}}
|
||||
+ /usr/sbin/autrace {{{ aide_string }}}
|
||||
+ {{% if 'rhel' not in product %}}/usr/sbin/audispd {{{ aide_string }}}{{% endif %}}
|
||||
+ /usr/sbin/augenrules {{{ aide_string }}}</pre>
|
||||
|
||||
If AIDE is configured properly to protect the integrity of the audit tools,
|
||||
all lines listed above will be returned from the command.
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct.pass.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..756b88d8a23
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct.pass.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_rhel,multi_platform_fedora
|
||||
+
|
||||
+
|
||||
+yum -y install aide
|
||||
+aide --init
|
||||
+
|
||||
+
|
||||
+declare -a bins
|
||||
+bins=('/usr/sbin/auditctl' '/usr/sbin/auditd' '/usr/sbin/augenrules' '/usr/sbin/aureport' '/usr/sbin/ausearch' '/usr/sbin/autrace')
|
||||
+
|
||||
+for theFile in "${bins[@]}"
|
||||
+do
|
||||
+ echo "$theFile p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct_with_selinux.pass.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct_with_selinux.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..f3a2a126d3d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/correct_with_selinux.pass.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_rhel,multi_platform_fedora
|
||||
+
|
||||
+yum -y install aide
|
||||
+
|
||||
+declare -a bins
|
||||
+bins=('/usr/sbin/auditctl' '/usr/sbin/auditd' '/usr/sbin/augenrules' '/usr/sbin/aureport' '/usr/sbin/ausearch' '/usr/sbin/autrace')
|
||||
+
|
||||
+for theFile in "${bins[@]}"
|
||||
+do
|
||||
+ echo "$theFile p+i+n+u+g+s+b+acl+selinux+xattrs+sha5122" >> /etc/aide.conf
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/not_config.fail.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/not_config.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..4315cef2073
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/tests/not_config.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_rhel,multi_platform_fedora
|
||||
+
|
||||
+
|
||||
+yum -y install aide
|
||||
+aide --init
|
||||
+
|
||||
+declare -a bins
|
||||
+bins=('/usr/sbin/auditctl' '/usr/sbin/auditd' '/usr/sbin/augenrules' '/usr/sbin/aureport' '/usr/sbin/ausearch' '/usr/sbin/autrace')
|
||||
+
|
||||
+for theFile in "${bins[@]}"
|
||||
+do
|
||||
+ echo sed -i "s#^.*${theFile}.*##g" /etc/aide.conf
|
||||
+done
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 7270a8f91f2..6b3232a9e00 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -822,6 +822,7 @@ selections:
|
||||
# RHEL-08-030640
|
||||
|
||||
# RHEL-08-030650
|
||||
+ - aide_check_audit_tools
|
||||
|
||||
# RHEL-08-030660
|
||||
- auditd_audispd_configure_sufficiently_large_partition
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 665f903ead4..ff557cc2323 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -97,7 +97,6 @@ CCE-85960-3
|
||||
CCE-85961-1
|
||||
CCE-85962-9
|
||||
CCE-85963-7
|
||||
-CCE-85964-5
|
||||
CCE-85965-2
|
||||
CCE-85966-0
|
||||
CCE-85967-8
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 7d59cfff625..692a1690b19 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -60,6 +60,7 @@ selections:
|
||||
- accounts_user_home_paths_only
|
||||
- accounts_user_interactive_home_directory_defined
|
||||
- accounts_user_interactive_home_directory_exists
|
||||
+- aide_check_audit_tools
|
||||
- aide_scan_notification
|
||||
- aide_verify_acls
|
||||
- aide_verify_ext_attributes
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 2c2daad6f6d..cf119c02a17 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -71,6 +71,7 @@ selections:
|
||||
- accounts_user_home_paths_only
|
||||
- accounts_user_interactive_home_directory_defined
|
||||
- accounts_user_interactive_home_directory_exists
|
||||
+- aide_check_audit_tools
|
||||
- aide_scan_notification
|
||||
- aide_verify_acls
|
||||
- aide_verify_ext_attributes
|
@ -1,241 +0,0 @@
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000000..4f88ed361d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml
|
||||
@@ -0,0 +1,8 @@
|
||||
+# platform = multi_platform_fedora,multi_platform_rhel
|
||||
+
|
||||
+{{{ ansible_set_config_file(file="/etc/audit/auditd.conf",
|
||||
+ parameter="overflow_action",
|
||||
+ value="syslog",
|
||||
+ separator="=",
|
||||
+ separator_regex="=",
|
||||
+ prefix_regex="^\s*") }}}
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/bash/shared.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000000..539b9b6582
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/bash/shared.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+# platform = multi_platform_fedora,multi_platform_rhel
|
||||
+# reboot = true
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+{{{set_config_file(path="/etc/audit/auditd.conf",
|
||||
+ parameter="overflow_action",
|
||||
+ value="syslog",
|
||||
+ separator="=",
|
||||
+ separator_regex="=",
|
||||
+ prefix_regex="^\s*")}}}
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/oval/shared.xml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000000..fd45280e4e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/oval/shared.xml
|
||||
@@ -0,0 +1,6 @@
|
||||
+{{{ oval_check_config_file(
|
||||
+ path="/etc/audit/auditd.conf",
|
||||
+ prefix_regex="^(?:.*\\n)*\s*",
|
||||
+ parameter="overflow_action",
|
||||
+ value="syslog|single|halt",
|
||||
+ separator_regex="\s*=\s*") }}}
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..d41ca00076
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/rule.yml
|
||||
@@ -0,0 +1,36 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: Appropriate Action Must be Setup When the Internal Audit Event Queue is Full
|
||||
+
|
||||
+description: |-
|
||||
+ The audit system should have an action setup in the event the internal event queue becomes full.
|
||||
+ To setup an overflow action edit <tt>/etc/audit/auditd.conf</tt>. Set <tt>overflow_action</tt>
|
||||
+ to one of the following values: <tt>syslog</tt>, <tt>single</tt>, <tt>halt</tt>.
|
||||
+
|
||||
+
|
||||
+rationale: |-
|
||||
+ The audit system should have an action setup in the event the internal event queue becomes full
|
||||
+ so that no data is lost.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85889-4
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001851
|
||||
+ nist: AU-4(1)
|
||||
+ srg: SRG-OS-000342-GPOS-00133,SRG-OS-000479-GPOS-00224
|
||||
+ stigid@rhel8: RHEL-08-030700
|
||||
+
|
||||
+ocil_clause: 'auditd overflow action is not setup correctly'
|
||||
+
|
||||
+ocil: |-
|
||||
+ Verify the audit system is configured to take an appropriate action when the internal event queue is full:
|
||||
+ <pre>$ sudo grep -i overflow_action /etc/audit/auditd.conf</pre>
|
||||
+
|
||||
+ The output should contain be like <tt>overflow_action = syslog</tt>
|
||||
+
|
||||
+ If the value of the "overflow_action" option is not set to <tt>syslog</tt>,
|
||||
+ <tt>single</tt>, <tt>halt</tt> 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.
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/commented_out.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/commented_out.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..ec7525b195
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/commented_out.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "# overflow_action = syslog" >> /etc/audit/auditd.conf
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/empty.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/empty.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..e4d173ab37
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/empty.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+if [[ -f $config_file ]]; then
|
||||
+ echo '' > $config_file
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/file_not_present.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/file_not_present.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..f26cd7cddf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/file_not_present.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+config_file=/etc/audit/auditd.conf
|
||||
+
|
||||
+if [[ -f $config_file ]]; then
|
||||
+ rm -f $config_file
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/halt.pass.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/halt.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..0ec591b25b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/halt.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "overflow_action = halt" >> /etc/audit/auditd.conf
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/ignore.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/ignore.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..236ad543fe
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/ignore.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "overflow_action = ignore" >> /etc/audit/auditd.conf
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/not_present.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/not_present.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..74efdcafee
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/not_present.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+config_file=/etc/audit/auditd.conf
|
||||
+sed -i "s/^.*overflow_action.*$//" $config_file
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/setup.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/setup.sh
|
||||
new file mode 100644
|
||||
index 0000000000..de11126320
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/setup.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+# Use this script to ensure the audit directory structure and audit conf file
|
||||
+# exist in the test env.
|
||||
+config_file=/etc/audit/auditd.conf
|
||||
+
|
||||
+# Ensure directory structure exists (useful for container based testing)
|
||||
+test -d /etc/audit/ || mkdir -p /etc/audit/
|
||||
+
|
||||
+test -f $config_file || touch $config_file
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/single.pass.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/single.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..f9fa7a935c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/single.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "overflow_action = single" >> /etc/audit/auditd.conf
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/syslog.pass.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/syslog.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..1c625fb752
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/tests/syslog.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# Ensure test system has proper directories/files for test scenario
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "overflow_action = syslog" >> /etc/audit/auditd.conf
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 6372d13cfc..5cac78e00d 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -826,6 +826,7 @@ selections:
|
||||
- rsyslog_remote_loghost
|
||||
|
||||
# RHEL-08-030700
|
||||
+ - auditd_overflow_action
|
||||
|
||||
# RHEL-08-030710
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 24e8149168..b3d9596e1f 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -27,7 +27,6 @@ CCE-85885-2
|
||||
CCE-85886-0
|
||||
CCE-85887-8
|
||||
CCE-85888-6
|
||||
-CCE-85889-4
|
||||
CCE-85890-2
|
||||
CCE-85891-0
|
||||
CCE-85892-8
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 32f1a24a7a..c9d23ed1dc 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -73,6 +73,7 @@ selections:
|
||||
- auditd_local_events
|
||||
- auditd_log_format
|
||||
- auditd_name_format
|
||||
+- auditd_overflow_action
|
||||
- banner_etc_issue
|
||||
- bios_enable_execution_restrictions
|
||||
- chronyd_client_only
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index d6a27c67dc..7303145141 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -84,6 +84,7 @@ selections:
|
||||
- auditd_local_events
|
||||
- auditd_log_format
|
||||
- auditd_name_format
|
||||
+- auditd_overflow_action
|
||||
- banner_etc_issue
|
||||
- bios_enable_execution_restrictions
|
||||
- chronyd_client_only
|
@ -1,480 +0,0 @@
|
||||
From 2f38b61e9b6b26dab05443a9bf03642971cbeeef Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Fri, 23 Jul 2021 16:32:15 -0500
|
||||
Subject: [PATCH] Add new rule for RHEL-08-030710
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 5 +++
|
||||
.../bash/shared.sh | 6 +++
|
||||
.../oval/shared.xml | 44 +++++++++++++++++++
|
||||
.../rule.yml | 38 ++++++++++++++++
|
||||
.../tests/default_no_pass.fail.sh | 7 +++
|
||||
.../tests/rsyslog.pass.sh | 4 ++
|
||||
.../tests/rsyslog_wrong_value.fail.sh | 4 ++
|
||||
.../tests/rsyslogd.pass.sh | 4 ++
|
||||
.../tests/rsyslogd_wrong_value.fail.sh | 4 ++
|
||||
.../tests/setup.sh | 9 ++++
|
||||
.../ansible/shared.yml | 5 +++
|
||||
.../bash/shared.sh | 5 +++
|
||||
.../oval/shared.xml | 44 +++++++++++++++++++
|
||||
.../rule.yml | 38 ++++++++++++++++
|
||||
.../tests/default_no_pass.fail.sh | 7 +++
|
||||
.../tests/rsyslog.pass.sh | 4 ++
|
||||
.../tests/rsyslog_wrong_value.fail.sh | 4 ++
|
||||
.../tests/rsyslogd.pass.sh | 4 ++
|
||||
.../tests/rsyslogd_wrong_value.fail.sh | 4 ++
|
||||
.../tests/setup.sh | 9 ++++
|
||||
products/rhel8/profiles/stig.profile | 2 +
|
||||
shared/references/cce-redhat-avail.txt | 2 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 2 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 2 +
|
||||
24 files changed, 255 insertions(+), 2 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/rule.yml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/default_no_pass.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog.pass.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog_wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd.pass.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd_wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/setup.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/rule.yml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/default_no_pass.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog.pass.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog_wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd.pass.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd_wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/setup.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000000..2d6c5227a8
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
@@ -0,0 +1,5 @@
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
+{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
+ parameter="\$ActionSendStreamDriverMode", value="1", create=true, separator=" ", separator_regex=" ")
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/bash/shared.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000000..36853d1786
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/bash/shared.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
+{{{ set_config_file(path="/etc/rsyslog.d/encrypt.conf",
|
||||
+ parameter="\$ActionSendStreamDriverMode", value="1", create=true, separator=" ", separator_regex=" ")
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000000..d21f8af1e4
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/oval/shared.xml
|
||||
@@ -0,0 +1,44 @@
|
||||
+
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Rsyslogd must encrypt the off-loading of logs off of the system.") }}}
|
||||
+ <criteria operator="AND">
|
||||
+ <criteria operator="OR">
|
||||
+ <criterion comment="Check if $ActionSendStreamDriverMode 1 is set in /etc/rsyslog.conf"
|
||||
+ test_ref="test_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog" />
|
||||
+ <criterion comment="Check if $ActionSendStreamDriverMode 1 is set in files in /etc/rsyslog.d"
|
||||
+ test_ref="test_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog_dir" />
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
|
||||
+ comment="Check if $ActionSendStreamDriverMode 1 is set in /etc/rsyslog.conf"
|
||||
+ id="test_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog" version="1">
|
||||
+
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog"
|
||||
+ comment="Check if $ActionSendStreamDriverMode 1 is set in /etc/rsyslog.conf"
|
||||
+ version="1">
|
||||
+ <ind:filepath>/etc/rsyslog.conf</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^\$ActionSendStreamDriverMode 1$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
|
||||
+ comment="Check if $ActionSendStreamDriverMode 1 is set in /etc/rsyslog.conf"
|
||||
+ id="test_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog_dir" version="1">
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog_dir" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}_action_send_stream_driver_mode_rsyslog_dir"
|
||||
+ comment="Check if $ActionSendStreamDriverMode 1 is set in /etc/rsyslog.d"
|
||||
+ version="1">
|
||||
+ <ind:path>/etc/rsyslog.d</ind:path>
|
||||
+ <ind:filename operation="pattern match">^.*conf$</ind:filename>
|
||||
+ <ind:pattern operation="pattern match">^\$ActionSendStreamDriverMode 1$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/rule.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..1bcc33927b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/rule.yml
|
||||
@@ -0,0 +1,38 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: Ensure Rsyslog Encrypts Off-Loaded Audit Records
|
||||
+
|
||||
+description: |-
|
||||
+ Rsyslogd is a system utility providing support for message logging. Support
|
||||
+ for both internet and UNIX domain sockets enables this utility to support both local
|
||||
+ and remote logging. Couple this utility with <tt>gnutls</tt> (which is a secure communications
|
||||
+ library implementing the SSL, TLS and DTLS protocols), and you have a method to securely
|
||||
+ encrypt and off-load auditing.
|
||||
+
|
||||
+ When using <tt>rsyslogd</tt> to off-load logs off a encrpytion system must be used.
|
||||
+
|
||||
+rationale: |-
|
||||
+ The audit records generated by Rsyslog contain valuable information regarding system
|
||||
+ configuration, user authentication, and other such information. Audit records should be
|
||||
+ protected from unauthorized access.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-86098-1
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001851
|
||||
+ nist: AU-4(1)
|
||||
+ srg: SRG-OS-000342-GPOS-00133,SRG-OS-000479-GPOS-00224
|
||||
+ stigid@rhel8: RHEL-08-030710
|
||||
+
|
||||
+ocil_clause: 'rsyslogd ActionSendStreamDriverMode not set to 1'
|
||||
+
|
||||
+ocil: |-
|
||||
+ Verify the operating system encrypts audit records off-loaded onto a different system
|
||||
+ or media from the system being audited with the following commands:
|
||||
+
|
||||
+ <pre>$ sudo grep -i '$ActionSendStreamDriverMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf</pre>
|
||||
+ The output should be
|
||||
+ <pre>/etc/rsyslog.conf:$ActionSendStreamDriverMode 1</pre>
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/default_no_pass.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/default_no_pass.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..3ee5384371
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/default_no_pass.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+if [[ -f encrypt.conf ]]; then
|
||||
+ sed -i i/\$ActionSendStreamDriverMod//g /etc/rsyslog.d/encrypt.conf
|
||||
+fi
|
||||
+ sed -i i/\$ActionSendStreamDriverMod//g /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..34105aaa85
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverMode 1" >> /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog_wrong_value.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog_wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..db87b2956c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslog_wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverMode 0" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..25e7cdf783
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverMode 1" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd_wrong_value.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd_wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..d37882acf3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/rsyslogd_wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverMode 0" >> /etc/rsyslog
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/setup.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/setup.sh
|
||||
new file mode 100644
|
||||
index 0000000000..9686f16bcc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/tests/setup.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+# Use this script to ensure the rsyslog directory structure and rsyslog conf file
|
||||
+# exist in the test env.
|
||||
+config_file=/etc/rsyslog.conf
|
||||
+
|
||||
+# Ensure directory structure exists (useful for container based testing)
|
||||
+test -f $config_file || touch $config_file
|
||||
+
|
||||
+test -d /etc/rsyslog.d/ || mkdir /etc/rsyslog.d/
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000000..2ddbfb871f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
@@ -0,0 +1,5 @@
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
+{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
+ parameter="\$DefaultNetstreamDriver", value="gtls", create=true, separator=" ", separator_regex=" ")
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/bash/shared.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000000..3955346cd3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/bash/shared.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+{{{ set_config_file(path="/etc/rsyslog.d/encrypt.conf",
|
||||
+ parameter="\$DefaultNetstreamDriver", value="gtls", create=true, separator=" ", separator_regex=" ")
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000000..71d39c179d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/oval/shared.xml
|
||||
@@ -0,0 +1,44 @@
|
||||
+
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Rsyslogd must encrypt the off-loading of logs off of the system.") }}}
|
||||
+ <criteria operator="AND">
|
||||
+ <criteria operator="OR">
|
||||
+ <criterion comment="Check if $DefaultNetstreamDriver gtls is set in /etc/rsyslog.conf"
|
||||
+ test_ref="test_{{{rule_id}}}_default_netstream_rsyslog" />
|
||||
+ <criterion comment="Check if $DefaultNetstreamDriver gtls is set in files in /etc/rsyslog.d"
|
||||
+ test_ref="test_{{{rule_id}}}_default_netstream_rsyslog_dir" />
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
|
||||
+ comment="Check if $DefaultNetstreamDriver gtls is set in /etc/rsyslog.conf"
|
||||
+ id="test_{{{rule_id}}}_default_netstream_rsyslog" version="1">
|
||||
+
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}_default_netstream_rsyslog" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}_default_netstream_rsyslog"
|
||||
+ comment="Check if $DefaultNetstreamDriver gtls is set in /etc/rsyslog.conf"
|
||||
+ version="1">
|
||||
+ <ind:filepath>/etc/rsyslog.conf</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^\$DefaultNetstreamDriver gtls$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
|
||||
+ comment="Check if $DefaultNetstreamDriver gtls is set in /etc/rsyslog.conf"
|
||||
+ id="test_{{{rule_id}}}_default_netstream_rsyslog_dir" version="1">
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}_default_netstream_rsyslog_dir" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}_default_netstream_rsyslog_dir"
|
||||
+ comment="Check if $DefaultNetstreamDriver gtls is set in /etc/rsyslog.d"
|
||||
+ version="1">
|
||||
+ <ind:path>/etc/rsyslog.d</ind:path>
|
||||
+ <ind:filename operation="pattern match">^.*conf$</ind:filename>
|
||||
+ <ind:pattern operation="pattern match">^\$DefaultNetstreamDriver gtls$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/rule.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..eff85d3fae
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/rule.yml
|
||||
@@ -0,0 +1,38 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: Ensure Rsyslog Encrypts Off-Loaded Audit Records
|
||||
+
|
||||
+description: |-
|
||||
+ Rsyslogd is a system utility providing support for message logging. Support
|
||||
+ for both internet and UNIX domain sockets enables this utility to support both local
|
||||
+ and remote logging. Couple this utility with <tt>gnutls</tt> (which is a secure communications
|
||||
+ library implementing the SSL, TLS and DTLS protocols), and you have a method to securely
|
||||
+ encrypt and off-load auditing.
|
||||
+
|
||||
+ When using <tt>rsyslogd</tt> to off-load logs off a encrpytion system must be used.
|
||||
+
|
||||
+rationale: |-
|
||||
+ The audit records generated by Rsyslog contain valuable information regarding system
|
||||
+ configuration, user authentication, and other such information. Audit records should be
|
||||
+ protected from unauthorized access.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85992-6
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001851
|
||||
+ nist: AU-4(1)
|
||||
+ srg: SRG-OS-000342-GPOS-00133,SRG-OS-000479-GPOS-00224
|
||||
+ stigid@rhel8: RHEL-08-030710
|
||||
+
|
||||
+ocil_clause: 'rsyslogd DefaultNetstreamDriver not set to gtls'
|
||||
+
|
||||
+ocil: |-
|
||||
+ Verify the operating system encrypts audit records off-loaded onto a different system
|
||||
+ or media from the system being audited with the following commands:
|
||||
+
|
||||
+ <pre>$ sudo grep -i '$DefaultNetstreamDriver' /etc/rsyslog.conf /etc/rsyslog.d/*.conf</pre>
|
||||
+ The output should be
|
||||
+ <pre>/etc/rsyslog.conf:$DefaultNetstreamDriver gtls</pre>
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/default_no_pass.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/default_no_pass.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..6ab43bfc0d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/default_no_pass.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+if [[ -f encrypt.conf ]]; then
|
||||
+ sed -i i/\$DefaultNetstreamDriver*.$//g /etc/rsyslog.d/encrypt.conf
|
||||
+fi
|
||||
+ sed -i i/\$DefaultNetstreamDriver*.$//g /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..40f1bfe087
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$DefaultNetstreamDriver gtls" >> /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog_wrong_value.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog_wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..30a1d5b43a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslog_wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$DefaultNetstreamDriver none" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..44715bca66
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$DefaultNetstreamDriver gtls" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd_wrong_value.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd_wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..30a1d5b43a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/rsyslogd_wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$DefaultNetstreamDriver none" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/setup.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/setup.sh
|
||||
new file mode 100644
|
||||
index 0000000000..9686f16bcc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/tests/setup.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+# Use this script to ensure the rsyslog directory structure and rsyslog conf file
|
||||
+# exist in the test env.
|
||||
+config_file=/etc/rsyslog.conf
|
||||
+
|
||||
+# Ensure directory structure exists (useful for container based testing)
|
||||
+test -f $config_file || touch $config_file
|
||||
+
|
||||
+test -d /etc/rsyslog.d/ || mkdir /etc/rsyslog.d/
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 6372d13cfc..1cc53cf1e1 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -828,6 +828,8 @@ selections:
|
||||
- auditd_overflow_action
|
||||
|
||||
# RHEL-08-030710
|
||||
+ - rsyslog_encrypt_offload_defaultnetstreamdriver
|
||||
+ - rsyslog_encrypt_offload_actionsendstreamdrivermode
|
||||
|
||||
# RHEL-08-030720
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 24e8149168..fdf69f6baa 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -129,7 +129,6 @@ CCE-85988-4
|
||||
CCE-85989-2
|
||||
CCE-85990-0
|
||||
CCE-85991-8
|
||||
-CCE-85992-6
|
||||
CCE-85993-4
|
||||
CCE-85994-2
|
||||
CCE-85995-9
|
||||
@@ -235,7 +234,6 @@ CCE-86094-0
|
||||
CCE-86095-7
|
||||
CCE-86096-5
|
||||
CCE-86097-3
|
||||
-CCE-86098-1
|
||||
CCE-86099-9
|
||||
CCE-86100-5
|
||||
CCE-86101-3
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 32f1a24a7a..c0ef381696 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -228,6 +228,8 @@ selections:
|
||||
- require_singleuser_auth
|
||||
- root_permissions_syslibrary_files
|
||||
- rsyslog_cron_logging
|
||||
+- rsyslog_encrypt_offload_actionsendstreamdrivermode
|
||||
+- rsyslog_encrypt_offload_defaultnetstreamdriver
|
||||
- rsyslog_remote_access_monitoring
|
||||
- rsyslog_remote_loghost
|
||||
- security_patches_up_to_date
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index d6a27c67dc..5adeea4a35 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -239,6 +239,8 @@ selections:
|
||||
- require_singleuser_auth
|
||||
- root_permissions_syslibrary_files
|
||||
- rsyslog_cron_logging
|
||||
+- rsyslog_encrypt_offload_actionsendstreamdrivermode
|
||||
+- rsyslog_encrypt_offload_defaultnetstreamdriver
|
||||
- rsyslog_remote_access_monitoring
|
||||
- rsyslog_remote_loghost
|
||||
- security_patches_up_to_date
|
@ -1,389 +0,0 @@
|
||||
From fbaa0ae639fbb001e4c9e92d9e35f9dd9309d605 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 9 Aug 2021 10:56:36 -0500
|
||||
Subject: [PATCH 1/2] Allow set_config_file bash macro and lineinfile to set a
|
||||
custom sed path separator
|
||||
|
||||
So that if the text has '/' in it the sed path separator can be changed.
|
||||
---
|
||||
.../developer/06_contributing_with_content.md | 3 +++
|
||||
shared/macros-bash.jinja | 23 ++++++++++---------
|
||||
shared/templates/lineinfile/bash.template | 6 ++++-
|
||||
3 files changed, 20 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/docs/manual/developer/06_contributing_with_content.md b/docs/manual/developer/06_contributing_with_content.md
|
||||
index 245db1550de..c0d62bef5ca 100644
|
||||
--- a/docs/manual/developer/06_contributing_with_content.md
|
||||
+++ b/docs/manual/developer/06_contributing_with_content.md
|
||||
@@ -1572,6 +1572,9 @@ the following to `rule.yml`:
|
||||
- **oval_extend_definitions** - optional, list of additional OVAL
|
||||
definitions that have to pass along the generated check.
|
||||
|
||||
+ **sed_path_separator** - optional, default is `/`, sets the sed path separator. Set this
|
||||
+ to a character like `#` if `/` is in use in your text.
|
||||
+
|
||||
- Languages: Ansible, Bash, OVAL
|
||||
|
||||
|
||||
diff --git a/shared/macros-bash.jinja b/shared/macros-bash.jinja
|
||||
index d654a0e0e89..7af8038a783 100644
|
||||
--- a/shared/macros-bash.jinja
|
||||
+++ b/shared/macros-bash.jinja
|
||||
@@ -444,11 +444,12 @@ printf '%s\n' "{{{ message | replace('"', '\\"') }}}" >&2
|
||||
# separator_regex: regular expression that describes the separator and surrounding whitespace
|
||||
# prefix_regex: regular expression describing allowed leading characters at each line
|
||||
#}}
|
||||
-{{%- macro set_config_file(path, parameter, value, create, insert_after, insert_before, insensitive=true, separator=" ", separator_regex="\s\+", prefix_regex="^\s*") -%}}
|
||||
- {{%- set line_regex = prefix_regex + ((parameter | escape_regex) | replace("/", "\/")) + separator_regex -%}}
|
||||
+
|
||||
+{{%- macro set_config_file(path, parameter, value, create, insert_after, insert_before, insensitive=true, separator=" ", separator_regex="\s\+", prefix_regex="^\s*", sed_path_separator="/") -%}}
|
||||
{{%- set new_line = parameter+separator+value -%}}
|
||||
+ {{%- set line_regex = prefix_regex + ((parameter | escape_regex) | replace("/", "\/")) + separator_regex -%}}
|
||||
if [ -e "{{{ path }}}" ] ; then
|
||||
- {{{ lineinfile_absent(path, line_regex, insensitive) | indent(4) }}}
|
||||
+ {{{ lineinfile_absent(path, line_regex, insensitive, sed_path_separator=sed_path_separator) | indent(4) }}}
|
||||
else
|
||||
{{%- if create %}}
|
||||
touch "{{{ path }}}"
|
||||
@@ -456,19 +457,19 @@ else
|
||||
{{{ die("Path '" + path + "' wasn't found on this system. Refusing to continue.", action="return") | indent(4) }}}
|
||||
{{%- endif %}}
|
||||
fi
|
||||
-{{{ lineinfile_present(path, new_line, insert_after, insert_before, insensitive) }}}
|
||||
+{{{ lineinfile_present(path, new_line, insert_after, insert_before, insensitive, sed_path_separator=sed_path_separator) }}}
|
||||
{{%- endmacro -%}}
|
||||
|
||||
-{{%- macro lineinfile_absent(path, regex, insensitive=true) -%}}
|
||||
+{{%- macro lineinfile_absent(path, regex, insensitive=true, sed_path_separator="/") -%}}
|
||||
{{%- if insensitive -%}}
|
||||
{{%- set modifier="Id" -%}}
|
||||
{{%- else -%}}
|
||||
{{%- set modifier="d" -%}}
|
||||
{{%- endif -%}}
|
||||
- {{% if '/' in regex %}}
|
||||
- {{{ raise("regex (" + regex + ") uses sed path separator (/) in " + rule_id) }}}
|
||||
+ {{% if sed_path_separator in regex %}}
|
||||
+ {{{ raise("regex (" + regex + ") uses sed path separator (" + sed_path_separator + ") in " + rule_id) }}}
|
||||
{{% endif %}}
|
||||
-LC_ALL=C sed -i "/{{{ regex }}}/{{{ modifier }}}" "{{{ path }}}"
|
||||
+LC_ALL=C sed -i "{{{ sed_path_separator }}}{{{ regex }}}{{{ sed_path_separator }}}{{{ modifier }}}" "{{{ path }}}"
|
||||
{{%- endmacro -%}}
|
||||
|
||||
{{%- macro lineinfile_absent_in_directory(dirname, regex, insensitive=true) -%}}
|
||||
@@ -480,7 +481,7 @@ LC_ALL=C sed -i "/{{{ regex }}}/{{{ modifier }}}" "{{{ path }}}"
|
||||
LC_ALL=C sed -i "/{{{ regex }}}/{{{ modifier }}}" "{{{ dirname }}}"/*
|
||||
{{%- endmacro -%}}
|
||||
|
||||
-{{%- macro lineinfile_present(path, line, insert_after="", insert_before="", insensitive=true) -%}}
|
||||
+{{%- macro lineinfile_present(path, line, insert_after="", insert_before="", insensitive=true, sed_path_separator="/") -%}}
|
||||
{{%- if insensitive -%}}
|
||||
{{%- set grep_args="-q -m 1 -i" -%}}
|
||||
{{%- else -%}}
|
||||
@@ -496,7 +497,7 @@ printf '%s\n' "{{{ line }}}" > "{{{ path }}}"
|
||||
cat "{{{ path }}}.bak" >> "{{{ path }}}"
|
||||
{{%- elif insert_after %}}
|
||||
# Insert after the line matching the regex '{{{ insert_after }}}'
|
||||
-line_number="$(LC_ALL=C grep -n "{{{ insert_after }}}" "{{{ path }}}.bak" | LC_ALL=C sed 's/:.*//g')"
|
||||
+line_number="$(LC_ALL=C grep -n "{{{ insert_after }}}" "{{{ path }}}.bak" | LC_ALL=C sed 's{{{sed_path_separator}}}:.*{{{sed_path_separator}}}{{{sed_path_separator}}}g')"
|
||||
if [ -z "$line_number" ]; then
|
||||
# There was no match of '{{{ insert_after }}}', insert at
|
||||
# the end of the file.
|
||||
@@ -508,7 +509,7 @@ else
|
||||
fi
|
||||
{{%- elif insert_before %}}
|
||||
# Insert before the line matching the regex '{{{ insert_before }}}'.
|
||||
-line_number="$(LC_ALL=C grep -n "{{{ insert_before }}}" "{{{ path }}}.bak" | LC_ALL=C sed 's/:.*//g')"
|
||||
+line_number="$(LC_ALL=C grep -n "{{{ insert_before }}}" "{{{ path }}}.bak" | LC_ALL=C sed 's{{{sed_path_separator}}}:.*{{{sed_path_separator}}}{{{sed_path_separator}}}g')"
|
||||
if [ -z "$line_number" ]; then
|
||||
# There was no match of '{{{ insert_before }}}', insert at
|
||||
# the end of the file.
|
||||
diff --git a/shared/templates/lineinfile/bash.template b/shared/templates/lineinfile/bash.template
|
||||
index 0e43e88842a..6d1ca349268 100644
|
||||
--- a/shared/templates/lineinfile/bash.template
|
||||
+++ b/shared/templates/lineinfile/bash.template
|
||||
@@ -4,4 +4,8 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
-{{{ set_config_file(PATH, TEXT, value="", create='yes', insert_after="", insert_before="", separator="", separator_regex="", prefix_regex="^\s*") -}}}
|
||||
+{{% if SED_PATH_SEPARATOR %}}
|
||||
+ {{{ set_config_file(PATH, TEXT, value="", create='yes', insert_after="", insert_before="", separator="", separator_regex="", prefix_regex="^\s*", sed_path_separator=SED_PATH_SEPARATOR) -}}}
|
||||
+{{% else %}}
|
||||
+ {{{ set_config_file(PATH, TEXT, value="", create='yes', insert_after="", insert_before="", separator="", separator_regex="", prefix_regex="^\s*") -}}}
|
||||
+{{% endif %}}
|
||||
|
||||
From 4b3182bd5d5308fed16f58da9656aa76a4275569 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 9 Aug 2021 13:56:32 -0500
|
||||
Subject: [PATCH 2/2] Add new rule for RHEL-08-030720
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 9 ++++
|
||||
.../bash/shared.sh | 11 +++++
|
||||
.../oval/shared.xml | 43 +++++++++++++++++++
|
||||
.../rule.yml | 40 +++++++++++++++++
|
||||
.../tests/default_no_pass.fail.sh | 7 +++
|
||||
.../tests/rsyslog.pass.sh | 4 ++
|
||||
.../tests/rsyslog_wrong_value.fail.sh | 4 ++
|
||||
.../tests/rsyslogd.pass.sh | 4 ++
|
||||
.../tests/rsyslogd_wrong_value.fail.sh | 4 ++
|
||||
.../tests/setup.sh | 9 ++++
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
14 files changed, 138 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/rule.yml
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/default_no_pass.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog.pass.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog_wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd.pass.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd_wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/setup.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..637f90003b2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml
|
||||
@@ -0,0 +1,9 @@
|
||||
+# platform = Red Hat Virtualization 4,multi_platform_fedora,multi_platform_rhel
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+{{{ ansible_set_config_file_dir(msg, "/etc/rsyslog.conf", "/etc/rsyslog.d", "/etc/rsyslog.conf",
|
||||
+ "$ActionSendStreamDriverAuthMode", separator=' ', separator_regex='\s',
|
||||
+ value="x509/name", create='yes') }}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/bash/shared.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..71d312f332f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/bash/shared.sh
|
||||
@@ -0,0 +1,11 @@
|
||||
+# platform = Red Hat Virtualization 4,multi_platform_fedora,multi_platform_rhel
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+if ! grep -s "\$ActionSendStreamDriverAuthMode\s*x509/name" /etc/rsyslog.conf /etc/rsyslog.d/*.conf; then
|
||||
+ mkdir -p /etc/rsyslog.d
|
||||
+ sed -i '/^.*\$ActionSendStreamDriverAuthMode.*/d' /etc/rsyslog.conf /etc/rsyslog.d/*.conf
|
||||
+ echo "\$ActionSendStreamDriverAuthMode x509/name" > /etc/rsyslog.d/stream_driver_auth.conf
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..8e1ec48a974
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/oval/shared.xml
|
||||
@@ -0,0 +1,43 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Rsyslogd must authenticate remote system its sending logs to.") }}}
|
||||
+ <criteria operator="AND">
|
||||
+ <criteria operator="OR">
|
||||
+ <criterion comment="Check if $ActionSendStreamDriverAuthMode x509/name is set in /etc/rsyslog.conf"
|
||||
+ test_ref="test_{{{rule_id}}}_action_send_stream_driver_auth_mode" />
|
||||
+ <criterion comment="Check if $ActionSendStreamDriverAuthMode x509/name is set in files in /etc/rsyslog.d"
|
||||
+ test_ref="test_{{{rule_id}}}_action_send_stream_driver_auth_mode_dir" />
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
|
||||
+ comment="Check if $ActionSendStreamDriverAuthMode x509/name is set in /etc/rsyslog.conf"
|
||||
+ id="test_{{{rule_id}}}_action_send_stream_driver_auth_mode" version="1">
|
||||
+
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}_action_send_stream_driver_auth_mode" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}_action_send_stream_driver_auth_mode"
|
||||
+ comment="Check if $ActionSendStreamDriverAuthMode x509/name is set in /etc/rsyslog.conf"
|
||||
+ version="1">
|
||||
+ <ind:filepath>/etc/rsyslog.conf</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^\$ActionSendStreamDriverAuthMode x509/name$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
|
||||
+ comment="Check if $ActionSendStreamDriverAuthMode x509/name is set in /etc/rsyslog.conf"
|
||||
+ id="test_{{{rule_id}}}_action_send_stream_driver_auth_mode_dir" version="1">
|
||||
+ <ind:object object_ref="obj_{{{rule_id}}}_action_send_stream_driver_auth_mode_dir" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{rule_id}}}_action_send_stream_driver_auth_mode_dir"
|
||||
+ comment="Check if $ActionSendStreamDriverAuthMode x509/name is set in /etc/rsyslog.d"
|
||||
+ version="1">
|
||||
+ <ind:path>/etc/rsyslog.d</ind:path>
|
||||
+ <ind:filename operation="pattern match">^.*conf$</ind:filename>
|
||||
+ <ind:pattern operation="pattern match">^\$ActionSendStreamDriverAuthMode x509/name$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/rule.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..beaf8ce96da
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/rule.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: Ensure Rsyslog Authenticates Off-Loaded Audit Records
|
||||
+
|
||||
+description: |-
|
||||
+ Rsyslogd is a system utility providing support for message logging. Support
|
||||
+ for both internet and UNIX domain sockets enables this utility to support both local
|
||||
+ and remote logging. Couple this utility with <tt>gnutls</tt> (which is a secure communications
|
||||
+ library implementing the SSL, TLS and DTLS protocols), and you have a method to securely
|
||||
+ encrypt and off-load auditing.
|
||||
+
|
||||
+ When using <tt>rsyslogd</tt> to off-load logs the remote system must be authenticated.
|
||||
+
|
||||
+rationale: |-
|
||||
+ The audit records generated by Rsyslog contain valuable information regarding system
|
||||
+ configuration, user authentication, and other such information. Audit records should be
|
||||
+ protected from unauthorized access.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-86339-9
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001851
|
||||
+ nist: AU-4(1)
|
||||
+ srg: SRG-OS-000342-GPOS-00133,SRG-OS-000479-GPOS-00224
|
||||
+ stigid@rhel8: RHEL-08-030720
|
||||
+
|
||||
+
|
||||
+ocil_clause: '$ActionSendStreamDriverAuthMode in /etc/rsyslog.conf is not set to x509/name'
|
||||
+
|
||||
+ocil: |-
|
||||
+ Verify the operating system authenticates the remote logging server for off-loading audit logs with the following command:
|
||||
+
|
||||
+ <pre>$ sudo grep -i '$ActionSendStreamDriverAuthMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf</pre>
|
||||
+ The output should be
|
||||
+ <pre>$/etc/rsyslog.conf:$ActionSendStreamDriverAuthMode x509/name</pre>
|
||||
+
|
||||
+
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/default_no_pass.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/default_no_pass.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..54d70f6b85f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/default_no_pass.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+if [[ -f encrypt.conf ]]; then
|
||||
+ sed -i "/^\$ActionSendStreamDriverMod.*/d" /etc/rsyslog.conf
|
||||
+fi
|
||||
+ sed -i "/^\$ActionSendStreamDriverMod.*/d" /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..fe3db6f9c41
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverAuthMode x509/name" >> /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog_wrong_value.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog_wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..bad06fba0e9
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslog_wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverAuthMode 0" >> /etc/rsyslog.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ab511daecc7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverAuthMode x509/name" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd_wrong_value.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd_wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..02bf64747a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/rsyslogd_wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+bash -x setup.sh
|
||||
+
|
||||
+echo "\$ActionSendStreamDriverAuthMode x509/certvalid" >> /etc/rsyslog.d/encrypt.conf
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/setup.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/setup.sh
|
||||
new file mode 100644
|
||||
index 00000000000..9686f16bcc9
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/tests/setup.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+# Use this script to ensure the rsyslog directory structure and rsyslog conf file
|
||||
+# exist in the test env.
|
||||
+config_file=/etc/rsyslog.conf
|
||||
+
|
||||
+# Ensure directory structure exists (useful for container based testing)
|
||||
+test -f $config_file || touch $config_file
|
||||
+
|
||||
+test -d /etc/rsyslog.d/ || mkdir /etc/rsyslog.d/
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index ec0a3b17537..382247057cd 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -854,6 +854,7 @@ selections:
|
||||
- rsyslog_encrypt_offload_actionsendstreamdrivermode
|
||||
|
||||
# RHEL-08-030720
|
||||
+ - rsyslog_encrypt_offload_actionsendstreamdriverauthmode
|
||||
|
||||
# RHEL-08-030730
|
||||
# this rule expects configuration in MB instead percentage as how STIG demands
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 61384c108a0..03211442aba 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -460,7 +460,6 @@ CCE-86335-7
|
||||
CCE-86336-5
|
||||
CCE-86337-3
|
||||
CCE-86338-1
|
||||
-CCE-86339-9
|
||||
CCE-86340-7
|
||||
CCE-86341-5
|
||||
CCE-86342-3
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index bffa509b698..481e7b28228 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -238,6 +238,7 @@ selections:
|
||||
- require_singleuser_auth
|
||||
- root_permissions_syslibrary_files
|
||||
- rsyslog_cron_logging
|
||||
+- rsyslog_encrypt_offload_actionsendstreamdriverauthmode
|
||||
- rsyslog_encrypt_offload_actionsendstreamdrivermode
|
||||
- rsyslog_encrypt_offload_defaultnetstreamdriver
|
||||
- rsyslog_remote_access_monitoring
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index c84ac75c7bf..7fb3d892a30 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -249,6 +249,7 @@ selections:
|
||||
- require_singleuser_auth
|
||||
- root_permissions_syslibrary_files
|
||||
- rsyslog_cron_logging
|
||||
+- rsyslog_encrypt_offload_actionsendstreamdriverauthmode
|
||||
- rsyslog_encrypt_offload_actionsendstreamdrivermode
|
||||
- rsyslog_encrypt_offload_defaultnetstreamdriver
|
||||
- rsyslog_remote_access_monitoring
|
@ -1,357 +0,0 @@
|
||||
From 2f4ddb4297f2a14e2bde3b32f76347e2bbe2cb2d Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 19 Aug 2021 09:47:42 -0500
|
||||
Subject: [PATCH] Add new rule for RHEL-07-030330 and RHEL-08-030730
|
||||
|
||||
This new rule is copy of auditd_data_retention_space_left, but
|
||||
setup to allow for percentages.
|
||||
---
|
||||
.../auditd_data_retention_space_left/rule.yml | 2 -
|
||||
.../ansible/shared.yml | 15 ++++++
|
||||
.../bash/shared.sh | 7 +++
|
||||
.../oval/shared.xml | 32 +++++++++++++
|
||||
.../rule.yml | 47 +++++++++++++++++++
|
||||
.../tests/no_percent_sign.fail.sh | 6 +++
|
||||
.../space_left_greater_than_minimum.pass.sh | 6 +++
|
||||
.../tests/space_left_minimum_value.pass.sh | 6 +++
|
||||
.../tests/space_left_not_enough.fail.sh | 6 +++
|
||||
.../tests/space_left_not_there.fail.sh | 6 +++
|
||||
.../var_auditd_space_left_percentage.var | 15 ++++++
|
||||
products/rhel7/profiles/stig.profile | 3 +-
|
||||
products/rhel8/profiles/stig.profile | 7 +--
|
||||
shared/references/cce-redhat-avail.txt | 2 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 3 +-
|
||||
.../profile_stability/rhel8/stig_gui.profile | 3 +-
|
||||
16 files changed, 156 insertions(+), 10 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/rule.yml
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/no_percent_sign.fail.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_greater_than_minimum.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_minimum_value.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_enough.fail.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_there.fail.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/configure_auditd_data_retention/var_auditd_space_left_percentage.var
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left/rule.yml
|
||||
index 7fd0470df8..a652d15d0d 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left/rule.yml
|
||||
@@ -39,8 +39,6 @@ references:
|
||||
pcidss: Req-10.7
|
||||
srg: SRG-OS-000343-GPOS-00134
|
||||
stigid@ol7: OL07-00-030330
|
||||
- stigid@rhel7: RHEL-07-030330
|
||||
- stigid@rhel8: RHEL-08-030730
|
||||
stigid@sle12: SLES-12-020030
|
||||
stigid@sle15: SLES-15-030700
|
||||
stigid@ubuntu2004: UBTU-20-010217
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/ansible/shared.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000000..ea52773bd3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/ansible/shared.yml
|
||||
@@ -0,0 +1,15 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+{{{ ansible_instantiate_variables("var_auditd_space_left_percentage") }}}
|
||||
+
|
||||
+- name: Configure auditd space_left on Low Disk Space
|
||||
+ lineinfile:
|
||||
+ dest: /etc/audit/auditd.conf
|
||||
+ line: "space_left = {{ var_auditd_space_left_percentage }}%"
|
||||
+ regexp: '^\s*space_left\s*=\s*.*$'
|
||||
+ state: present
|
||||
+ create: yes
|
||||
+ #notify: reload auditd
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/bash/shared.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000000..6cc3e9ecbe
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+. /usr/share/scap-security-guide/remediation_functions
|
||||
+{{{ bash_instantiate_variables("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
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/oval/shared.xml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000000..2fcd222d29
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/oval/shared.xml
|
||||
@@ -0,0 +1,32 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="2">
|
||||
+ {{{ oval_metadata("space_left setting in /etc/audit/auditd.conf is set to at least a certain value") }}}
|
||||
+
|
||||
+ <criteria>
|
||||
+ <criterion comment="space_left setting in auditd.conf" test_ref="test_auditd_data_retention_space_left_percentage" />
|
||||
+ </criteria>
|
||||
+
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all" comment="admin space left action " id="test_auditd_data_retention_space_left_percentage" version="1">
|
||||
+ <ind:object object_ref="object_auditd_data_retention_space_left_percentage" />
|
||||
+ <ind:state state_ref="state_auditd_data_retention_space_left_percentage" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="object_auditd_data_retention_space_left_percentage" version="2">
|
||||
+ <ind:filepath>/etc/audit/auditd.conf</ind:filepath>
|
||||
+ <!-- Allow only space (exactly) as delimiter: https://fedorahosted.org/audit/browser/trunk/src/auditd-config.c#L426 -->
|
||||
+ <!-- Require at least one space before and after the equal sign -->
|
||||
+ <ind:pattern operation="pattern match">^[\s]*space_left[\s]+=[\s]+(\d+)%[\s]*$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+
|
||||
+ <ind:textfilecontent54_state id="state_auditd_data_retention_space_left_percentage" version="1">
|
||||
+ <ind:subexpression operation="greater than or equal" var_ref="var_auditd_space_left_percentage" datatype="int" />
|
||||
+ </ind:textfilecontent54_state>
|
||||
+
|
||||
+ <external_variable comment="audit space_left setting" datatype="int" id="var_auditd_space_left_percentage" version="1" />
|
||||
+
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..ea9d9fcc6b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/rule.yml
|
||||
@@ -0,0 +1,47 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel7,rhel8,rhel9
|
||||
+
|
||||
+title: 'Configure auditd space_left on Low Disk Space'
|
||||
+
|
||||
+description: |-
|
||||
+ The <tt>auditd</tt> service can be configured to take an action
|
||||
+ when disk space is running low but prior to running out of space completely.
|
||||
+ Edit the file <tt>/etc/audit/auditd.conf</tt>. Add or modify the following line,
|
||||
+ substituting <i>PERCENTAGE</i> appropriately:
|
||||
+ <pre>space_left = <i>PERCENTAGE</i>%</pre>
|
||||
+ Set this value to at least 25 to cause the system to
|
||||
+ notify the user of an issue.
|
||||
+
|
||||
+rationale: |-
|
||||
+ Notifying administrators of an impending disk space problem may allow them to
|
||||
+ take corrective action prior to any disruption.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel7: CCE-86056-9
|
||||
+ cce@rhel8: CCE-86055-1
|
||||
+
|
||||
+references:
|
||||
+ cis-csc: 1,11,12,13,14,15,16,19,2,3,4,5,6,7,8
|
||||
+ cobit5: APO11.04,APO12.06,APO13.01,BAI03.05,BAI04.04,BAI08.02,DSS02.02,DSS02.04,DSS02.07,DSS03.01,DSS05.04,DSS05.07,MEA02.01
|
||||
+ disa: CCI-001855
|
||||
+ isa-62443-2009: 4.2.3.10,4.3.3.3.9,4.3.3.5.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
|
||||
+ isa-62443-2013: 'SR 2.10,SR 2.11,SR 2.12,SR 2.8,SR 2.9,SR 6.1,SR 7.1,SR 7.2'
|
||||
+ iso27001-2013: 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.16.1.4,A.16.1.5,A.16.1.7,A.17.2.1
|
||||
+ nist: AU-5(b),AU-5(2),AU-5(1),AU-5(4),CM-6(a)
|
||||
+ nist-csf: DE.AE-3,DE.AE-5,PR.DS-4,PR.PT-1,RS.AN-1,RS.AN-4
|
||||
+ pcidss: Req-10.7
|
||||
+ srg: SRG-OS-000343-GPOS-00134
|
||||
+ stigid@rhel7: RHEL-07-030330
|
||||
+ stigid@rhel8: RHEL-08-030730
|
||||
+ vmmsrg: SRG-OS-000343-VMM-001240
|
||||
+
|
||||
+ocil_clause: 'the system is not configured with a specific percentage to notify administrators of an issue'
|
||||
+
|
||||
+ocil: |-
|
||||
+ Inspect <tt>/etc/audit/auditd.conf</tt> and locate the following line to
|
||||
+ determine if the system is configured correctly:
|
||||
+ <pre>space_left <i>PERCENTAGE</i>%</pre>
|
||||
+
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/no_percent_sign.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/no_percent_sign.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..2e90ce1d7b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/no_percent_sign.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# variables = var_auditd_space_left_percentage=25
|
||||
+
|
||||
+. $SHARED/auditd_utils.sh
|
||||
+prepare_auditd_test_enviroment
|
||||
+set_parameters_value /etc/audit/auditd.conf "space_left" "25"
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_greater_than_minimum.pass.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_greater_than_minimum.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..135d6e4258
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_greater_than_minimum.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# variables = var_auditd_space_left_percentage=25
|
||||
+
|
||||
+. $SHARED/auditd_utils.sh
|
||||
+prepare_auditd_test_enviroment
|
||||
+set_parameters_value /etc/audit/auditd.conf "space_left" "35%"
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_minimum_value.pass.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_minimum_value.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000000..10d652e80e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_minimum_value.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# variables = var_auditd_space_left_percentage=25
|
||||
+
|
||||
+. $SHARED/auditd_utils.sh
|
||||
+prepare_auditd_test_enviroment
|
||||
+set_parameters_value /etc/audit/auditd.conf "space_left" "25%"
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_enough.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_enough.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..0bf7694b15
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_enough.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# variables = var_auditd_space_left_percentage=25
|
||||
+
|
||||
+. $SHARED/auditd_utils.sh
|
||||
+prepare_auditd_test_enviroment
|
||||
+set_parameters_value /etc/audit/auditd.conf "space_left" "15%"
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_there.fail.sh b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_there.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000000..34ac5595c6
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_percentage/tests/space_left_not_there.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+# variables = var_auditd_space_left_percentage=25
|
||||
+
|
||||
+. $SHARED/auditd_utils.sh
|
||||
+prepare_auditd_test_enviroment
|
||||
+delete_parameter /etc/audit/auditd.conf "space_left"
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/var_auditd_space_left_percentage.var b/linux_os/guide/system/auditing/configure_auditd_data_retention/var_auditd_space_left_percentage.var
|
||||
new file mode 100644
|
||||
index 0000000000..427a1d4bfa
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/var_auditd_space_left_percentage.var
|
||||
@@ -0,0 +1,15 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+title: 'The percentage remaining in disk space before prompting space_left_action'
|
||||
+
|
||||
+description: 'The setting for space_left as a percentage in /etc/audit/auditd.conf'
|
||||
+
|
||||
+type: number
|
||||
+
|
||||
+interactive: true
|
||||
+
|
||||
+options:
|
||||
+ 25pc: 25
|
||||
+ 50pc: 50
|
||||
+ 75pc: 75
|
||||
+ default: 25
|
||||
diff --git a/products/rhel7/profiles/stig.profile b/products/rhel7/profiles/stig.profile
|
||||
index 9ca1360005..67e22982cd 100644
|
||||
--- a/products/rhel7/profiles/stig.profile
|
||||
+++ b/products/rhel7/profiles/stig.profile
|
||||
@@ -50,6 +50,7 @@ selections:
|
||||
- var_removable_partition=dev_cdrom
|
||||
- var_auditd_action_mail_acct=root
|
||||
- var_auditd_space_left_action=email
|
||||
+ - var_auditd_space_left_percentage=25pc
|
||||
- var_accounts_user_umask=077
|
||||
- var_password_pam_retry=3
|
||||
- var_accounts_max_concurrent_login_sessions=10
|
||||
@@ -178,8 +179,8 @@ selections:
|
||||
- auditd_audispd_configure_remote_server
|
||||
- auditd_audispd_encrypt_sent_records
|
||||
- auditd_audispd_disk_full_action
|
||||
- - auditd_data_retention_space_left
|
||||
- auditd_data_retention_space_left_action
|
||||
+ - auditd_data_retention_space_left_percentage
|
||||
- auditd_data_retention_action_mail_acct
|
||||
- audit_rules_suid_privilege_function
|
||||
- audit_rules_dac_modification_chown
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 36f384621a..10dbc1501b 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -65,7 +65,7 @@ selections:
|
||||
- var_auditd_action_mail_acct=root
|
||||
- var_time_service_set_maxpoll=18_hours
|
||||
- var_accounts_maximum_age_login_defs=60
|
||||
- - var_auditd_space_left=250MB
|
||||
+ - var_auditd_space_left_percentage=25pc
|
||||
- var_auditd_space_left_action=email
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
@@ -922,8 +922,9 @@ selections:
|
||||
- rsyslog_encrypt_offload_actionsendstreamdriverauthmode
|
||||
|
||||
# RHEL-08-030730
|
||||
- # this rule expects configuration in MB instead percentage as how STIG demands
|
||||
- # - auditd_data_retention_space_left
|
||||
+ - auditd_data_retention_space_left_percentage
|
||||
+
|
||||
+ # RHEL-08-030731
|
||||
- auditd_data_retention_space_left_action
|
||||
|
||||
# RHEL-08-030740
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 6c33c2e85f..fcb8125ca4 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -170,8 +170,6 @@ CCE-86051-0
|
||||
CCE-86052-8
|
||||
CCE-86053-6
|
||||
CCE-86054-4
|
||||
-CCE-86055-1
|
||||
-CCE-86056-9
|
||||
CCE-86057-7
|
||||
CCE-86058-5
|
||||
CCE-86059-3
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index f3e6c4fa1a..09a5bc3174 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -140,6 +140,7 @@ selections:
|
||||
- auditd_data_retention_action_mail_acct
|
||||
- auditd_data_retention_max_log_file_action
|
||||
- auditd_data_retention_space_left_action
|
||||
+- auditd_data_retention_space_left_percentage
|
||||
- auditd_local_events
|
||||
- auditd_log_format
|
||||
- auditd_name_format
|
||||
@@ -422,7 +423,7 @@ selections:
|
||||
- var_auditd_action_mail_acct=root
|
||||
- var_time_service_set_maxpoll=18_hours
|
||||
- var_accounts_maximum_age_login_defs=60
|
||||
-- var_auditd_space_left=250MB
|
||||
+- var_auditd_space_left_percentage=25pc
|
||||
- var_auditd_space_left_action=email
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index b5b60349a8..5b631a3fe0 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -151,6 +151,7 @@ selections:
|
||||
- auditd_data_retention_action_mail_acct
|
||||
- auditd_data_retention_max_log_file_action
|
||||
- auditd_data_retention_space_left_action
|
||||
+- auditd_data_retention_space_left_percentage
|
||||
- auditd_local_events
|
||||
- auditd_log_format
|
||||
- auditd_name_format
|
||||
@@ -432,7 +433,7 @@ selections:
|
||||
- var_auditd_action_mail_acct=root
|
||||
- var_time_service_set_maxpoll=18_hours
|
||||
- var_accounts_maximum_age_login_defs=60
|
||||
-- var_auditd_space_left=250MB
|
||||
+- var_auditd_space_left_percentage=25pc
|
||||
- var_auditd_space_left_action=email
|
||||
- var_auditd_disk_error_action=halt
|
||||
- var_auditd_max_log_file_action=syslog
|
@ -1,66 +0,0 @@
|
||||
From 994b50e9a47e222c2a27fde231cbf3e2f6f77aed Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Fri, 6 Aug 2021 15:26:28 -0500
|
||||
Subject: [PATCH] Select sysctl_net_core_bpf_jit_harden for RHEL-08-040286
|
||||
|
||||
---
|
||||
.../restrictions/sysctl_net_core_bpf_jit_harden/rule.yml | 3 +++
|
||||
products/rhel8/profiles/stig.profile | 3 +++
|
||||
tests/data/profile_stability/rhel8/stig.profile | 1 +
|
||||
tests/data/profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_net_core_bpf_jit_harden/rule.yml b/linux_os/guide/system/permissions/restrictions/sysctl_net_core_bpf_jit_harden/rule.yml
|
||||
index 9a1096cc72..31b7183b87 100644
|
||||
--- a/linux_os/guide/system/permissions/restrictions/sysctl_net_core_bpf_jit_harden/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_net_core_bpf_jit_harden/rule.yml
|
||||
@@ -19,8 +19,11 @@ identifiers:
|
||||
cce@rhel9: CCE-83966-2
|
||||
|
||||
references:
|
||||
+ disa: CCI-000366
|
||||
+ nist: CM-6b
|
||||
ospp: FMT_SMF_EXT.1
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
+ stigid@rhel8: RHEL-08-040286
|
||||
|
||||
{{{ complete_ocil_entry_sysctl_option_value(sysctl="net.core.bpf_jit_harden", value="2") }}}
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 0a1fdd15ca..a358f61dba 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1149,6 +1149,9 @@ selections:
|
||||
# RHEL-08-040285
|
||||
- sysctl_net_ipv4_conf_all_rp_filter
|
||||
|
||||
+ # RHEL-08-040286
|
||||
+ - sysctl_net_core_bpf_jit_harden
|
||||
+
|
||||
# RHEL-08-040290
|
||||
# /etc/postfix/main.cf does not exist on default installation resulting in error during remediation
|
||||
# there needs to be a new platform check to identify when postfix is installed or not
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index d7e2f71376..7d54a7505f 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -359,6 +359,7 @@ selections:
|
||||
- sysctl_kernel_randomize_va_space
|
||||
- sysctl_kernel_unprivileged_bpf_disabled
|
||||
- sysctl_kernel_yama_ptrace_scope
|
||||
+- sysctl_net_core_bpf_jit_harden
|
||||
- sysctl_net_ipv4_conf_all_accept_redirects
|
||||
- sysctl_net_ipv4_conf_all_accept_source_route
|
||||
- sysctl_net_ipv4_conf_all_rp_filter
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 7c95e31545..97291230e7 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -370,6 +370,7 @@ selections:
|
||||
- sysctl_kernel_randomize_va_space
|
||||
- sysctl_kernel_unprivileged_bpf_disabled
|
||||
- sysctl_kernel_yama_ptrace_scope
|
||||
+- sysctl_net_core_bpf_jit_harden
|
||||
- sysctl_net_ipv4_conf_all_accept_redirects
|
||||
- sysctl_net_ipv4_conf_all_accept_source_route
|
||||
- sysctl_net_ipv4_conf_all_rp_filter
|
@ -1,121 +0,0 @@
|
||||
From 3d24d93e200f53f3845fffbc8764b8e48517c7b2 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 16:57:50 +0200
|
||||
Subject: [PATCH] Assign RHEL-08-020240 to account_unique_id and add test
|
||||
scenarios.
|
||||
|
||||
---
|
||||
.../accounts-restrictions/account_unique_id/oval/shared.xml | 2 +-
|
||||
.../accounts-restrictions/account_unique_id/rule.yml | 4 +++-
|
||||
.../account_unique_id/tests/correct_value.pass.sh | 2 ++
|
||||
.../account_unique_id/tests/wrong_value.fail.sh | 5 +++++
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
tests/data/profile_stability/rhel8/stig.profile | 1 +
|
||||
tests/data/profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
8 files changed, 14 insertions(+), 3 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/correct_value.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/wrong_value.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/oval/shared.xml b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/oval/shared.xml
|
||||
index be45c518115..491ad4587ee 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/oval/shared.xml
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
</definition>
|
||||
|
||||
- <!-- collect informatino about all users -->
|
||||
+ <!-- collect information about all users -->
|
||||
<unix:password_object id="obj_all_uids" version="1">
|
||||
<unix:username operation="pattern match">.*</unix:username>
|
||||
</unix:password_object>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/rule.yml
|
||||
index 731632f7f5a..e55901dbdc5 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/rule.yml
|
||||
@@ -12,6 +12,7 @@ severity: medium
|
||||
|
||||
identifiers:
|
||||
cce@rhel7: CCE-85857-1
|
||||
+ cce@rhel8: CCE-89903-9
|
||||
cce@sle12: CCE-83196-6
|
||||
cce@sle15: CCE-83277-4
|
||||
|
||||
@@ -19,7 +20,8 @@ references:
|
||||
cis@rhel7: 6.2.7
|
||||
disa: CCI-000764,CCI-000804
|
||||
nist@sle12: IA-2,IA-2.1,IA-8,IA-8.1
|
||||
- srg: SRG-OS-000104-GPOS-00051,SRG-OS-000121-GPOS-00062
|
||||
+ srg: SRG-OS-000104-GPOS-00051,SRG-OS-000121-GPOS-00062,SRG-OS-000042-GPOS-00020
|
||||
+ stigid@rhel8: RHEL-08-020240
|
||||
stigid@sle12: SLES-12-010640
|
||||
stigid@sle15: SLES-15-010230
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/correct_value.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..645c46eb847
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/bash
|
||||
+# remediation = none
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/wrong_value.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..cc7f2215041
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_unique_id/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# remediation = none
|
||||
+
|
||||
+echo "test_user:x:30090:30090:Test User:/home/test_user:/usr/bin/bash" >> /etc/passwd
|
||||
+echo "test_user_2:x:30090:30090:Test User 2:/home/test_user_2:/usr/bin/bash" >> /etc/passwd
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index ec0a3b17537..bdddfef846f 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -552,6 +552,7 @@ selections:
|
||||
- accounts_password_minlen_login_defs
|
||||
|
||||
# RHEL-08-020240
|
||||
+ - account_unique_id
|
||||
|
||||
# RHEL-08-020250
|
||||
- sssd_enable_smartcards
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 61384c108a0..1d54e8ec15f 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -3969,7 +3969,6 @@ CCE-89899-9
|
||||
CCE-89900-5
|
||||
CCE-89901-3
|
||||
CCE-89902-1
|
||||
-CCE-89903-9
|
||||
CCE-89904-7
|
||||
CCE-89905-4
|
||||
CCE-89906-2
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index bffa509b698..71dd6330a16 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -26,6 +26,7 @@ selections:
|
||||
- account_disable_post_pw_expiration
|
||||
- account_emergency_expire_date
|
||||
- account_temp_expire_date
|
||||
+- account_unique_id
|
||||
- accounts_have_homedir_login_defs
|
||||
- accounts_logon_fail_delay
|
||||
- accounts_max_concurrent_login_sessions
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index c84ac75c7bf..3e788b27bac 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -37,6 +37,7 @@ selections:
|
||||
- account_disable_post_pw_expiration
|
||||
- account_emergency_expire_date
|
||||
- account_temp_expire_date
|
||||
+- account_unique_id
|
||||
- accounts_have_homedir_login_defs
|
||||
- accounts_logon_fail_delay
|
||||
- accounts_max_concurrent_login_sessions
|
@ -1,80 +0,0 @@
|
||||
From 86dad83f4e6c5b823882ec736d27410570f5b69a Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Fri, 20 Aug 2021 16:03:33 +0200
|
||||
Subject: [PATCH] Add missing unit test playbook
|
||||
|
||||
The playbook is used on
|
||||
test-function-check_playbook_file_removed_and_added
|
||||
---
|
||||
.../file_block_removed_and_not_added.yml | 62 +++++++++++++++++++
|
||||
1 file changed, 62 insertions(+)
|
||||
create mode 100644 tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml
|
||||
|
||||
diff --git a/tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml b/tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml
|
||||
new file mode 100644
|
||||
index 0000000000..8391d1bc99
|
||||
--- /dev/null
|
||||
+++ b/tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml
|
||||
@@ -0,0 +1,62 @@
|
||||
+---
|
||||
+
|
||||
+- hosts: all
|
||||
+ vars:
|
||||
+ var_system_crypto_policy: !!str FUTURE
|
||||
+ var_sudo_logfile: !!str /var/log/sudo.log
|
||||
+
|
||||
+ tasks:
|
||||
+ - name: Modify the System Login Banner - add correct banner
|
||||
+ lineinfile:
|
||||
+ dest: /etc/issue
|
||||
+ line: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*)\|.*\)$",
|
||||
+ "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
|
||||
+ "\n") | regex_replace("\\", "") | wordwrap() }}'
|
||||
+ create: true
|
||||
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
+ tags:
|
||||
+ - banner_etc_issue
|
||||
+ - low_complexity
|
||||
+ - medium_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+ - unknown_strategy
|
||||
+
|
||||
+ - name: Test for existence /etc/issue
|
||||
+ stat:
|
||||
+ path: /etc/issue
|
||||
+ register: file_exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - name: Ensure permission 0644 on /etc/issue
|
||||
+ file:
|
||||
+ path: /etc/issue
|
||||
+ mode: '0644'
|
||||
+ when: file_exists.stat is defined and file_exists.stat.exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - block:
|
||||
+ - name: Remove Rsh Trust Files
|
||||
+ file:
|
||||
+ path: '/root/shosts.equiv'
|
||||
+ state: absent
|
||||
+ tags:
|
||||
+ - high_severity
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - no_reboot_needed
|
||||
+ - no_rsh_trust_files
|
||||
+ - restrict_strategy
|
||||
+
|
@ -1,179 +0,0 @@
|
||||
From b814fc94d0fb360ef53a6b735e9520df5b484589 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 14 Jul 2021 12:52:13 -0500
|
||||
Subject: [PATCH 1/3] Add Jinja-based RHEL 8 minor check
|
||||
|
||||
---
|
||||
shared/checks/oval/installed_OS_is_rhel8.xml | 29 ++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
diff --git a/shared/checks/oval/installed_OS_is_rhel8.xml b/shared/checks/oval/installed_OS_is_rhel8.xml
|
||||
index a9699411ce7..fdd3c870d43 100644
|
||||
--- a/shared/checks/oval/installed_OS_is_rhel8.xml
|
||||
+++ b/shared/checks/oval/installed_OS_is_rhel8.xml
|
||||
@@ -44,6 +44,35 @@
|
||||
<linux:name>redhat-release</linux:name>
|
||||
</linux:rpminfo_object>
|
||||
|
||||
+ {{% for minorversion in range(0, 9) %}}
|
||||
+ <definition class="inventory" id="installed_OS_is_rhel8_{{{ minorversion }}}" version="1">
|
||||
+ <metadata>
|
||||
+ <title>Red Hat Enterprise Linux 8.{{{ minorversion }}}</title>
|
||||
+ <affected family="unix">
|
||||
+ <platform>Red Hat Enterprise Linux 8.{{{ minorversion }}}</platform>
|
||||
+ </affected>
|
||||
+ <reference ref_id="cpe:/o:redhat:enterprise_linux:8.{{{ minorversion }}}" source="CPE" />
|
||||
+ <description>The operating system installed on the system is Red Hat Enterprise Linux 8.{{{ minorversion}}}</description>
|
||||
+ </metadata>
|
||||
+ </definition>
|
||||
+
|
||||
+ <criteria>
|
||||
+ <criterion comment="RHEL.{{{ minorversion }}} 8 is installed" test_ref="test_rhel8_{{{ minorversion }}}" />
|
||||
+ </criteria>
|
||||
+
|
||||
+ <linux:rpminfo_test check="all" check_existence="at_least_one_exists" comment="redhat-release is version 8.{{{ minorversion }}}"
|
||||
+ id="test_rhel8_{{{ minorversion }}}" version="1">
|
||||
+ <linux:object object_ref="obj_rhel8_{{{ minorversion }}}" />
|
||||
+ <linux:state state_ref="state_rhel8_{{{ minorversion }}}" />
|
||||
+ </linux:rpminfo_test>
|
||||
+ <linux:rpminfo_state id="state_rhel8_{{{ minorversion }}}" version="1">
|
||||
+ <linux:version operation="pattern match">^8.{{{ minorversion }}}*$</linux:version>
|
||||
+ </linux:rpminfo_state>
|
||||
+ <linux:rpminfo_object id="obj_rhel8_{{{ minorversion }}}" version="1">
|
||||
+ <linux:name>redhat-release</linux:name>
|
||||
+ </linux:rpminfo_object>
|
||||
+ {{% endfor %}}
|
||||
+
|
||||
<ind:textfilecontent54_test check="all" comment="RHEVH base RHEL is version 8" id="test_rhevh_rhel8_version" version="1">
|
||||
<ind:object object_ref="obj_rhevh_rhel8_version" />
|
||||
<ind:state state_ref="state_rhevh_rhel8_version" />
|
||||
|
||||
From d37d303654be74758c19615ef027b3bafa2d7217 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Matos <cmatos@redhat.com>
|
||||
Date: Wed, 14 Jul 2021 15:30:02 -0400
|
||||
Subject: [PATCH 2/3] Adding cpe's to product.yml
|
||||
|
||||
---
|
||||
products/rhel8/product.yml | 45 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 45 insertions(+)
|
||||
|
||||
diff --git a/products/rhel8/product.yml b/products/rhel8/product.yml
|
||||
index 3278207fcb4..14336bfddf1 100644
|
||||
--- a/products/rhel8/product.yml
|
||||
+++ b/products/rhel8/product.yml
|
||||
@@ -27,6 +27,51 @@ cpes:
|
||||
title: "Red Hat Enterprise Linux 8"
|
||||
check_id: installed_OS_is_rhel8
|
||||
|
||||
+ - rhel8.0:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.0"
|
||||
+ title: "Red Hat Enterprise Linux 8.0"
|
||||
+ check_id: installed_OS_is_rhel8_0
|
||||
+
|
||||
+ - rhel8.1:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.1"
|
||||
+ title: "Red Hat Enterprise Linux 8.1"
|
||||
+ check_id: installed_OS_is_rhel8_1
|
||||
+
|
||||
+ - rhel8.2:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.2"
|
||||
+ title: "Red Hat Enterprise Linux 8.2"
|
||||
+ check_id: installed_OS_is_rhel8_2
|
||||
+
|
||||
+ - rhel8.3:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.3"
|
||||
+ title: "Red Hat Enterprise Linux 8.3"
|
||||
+ check_id: installed_OS_is_rhel8_3
|
||||
+
|
||||
+ - rhel8.4:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.4"
|
||||
+ title: "Red Hat Enterprise Linux 8.4"
|
||||
+ check_id: installed_OS_is_rhel8_4
|
||||
+
|
||||
+ - rhel8.5:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.5"
|
||||
+ title: "Red Hat Enterprise Linux 8.5"
|
||||
+ check_id: installed_OS_is_rhel8_5
|
||||
+
|
||||
+ - rhel8.6:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.6"
|
||||
+ title: "Red Hat Enterprise Linux 8.6"
|
||||
+ check_id: installed_OS_is_rhel8_6
|
||||
+
|
||||
+ - rhel8.7:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.7"
|
||||
+ title: "Red Hat Enterprise Linux 8.7"
|
||||
+ check_id: installed_OS_is_rhel8_7
|
||||
+
|
||||
+ - rhel8.8:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.8"
|
||||
+ title: "Red Hat Enterprise Linux 8.8"
|
||||
+ check_id: installed_OS_is_rhel8_8
|
||||
+
|
||||
# Mapping of CPE platform to package
|
||||
platform_package_overrides:
|
||||
login_defs: "shadow-utils"
|
||||
|
||||
From c4e4fd7b0449ba4655020fc0dc99ae3c4523b8cc Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 19 Jul 2021 08:12:34 -0500
|
||||
Subject: [PATCH 3/3] Add checks to go up to RHEL 8.10
|
||||
|
||||
This also makes the checks work.
|
||||
---
|
||||
products/rhel8/product.yml | 10 ++++++++++
|
||||
shared/checks/oval/installed_OS_is_rhel8.xml | 10 +++++-----
|
||||
2 files changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/products/rhel8/product.yml b/products/rhel8/product.yml
|
||||
index 14336bfddf1..78c987b2457 100644
|
||||
--- a/products/rhel8/product.yml
|
||||
+++ b/products/rhel8/product.yml
|
||||
@@ -72,6 +72,16 @@ cpes:
|
||||
title: "Red Hat Enterprise Linux 8.8"
|
||||
check_id: installed_OS_is_rhel8_8
|
||||
|
||||
+ - rhel8.9:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.9"
|
||||
+ title: "Red Hat Enterprise Linux 8.9"
|
||||
+ check_id: installed_OS_is_rhel8_9
|
||||
+
|
||||
+ - rhel8.10:
|
||||
+ name: "cpe:/o:redhat:enterprise_linux:8.10"
|
||||
+ title: "Red Hat Enterprise Linux 8.10"
|
||||
+ check_id: installed_OS_is_rhel8_10
|
||||
+
|
||||
# Mapping of CPE platform to package
|
||||
platform_package_overrides:
|
||||
login_defs: "shadow-utils"
|
||||
diff --git a/shared/checks/oval/installed_OS_is_rhel8.xml b/shared/checks/oval/installed_OS_is_rhel8.xml
|
||||
index fdd3c870d43..feab963b941 100644
|
||||
--- a/shared/checks/oval/installed_OS_is_rhel8.xml
|
||||
+++ b/shared/checks/oval/installed_OS_is_rhel8.xml
|
||||
@@ -44,7 +44,7 @@
|
||||
<linux:name>redhat-release</linux:name>
|
||||
</linux:rpminfo_object>
|
||||
|
||||
- {{% for minorversion in range(0, 9) %}}
|
||||
+ {{% for minorversion in range(0, 11) %}}
|
||||
<definition class="inventory" id="installed_OS_is_rhel8_{{{ minorversion }}}" version="1">
|
||||
<metadata>
|
||||
<title>Red Hat Enterprise Linux 8.{{{ minorversion }}}</title>
|
||||
@@ -52,13 +52,13 @@
|
||||
<platform>Red Hat Enterprise Linux 8.{{{ minorversion }}}</platform>
|
||||
</affected>
|
||||
<reference ref_id="cpe:/o:redhat:enterprise_linux:8.{{{ minorversion }}}" source="CPE" />
|
||||
- <description>The operating system installed on the system is Red Hat Enterprise Linux 8.{{{ minorversion}}}</description>
|
||||
+ <description>The operating system installed on the system is Red Hat Enterprise Linux 8.{{{ minorversion }}}</description>
|
||||
</metadata>
|
||||
+ <criteria>
|
||||
+ <criterion comment="RHEL 8.{{{ minorversion }}} is installed" test_ref="test_rhel8_{{{ minorversion }}}" />
|
||||
+ </criteria>
|
||||
</definition>
|
||||
|
||||
- <criteria>
|
||||
- <criterion comment="RHEL.{{{ minorversion }}} 8 is installed" test_ref="test_rhel8_{{{ minorversion }}}" />
|
||||
- </criteria>
|
||||
|
||||
<linux:rpminfo_test check="all" check_existence="at_least_one_exists" comment="redhat-release is version 8.{{{ minorversion }}}"
|
||||
id="test_rhel8_{{{ minorversion }}}" version="1">
|
@ -1,23 +0,0 @@
|
||||
From 91fb54a2e5e52d789f786fefbe711e7250470437 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 16 Sep 2021 19:45:26 +0200
|
||||
Subject: [PATCH] Force masking of ctrl-alt-del.target
|
||||
|
||||
Without forcing the remediation it never converges.
|
||||
The target is stopped but not masked.
|
||||
---
|
||||
.../disable_ctrlaltdel_reboot/ansible/shared.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/ansible/shared.yml
|
||||
index 8ea1de865ae..30f06a8751c 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/ansible/shared.yml
|
||||
@@ -7,6 +7,7 @@
|
||||
- name: Disable Ctrl-Alt-Del Reboot Activation
|
||||
systemd:
|
||||
name: ctrl-alt-del.target
|
||||
+ force: yes
|
||||
masked: yes
|
||||
state: stopped
|
||||
|
@ -1,50 +0,0 @@
|
||||
From 5d4726bb609f463956c03909891f8fbd1975d222 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Lysonek <mlysonek@redhat.com>
|
||||
Date: Mon, 9 Aug 2021 14:00:19 +0200
|
||||
Subject: [PATCH] Add missing ansible remediation metadata
|
||||
|
||||
---
|
||||
.../auditd_overflow_action/ansible/shared.yml | 4 ++++
|
||||
.../ansible/shared.yml | 4 ++++
|
||||
.../ansible/shared.yml | 4 ++++
|
||||
3 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml
|
||||
index 166054a95a..e1569b2254 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_overflow_action/ansible/shared.yml
|
||||
@@ -1,4 +1,8 @@
|
||||
# platform = multi_platform_fedora,multi_platform_rhel
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file(file="/etc/audit/auditd.conf",
|
||||
parameter="overflow_action",
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
index 2d6c5227a8..bbd27a0061 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
@@ -1,4 +1,8 @@
|
||||
# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
parameter="\$ActionSendStreamDriverMode", value="1", create=true, separator=" ", separator_regex=" ")
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
index 2ddbfb871f..b215daaef4 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
@@ -1,4 +1,8 @@
|
||||
# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
parameter="\$DefaultNetstreamDriver", value="gtls", create=true, separator=" ", separator_regex=" ")
|
@ -1,92 +0,0 @@
|
||||
From 01397cbe2a62303ef001ab5e5821ffafd6929e41 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Haydock <alex@alexhaydock.co.uk>
|
||||
Date: Fri, 6 Aug 2021 16:46:22 +0100
|
||||
Subject: [PATCH] Update CCEs and identifiers on rules that make up RHEL 8 CIS
|
||||
4.1.15
|
||||
|
||||
---
|
||||
.../audit_rules_privileged_commands_insmod/rule.yml | 2 ++
|
||||
.../audit_rules_privileged_commands_modprobe/rule.yml | 2 ++
|
||||
.../audit_rules_privileged_commands_rmmod/rule.yml | 2 ++
|
||||
shared/references/cce-redhat-avail.txt | 3 ---
|
||||
4 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_insmod/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_insmod/rule.yml
|
||||
index 5c3a99447c..a4ecb0d1e0 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_insmod/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_insmod/rule.yml
|
||||
@@ -28,10 +28,12 @@ severity: medium
|
||||
|
||||
identifiers:
|
||||
cce@rhel7: CCE-85851-4
|
||||
+ cce@rhel8: CCE-85919-9
|
||||
cce@sle15: CCE-85744-1
|
||||
|
||||
references:
|
||||
cis@rhel7: 4.1.16
|
||||
+ cis@rhel8: 4.1.15
|
||||
cis@ubuntu2004: 4.1.16
|
||||
disa: CCI-000130,CCI-000169,CCI-000172,CCI-002884
|
||||
nist: AU-12(c),AU-12.1(iv),AU-3,AU-3.1,AU-12(a),AU-12.1(ii),MA-4(1)(a)
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_modprobe/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_modprobe/rule.yml
|
||||
index 5e03dde851..f70c537064 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_modprobe/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_modprobe/rule.yml
|
||||
@@ -32,10 +32,12 @@ severity: medium
|
||||
|
||||
identifiers:
|
||||
cce@rhel7: CCE-85853-0
|
||||
+ cce@rhel8: CCE-85973-6
|
||||
cce@sle15: CCE-85731-8
|
||||
|
||||
references:
|
||||
cis@rhel7: 4.1.16
|
||||
+ cis@rhel8: 4.1.15
|
||||
cis@ubuntu2004: 4.1.16
|
||||
disa: CCI-000130,CCI-000169,CCI-000172,CCI-002884
|
||||
nist: AU-12(a),AU-12.1(ii),AU-3,AU-3.1,AU-12(c),AU-12.1(iv),MA-4(1)(a)
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_rmmod/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_rmmod/rule.yml
|
||||
index 1535041672..113c8fc4bc 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_rmmod/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_privileged_commands/audit_rules_privileged_commands_rmmod/rule.yml
|
||||
@@ -28,10 +28,12 @@ severity: medium
|
||||
|
||||
identifiers:
|
||||
cce@rhel7: CCE-85852-2
|
||||
+ cce@rhel8: CCE-86017-1
|
||||
cce@sle15: CCE-85732-6
|
||||
|
||||
references:
|
||||
cis@rhel7: 4.1.16
|
||||
+ cis@rhel8: 4.1.15
|
||||
cis@ubuntu2004: 4.1.16
|
||||
disa: CCI-000130,CCI-000169,CCI-000172,CCI-002884
|
||||
nist@sle15: AU-12(c),AU-12.1(iv),AU-3,AU-3.1,AU-12(a),AU-12.1(ii),MA-4(1)(a)
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 001262c6ee..aaa631515b 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -49,7 +49,6 @@ CCE-85915-7
|
||||
CCE-85916-5
|
||||
CCE-85917-3
|
||||
CCE-85918-1
|
||||
-CCE-85919-9
|
||||
CCE-85920-7
|
||||
CCE-85921-5
|
||||
CCE-85922-3
|
||||
@@ -100,7 +99,6 @@ CCE-85968-6
|
||||
CCE-85969-4
|
||||
CCE-85970-2
|
||||
CCE-85972-8
|
||||
-CCE-85973-6
|
||||
CCE-85974-4
|
||||
CCE-85975-1
|
||||
CCE-85976-9
|
||||
@@ -143,7 +141,6 @@ CCE-86013-0
|
||||
CCE-86014-8
|
||||
CCE-86015-5
|
||||
CCE-86016-3
|
||||
-CCE-86017-1
|
||||
CCE-86018-9
|
||||
CCE-86019-7
|
||||
CCE-86020-5
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
From df11870dd23bc5ada56acd89610c6498cbc5bc35 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Lysonek <mlysonek@redhat.com>
|
||||
Date: Mon, 26 Jul 2021 11:49:30 +0200
|
||||
Subject: [PATCH] Add bios_enable_execution_restrictions SRG reference
|
||||
|
||||
---
|
||||
.../enable_nx/bios_enable_execution_restrictions/rule.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
index b037e374f5..99f2c739c9 100644
|
||||
--- a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
@@ -31,6 +31,7 @@ references:
|
||||
iso27001-2013: A.12.1.2,A.12.5.1,A.12.6.2,A.14.2.2,A.14.2.3,A.14.2.4
|
||||
nist: SC-39,CM-6(a)
|
||||
nist-csf: PR.IP-1
|
||||
+ srg: SRG-OS-000433-GPOS-00192
|
||||
stig@rhel8: RHEL-08-010420
|
||||
|
||||
platform: machine
|
@ -1,139 +0,0 @@
|
||||
From 44976b5fda0f34e78a0a0764add645212bd4e26d Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 11:08:56 +0200
|
||||
Subject: [PATCH 1/4] remove automated: yes for 1.1.6, rule is missing
|
||||
|
||||
---
|
||||
controls/cis_rhel7.yml | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/controls/cis_rhel7.yml b/controls/cis_rhel7.yml
|
||||
index 6a333693fb..7298158ad3 100644
|
||||
--- a/controls/cis_rhel7.yml
|
||||
+++ b/controls/cis_rhel7.yml
|
||||
@@ -95,8 +95,7 @@ controls:
|
||||
levels:
|
||||
- l1_server
|
||||
- l1_workstation
|
||||
- automated: yes
|
||||
-# rules:
|
||||
+ automated: no # rule missing
|
||||
|
||||
- id: 1.1.7
|
||||
title: Ensure noexec option set on /dev/shm partition (Automated)
|
||||
|
||||
From 4dcbe4b2d4a9c14527edd06e90809630877d97aa Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 11:21:20 +0200
|
||||
Subject: [PATCH 2/4] add rule for 3.5.1.5 - firewalld default zone
|
||||
|
||||
---
|
||||
controls/cis_rhel7.yml | 4 +++-
|
||||
.../ruleset_modifications/set_firewalld_default_zone/rule.yml | 1 +
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/controls/cis_rhel7.yml b/controls/cis_rhel7.yml
|
||||
index 7298158ad3..0f3cec2a83 100644
|
||||
--- a/controls/cis_rhel7.yml
|
||||
+++ b/controls/cis_rhel7.yml
|
||||
@@ -1022,7 +1022,9 @@ controls:
|
||||
levels:
|
||||
- l1_server
|
||||
- l1_workstation
|
||||
- automated: no # no exact rule is present
|
||||
+ automated: yes
|
||||
+ rules:
|
||||
+ - set_firewalld_default_zone
|
||||
|
||||
- id: 3.5.1.6
|
||||
title: Ensure network interfaces are assigned to appropriate zone (Manual)
|
||||
diff --git a/linux_os/guide/system/network/network-firewalld/ruleset_modifications/set_firewalld_default_zone/rule.yml b/linux_os/guide/system/network/network-firewalld/ruleset_modifications/set_firewalld_default_zone/rule.yml
|
||||
index 48de06c5bc..f4d78fb7a1 100644
|
||||
--- a/linux_os/guide/system/network/network-firewalld/ruleset_modifications/set_firewalld_default_zone/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-firewalld/ruleset_modifications/set_firewalld_default_zone/rule.yml
|
||||
@@ -27,6 +27,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis-csc: 11,14,3,9
|
||||
+ cis@rhel7: 3.5.1.5
|
||||
cis@rhel8: 3.4.2.4
|
||||
cis@sle15: 3.5.1.5
|
||||
cjis: 5.10.1
|
||||
|
||||
From a13a796ee8c33ae98e93072bfc7ee15182bdfb5c Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 11:45:52 +0200
|
||||
Subject: [PATCH 3/4] partially cover 5.5.1.4
|
||||
|
||||
---
|
||||
controls/cis_rhel7.yml | 5 ++++-
|
||||
.../account_disable_post_pw_expiration/rule.yml | 2 +-
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/controls/cis_rhel7.yml b/controls/cis_rhel7.yml
|
||||
index 0f3cec2a83..78ac34817f 100644
|
||||
--- a/controls/cis_rhel7.yml
|
||||
+++ b/controls/cis_rhel7.yml
|
||||
@@ -1966,7 +1966,10 @@ controls:
|
||||
levels:
|
||||
- l1_server
|
||||
- l1_workstation
|
||||
- automated: no # rule missing
|
||||
+ automated: partially # we do not check /et/shadow
|
||||
+ rules:
|
||||
+ - account_disable_post_pw_expiration
|
||||
+ - var_account_disable_post_pw_expiration=30
|
||||
|
||||
- id: 5.5.1.5
|
||||
title: Ensure all users last password change date is in the past (Automated)
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_disable_post_pw_expiration/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_disable_post_pw_expiration/rule.yml
|
||||
index 310e234d43..a3d81cf73f 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_disable_post_pw_expiration/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_disable_post_pw_expiration/rule.yml
|
||||
@@ -34,7 +34,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis-csc: 1,12,13,14,15,16,18,3,5,7,8
|
||||
- cis@rhel7: 5.4.1.4
|
||||
+ cis@rhel7: 5.5.1.4
|
||||
cis@rhel8: 5.5.1.4
|
||||
cis@ubuntu2004: 5.4.1.4
|
||||
cjis: 5.6.2.1.1
|
||||
|
||||
From 31ecc1b5806e7bc14199904b0a4e4d7b027ef7c4 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 11:52:09 +0200
|
||||
Subject: [PATCH 4/4] automate 6.2.5
|
||||
|
||||
---
|
||||
controls/cis_rhel7.yml | 4 +++-
|
||||
.../account_expiration/account_unique_name/rule.yml | 1 +
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/controls/cis_rhel7.yml b/controls/cis_rhel7.yml
|
||||
index 78ac34817f..672b96cbeb 100644
|
||||
--- a/controls/cis_rhel7.yml
|
||||
+++ b/controls/cis_rhel7.yml
|
||||
@@ -2205,7 +2205,9 @@ controls:
|
||||
levels:
|
||||
- l1_server
|
||||
- l1_workstation
|
||||
- automated: no # rule missing
|
||||
+ automated: yes
|
||||
+ rules:
|
||||
+ - account_unique_name
|
||||
|
||||
- id: 6.2.6
|
||||
title: Ensure no duplicate group names exist (Automated)
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_unique_name/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_unique_name/rule.yml
|
||||
index 484b3c4f90..5f6377f194 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_unique_name/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_unique_name/rule.yml
|
||||
@@ -20,6 +20,7 @@ identifiers:
|
||||
cce@rhel9: CCE-83628-8
|
||||
|
||||
references:
|
||||
+ cis@rhel7: 6.2.5
|
||||
cis@rhel8: 6.2.17
|
||||
cjis: 5.5.2
|
||||
disa: CCI-000770,CCI-000804
|
@ -1,20 +0,0 @@
|
||||
From 9bb002a6870f255a8e4934fab0d1b44893f818bc Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 23 Aug 2021 12:29:13 +0200
|
||||
Subject: [PATCH] disable_ctrlaltdel_reboot: disable service before masking
|
||||
during test scenario setup.
|
||||
|
||||
---
|
||||
.../disable_ctrlaltdel_reboot/tests/masked.pass.sh | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/tests/masked.pass.sh b/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/tests/masked.pass.sh
|
||||
index cc333ea2e9e..b56b59b2fd2 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/tests/masked.pass.sh
|
||||
+++ b/linux_os/guide/system/accounts/accounts-physical/disable_ctrlaltdel_reboot/tests/masked.pass.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
# platform = Red Hat Enterprise Linux 7,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
|
||||
+systemctl disable --now ctrl-alt-del.target
|
||||
systemctl mask --now ctrl-alt-del.target
|
@ -1,28 +0,0 @@
|
||||
From 030557e3c4b48f568f6fef7de36de4dca6c66838 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 29 Jul 2021 19:02:11 +0200
|
||||
Subject: [PATCH] Ensure test scenarios and scripts are excutable
|
||||
|
||||
After Jinja processing the test scenarios and test helper scripts they
|
||||
lose their original permissions. This ensures they are readable and
|
||||
executable.
|
||||
|
||||
The helper scripts are called by test scenarios and they need to be
|
||||
executable.
|
||||
---
|
||||
tests/ssg_test_suite/common.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/tests/ssg_test_suite/common.py b/tests/ssg_test_suite/common.py
|
||||
index 3dbeaf304a..130e5c960c 100644
|
||||
--- a/tests/ssg_test_suite/common.py
|
||||
+++ b/tests/ssg_test_suite/common.py
|
||||
@@ -245,6 +245,8 @@ def _make_file_root_owned(tarinfo):
|
||||
if tarinfo:
|
||||
tarinfo.uid = 0
|
||||
tarinfo.gid = 0
|
||||
+ # set permission to 775
|
||||
+ tarinfo.mode = 509
|
||||
return tarinfo
|
||||
|
||||
|
@ -1,114 +0,0 @@
|
||||
From 859684c560e948a439029b0d180fe23659d85141 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Tue, 10 Aug 2021 12:04:16 +0200
|
||||
Subject: [PATCH] Remove inexistent and/or duplicated STIG references.
|
||||
|
||||
---
|
||||
.../package_xorg-x11-server-common_removed/rule.yml | 1 -
|
||||
.../accounts_password_pam_unix_remember/rule.yml | 1 -
|
||||
.../audit_rules_sysadmin_actions/rule.yml | 1 -
|
||||
.../file_ownership_var_log_audit/rule.yml | 1 -
|
||||
.../auditd_data_retention_space_left_action/rule.yml | 2 +-
|
||||
.../harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml | 1 -
|
||||
.../rule.yml | 2 +-
|
||||
.../crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml | 1 -
|
||||
8 files changed, 2 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/xwindows/disabling_xwindows/package_xorg-x11-server-common_removed/rule.yml b/linux_os/guide/services/xwindows/disabling_xwindows/package_xorg-x11-server-common_removed/rule.yml
|
||||
index de8f0f6fd8..6e739d21a2 100644
|
||||
--- a/linux_os/guide/services/xwindows/disabling_xwindows/package_xorg-x11-server-common_removed/rule.yml
|
||||
+++ b/linux_os/guide/services/xwindows/disabling_xwindows/package_xorg-x11-server-common_removed/rule.yml
|
||||
@@ -42,7 +42,6 @@ references:
|
||||
nist-csf: PR.AC-3,PR.PT-4
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@rhel7: RHEL-07-040730
|
||||
- stigid@rhel8: RHEL-08-040320
|
||||
|
||||
ocil_clause: 'the X Windows package group or xorg-x11-server-common has not be removed'
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_remember/rule.yml b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_remember/rule.yml
|
||||
index 9138681688..a2b66fc4d6 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_remember/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_remember/rule.yml
|
||||
@@ -50,7 +50,6 @@ references:
|
||||
srg: SRG-OS-000077-GPOS-00045
|
||||
stigid@ol7: OL07-00-010270
|
||||
stigid@rhel7: RHEL-07-010270
|
||||
- stigid@rhel8: RHEL-08-020220
|
||||
stigid@sle15: SLES-15-020250
|
||||
stigid@ubuntu2004: UBTU-20-010070
|
||||
vmmsrg: SRG-OS-000077-VMM-000440
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_sysadmin_actions/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_sysadmin_actions/rule.yml
|
||||
index 12bca676d8..b4291e168c 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_sysadmin_actions/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_sysadmin_actions/rule.yml
|
||||
@@ -50,7 +50,6 @@ references:
|
||||
srg: 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-000304-GPOS-00121,CCI-002884,SRG-OS-000466-GPOS-00210,SRG-OS-000476-GPOS-00221
|
||||
stigid@ol7: OL07-00-030700
|
||||
stigid@rhel7: RHEL-07-030700
|
||||
- stigid@rhel8: RHEL-08-030172
|
||||
stigid@sle15: SLES-15-030140
|
||||
vmmsrg: SRG-OS-000462-VMM-001840,SRG-OS-000471-VMM-001910
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit/rule.yml
|
||||
index 956beef52b..96bc0fa0b8 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit/rule.yml
|
||||
@@ -35,7 +35,6 @@ references:
|
||||
srg: SRG-OS-000057-GPOS-00027,SRG-OS-000058-GPOS-00028,SRG-OS-000059-GPOS-00029,SRG-OS-000206-GPOS-00084
|
||||
stigid@ol7: OL07-00-910055
|
||||
stigid@rhel7: RHEL-07-910055
|
||||
- stigid@rhel8: RHEL-08-030080
|
||||
|
||||
ocil: |-
|
||||
{{{ describe_file_owner(file="/var/log/audit", owner="root") }}}
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_action/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_action/rule.yml
|
||||
index 6e30f1c4ac..7569a6776b 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_action/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_data_retention_space_left_action/rule.yml
|
||||
@@ -53,7 +53,7 @@ references:
|
||||
srg: SRG-OS-000343-GPOS-00134
|
||||
stigid@ol7: OL07-00-030340
|
||||
stigid@rhel7: RHEL-07-030340
|
||||
- stigid@rhel8: RHEL-08-030730
|
||||
+ stigid@rhel8: RHEL-08-030731
|
||||
stigid@ubuntu2004: UBTU-20-010217
|
||||
vmmsrg: SRG-OS-000343-VMM-001240
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml
|
||||
index 0aa310d924..682ca436b8 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml
|
||||
@@ -30,7 +30,6 @@ references:
|
||||
disa: CCI-001453
|
||||
nist: AC-17(2)
|
||||
srg: SRG-OS-000250-GPOS-00093
|
||||
- stigid@rhel8: RHEL-08-010291
|
||||
|
||||
ocil_clause: 'Crypto Policy for OpenSSH client is not configured correctly'
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/rule.yml
|
||||
index b56f2421f2..e904bc848c 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/rule.yml
|
||||
@@ -30,7 +30,7 @@ references:
|
||||
disa: CCI-001453
|
||||
nist: AC-17(2)
|
||||
srg: SRG-OS-000250-GPOS-00093
|
||||
- stigid@rhel8: RHEL-08-010290
|
||||
+ stigid@rhel8: RHEL-08-010291
|
||||
|
||||
ocil_clause: 'Crypto Policy for OpenSSH Server is not configured correctly'
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
index 1aeb987db2..d21f68ac17 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
@@ -28,7 +28,6 @@ references:
|
||||
disa: CCI-001453
|
||||
nist: AC-17(2)
|
||||
srg: SRG-OS-000250-GPOS-00093
|
||||
- stigid@rhel8: RHEL-08-010290
|
||||
|
||||
ocil_clause: 'Crypto Policy for OpenSSH client is not configured correctly'
|
||||
|
@ -1,53 +0,0 @@
|
||||
From a9660f01ecd85240df9460f141387dd2874eba82 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <marcus@mbsec.com.br>
|
||||
Date: Fri, 9 Jul 2021 16:15:28 +0200
|
||||
Subject: [PATCH] Bug 1857179 - Improved ansible fix for banner files. Replace
|
||||
files only when necessary.
|
||||
|
||||
---
|
||||
.../banner_etc_issue/ansible/shared.yml | 12 +++---------
|
||||
.../banner_etc_motd/ansible/shared.yml | 12 +++---------
|
||||
2 files changed, 6 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-banners/banner_etc_issue/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-banners/banner_etc_issue/ansible/shared.yml
|
||||
index ff6b6eab42b..4f6d64fd7ac 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-banners/banner_etc_issue/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-banners/banner_etc_issue/ansible/shared.yml
|
||||
@@ -5,13 +5,7 @@
|
||||
# disruption = medium
|
||||
{{{ ansible_instantiate_variables("login_banner_text") }}}
|
||||
|
||||
-- name: "{{{ rule_title }}} - remove incorrect banner"
|
||||
- file:
|
||||
- state: absent
|
||||
- path: /etc/issue
|
||||
-
|
||||
-- name: "{{{ rule_title }}} - add correct banner"
|
||||
- lineinfile:
|
||||
+- name: "{{{ rule_title }}} - ensure correct banner"
|
||||
+ copy:
|
||||
dest: /etc/issue
|
||||
- line: '{{{ ansible_deregexify_banner_etc_issue("login_banner_text") }}}'
|
||||
- create: yes
|
||||
+ content: '{{{ ansible_deregexify_banner_etc_issue("login_banner_text") }}}'
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-banners/banner_etc_motd/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-banners/banner_etc_motd/ansible/shared.yml
|
||||
index 15eb3cc1cbd..2c645889336 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-banners/banner_etc_motd/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-banners/banner_etc_motd/ansible/shared.yml
|
||||
@@ -5,13 +5,7 @@
|
||||
# disruption = medium
|
||||
{{{ ansible_instantiate_variables("login_banner_text") }}}
|
||||
|
||||
-- name: "{{{ rule_title }}} - remove incorrect banner"
|
||||
- file:
|
||||
- state: absent
|
||||
- path: /etc/motd
|
||||
-
|
||||
-- name: "{{{ rule_title }}} - add correct banner"
|
||||
- lineinfile:
|
||||
+- name: "{{{ rule_title }}} - ensure correct banner"
|
||||
+ copy:
|
||||
dest: /etc/motd
|
||||
- line: '{{{ ansible_deregexify_banner_etc_issue("login_banner_text") }}}'
|
||||
- create: yes
|
||||
+ content: '{{{ ansible_deregexify_banner_etc_issue("login_banner_text") }}}'
|
@ -1,58 +0,0 @@
|
||||
From 1dcdad51a48c17dd5dbb7eb9bbb8cef23cf00e29 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 23 Aug 2021 10:26:39 +0200
|
||||
Subject: [PATCH] Fix remaining audit rule files permissions.
|
||||
|
||||
---
|
||||
.../audit_rules_immutable/ansible/shared.yml | 1 +
|
||||
.../audit_rules_immutable/bash/shared.sh | 1 +
|
||||
shared/templates/audit_file_contents/ansible.template | 5 +++++
|
||||
shared/templates/audit_file_contents/bash.template | 2 ++
|
||||
4 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/ansible/shared.yml b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/ansible/shared.yml
|
||||
index 1cafb744cc3..736d4c333e4 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/ansible/shared.yml
|
||||
@@ -22,6 +22,7 @@
|
||||
path: "{{ item }}"
|
||||
create: True
|
||||
line: "-e 2"
|
||||
+ mode: o-rwx
|
||||
loop:
|
||||
- "/etc/audit/audit.rules"
|
||||
- "/etc/audit/rules.d/immutable.rules"
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/bash/shared.sh b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/bash/shared.sh
|
||||
index 29cd4a5de6f..36e0691493f 100644
|
||||
--- a/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_immutable/bash/shared.sh
|
||||
@@ -20,4 +20,5 @@ do
|
||||
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
|
||||
diff --git a/shared/templates/audit_file_contents/ansible.template b/shared/templates/audit_file_contents/ansible.template
|
||||
index c2852745451..a262386cfbf 100644
|
||||
--- a/shared/templates/audit_file_contents/ansible.template
|
||||
+++ b/shared/templates/audit_file_contents/ansible.template
|
||||
@@ -9,3 +9,8 @@
|
||||
contents=CONTENTS,
|
||||
)
|
||||
}}}
|
||||
+
|
||||
+- name: Remove any permissions from other group
|
||||
+ file:
|
||||
+ path: {{{ FILEPATH }}}
|
||||
+ mode: o-rwx
|
||||
diff --git a/shared/templates/audit_file_contents/bash.template b/shared/templates/audit_file_contents/bash.template
|
||||
index f264be6f14d..d6277167892 100644
|
||||
--- a/shared/templates/audit_file_contents/bash.template
|
||||
+++ b/shared/templates/audit_file_contents/bash.template
|
||||
@@ -11,4 +11,6 @@
|
||||
)
|
||||
}}}
|
||||
|
||||
+chmod o-rwx {{{ FILEPATH }}}
|
||||
+
|
||||
augenrules --load
|
@ -1,39 +0,0 @@
|
||||
From bd790153e02c1d1725f59f5d88c65c77eb1421e9 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Tue, 24 Aug 2021 12:48:46 +0200
|
||||
Subject: [PATCH] Add a new selector for var_system_crypto_policy and use it
|
||||
RHEL8 CIS.
|
||||
|
||||
This new selector is used to select explicit DEFAULT value in RHEL8 CIS
|
||||
L1 profiles. The "default" selector cannot be selected and it causes
|
||||
errors if used.
|
||||
---
|
||||
controls/cis_rhel8.yml | 2 +-
|
||||
.../software/integrity/crypto/var_system_crypto_policy.var | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/controls/cis_rhel8.yml b/controls/cis_rhel8.yml
|
||||
index 29d972427cf..c0d3f5f40de 100644
|
||||
--- a/controls/cis_rhel8.yml
|
||||
+++ b/controls/cis_rhel8.yml
|
||||
@@ -553,7 +553,7 @@ controls:
|
||||
automated: yes
|
||||
rules:
|
||||
- configure_crypto_policy
|
||||
- - var_system_crypto_policy=default
|
||||
+ - var_system_crypto_policy=default_policy
|
||||
|
||||
# This rule works in conjunction with the configure_crypto_policy above.
|
||||
# If a system is remediated to CIS Level 1, just the rule above will apply
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/var_system_crypto_policy.var b/linux_os/guide/system/software/integrity/crypto/var_system_crypto_policy.var
|
||||
index ce301154a39..8b89848d122 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/var_system_crypto_policy.var
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/var_system_crypto_policy.var
|
||||
@@ -13,6 +13,7 @@ interactive: false
|
||||
|
||||
options:
|
||||
default: DEFAULT
|
||||
+ default_policy: DEFAULT
|
||||
default_nosha1: "DEFAULT:NO-SHA1"
|
||||
fips: FIPS
|
||||
fips_ospp: "FIPS:OSPP"
|
@ -1,702 +0,0 @@
|
||||
From 7901659fa169db8ac5ffd7c610a798c785a3556b Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Fri, 9 Jul 2021 14:41:03 +0200
|
||||
Subject: [PATCH 01/12] ensure that higher policy levels can override variables
|
||||
of lower levels
|
||||
|
||||
---
|
||||
ssg/controls.py | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 297d80e46c5..165cdf0511a 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -202,9 +202,16 @@ def get_all_controls_of_level(self, policy_id, level_id):
|
||||
|
||||
all_policy_controls = self.get_all_controls(policy_id)
|
||||
eligible_controls = []
|
||||
- for c in all_policy_controls:
|
||||
- if len(level_ids.intersection(c.levels)) > 0:
|
||||
- eligible_controls.append(c)
|
||||
+ defined_variables = []
|
||||
+ # we will go level by level, from top to bottom
|
||||
+ # this is done to enable overriding of variables by higher levels
|
||||
+ for lv in level_ids:
|
||||
+ for c in all_policy_controls:
|
||||
+ if lv in c.levels:
|
||||
+ # if the control has a variable, check if it is not already defined
|
||||
+ if c.variables.keys().isdisjoint(defined_variables):
|
||||
+ eligible_controls.append(c)
|
||||
+ defined_variables += [*c.variables.keys()]
|
||||
return eligible_controls
|
||||
|
||||
def get_all_controls(self, policy_id):
|
||||
|
||||
From 66e612a9668009cc553fcf1abbf2c9477155c0c2 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 5 Aug 2021 14:02:25 +0200
|
||||
Subject: [PATCH 02/12] use ordered sets emulated by ordereddict
|
||||
|
||||
because of compatibility with python2
|
||||
---
|
||||
ssg/controls.py | 21 ++++++++++++++-------
|
||||
1 file changed, 14 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 165cdf0511a..611a647e125 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -2,6 +2,7 @@
|
||||
import logging
|
||||
import os
|
||||
from glob import glob
|
||||
+from collections import OrderedDict
|
||||
|
||||
import ssg.build_yaml
|
||||
import ssg.yaml
|
||||
@@ -152,16 +153,18 @@ def get_level(self, level_id):
|
||||
raise ValueError(msg)
|
||||
|
||||
def get_level_with_ancestors(self, level_id):
|
||||
- levels = set()
|
||||
+ # use OrderedDict for Python2 compatibility instead of ordered set
|
||||
+ levels = OrderedDict()
|
||||
level = self.get_level(level_id)
|
||||
- levels.add(level)
|
||||
+ levels[level] = ""
|
||||
if level.inherits_from:
|
||||
for lv in level.inherits_from:
|
||||
- levels.update(self.get_level_with_ancestors(lv))
|
||||
+ eligible_levels = [l for l in self.get_level_with_ancestors(lv).keys() if l not in levels.keys()]
|
||||
+ for l in eligible_levels:
|
||||
+ levels[l] = ""
|
||||
return levels
|
||||
|
||||
|
||||
-
|
||||
class ControlsManager():
|
||||
def __init__(self, controls_dir, env_yaml=None):
|
||||
self.controls_dir = os.path.abspath(controls_dir)
|
||||
@@ -198,20 +201,24 @@ def _get_policy(self, policy_id):
|
||||
def get_all_controls_of_level(self, policy_id, level_id):
|
||||
policy = self._get_policy(policy_id)
|
||||
levels = policy.get_level_with_ancestors(level_id)
|
||||
- level_ids = set([lv.id for lv in levels])
|
||||
+ # we use OrderedDict here with empty values instead of ordered set
|
||||
+ # cause we want to be compatible with python 2
|
||||
+ level_ids = OrderedDict()
|
||||
+ for lv in levels.keys():
|
||||
+ level_ids[lv.id] = ""
|
||||
|
||||
all_policy_controls = self.get_all_controls(policy_id)
|
||||
eligible_controls = []
|
||||
defined_variables = []
|
||||
# we will go level by level, from top to bottom
|
||||
# this is done to enable overriding of variables by higher levels
|
||||
- for lv in level_ids:
|
||||
+ for lv in level_ids.keys():
|
||||
for c in all_policy_controls:
|
||||
if lv in c.levels:
|
||||
# if the control has a variable, check if it is not already defined
|
||||
if c.variables.keys().isdisjoint(defined_variables):
|
||||
eligible_controls.append(c)
|
||||
- defined_variables += [*c.variables.keys()]
|
||||
+ defined_variables += list(c.variables.keys())
|
||||
return eligible_controls
|
||||
|
||||
def get_all_controls(self, policy_id):
|
||||
|
||||
From 95a23a31293a0a63361ddf1831866cd5ae1ab61e Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 5 Aug 2021 16:30:10 +0200
|
||||
Subject: [PATCH 03/12] rework handling of variables when returning all
|
||||
controls of a level
|
||||
|
||||
currently only the top most level variables are kept in the controls
|
||||
if there is a control with lower level which has the same variable defined, it is deep copied and the variable definition is removed only from the resulting control
|
||||
the original control stays in tact
|
||||
---
|
||||
ssg/controls.py | 27 +++++++++++++++++++++------
|
||||
1 file changed, 21 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 611a647e125..4ebb8bda3d7 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -1,8 +1,8 @@
|
||||
import collections
|
||||
import logging
|
||||
import os
|
||||
+import copy
|
||||
from glob import glob
|
||||
-from collections import OrderedDict
|
||||
|
||||
import ssg.build_yaml
|
||||
import ssg.yaml
|
||||
@@ -154,7 +154,7 @@ def get_level(self, level_id):
|
||||
|
||||
def get_level_with_ancestors(self, level_id):
|
||||
# use OrderedDict for Python2 compatibility instead of ordered set
|
||||
- levels = OrderedDict()
|
||||
+ levels = collections.OrderedDict()
|
||||
level = self.get_level(level_id)
|
||||
levels[level] = ""
|
||||
if level.inherits_from:
|
||||
@@ -201,24 +201,39 @@ def _get_policy(self, policy_id):
|
||||
def get_all_controls_of_level(self, policy_id, level_id):
|
||||
policy = self._get_policy(policy_id)
|
||||
levels = policy.get_level_with_ancestors(level_id)
|
||||
+ print ("getting levels of " + level_id)
|
||||
+ print ([ l.id for l in levels.keys()])
|
||||
# we use OrderedDict here with empty values instead of ordered set
|
||||
# cause we want to be compatible with python 2
|
||||
- level_ids = OrderedDict()
|
||||
+ level_ids = collections.OrderedDict()
|
||||
for lv in levels.keys():
|
||||
level_ids[lv.id] = ""
|
||||
-
|
||||
+ print (level_ids.keys())
|
||||
all_policy_controls = self.get_all_controls(policy_id)
|
||||
eligible_controls = []
|
||||
defined_variables = []
|
||||
# we will go level by level, from top to bottom
|
||||
# this is done to enable overriding of variables by higher levels
|
||||
for lv in level_ids.keys():
|
||||
+ print ("going through level " +lv)
|
||||
for c in all_policy_controls:
|
||||
+ print (c.levels)
|
||||
if lv in c.levels:
|
||||
# if the control has a variable, check if it is not already defined
|
||||
- if c.variables.keys().isdisjoint(defined_variables):
|
||||
+ variables = list(c.variables.keys())
|
||||
+ if len(variables) == 0:
|
||||
eligible_controls.append(c)
|
||||
- defined_variables += list(c.variables.keys())
|
||||
+ for var in variables:
|
||||
+ if var in defined_variables:
|
||||
+ # if it is, create new instance of the control and remove the variable
|
||||
+ # we are going from the top level to the bottom
|
||||
+ # so we don't want to overwrite variables
|
||||
+ new_c = copy.deepcopy(c)
|
||||
+ del new_c.variables[var]
|
||||
+ eligible_controls.append(new_c)
|
||||
+ else:
|
||||
+ defined_variables.append(var)
|
||||
+ eligible_controls.append(c)
|
||||
return eligible_controls
|
||||
|
||||
def get_all_controls(self, policy_id):
|
||||
|
||||
From a2dd7e9386c757a523b57646bdc5a9ffa99f68c5 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 5 Aug 2021 16:31:25 +0200
|
||||
Subject: [PATCH 04/12] add tests for defining of variables
|
||||
|
||||
---
|
||||
tests/unit/ssg-module/data/controls_dir/abcd-levels.yml | 6 ++++++
|
||||
tests/unit/ssg-module/test_controls.py | 5 +++++
|
||||
2 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml b/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
index aded77c12a6..b98a7cd4e19 100644
|
||||
--- a/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
+++ b/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
@@ -19,10 +19,14 @@ controls:
|
||||
- id: S2
|
||||
levels:
|
||||
- low
|
||||
+ rules:
|
||||
+ - var_password_pam_minlen=1
|
||||
|
||||
- id: S3
|
||||
levels:
|
||||
- medium
|
||||
+ rules:
|
||||
+ - var_password_pam_minlen=2
|
||||
|
||||
- id: S4
|
||||
title: Configure authentication
|
||||
@@ -36,3 +40,5 @@ controls:
|
||||
title: Enforce password quality standards
|
||||
levels:
|
||||
- high
|
||||
+ rules:
|
||||
+ - var_password_pam_minlen=3
|
||||
diff --git a/tests/unit/ssg-module/test_controls.py b/tests/unit/ssg-module/test_controls.py
|
||||
index ff9b04f26c9..06fcb0c375d 100644
|
||||
--- a/tests/unit/ssg-module/test_controls.py
|
||||
+++ b/tests/unit/ssg-module/test_controls.py
|
||||
@@ -87,6 +87,11 @@ def test_controls_levels():
|
||||
assert len(low_controls) == 4
|
||||
assert len(medium_controls) == 5
|
||||
|
||||
+ # test overriding of variables in levels
|
||||
+ assert c_2.variables["var_password_pam_minlen"] == "1"
|
||||
+ assert c_3.variables["var_password_pam_minlen"] == "2"
|
||||
+ assert c_4b.variables["var_password_pam_minlen"] == "3"
|
||||
+
|
||||
|
||||
def test_controls_load_product():
|
||||
ssg_root = \
|
||||
|
||||
From 82b90a9720dadab7d6060f0ccbcd902b1c097904 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Fri, 6 Aug 2021 09:30:47 +0200
|
||||
Subject: [PATCH 05/12] make overriding of variables optional
|
||||
|
||||
---
|
||||
ssg/controls.py | 38 +++++++++++++++++++-------------------
|
||||
1 file changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 4ebb8bda3d7..90639fbe4c7 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -198,42 +198,42 @@ def _get_policy(self, policy_id):
|
||||
raise ValueError(msg)
|
||||
return policy
|
||||
|
||||
- def get_all_controls_of_level(self, policy_id, level_id):
|
||||
+ def get_all_controls_of_level(self, policy_id, level_id, override_vars=True):
|
||||
+ # if override_vars is enabled, then variables from higher levels will
|
||||
+ # override variables efined in controls of lower levels
|
||||
policy = self._get_policy(policy_id)
|
||||
levels = policy.get_level_with_ancestors(level_id)
|
||||
- print ("getting levels of " + level_id)
|
||||
- print ([ l.id for l in levels.keys()])
|
||||
# we use OrderedDict here with empty values instead of ordered set
|
||||
# cause we want to be compatible with python 2
|
||||
level_ids = collections.OrderedDict()
|
||||
for lv in levels.keys():
|
||||
level_ids[lv.id] = ""
|
||||
- print (level_ids.keys())
|
||||
all_policy_controls = self.get_all_controls(policy_id)
|
||||
eligible_controls = []
|
||||
defined_variables = []
|
||||
# we will go level by level, from top to bottom
|
||||
# this is done to enable overriding of variables by higher levels
|
||||
for lv in level_ids.keys():
|
||||
- print ("going through level " +lv)
|
||||
for c in all_policy_controls:
|
||||
- print (c.levels)
|
||||
if lv in c.levels:
|
||||
- # if the control has a variable, check if it is not already defined
|
||||
- variables = list(c.variables.keys())
|
||||
- if len(variables) == 0:
|
||||
+ if override_vars == False:
|
||||
eligible_controls.append(c)
|
||||
- for var in variables:
|
||||
- if var in defined_variables:
|
||||
- # if it is, create new instance of the control and remove the variable
|
||||
- # we are going from the top level to the bottom
|
||||
- # so we don't want to overwrite variables
|
||||
- new_c = copy.deepcopy(c)
|
||||
- del new_c.variables[var]
|
||||
- eligible_controls.append(new_c)
|
||||
- else:
|
||||
- defined_variables.append(var)
|
||||
+ else:
|
||||
+ # if the control has a variable, check if it is not already defined
|
||||
+ variables = list(c.variables.keys())
|
||||
+ if len(variables) == 0:
|
||||
eligible_controls.append(c)
|
||||
+ for var in variables:
|
||||
+ if var in defined_variables:
|
||||
+ # if it is, create new instance of the control and remove the variable
|
||||
+ # we are going from the top level to the bottom
|
||||
+ # so we don't want to overwrite variables
|
||||
+ new_c = copy.deepcopy(c)
|
||||
+ del new_c.variables[var]
|
||||
+ eligible_controls.append(new_c)
|
||||
+ else:
|
||||
+ defined_variables.append(var)
|
||||
+ eligible_controls.append(c)
|
||||
return eligible_controls
|
||||
|
||||
def get_all_controls(self, policy_id):
|
||||
|
||||
From 47df80d086e96deb4eab88d5f813bffb380006a8 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Wed, 11 Aug 2021 12:38:42 +0200
|
||||
Subject: [PATCH 06/12] fix a typo
|
||||
|
||||
---
|
||||
ssg/controls.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 90639fbe4c7..10a304bf8c2 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -200,7 +200,7 @@ def _get_policy(self, policy_id):
|
||||
|
||||
def get_all_controls_of_level(self, policy_id, level_id, override_vars=True):
|
||||
# if override_vars is enabled, then variables from higher levels will
|
||||
- # override variables efined in controls of lower levels
|
||||
+ # override variables defined in controls of lower levels
|
||||
policy = self._get_policy(policy_id)
|
||||
levels = policy.get_level_with_ancestors(level_id)
|
||||
# we use OrderedDict here with empty values instead of ordered set
|
||||
|
||||
From 8e59037ed07aad33a55e8297ee5bce0f51c0dee6 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Wed, 11 Aug 2021 17:02:11 +0200
|
||||
Subject: [PATCH 07/12] update tests to check that overriding of variables
|
||||
works
|
||||
|
||||
---
|
||||
.../ssg-module/data/controls_dir/abcd-levels.yml | 4 +---
|
||||
tests/unit/ssg-module/test_controls.py | 16 ++++++++++++++--
|
||||
2 files changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml b/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
index b98a7cd4e19..99efafd832e 100644
|
||||
--- a/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
+++ b/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
@@ -25,8 +25,6 @@ controls:
|
||||
- id: S3
|
||||
levels:
|
||||
- medium
|
||||
- rules:
|
||||
- - var_password_pam_minlen=2
|
||||
|
||||
- id: S4
|
||||
title: Configure authentication
|
||||
@@ -41,4 +39,4 @@ controls:
|
||||
levels:
|
||||
- high
|
||||
rules:
|
||||
- - var_password_pam_minlen=3
|
||||
+ - var_password_pam_minlen=2
|
||||
diff --git a/tests/unit/ssg-module/test_controls.py b/tests/unit/ssg-module/test_controls.py
|
||||
index 06fcb0c375d..124b344d141 100644
|
||||
--- a/tests/unit/ssg-module/test_controls.py
|
||||
+++ b/tests/unit/ssg-module/test_controls.py
|
||||
@@ -89,8 +89,20 @@ def test_controls_levels():
|
||||
|
||||
# test overriding of variables in levels
|
||||
assert c_2.variables["var_password_pam_minlen"] == "1"
|
||||
- assert c_3.variables["var_password_pam_minlen"] == "2"
|
||||
- assert c_4b.variables["var_password_pam_minlen"] == "3"
|
||||
+ assert "var_password_pam_minlen" not in c_3.variables.keys()
|
||||
+ assert c_4b.variables["var_password_pam_minlen"] == "2"
|
||||
+
|
||||
+ for c in low_controls:
|
||||
+ if "var_password_pam_minlen" in c.variables.keys():
|
||||
+ assert c.variables["var_password_pam_minlen"] == "1"
|
||||
+
|
||||
+ for c in medium_controls:
|
||||
+ if "var_password_pam_minlen" in c.variables.keys():
|
||||
+ assert c.variables["var_password_pam_minlen"] == "1"
|
||||
+
|
||||
+ for c in high_controls:
|
||||
+ if "var_password_pam_minlen" in c.variables.keys():
|
||||
+ assert c.variables["var_password_pam_minlen"] == "2"
|
||||
|
||||
|
||||
def test_controls_load_product():
|
||||
|
||||
From dae4fc52a627eac6595bb73e3ffb1a0c50e78fdd Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Wed, 11 Aug 2021 17:02:32 +0200
|
||||
Subject: [PATCH 08/12] make overriding of variables hardcoded when requesting
|
||||
controls of a certain level
|
||||
|
||||
---
|
||||
ssg/controls.py | 34 +++++++++++++++-------------------
|
||||
1 file changed, 15 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 10a304bf8c2..7923f0cb379 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -198,9 +198,7 @@ def _get_policy(self, policy_id):
|
||||
raise ValueError(msg)
|
||||
return policy
|
||||
|
||||
- def get_all_controls_of_level(self, policy_id, level_id, override_vars=True):
|
||||
- # if override_vars is enabled, then variables from higher levels will
|
||||
- # override variables defined in controls of lower levels
|
||||
+ def get_all_controls_of_level(self, policy_id, level_id):
|
||||
policy = self._get_policy(policy_id)
|
||||
levels = policy.get_level_with_ancestors(level_id)
|
||||
# we use OrderedDict here with empty values instead of ordered set
|
||||
@@ -216,24 +214,22 @@ def get_all_controls_of_level(self, policy_id, level_id, override_vars=True):
|
||||
for lv in level_ids.keys():
|
||||
for c in all_policy_controls:
|
||||
if lv in c.levels:
|
||||
- if override_vars == False:
|
||||
+ # if the control has a variable, check if it is not already defined
|
||||
+ variables = list(c.variables.keys())
|
||||
+ if len(variables) == 0:
|
||||
eligible_controls.append(c)
|
||||
- else:
|
||||
- # if the control has a variable, check if it is not already defined
|
||||
- variables = list(c.variables.keys())
|
||||
- if len(variables) == 0:
|
||||
+ continue
|
||||
+ for var in variables:
|
||||
+ if var in defined_variables:
|
||||
+ # if it is, create new instance of the control and remove the variable
|
||||
+ # we are going from the top level to the bottom
|
||||
+ # so we don't want to overwrite variables
|
||||
+ new_c = copy.deepcopy(c)
|
||||
+ del new_c.variables[var]
|
||||
+ eligible_controls.append(new_c)
|
||||
+ else:
|
||||
+ defined_variables.append(var)
|
||||
eligible_controls.append(c)
|
||||
- for var in variables:
|
||||
- if var in defined_variables:
|
||||
- # if it is, create new instance of the control and remove the variable
|
||||
- # we are going from the top level to the bottom
|
||||
- # so we don't want to overwrite variables
|
||||
- new_c = copy.deepcopy(c)
|
||||
- del new_c.variables[var]
|
||||
- eligible_controls.append(new_c)
|
||||
- else:
|
||||
- defined_variables.append(var)
|
||||
- eligible_controls.append(c)
|
||||
return eligible_controls
|
||||
|
||||
def get_all_controls(self, policy_id):
|
||||
|
||||
From c051e11c70b7e23ce3d4a8e0670da4fae72833c6 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 15:30:39 +0200
|
||||
Subject: [PATCH 09/12] get rid of one ordereddict
|
||||
|
||||
---
|
||||
ssg/controls.py | 9 ++-------
|
||||
1 file changed, 2 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 7923f0cb379..891b13c891c 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -201,19 +201,14 @@ def _get_policy(self, policy_id):
|
||||
def get_all_controls_of_level(self, policy_id, level_id):
|
||||
policy = self._get_policy(policy_id)
|
||||
levels = policy.get_level_with_ancestors(level_id)
|
||||
- # we use OrderedDict here with empty values instead of ordered set
|
||||
- # cause we want to be compatible with python 2
|
||||
- level_ids = collections.OrderedDict()
|
||||
- for lv in levels.keys():
|
||||
- level_ids[lv.id] = ""
|
||||
all_policy_controls = self.get_all_controls(policy_id)
|
||||
eligible_controls = []
|
||||
defined_variables = []
|
||||
# we will go level by level, from top to bottom
|
||||
# this is done to enable overriding of variables by higher levels
|
||||
- for lv in level_ids.keys():
|
||||
+ for lv in levels.keys():
|
||||
for c in all_policy_controls:
|
||||
- if lv in c.levels:
|
||||
+ if lv.id in c.levels:
|
||||
# if the control has a variable, check if it is not already defined
|
||||
variables = list(c.variables.keys())
|
||||
if len(variables) == 0:
|
||||
|
||||
From 4dd5cb1326932cf020785a8c2472998eb2e7775e Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 16:44:57 +0200
|
||||
Subject: [PATCH 10/12] fix overriding of variables
|
||||
|
||||
when there were multiple variables overridden, it caused problems by creating multiple copies of controls
|
||||
---
|
||||
ssg/controls.py | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 891b13c891c..8b69676313c 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -214,17 +214,19 @@ def get_all_controls_of_level(self, policy_id, level_id):
|
||||
if len(variables) == 0:
|
||||
eligible_controls.append(c)
|
||||
continue
|
||||
+ variables_to_remove = [] # contains list of variables which are already defined and should be removed from the control
|
||||
for var in variables:
|
||||
if var in defined_variables:
|
||||
- # if it is, create new instance of the control and remove the variable
|
||||
- # we are going from the top level to the bottom
|
||||
- # so we don't want to overwrite variables
|
||||
- new_c = copy.deepcopy(c)
|
||||
- del new_c.variables[var]
|
||||
- eligible_controls.append(new_c)
|
||||
+ variables_to_remove.append(var)
|
||||
else:
|
||||
defined_variables.append(var)
|
||||
- eligible_controls.append(c)
|
||||
+ if len(variables_to_remove) == 0:
|
||||
+ eligible_controls.append(c)
|
||||
+ else:
|
||||
+ new_c = copy.deepcopy(c)
|
||||
+ for var in variables_to_remove:
|
||||
+ del new_c.variables[var]
|
||||
+ eligible_controls.append(new_c)
|
||||
return eligible_controls
|
||||
|
||||
def get_all_controls(self, policy_id):
|
||||
|
||||
From fbebba524cab090bc4c2f92b75257a7cc881ef5e Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 16:45:38 +0200
|
||||
Subject: [PATCH 11/12] extended tests to test for multiple overridden
|
||||
variables
|
||||
|
||||
---
|
||||
.../data/controls_dir/abcd-levels.yml | 2 ++
|
||||
tests/unit/ssg-module/test_controls.py | 19 +++++++++++++++++++
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml b/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
index 99efafd832e..2e60ec43532 100644
|
||||
--- a/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
+++ b/tests/unit/ssg-module/data/controls_dir/abcd-levels.yml
|
||||
@@ -21,6 +21,7 @@ controls:
|
||||
- low
|
||||
rules:
|
||||
- var_password_pam_minlen=1
|
||||
+ - var_some_variable=1
|
||||
|
||||
- id: S3
|
||||
levels:
|
||||
@@ -40,3 +41,4 @@ controls:
|
||||
- high
|
||||
rules:
|
||||
- var_password_pam_minlen=2
|
||||
+ - var_some_variable=3
|
||||
diff --git a/tests/unit/ssg-module/test_controls.py b/tests/unit/ssg-module/test_controls.py
|
||||
index 124b344d141..1465661b04a 100644
|
||||
--- a/tests/unit/ssg-module/test_controls.py
|
||||
+++ b/tests/unit/ssg-module/test_controls.py
|
||||
@@ -104,6 +104,25 @@ def test_controls_levels():
|
||||
if "var_password_pam_minlen" in c.variables.keys():
|
||||
assert c.variables["var_password_pam_minlen"] == "2"
|
||||
|
||||
+ # now test if controls of lower level has the variable definition correctly removed
|
||||
+ # because it is overriden by higher level controls
|
||||
+ s2_high = [c for c in high_controls if c.id == "S2"]
|
||||
+ assert len(s2_high) == 1
|
||||
+ assert "var_some_variable" not in s2_high[0].variables.keys()
|
||||
+ assert "var_password_pam_minlen" not in s2_high[0].variables.keys()
|
||||
+ s4b_high = [c for c in high_controls if c.id == "S4.b"]
|
||||
+ assert len(s4b_high) == 1
|
||||
+ assert s4b_high[0].variables["var_some_variable"] == "3"
|
||||
+ assert s4b_high[0].variables["var_password_pam_minlen"] == "2"
|
||||
+
|
||||
+ # check that in low level the variable is correctly placed there in S2
|
||||
+ s2_low = [c for c in low_controls if c.id == "S2"]
|
||||
+ assert len(s2_low) == 1
|
||||
+ assert s2_low[0].variables["var_some_variable"] == "1"
|
||||
+ assert s2_low[0].variables["var_password_pam_minlen"] == "1"
|
||||
+
|
||||
+
|
||||
+
|
||||
|
||||
def test_controls_load_product():
|
||||
ssg_root = \
|
||||
|
||||
From 369de6b8374084d9d607979b712285912dbb65aa Mon Sep 17 00:00:00 2001
|
||||
From: Matej Tyc <matyc@redhat.com>
|
||||
Date: Mon, 16 Aug 2021 10:39:22 +0200
|
||||
Subject: [PATCH 12/12] Style improvements
|
||||
|
||||
- Renamed get_level_with_ancestors to get_level_with_ancestors_sequence,
|
||||
and made it return a list - a dictionary result is quite confusing.
|
||||
- Removed some optimization in the variable deletion loops.
|
||||
- Extracted functionality to a _get_control_without_variables static
|
||||
method.
|
||||
- Defined variable removal steps using set operations.
|
||||
---
|
||||
ssg/controls.py | 54 +++++++++++++++++++++++++------------------------
|
||||
1 file changed, 28 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/ssg/controls.py b/ssg/controls.py
|
||||
index 8b69676313c..ca3187d5b16 100644
|
||||
--- a/ssg/controls.py
|
||||
+++ b/ssg/controls.py
|
||||
@@ -152,17 +152,17 @@ def get_level(self, level_id):
|
||||
)
|
||||
raise ValueError(msg)
|
||||
|
||||
- def get_level_with_ancestors(self, level_id):
|
||||
+ def get_level_with_ancestors_sequence(self, level_id):
|
||||
# use OrderedDict for Python2 compatibility instead of ordered set
|
||||
levels = collections.OrderedDict()
|
||||
level = self.get_level(level_id)
|
||||
levels[level] = ""
|
||||
if level.inherits_from:
|
||||
for lv in level.inherits_from:
|
||||
- eligible_levels = [l for l in self.get_level_with_ancestors(lv).keys() if l not in levels.keys()]
|
||||
+ eligible_levels = [l for l in self.get_level_with_ancestors_sequence(lv) if l not in levels.keys()]
|
||||
for l in eligible_levels:
|
||||
levels[l] = ""
|
||||
- return levels
|
||||
+ return list(levels.keys())
|
||||
|
||||
|
||||
class ControlsManager():
|
||||
@@ -200,35 +200,37 @@ def _get_policy(self, policy_id):
|
||||
|
||||
def get_all_controls_of_level(self, policy_id, level_id):
|
||||
policy = self._get_policy(policy_id)
|
||||
- levels = policy.get_level_with_ancestors(level_id)
|
||||
+ levels = policy.get_level_with_ancestors_sequence(level_id)
|
||||
all_policy_controls = self.get_all_controls(policy_id)
|
||||
eligible_controls = []
|
||||
- defined_variables = []
|
||||
+ already_defined_variables = set()
|
||||
# we will go level by level, from top to bottom
|
||||
# this is done to enable overriding of variables by higher levels
|
||||
- for lv in levels.keys():
|
||||
- for c in all_policy_controls:
|
||||
- if lv.id in c.levels:
|
||||
- # if the control has a variable, check if it is not already defined
|
||||
- variables = list(c.variables.keys())
|
||||
- if len(variables) == 0:
|
||||
- eligible_controls.append(c)
|
||||
- continue
|
||||
- variables_to_remove = [] # contains list of variables which are already defined and should be removed from the control
|
||||
- for var in variables:
|
||||
- if var in defined_variables:
|
||||
- variables_to_remove.append(var)
|
||||
- else:
|
||||
- defined_variables.append(var)
|
||||
- if len(variables_to_remove) == 0:
|
||||
- eligible_controls.append(c)
|
||||
- else:
|
||||
- new_c = copy.deepcopy(c)
|
||||
- for var in variables_to_remove:
|
||||
- del new_c.variables[var]
|
||||
- eligible_controls.append(new_c)
|
||||
+ for lv in levels:
|
||||
+ for control in all_policy_controls:
|
||||
+ if lv.id not in control.levels:
|
||||
+ continue
|
||||
+
|
||||
+ variables = set(control.variables.keys())
|
||||
+
|
||||
+ variables_to_remove = variables.intersection(already_defined_variables)
|
||||
+ already_defined_variables.update(variables)
|
||||
+
|
||||
+ new_c = self._get_control_without_variables(variables_to_remove, control)
|
||||
+ eligible_controls.append(new_c)
|
||||
+
|
||||
return eligible_controls
|
||||
|
||||
+ @staticmethod
|
||||
+ def _get_control_without_variables(variables_to_remove, control):
|
||||
+ if not variables_to_remove:
|
||||
+ return control
|
||||
+
|
||||
+ new_c = copy.deepcopy(control)
|
||||
+ for var in variables_to_remove:
|
||||
+ del new_c.variables[var]
|
||||
+ return new_c
|
||||
+
|
||||
def get_all_controls(self, policy_id):
|
||||
policy = self._get_policy(policy_id)
|
||||
return policy.controls_by_id.values()
|
@ -1,43 +0,0 @@
|
||||
From 90cbb9fc2662cd2b7652d1f012ece74e8cf41c5d Mon Sep 17 00:00:00 2001
|
||||
From: Milan Lysonek <mlysonek@redhat.com>
|
||||
Date: Mon, 9 Aug 2021 15:22:59 +0200
|
||||
Subject: [PATCH 1/2] Add SRG for sssd_enable_certmap
|
||||
|
||||
---
|
||||
linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml b/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml
|
||||
index 0614a2f4a0..67c02f4fb7 100644
|
||||
--- a/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml
|
||||
+++ b/linux_os/guide/services/sssd/sssd_enable_certmap/rule.yml
|
||||
@@ -28,6 +28,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-000187
|
||||
nist: IA-5 (2) (c)
|
||||
+ srg: SRG-OS-000068-GPOS-00036
|
||||
stigid@rhel8: RHEL-08-020090
|
||||
|
||||
warnings:
|
||||
|
||||
From b15299568849111d142c27f99dff7052afd96c07 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Lysonek <mlysonek@redhat.com>
|
||||
Date: Mon, 9 Aug 2021 15:23:16 +0200
|
||||
Subject: [PATCH 2/2] Add SRG for accounts_password_pam_dictcheck
|
||||
|
||||
---
|
||||
.../accounts_password_pam_dictcheck/rule.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
index 2990150c0a..5956718a70 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
@@ -27,6 +27,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-000366
|
||||
nist: IA-5(c),IA-5(1)(a),CM-6(a),IA-5(4)
|
||||
+ srg: SRG-OS-000480-GPOS-00225
|
||||
stigid@rhel8: RHEL-08-020300
|
||||
|
||||
ocil_clause: 'dictcheck is not found or not equal to the required value'
|
@ -1,22 +0,0 @@
|
||||
From 3866ba4f0ce678b68de0ff5f1dc7edbea6a904bb Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 23 Aug 2021 12:10:01 +0200
|
||||
Subject: [PATCH] Fix RHEL7 documentation link.
|
||||
|
||||
---
|
||||
.../screen_locking/smart_card_login/smartcard_auth/rule.yml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml b/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml
|
||||
index 62a343cf39..8153b31177 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml
|
||||
@@ -8,7 +8,7 @@ description: |-
|
||||
To enable smart card authentication, consult the documentation at:
|
||||
<ul>
|
||||
{{% if product == "rhel7" %}}
|
||||
- <li><b>{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/smartcards.html#authconfig-smartcards") }}}</b></li>
|
||||
+ <li><b>{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/smartcards#authconfig-smartcards") }}}</b></li>
|
||||
{{% elif product == "ol7" %}}
|
||||
<li><b>{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/7/userauth/ol7-auth.html#ol7-s4-auth") }}}</b></li>
|
||||
{{% endif %}}
|
@ -1,160 +0,0 @@
|
||||
From ac416fb6b73135b6fdeae850740ca4e10ad9fa1e Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Wed, 18 Aug 2021 15:16:59 +0200
|
||||
Subject: [PATCH] Fix RHEL7 documentation links.
|
||||
|
||||
---
|
||||
linux_os/guide/services/ldap/openldap_client/group.yml | 2 +-
|
||||
linux_os/guide/services/ldap/openldap_server/group.yml | 2 +-
|
||||
.../ntp/chronyd_or_ntpd_specify_multiple_servers/rule.yml | 2 +-
|
||||
.../ntp/chronyd_or_ntpd_specify_remote_server/rule.yml | 2 +-
|
||||
linux_os/guide/services/ntp/group.yml | 2 +-
|
||||
.../services/ntp/service_chronyd_or_ntpd_enabled/rule.yml | 2 +-
|
||||
linux_os/guide/services/sssd/group.yml | 2 +-
|
||||
.../screen_locking/smart_card_login/smartcard_auth/rule.yml | 4 +---
|
||||
linux_os/guide/system/auditing/group.yml | 2 +-
|
||||
.../software/disk_partitioning/encrypt_partitions/rule.yml | 2 +-
|
||||
.../guide/system/software/gnome/gnome_login_screen/group.yml | 2 +-
|
||||
11 files changed, 11 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ldap/openldap_client/group.yml b/linux_os/guide/services/ldap/openldap_client/group.yml
|
||||
index bf17a053cd5..a64f105395f 100644
|
||||
--- a/linux_os/guide/services/ldap/openldap_client/group.yml
|
||||
+++ b/linux_os/guide/services/ldap/openldap_client/group.yml
|
||||
@@ -13,7 +13,7 @@ description: |-
|
||||
files, which is useful when trying to use SSL cleanly across several protocols.
|
||||
Installation and configuration of OpenLDAP on {{{ full_name }}} is available at
|
||||
{{% if product == "rhel7" %}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System-Level_Authentication_Guide/openldap.html") }}}.
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/openldap") }}}.
|
||||
{{% elif product == "ol7" %}}
|
||||
{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/7/userauth/ol7-auth.html#ol7-s9-auth") }}}.
|
||||
{{% endif %}}
|
||||
diff --git a/linux_os/guide/services/ldap/openldap_server/group.yml b/linux_os/guide/services/ldap/openldap_server/group.yml
|
||||
index c180820e9fc..d571867a7f8 100644
|
||||
--- a/linux_os/guide/services/ldap/openldap_server/group.yml
|
||||
+++ b/linux_os/guide/services/ldap/openldap_server/group.yml
|
||||
@@ -7,5 +7,5 @@ description: |-
|
||||
for an OpenLDAP server.
|
||||
{{% if product == "rhel7" %}}
|
||||
Installation and configuration of OpenLDAP on Red Hat Enterprise Linux 7 is available at:
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System-Level_Authentication_Guide/openldap.html") }}}.
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/openldap") }}}.
|
||||
{{% endif %}}
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_multiple_servers/rule.yml b/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_multiple_servers/rule.yml
|
||||
index 8f939356ab1..7dc188589ee 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_multiple_servers/rule.yml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_multiple_servers/rule.yml
|
||||
@@ -14,7 +14,7 @@ description: |-
|
||||
{{% elif product == "ol8" %}}
|
||||
{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/8/network/ol-nettime.html") }}}
|
||||
{{% else %}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Configuring_NTP_Using_the_chrony_Suite.html") }}}
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite") }}}
|
||||
{{% endif %}}
|
||||
for more detailed comparison of the features of both of the choices, and for
|
||||
further guidance how to choose between the two NTP daemons.
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_remote_server/rule.yml b/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_remote_server/rule.yml
|
||||
index 503aecc0de2..27df8595efa 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_remote_server/rule.yml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_specify_remote_server/rule.yml
|
||||
@@ -14,7 +14,7 @@ description: |-
|
||||
{{% elif product == "ol8" %}}
|
||||
{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/8/network/ol-nettime.html") }}}
|
||||
{{% else %}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Configuring_NTP_Using_the_chrony_Suite.html") }}}
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite") }}}
|
||||
{{% endif %}}
|
||||
for more detailed comparison of the features of both of the choices, and for
|
||||
further guidance how to choose between the two NTP daemons.
|
||||
diff --git a/linux_os/guide/services/ntp/group.yml b/linux_os/guide/services/ntp/group.yml
|
||||
index 181b10dfd65..b944ee03116 100644
|
||||
--- a/linux_os/guide/services/ntp/group.yml
|
||||
+++ b/linux_os/guide/services/ntp/group.yml
|
||||
@@ -54,7 +54,7 @@ description: |-
|
||||
{{% elif product == "ol8" %}}
|
||||
{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/8/network/ol-nettime.html") }}}
|
||||
{{% elif product == "rhel7" %}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Configuring_NTP_Using_the_chrony_Suite.html") }}}
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite") }}}
|
||||
{{% elif "ubuntu" in product %}}
|
||||
{{{ weblink(link="https://help.ubuntu.com/lts/serverguide/NTP.html") }}}
|
||||
{{% elif "debian" in product %}}
|
||||
diff --git a/linux_os/guide/services/ntp/service_chronyd_or_ntpd_enabled/rule.yml b/linux_os/guide/services/ntp/service_chronyd_or_ntpd_enabled/rule.yml
|
||||
index 065cf301b95..00739816f5e 100644
|
||||
--- a/linux_os/guide/services/ntp/service_chronyd_or_ntpd_enabled/rule.yml
|
||||
+++ b/linux_os/guide/services/ntp/service_chronyd_or_ntpd_enabled/rule.yml
|
||||
@@ -17,7 +17,7 @@ description: |-
|
||||
{{% elif product == "ol8" %}}
|
||||
{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/8/network/ol-nettime.html") }}}
|
||||
{{% else %}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Configuring_NTP_Using_the_chrony_Suite.html") }}}
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite") }}}
|
||||
{{% endif %}}
|
||||
for guidance which NTP daemon to choose depending on the environment used.
|
||||
|
||||
diff --git a/linux_os/guide/services/sssd/group.yml b/linux_os/guide/services/sssd/group.yml
|
||||
index 5b0caf7d64b..3f4eced7ca7 100644
|
||||
--- a/linux_os/guide/services/sssd/group.yml
|
||||
+++ b/linux_os/guide/services/sssd/group.yml
|
||||
@@ -11,7 +11,7 @@ description: |-
|
||||
<br /><br />
|
||||
For more information, see
|
||||
{{%- if product == "rhel7" -%}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System-Level_Authentication_Guide/SSSD.html") }}}
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/sssd") }}}
|
||||
{{%- elif product == "rhel8" -%}}
|
||||
{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/installing_identity_management/installing-an-ipa-client-basic-scenario_installing-identity-management#sssd-deployment-operations_install-client-basic") }}}
|
||||
{{%- elif product == "ol7" -%}}
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml b/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml
|
||||
index fc7f149bf40..62a343cf396 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_auth/rule.yml
|
||||
@@ -8,9 +8,7 @@ description: |-
|
||||
To enable smart card authentication, consult the documentation at:
|
||||
<ul>
|
||||
{{% if product == "rhel7" %}}
|
||||
- <li><b>{{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System-Level_Authentication_Guide/smartcards.html#authconfig-smartcards") }}}</b></li>
|
||||
- {{% elif product == "rhel8" %}}
|
||||
- <li><b>{{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System-Level_Authentication_Guide/smartcards.html#authconfig-smartcards") }}}</b></li>
|
||||
+ <li><b>{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/smartcards.html#authconfig-smartcards") }}}</b></li>
|
||||
{{% elif product == "ol7" %}}
|
||||
<li><b>{{{ weblink(link="https://docs.oracle.com/en/operating-systems/oracle-linux/7/userauth/ol7-auth.html#ol7-s4-auth") }}}</b></li>
|
||||
{{% endif %}}
|
||||
diff --git a/linux_os/guide/system/auditing/group.yml b/linux_os/guide/system/auditing/group.yml
|
||||
index 82f87e81c47..5fce88db032 100644
|
||||
--- a/linux_os/guide/system/auditing/group.yml
|
||||
+++ b/linux_os/guide/system/auditing/group.yml
|
||||
@@ -38,7 +38,7 @@ description: |-
|
||||
Examining some example audit records demonstrates how the Linux audit system
|
||||
satisfies common requirements.
|
||||
The following example from Fedora Documentation available at
|
||||
- <tt>{{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/SELinux_Users_and_Administrators_Guide/sect-Security-Enhanced_Linux-Troubleshooting-Fixing_Problems.html#sect-Security-Enhanced_Linux-Fixing_Problems-Raw_Audit_Messages") }}}</tt>
|
||||
+ <tt>{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/selinux_users_and_administrators_guide/index#sect-Security-Enhanced_Linux-Fixing_Problems-Raw_Audit_Messages") }}}</tt>
|
||||
shows the substantial amount of information captured in a
|
||||
two typical "raw" audit messages, followed by a breakdown of the most important
|
||||
fields. In this example the message is SELinux-related and reports an AVC
|
||||
diff --git a/linux_os/guide/system/software/disk_partitioning/encrypt_partitions/rule.yml b/linux_os/guide/system/software/disk_partitioning/encrypt_partitions/rule.yml
|
||||
index add0a41fa94..cd07fb4c0ca 100644
|
||||
--- a/linux_os/guide/system/software/disk_partitioning/encrypt_partitions/rule.yml
|
||||
+++ b/linux_os/guide/system/software/disk_partitioning/encrypt_partitions/rule.yml
|
||||
@@ -38,7 +38,7 @@ description: |-
|
||||
{{% elif product in ["sle12", "sle15"] %}}
|
||||
{{{ weblink(link="https://www.suse.com/documentation/sled-12/book_security/data/sec_security_cryptofs_y2.html") }}}
|
||||
{{% elif product == "rhel7" %}}
|
||||
- {{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Encryption.html") }}}.
|
||||
+ {{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-encryption") }}}.
|
||||
{{% else %}}
|
||||
{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/encrypting-block-devices-using-luks_security-hardening") }}}.
|
||||
{{% endif %}}
|
||||
diff --git a/linux_os/guide/system/software/gnome/gnome_login_screen/group.yml b/linux_os/guide/system/software/gnome/gnome_login_screen/group.yml
|
||||
index 8e8b32f1d79..299b96c0592 100644
|
||||
--- a/linux_os/guide/system/software/gnome/gnome_login_screen/group.yml
|
||||
+++ b/linux_os/guide/system/software/gnome/gnome_login_screen/group.yml
|
||||
@@ -14,5 +14,5 @@ description: |-
|
||||
the man page <tt>dconf(1)</tt>.
|
||||
{{% else %}}
|
||||
For more information about enforcing preferences in the GNOME3 environment using the DConf
|
||||
- configuration system, see <b>{{{ weblink(link="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Desktop_Migration_and_Administration_Guide/index.html") }}}/></b> and the man page <tt>dconf(1)</tt>.
|
||||
+ configuration system, see <b>{{{ weblink(link="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/desktop_migration_and_administration_guide") }}}/></b> and the man page <tt>dconf(1)</tt>.
|
||||
{{% endif %}}
|
@ -1,33 +0,0 @@
|
||||
From 69eb6ab86201b5566595b3b6ac12f643dcd9e0ca Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 16 Sep 2021 14:59:27 +0200
|
||||
Subject: [PATCH] Fix typo in rsyslog streamdriver remediations
|
||||
|
||||
The Ansible remediations don't need to escape '$'.
|
||||
---
|
||||
.../ansible/shared.yml | 2 +-
|
||||
.../ansible/shared.yml | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
index bbd27a00611..5d11103fc0f 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
@@ -5,5 +5,5 @@
|
||||
# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
- parameter="\$ActionSendStreamDriverMode", value="1", create=true, separator=" ", separator_regex=" ")
|
||||
+ parameter="$ActionSendStreamDriverMode", value="1", create=true, separator=" ", separator_regex=" ")
|
||||
}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
index b215daaef4b..035ab152876 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
@@ -5,5 +5,5 @@
|
||||
# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
- parameter="\$DefaultNetstreamDriver", value="gtls", create=true, separator=" ", separator_regex=" ")
|
||||
+ parameter="$DefaultNetstreamDriver", value="gtls", create=true, separator=" ", separator_regex=" ")
|
||||
}}}
|
@ -1,27 +0,0 @@
|
||||
From a032960b4fb8e50386fa02739b6b107b233b64ca Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 2 Aug 2021 18:39:58 +0200
|
||||
Subject: [PATCH] Fix a python2 issue with STIG overlay generation.
|
||||
|
||||
---
|
||||
utils/create-stig-overlay.py | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/utils/create-stig-overlay.py b/utils/create-stig-overlay.py
|
||||
index 02deb0b5b2..5d4bb835ca 100755
|
||||
--- a/utils/create-stig-overlay.py
|
||||
+++ b/utils/create-stig-overlay.py
|
||||
@@ -107,7 +107,12 @@ def new_stig_overlay(xccdftree, ssgtree, outfile, quiet):
|
||||
lines = new_stig_overlay.findall("overlay")
|
||||
new_stig_overlay[:] = sorted(lines, key=getkey)
|
||||
|
||||
- dom = xml.dom.minidom.parseString(ET.tostring(new_stig_overlay, encoding="UTF-8", xml_declaration=True))
|
||||
+ try:
|
||||
+ et_str = ET.tostring(new_stig_overlay, encoding="UTF-8", xml_declaration=True)
|
||||
+ except TypeError:
|
||||
+ et_str = ET.tostring(new_stig_overlay, encoding="UTF-8")
|
||||
+
|
||||
+ dom = xml.dom.minidom.parseString(et_str)
|
||||
pretty_xml_as_string = dom.toprettyxml(indent=' ', encoding="UTF-8")
|
||||
|
||||
overlay_directory = os.path.dirname(outfile)
|
File diff suppressed because it is too large
Load Diff
@ -1,256 +0,0 @@
|
||||
From 86e1556555fde19d3b6bfa7e280c8d9faf6243d3 Mon Sep 17 00:00:00 2001
|
||||
From: Matej Tyc <matyc@redhat.com>
|
||||
Date: Mon, 16 Aug 2021 13:08:10 +0200
|
||||
Subject: [PATCH] Add ISM Official kickstarts
|
||||
|
||||
---
|
||||
.../rhel8/kickstart/ssg-rhel8-ism_o-ks.cfg | 116 ++++++++++++++++++
|
||||
.../rhel9/kickstart/ssg-rhel9-ism_o-ks.cfg | 116 ++++++++++++++++++
|
||||
2 files changed, 232 insertions(+)
|
||||
create mode 100644 products/rhel8/kickstart/ssg-rhel8-ism_o-ks.cfg
|
||||
create mode 100644 products/rhel9/kickstart/ssg-rhel9-ism_o-ks.cfg
|
||||
|
||||
diff --git a/products/rhel8/kickstart/ssg-rhel8-ism_o-ks.cfg b/products/rhel8/kickstart/ssg-rhel8-ism_o-ks.cfg
|
||||
new file mode 100644
|
||||
index 0000000000..d84d98b12d
|
||||
--- /dev/null
|
||||
+++ b/products/rhel8/kickstart/ssg-rhel8-ism_o-ks.cfg
|
||||
@@ -0,0 +1,116 @@
|
||||
+# SCAP Security Guide ISM Official profile kickstart for Red Hat Enterprise Linux 8 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-16
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#performing_an_automated_installation_using_kickstart
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# sssd profile sets sha512 to hash passwords
|
||||
+# passwords are shadowed by default
|
||||
+# See the manual page for authselect-profile for a complete list of possible options.
|
||||
+authselect select sssd
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet"
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+autopart
|
||||
+
|
||||
+# Harden installation with Essential Eight profile
|
||||
+# For more details and configuration options see
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#addon-org_fedora_oscap_kickstart-commands-for-addons-supplied-with-the-rhel-installation-program
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_ism_o
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
||||
diff --git a/products/rhel9/kickstart/ssg-rhel9-ism_o-ks.cfg b/products/rhel9/kickstart/ssg-rhel9-ism_o-ks.cfg
|
||||
new file mode 100644
|
||||
index 0000000000..517919539a
|
||||
--- /dev/null
|
||||
+++ b/products/rhel9/kickstart/ssg-rhel9-ism_o-ks.cfg
|
||||
@@ -0,0 +1,116 @@
|
||||
+# SCAP Security Guide ISM Official profile kickstart for Red Hat Enterprise Linux 9 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-16
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#performing_an_automated_installation_using_kickstart
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# sssd profile sets sha512 to hash passwords
|
||||
+# passwords are shadowed by default
|
||||
+# See the manual page for authselect-profile for a complete list of possible options.
|
||||
+authselect select sssd
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet"
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+autopart
|
||||
+
|
||||
+# Harden installation with Essential Eight profile
|
||||
+# For more details and configuration options see
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#addon-org_fedora_oscap_kickstart-commands-for-addons-supplied-with-the-rhel-installation-program
|
||||
+%addon com_redhat_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_ism_o
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
@ -1,36 +0,0 @@
|
||||
From 7189a9f4aa319b823e241ca11a798762bd62515f Mon Sep 17 00:00:00 2001
|
||||
From: Matej Tyc <matyc@redhat.com>
|
||||
Date: Tue, 31 Aug 2021 13:58:00 +0200
|
||||
Subject: [PATCH] Allow HID USB in the ISM profile
|
||||
|
||||
The usbguard is too strict without this rule,
|
||||
and its default setting blocks keyboard and mouse.
|
||||
---
|
||||
products/rhel8/profiles/ism_o.profile | 1 +
|
||||
products/rhel9/profiles/ism_o.profile | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/products/rhel8/profiles/ism_o.profile b/products/rhel8/profiles/ism_o.profile
|
||||
index 95cdfc4ede..2e78dc8776 100644
|
||||
--- a/products/rhel8/profiles/ism_o.profile
|
||||
+++ b/products/rhel8/profiles/ism_o.profile
|
||||
@@ -52,6 +52,7 @@ selections:
|
||||
## Identifiers 1418
|
||||
- package_usbguard_installed
|
||||
- service_usbguard_enabled
|
||||
+ - usbguard_allow_hid_and_hub
|
||||
|
||||
## Authentication hardening
|
||||
## Identifiers 1546 / 0974 / 1173 / 1504 / 1505 / 1401 / 1559 / 1560
|
||||
diff --git a/products/rhel9/profiles/ism_o.profile b/products/rhel9/profiles/ism_o.profile
|
||||
index 6fc919da12..b395b0e9cb 100644
|
||||
--- a/products/rhel9/profiles/ism_o.profile
|
||||
+++ b/products/rhel9/profiles/ism_o.profile
|
||||
@@ -52,6 +52,7 @@ selections:
|
||||
## Identifiers 1418
|
||||
- package_usbguard_installed
|
||||
- service_usbguard_enabled
|
||||
+ - usbguard_allow_hid_and_hub
|
||||
|
||||
## Authentication hardening
|
||||
## Identifiers 1546 / 0974 / 1173 / 1504 / 1505 / 1401 / 1559 / 1560
|
@ -1,33 +0,0 @@
|
||||
From 0d04f65d53b83690769f7baee48ec64e785b0e00 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 23 Aug 2021 11:33:28 +0200
|
||||
Subject: [PATCH] Mark agent_mfetpd_running as machine only.
|
||||
|
||||
---
|
||||
.../mcafee_endpoint_security_software/group.yml | 2 ++
|
||||
.../package_mcafeetp_installed/rule.yml | 2 --
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml
|
||||
index f2e4e89851..b915311533 100644
|
||||
--- a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/group.yml
|
||||
@@ -5,3 +5,5 @@ title: 'McAfee Endpoint Security for Linux (ENSL)'
|
||||
description: |-
|
||||
McAfee Endpoint Security for Linux (ENSL) is a suite of software applications
|
||||
used to monitor, detect, and defend computer networks and systems.
|
||||
+
|
||||
+platform: machine
|
||||
diff --git a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml
|
||||
index 16587792ef..4c7dc8d7a2 100644
|
||||
--- a/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/endpoint_security_software/mcafee_security_software/mcafee_endpoint_security_software/package_mcafeetp_installed/rule.yml
|
||||
@@ -37,8 +37,6 @@ warnings:
|
||||
Due to McAfee Endpoint Security for Linux (ENSL) being 3rd party software,
|
||||
automated remediation is not available for this configuration check.
|
||||
|
||||
-platform: machine
|
||||
-
|
||||
template:
|
||||
name: package_installed
|
||||
vars:
|
@ -1,63 +0,0 @@
|
||||
From 8fa9ca61649a36dd1f3d5e5c72c0162a4dbfe694 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Tue, 10 Aug 2021 09:45:56 +0200
|
||||
Subject: [PATCH] Remove RHEL-08-040162 from STIG profile.
|
||||
|
||||
This item has been removed in version RHEL8 DISA STIG V1R3.
|
||||
---
|
||||
.../services/ssh/ssh_client/ssh_client_rekey_limit/rule.yml | 1 -
|
||||
products/rhel8/profiles/stig.profile | 3 ---
|
||||
tests/data/profile_stability/rhel8/stig.profile | 1 -
|
||||
tests/data/profile_stability/rhel8/stig_gui.profile | 1 -
|
||||
4 files changed, 6 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_client/ssh_client_rekey_limit/rule.yml b/linux_os/guide/services/ssh/ssh_client/ssh_client_rekey_limit/rule.yml
|
||||
index 1852313216a..f43f92c2f15 100644
|
||||
--- a/linux_os/guide/services/ssh/ssh_client/ssh_client_rekey_limit/rule.yml
|
||||
+++ b/linux_os/guide/services/ssh/ssh_client/ssh_client_rekey_limit/rule.yml
|
||||
@@ -32,7 +32,6 @@ references:
|
||||
disa: CCI-000068
|
||||
ospp: FCS_SSHS_EXT.1
|
||||
srg: SRG-OS-000423-GPOS-00187,SRG-OS-000033-GPOS-00014
|
||||
- stigid@rhel8: RHEL-08-040162
|
||||
|
||||
ocil_clause: 'it is commented out or is not set'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index a358f61dba5..9d4d1965141 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1071,9 +1071,6 @@ selections:
|
||||
# RHEL-08-040161
|
||||
- sshd_rekey_limit
|
||||
|
||||
- # RHEL-08-040162
|
||||
- - ssh_client_rekey_limit
|
||||
-
|
||||
# RHEL-08-040170
|
||||
- disable_ctrlaltdel_reboot
|
||||
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 7d54a7505fb..fca5842cf22 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -323,7 +323,6 @@ selections:
|
||||
- service_usbguard_enabled
|
||||
- set_password_hashing_algorithm_logindefs
|
||||
- set_password_hashing_algorithm_systemauth
|
||||
-- ssh_client_rekey_limit
|
||||
- sshd_disable_compression
|
||||
- sshd_disable_empty_passwords
|
||||
- sshd_disable_gssapi_auth
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 97291230e7c..35fa9ddea2b 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -334,7 +334,6 @@ selections:
|
||||
- service_usbguard_enabled
|
||||
- set_password_hashing_algorithm_logindefs
|
||||
- set_password_hashing_algorithm_systemauth
|
||||
-- ssh_client_rekey_limit
|
||||
- sshd_disable_compression
|
||||
- sshd_disable_empty_passwords
|
||||
- sshd_disable_gssapi_auth
|
@ -1,490 +0,0 @@
|
||||
From ee2da171d5a76202b2aef8231c5af6f97ef156ef Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 10:36:30 +0200
|
||||
Subject: [PATCH 1/2] add rhel7 kickstarts for cis
|
||||
|
||||
---
|
||||
products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg | 4 +-
|
||||
.../kickstart/ssg-rhel7-cis_server_l1-ks.cfg | 136 ++++++++++++++++
|
||||
.../ssg-rhel7-cis_workstation_l1-ks.cfg | 137 ++++++++++++++++
|
||||
.../ssg-rhel7-cis_workstation_l2-ks.cfg | 147 ++++++++++++++++++
|
||||
4 files changed, 422 insertions(+), 2 deletions(-)
|
||||
create mode 100644 products/rhel7/kickstart/ssg-rhel7-cis_server_l1-ks.cfg
|
||||
create mode 100644 products/rhel7/kickstart/ssg-rhel7-cis_workstation_l1-ks.cfg
|
||||
create mode 100644 products/rhel7/kickstart/ssg-rhel7-cis_workstation_l2-ks.cfg
|
||||
|
||||
diff --git a/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg b/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg
|
||||
index 6ead435b978..00edb9d536c 100644
|
||||
--- a/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg
|
||||
+++ b/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg
|
||||
@@ -1,6 +1,6 @@
|
||||
-# SCAP Security Guide CIS profile kickstart for Red Hat Enterprise Linux 7 Server
|
||||
+# SCAP Security Guide CIS profile (Leve 2 - Server) kickstart for Red Hat Enterprise Linux 7 Server
|
||||
# Version: 0.0.1
|
||||
-# Date: 2020-03-30
|
||||
+# Date: 2021-08-12
|
||||
#
|
||||
# Based on:
|
||||
# https://pykickstart.readthedocs.io/en/latest/
|
||||
diff --git a/products/rhel7/kickstart/ssg-rhel7-cis_server_l1-ks.cfg b/products/rhel7/kickstart/ssg-rhel7-cis_server_l1-ks.cfg
|
||||
new file mode 100644
|
||||
index 00000000000..333105c4f9e
|
||||
--- /dev/null
|
||||
+++ b/products/rhel7/kickstart/ssg-rhel7-cis_server_l1-ks.cfg
|
||||
@@ -0,0 +1,136 @@
|
||||
+# SCAP Security Guide CIS profile (Level 1 - Server) kickstart for Red Hat Enterprise Linux 7 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-12
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html
|
||||
+
|
||||
+# Install a fresh new system (optional)
|
||||
+install
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+# NOTE: Usage of DHCP will fail CCE-27021-5 (DISA FSO RHEL-06-000292). To use static IP configuration,
|
||||
+# "--bootproto=static" must be used. For example:
|
||||
+# network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver 192.168.2.1,192.168.3.1
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# --enableshadow enable shadowed passwords by default
|
||||
+# --passalgo hash / crypt algorithm for new passwords
|
||||
+# See the manual page for authconfig for a complete list of possible options.
|
||||
+authconfig --enableshadow --passalgo=sha512
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+# Plaintext password is: password
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet" --password=$6$zCPaBARiNlBYUAS7$40phthWpqvaPVz3QUeIK6n5qoazJDJD5Nlc9OKy5SyYoX9Rt4jFaLjzqJCwpgR4RVAEFSADsqQot0WKs5qNto0
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+part /boot --fstype=xfs --size=512
|
||||
+part pv.01 --grow --size=1
|
||||
+
|
||||
+# Create a Logical Volume Management (LVM) group (optional)
|
||||
+volgroup VolGroup --pesize=4096 pv.01
|
||||
+
|
||||
+# Create particular logical volumes (optional)
|
||||
+logvol / --fstype=xfs --name=LogVol06 --vgname=VolGroup --size=11264 --grow
|
||||
+# Ensure /tmp Located On Separate Partition
|
||||
+logvol /tmp --fstype=xfs --name=LogVol01 --vgname=VolGroup --size=1024 --fsoptions="nodev,noexec,nosuid"
|
||||
+logvol swap --name=lv_swap --vgname=VolGroup --size=2016
|
||||
+
|
||||
+
|
||||
+# Harden installation with CIS profile
|
||||
+# For more details and configuration options see command %addon org_fedora_oscap in
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax#sect-kickstart-commands
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_cis_server_l1
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
||||
diff --git a/products/rhel7/kickstart/ssg-rhel7-cis_workstation_l1-ks.cfg b/products/rhel7/kickstart/ssg-rhel7-cis_workstation_l1-ks.cfg
|
||||
new file mode 100644
|
||||
index 00000000000..7ca9fe8558b
|
||||
--- /dev/null
|
||||
+++ b/products/rhel7/kickstart/ssg-rhel7-cis_workstation_l1-ks.cfg
|
||||
@@ -0,0 +1,137 @@
|
||||
+# SCAP Security Guide CIS profile (Level 1 - Workstation) kickstart for Red Hat Enterprise Linux 7 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-12
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html
|
||||
+
|
||||
+# Install a fresh new system (optional)
|
||||
+install
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+# NOTE: Usage of DHCP will fail CCE-27021-5 (DISA FSO RHEL-06-000292). To use static IP configuration,
|
||||
+# "--bootproto=static" must be used. For example:
|
||||
+# network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver 192.168.2.1,192.168.3.1
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# --enableshadow enable shadowed passwords by default
|
||||
+# --passalgo hash / crypt algorithm for new passwords
|
||||
+# See the manual page for authconfig for a complete list of possible options.
|
||||
+authconfig --enableshadow --passalgo=sha512
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+# Plaintext password is: password
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet" --password=$6$zCPaBARiNlBYUAS7$40phthWpqvaPVz3QUeIK6n5qoazJDJD5Nlc9OKy5SyYoX9Rt4jFaLjzqJCwpgR4RVAEFSADsqQot0WKs5qNto0
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+part /boot --fstype=xfs --size=512
|
||||
+part pv.01 --grow --size=1
|
||||
+
|
||||
+# Create a Logical Volume Management (LVM) group (optional)
|
||||
+volgroup VolGroup --pesize=4096 pv.01
|
||||
+
|
||||
+# Create particular logical volumes (optional)
|
||||
+logvol / --fstype=xfs --name=LogVol06 --vgname=VolGroup --size=11264 --grow
|
||||
+# Ensure /tmp Located On Separate Partition
|
||||
+logvol /tmp --fstype=xfs --name=LogVol01 --vgname=VolGroup --size=1024 --fsoptions="nodev,noexec,nosuid"
|
||||
+logvol swap --name=lv_swap --vgname=VolGroup --size=2016
|
||||
+
|
||||
+
|
||||
+
|
||||
+# Harden installation with CIS profile
|
||||
+# For more details and configuration options see command %addon org_fedora_oscap in
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax#sect-kickstart-commands
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_cis_workstation_l1
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
||||
diff --git a/products/rhel7/kickstart/ssg-rhel7-cis_workstation_l2-ks.cfg b/products/rhel7/kickstart/ssg-rhel7-cis_workstation_l2-ks.cfg
|
||||
new file mode 100644
|
||||
index 00000000000..b9bff5f390e
|
||||
--- /dev/null
|
||||
+++ b/products/rhel7/kickstart/ssg-rhel7-cis_workstation_l2-ks.cfg
|
||||
@@ -0,0 +1,147 @@
|
||||
+# SCAP Security Guide CIS profile (Level 2 - Workstation) kickstart for Red Hat Enterprise Linux 7 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-12
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html
|
||||
+
|
||||
+# Install a fresh new system (optional)
|
||||
+install
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+# NOTE: Usage of DHCP will fail CCE-27021-5 (DISA FSO RHEL-06-000292). To use static IP configuration,
|
||||
+# "--bootproto=static" must be used. For example:
|
||||
+# network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver 192.168.2.1,192.168.3.1
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# --enableshadow enable shadowed passwords by default
|
||||
+# --passalgo hash / crypt algorithm for new passwords
|
||||
+# See the manual page for authconfig for a complete list of possible options.
|
||||
+authconfig --enableshadow --passalgo=sha512
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+# Plaintext password is: password
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet" --password=$6$zCPaBARiNlBYUAS7$40phthWpqvaPVz3QUeIK6n5qoazJDJD5Nlc9OKy5SyYoX9Rt4jFaLjzqJCwpgR4RVAEFSADsqQot0WKs5qNto0
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+part /boot --fstype=xfs --size=512
|
||||
+part pv.01 --grow --size=1
|
||||
+
|
||||
+# Create a Logical Volume Management (LVM) group (optional)
|
||||
+volgroup VolGroup --pesize=4096 pv.01
|
||||
+
|
||||
+# Create particular logical volumes (optional)
|
||||
+logvol / --fstype=xfs --name=LogVol06 --vgname=VolGroup --size=11264 --grow
|
||||
+# Ensure /home Located On Separate Partition
|
||||
+logvol /home --fstype=xfs --name=LogVol02 --vgname=VolGroup --size=1024 --fsoptions="nodev"
|
||||
+# Ensure /tmp Located On Separate Partition
|
||||
+logvol /tmp --fstype=xfs --name=LogVol01 --vgname=VolGroup --size=1024 --fsoptions="nodev,noexec,nosuid"
|
||||
+# Ensure /var/tmp Located On Separate Partition
|
||||
+logvol /var/tmp --fstype=xfs --name=LogVol7 --vgname=VolGroup --size=1024 --fsoptions="nodev,nosuid,noexec"
|
||||
+# Ensure /var Located On Separate Partition
|
||||
+logvol /var --fstype=xfs --name=LogVol03 --vgname=VolGroup --size=2048
|
||||
+# Ensure /var/log Located On Separate Partition
|
||||
+logvol /var/log --fstype=xfs --name=LogVol04 --vgname=VolGroup --size=1024
|
||||
+# Ensure /var/log/audit Located On Separate Partition
|
||||
+logvol /var/log/audit --fstype=xfs --name=LogVol05 --vgname=VolGroup --size=512
|
||||
+logvol swap --name=lv_swap --vgname=VolGroup --size=2016
|
||||
+
|
||||
+
|
||||
+
|
||||
+# Harden installation with CIS profile
|
||||
+# For more details and configuration options see command %addon org_fedora_oscap in
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax#sect-kickstart-commands
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_cis_workstation_l2
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
||||
|
||||
From 92e84a2c1b302291aa8ffbc08ae3e4ffabd5dfe7 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Wed, 18 Aug 2021 14:24:34 +0200
|
||||
Subject: [PATCH 2/2] Fix typo in the CIS kickstart
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Co-authored-by: Jan Černý <jcerny@redhat.com>
|
||||
---
|
||||
products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg b/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg
|
||||
index 00edb9d536c..7062e2974ad 100644
|
||||
--- a/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg
|
||||
+++ b/products/rhel7/kickstart/ssg-rhel7-cis-ks.cfg
|
||||
@@ -1,4 +1,4 @@
|
||||
-# SCAP Security Guide CIS profile (Leve 2 - Server) kickstart for Red Hat Enterprise Linux 7 Server
|
||||
+# SCAP Security Guide CIS profile (Level 2 - Server) kickstart for Red Hat Enterprise Linux 7 Server
|
||||
# Version: 0.0.1
|
||||
# Date: 2021-08-12
|
||||
#
|
@ -1,302 +0,0 @@
|
||||
From 5f8264ed7c5580fdd013810a713ab9b3b296bf4a Mon Sep 17 00:00:00 2001
|
||||
From: Alex Haydock <alex@alexhaydock.co.uk>
|
||||
Date: Mon, 9 Aug 2021 11:46:22 +0100
|
||||
Subject: [PATCH] Update RHEL 8 CIS references to match benchmark 1.0.1
|
||||
|
||||
---
|
||||
.../file_groupowner_backup_etc_group/rule.yml | 2 +-
|
||||
.../file_groupowner_backup_etc_gshadow/rule.yml | 2 +-
|
||||
.../file_groupowner_backup_etc_passwd/rule.yml | 2 +-
|
||||
.../file_groupowner_backup_etc_shadow/rule.yml | 2 +-
|
||||
.../file_groupowner_etc_group/rule.yml | 2 +-
|
||||
.../file_groupowner_etc_gshadow/rule.yml | 2 +-
|
||||
.../file_groupowner_etc_shadow/rule.yml | 2 +-
|
||||
.../file_owner_backup_etc_group/rule.yml | 2 +-
|
||||
.../file_owner_backup_etc_gshadow/rule.yml | 2 +-
|
||||
.../file_owner_backup_etc_passwd/rule.yml | 2 +-
|
||||
.../file_owner_backup_etc_shadow/rule.yml | 2 +-
|
||||
.../file_owner_etc_group/rule.yml | 2 +-
|
||||
.../file_owner_etc_gshadow/rule.yml | 2 +-
|
||||
.../file_owner_etc_shadow/rule.yml | 2 +-
|
||||
.../file_permissions_backup_etc_group/rule.yml | 2 +-
|
||||
.../file_permissions_backup_etc_gshadow/rule.yml | 2 +-
|
||||
.../file_permissions_backup_etc_passwd/rule.yml | 2 +-
|
||||
.../file_permissions_backup_etc_shadow/rule.yml | 2 +-
|
||||
.../file_permissions_etc_group/rule.yml | 2 +-
|
||||
.../file_permissions_etc_gshadow/rule.yml | 2 +-
|
||||
.../file_permissions_etc_shadow/rule.yml | 2 +-
|
||||
21 files changed, 21 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_group/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_group/rule.yml
|
||||
index c4a7f19b94..fdbdbb08ad 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_group/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_group/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.9
|
||||
- cis@rhel8: 6.1.8
|
||||
+ cis@rhel8: 6.1.9
|
||||
cis@ubuntu2004: 6.1.8
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/group-", group="root") }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_gshadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_gshadow/rule.yml
|
||||
index 5348e80954..f1f7c7a4d6 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_gshadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_gshadow/rule.yml
|
||||
@@ -23,7 +23,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.6
|
||||
- cis@rhel8: 6.1.9
|
||||
+ cis@rhel8: 6.1.7
|
||||
cis@ubuntu2004: 6.1.3
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/gshadow-", group=target_group) }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_passwd/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_passwd/rule.yml
|
||||
index 170f6412cf..26ff82fb51 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_passwd/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_passwd/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.3
|
||||
- cis@rhel8: 6.1.6
|
||||
+ cis@rhel8: 6.1.3
|
||||
cis@ubuntu2004: 6.1.6
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/passwd-", group="root") }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_shadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_shadow/rule.yml
|
||||
index ce50f98e3f..07a3d919e2 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_shadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_backup_etc_shadow/rule.yml
|
||||
@@ -24,7 +24,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.5
|
||||
- cis@rhel8: 6.1.7
|
||||
+ cis@rhel8: 6.1.5
|
||||
cis@ubuntu2004: 6.1.7
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/shadow-", group=target_group) }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_group/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_group/rule.yml
|
||||
index 050dd198c3..7c3c3ac1d2 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_group/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_group/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
references:
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.8
|
||||
- cis@rhel8: 6.1.4
|
||||
+ cis@rhel8: 6.1.8
|
||||
cis@ubuntu2004: 6.1.5
|
||||
cjis: 5.5.2.2
|
||||
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_gshadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_gshadow/rule.yml
|
||||
index 4d4e3ff788..ca65dbc5af 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_gshadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_gshadow/rule.yml
|
||||
@@ -24,7 +24,7 @@ identifiers:
|
||||
references:
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.7
|
||||
- cis@rhel8: 6.1.5
|
||||
+ cis@rhel8: 6.1.6
|
||||
cis@ubuntu2004: 6.1.9
|
||||
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
|
||||
isa-62443-2009: 4.3.3.7.3
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_shadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_shadow/rule.yml
|
||||
index 2af088f528..d59a34ef04 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_shadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_groupowner_etc_shadow/rule.yml
|
||||
@@ -24,7 +24,7 @@ identifiers:
|
||||
references:
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.4
|
||||
- cis@rhel8: 6.1.3
|
||||
+ cis@rhel8: 6.1.4
|
||||
cis@ubuntu2004: 6.1.4
|
||||
cjis: 5.5.2.2
|
||||
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_group/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_group/rule.yml
|
||||
index 9021403357..2f2f475abf 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_group/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_group/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.9
|
||||
- cis@rhel8: 6.1.8
|
||||
+ cis@rhel8: 6.1.9
|
||||
cis@ubuntu2004: 6.1.8
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_owner(file="/etc/group-", owner="root") }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_gshadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_gshadow/rule.yml
|
||||
index 3f25afef5f..afbcd11696 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_gshadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_gshadow/rule.yml
|
||||
@@ -17,7 +17,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.6
|
||||
- cis@rhel8: 6.1.9
|
||||
+ cis@rhel8: 6.1.7
|
||||
cis@ubuntu2004: 6.1.3
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_owner(file="/etc/gshadow-", owner="root") }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_passwd/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_passwd/rule.yml
|
||||
index d16f370572..8a3af3ae70 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_passwd/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_passwd/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.3
|
||||
- cis@rhel8: 6.1.6
|
||||
+ cis@rhel8: 6.1.3
|
||||
cis@ubuntu2004: 6.1.6
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_owner(file="/etc/passwd-", owner="root") }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_shadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_shadow/rule.yml
|
||||
index 7ef757c006..508bc355c3 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_shadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_backup_etc_shadow/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.5
|
||||
- cis@rhel8: 6.1.7
|
||||
+ cis@rhel8: 6.1.5
|
||||
cis@ubuntu2004: 6.1.7
|
||||
|
||||
ocil_clause: '{{{ ocil_clause_file_owner(file="/etc/shadow-", owner="root") }}}'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_group/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_group/rule.yml
|
||||
index 90fd7b08eb..8e2cb53c67 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_group/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_group/rule.yml
|
||||
@@ -18,7 +18,7 @@ identifiers:
|
||||
references:
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.8
|
||||
- cis@rhel8: 6.1.4
|
||||
+ cis@rhel8: 6.1.8
|
||||
cis@sle15: 6.1.6
|
||||
cis@ubuntu2004: 6.1.5
|
||||
cjis: 5.5.2.2
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_gshadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_gshadow/rule.yml
|
||||
index cb16d61e88..fb91cee6d7 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_gshadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_gshadow/rule.yml
|
||||
@@ -19,7 +19,7 @@ references:
|
||||
anssi: BP28(R36)
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.7
|
||||
- cis@rhel8: 6.1.5
|
||||
+ cis@rhel8: 6.1.6
|
||||
cis@ubuntu2004: 6.1.9
|
||||
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
|
||||
isa-62443-2009: 4.3.3.7.3
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_shadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_shadow/rule.yml
|
||||
index 7c56014953..1099e5e7cc 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_shadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_owner_etc_shadow/rule.yml
|
||||
@@ -22,7 +22,7 @@ references:
|
||||
anssi: BP28(R36)
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.4
|
||||
- cis@rhel8: 6.1.3
|
||||
+ cis@rhel8: 6.1.4
|
||||
cis@ubuntu2004: 6.1.4
|
||||
cjis: 5.5.2.2
|
||||
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_group/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_group/rule.yml
|
||||
index 11f3818332..5d165a606e 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_group/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_group/rule.yml
|
||||
@@ -19,7 +19,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.9
|
||||
- cis@rhel8: 6.1.8
|
||||
+ cis@rhel8: 6.1.9
|
||||
cis@sle15: 6.1.9
|
||||
cis@ubuntu2004: 6.1.8
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_gshadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_gshadow/rule.yml
|
||||
index 05208fee37..9fd8981485 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_gshadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_gshadow/rule.yml
|
||||
@@ -26,7 +26,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.6
|
||||
- cis@rhel8: 6.1.9
|
||||
+ cis@rhel8: 6.1.7
|
||||
cis@sle15: 6.1.3
|
||||
cis@ubuntu2004: 6.1.3
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_passwd/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_passwd/rule.yml
|
||||
index 6de0c5f703..67191c872d 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_passwd/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_passwd/rule.yml
|
||||
@@ -19,7 +19,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.3
|
||||
- cis@rhel8: 6.1.6
|
||||
+ cis@rhel8: 6.1.3
|
||||
cis@sle15: 6.1.7
|
||||
cis@ubuntu2004: 6.1.6
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_shadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_shadow/rule.yml
|
||||
index c9a4fce34c..685427c0a0 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_shadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_backup_etc_shadow/rule.yml
|
||||
@@ -27,7 +27,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@rhel7: 6.1.5
|
||||
- cis@rhel8: 6.1.7
|
||||
+ cis@rhel8: 6.1.5
|
||||
cis@sle15: 6.1.8
|
||||
cis@ubuntu2004: 6.1.7
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_group/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_group/rule.yml
|
||||
index 1333bcb57b..fbf650b26d 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_group/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_group/rule.yml
|
||||
@@ -20,7 +20,7 @@ references:
|
||||
anssi: BP28(R36)
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.8
|
||||
- cis@rhel8: 6.1.4
|
||||
+ cis@rhel8: 6.1.8
|
||||
cis@sle15: 6.1.6
|
||||
cis@ubuntu2004: 6.1.5
|
||||
cjis: 5.5.2.2
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_gshadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_gshadow/rule.yml
|
||||
index c9b3495381..02404617c1 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_gshadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_gshadow/rule.yml
|
||||
@@ -28,7 +28,7 @@ references:
|
||||
anssi: BP28(R36)
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.7
|
||||
- cis@rhel8: 6.1.5
|
||||
+ cis@rhel8: 6.1.6
|
||||
cis@sle15: 6.1.2
|
||||
cis@ubuntu2004: 6.1.9
|
||||
cobit5: APO01.06,DSS05.04,DSS05.07,DSS06.02
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_shadow/rule.yml b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_shadow/rule.yml
|
||||
index acbc478ce9..ff4db782f0 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_shadow/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_important_account_files/file_permissions_etc_shadow/rule.yml
|
||||
@@ -31,7 +31,7 @@ references:
|
||||
anssi: BP28(R36)
|
||||
cis-csc: 12,13,14,15,16,18,3,5
|
||||
cis@rhel7: 6.1.4
|
||||
- cis@rhel8: 6.1.3
|
||||
+ cis@rhel8: 6.1.4
|
||||
cis@sle15: 6.1.5
|
||||
cis@ubuntu2004: 6.1.4
|
||||
cjis: 5.5.2.2
|
@ -1,455 +0,0 @@
|
||||
From b3dc8273ded33d8357239482cf07186b14e3cdd2 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 10:54:59 +0200
|
||||
Subject: [PATCH] add kickstarts for rhel8 CIS profiles
|
||||
|
||||
---
|
||||
products/rhel8/kickstart/ssg-rhel8-cis-ks.cfg | 4 +-
|
||||
.../kickstart/ssg-rhel8-cis_server_l1-ks.cfg | 133 ++++++++++++++++
|
||||
.../ssg-rhel8-cis_workstation_l1-ks.cfg | 133 ++++++++++++++++
|
||||
.../ssg-rhel8-cis_workstation_l2-ks.cfg | 143 ++++++++++++++++++
|
||||
4 files changed, 411 insertions(+), 2 deletions(-)
|
||||
create mode 100644 products/rhel8/kickstart/ssg-rhel8-cis_server_l1-ks.cfg
|
||||
create mode 100644 products/rhel8/kickstart/ssg-rhel8-cis_workstation_l1-ks.cfg
|
||||
create mode 100644 products/rhel8/kickstart/ssg-rhel8-cis_workstation_l2-ks.cfg
|
||||
|
||||
diff --git a/products/rhel8/kickstart/ssg-rhel8-cis-ks.cfg b/products/rhel8/kickstart/ssg-rhel8-cis-ks.cfg
|
||||
index c3f31429036..d1bbb09c422 100644
|
||||
--- a/products/rhel8/kickstart/ssg-rhel8-cis-ks.cfg
|
||||
+++ b/products/rhel8/kickstart/ssg-rhel8-cis-ks.cfg
|
||||
@@ -1,6 +1,6 @@
|
||||
-# SCAP Security Guide CIS profile kickstart for Red Hat Enterprise Linux 8 Server
|
||||
+# SCAP Security Guide CIS profile (Level 2 - Server) kickstart for Red Hat Enterprise Linux 8 Server
|
||||
# Version: 0.0.1
|
||||
-# Date: 2020-03-30
|
||||
+# Date: 2021-08-12
|
||||
#
|
||||
# Based on:
|
||||
# https://pykickstart.readthedocs.io/en/latest/
|
||||
diff --git a/products/rhel8/kickstart/ssg-rhel8-cis_server_l1-ks.cfg b/products/rhel8/kickstart/ssg-rhel8-cis_server_l1-ks.cfg
|
||||
new file mode 100644
|
||||
index 00000000000..b73d5c12d21
|
||||
--- /dev/null
|
||||
+++ b/products/rhel8/kickstart/ssg-rhel8-cis_server_l1-ks.cfg
|
||||
@@ -0,0 +1,133 @@
|
||||
+# SCAP Security Guide CIS profile (Level 1 - Server) kickstart for Red Hat Enterprise Linux 8 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-12
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#performing_an_automated_installation_using_kickstart
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+# NOTE: Usage of DHCP will fail CCE-27021-5 (DISA FSO RHEL-06-000292). To use static IP configuration,
|
||||
+# "--bootproto=static" must be used. For example:
|
||||
+# network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver 192.168.2.1,192.168.3.1
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# sssd profile sets sha512 to hash passwords
|
||||
+# passwords are shadowed by default
|
||||
+# See the manual page for authselect-profile for a complete list of possible options.
|
||||
+authselect select sssd
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+# Plaintext password is: password
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet" --password=$6$zCPaBARiNlBYUAS7$40phthWpqvaPVz3QUeIK6n5qoazJDJD5Nlc9OKy5SyYoX9Rt4jFaLjzqJCwpgR4RVAEFSADsqQot0WKs5qNto0
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+part /boot --fstype=xfs --size=512
|
||||
+part pv.01 --grow --size=1
|
||||
+
|
||||
+# Create a Logical Volume Management (LVM) group (optional)
|
||||
+volgroup VolGroup --pesize=4096 pv.01
|
||||
+
|
||||
+# Create particular logical volumes (optional)
|
||||
+logvol / --fstype=xfs --name=LogVol06 --vgname=VolGroup --size=10240 --grow
|
||||
+# Ensure /tmp Located On Separate Partition
|
||||
+logvol /tmp --fstype=xfs --name=LogVol01 --vgname=VolGroup --size=1024 --fsoptions="nodev,noexec,nosuid"
|
||||
+logvol swap --name=lv_swap --vgname=VolGroup --size=2016
|
||||
+
|
||||
+
|
||||
+# Harden installation with CIS profile
|
||||
+# For more details and configuration options see
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#addon-org_fedora_oscap_kickstart-commands-for-addons-supplied-with-the-rhel-installation-program
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_cis_server_l1
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
||||
diff --git a/products/rhel8/kickstart/ssg-rhel8-cis_workstation_l1-ks.cfg b/products/rhel8/kickstart/ssg-rhel8-cis_workstation_l1-ks.cfg
|
||||
new file mode 100644
|
||||
index 00000000000..33bd9dd2560
|
||||
--- /dev/null
|
||||
+++ b/products/rhel8/kickstart/ssg-rhel8-cis_workstation_l1-ks.cfg
|
||||
@@ -0,0 +1,133 @@
|
||||
+# SCAP Security Guide CIS profile (Level 1 - Workstation) kickstart for Red Hat Enterprise Linux 8 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-12
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#performing_an_automated_installation_using_kickstart
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+# NOTE: Usage of DHCP will fail CCE-27021-5 (DISA FSO RHEL-06-000292). To use static IP configuration,
|
||||
+# "--bootproto=static" must be used. For example:
|
||||
+# network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver 192.168.2.1,192.168.3.1
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# sssd profile sets sha512 to hash passwords
|
||||
+# passwords are shadowed by default
|
||||
+# See the manual page for authselect-profile for a complete list of possible options.
|
||||
+authselect select sssd
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+# Plaintext password is: password
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet" --password=$6$zCPaBARiNlBYUAS7$40phthWpqvaPVz3QUeIK6n5qoazJDJD5Nlc9OKy5SyYoX9Rt4jFaLjzqJCwpgR4RVAEFSADsqQot0WKs5qNto0
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+part /boot --fstype=xfs --size=512
|
||||
+part pv.01 --grow --size=1
|
||||
+
|
||||
+# Create a Logical Volume Management (LVM) group (optional)
|
||||
+volgroup VolGroup --pesize=4096 pv.01
|
||||
+
|
||||
+# Create particular logical volumes (optional)
|
||||
+logvol / --fstype=xfs --name=LogVol06 --vgname=VolGroup --size=10240 --grow
|
||||
+# Ensure /tmp Located On Separate Partition
|
||||
+logvol /tmp --fstype=xfs --name=LogVol01 --vgname=VolGroup --size=1024 --fsoptions="nodev,noexec,nosuid"
|
||||
+logvol swap --name=lv_swap --vgname=VolGroup --size=2016
|
||||
+
|
||||
+
|
||||
+# Harden installation with CIS profile
|
||||
+# For more details and configuration options see
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#addon-org_fedora_oscap_kickstart-commands-for-addons-supplied-with-the-rhel-installation-program
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_cis_workstation_l1
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
||||
diff --git a/products/rhel8/kickstart/ssg-rhel8-cis_workstation_l2-ks.cfg b/products/rhel8/kickstart/ssg-rhel8-cis_workstation_l2-ks.cfg
|
||||
new file mode 100644
|
||||
index 00000000000..79ca7fbc201
|
||||
--- /dev/null
|
||||
+++ b/products/rhel8/kickstart/ssg-rhel8-cis_workstation_l2-ks.cfg
|
||||
@@ -0,0 +1,143 @@
|
||||
+# SCAP Security Guide CIS profile (Level 2 - Workstation) kickstart for Red Hat Enterprise Linux 8 Server
|
||||
+# Version: 0.0.1
|
||||
+# Date: 2021-08-12
|
||||
+#
|
||||
+# Based on:
|
||||
+# https://pykickstart.readthedocs.io/en/latest/
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#performing_an_automated_installation_using_kickstart
|
||||
+
|
||||
+# Specify installation method to use for installation
|
||||
+# To use a different one comment out the 'url' one below, update
|
||||
+# the selected choice with proper options & un-comment it
|
||||
+#
|
||||
+# Install from an installation tree on a remote server via FTP or HTTP:
|
||||
+# --url the URL to install from
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# url --url=http://192.168.122.1/image
|
||||
+#
|
||||
+# Modify concrete URL in the above example appropriately to reflect the actual
|
||||
+# environment machine is to be installed in
|
||||
+#
|
||||
+# Other possible / supported installation methods:
|
||||
+# * install from the first CD-ROM/DVD drive on the system:
|
||||
+#
|
||||
+# cdrom
|
||||
+#
|
||||
+# * install from a directory of ISO images on a local drive:
|
||||
+#
|
||||
+# harddrive --partition=hdb2 --dir=/tmp/install-tree
|
||||
+#
|
||||
+# * install from provided NFS server:
|
||||
+#
|
||||
+# nfs --server=<hostname> --dir=<directory> [--opts=<nfs options>]
|
||||
+#
|
||||
+
|
||||
+# Set language to use during installation and the default language to use on the installed system (required)
|
||||
+lang en_US.UTF-8
|
||||
+
|
||||
+# Set system keyboard type / layout (required)
|
||||
+keyboard us
|
||||
+
|
||||
+# Configure network information for target system and activate network devices in the installer environment (optional)
|
||||
+# --onboot enable device at a boot time
|
||||
+# --device device to be activated and / or configured with the network command
|
||||
+# --bootproto method to obtain networking configuration for device (default dhcp)
|
||||
+# --noipv6 disable IPv6 on this device
|
||||
+#
|
||||
+# NOTE: Usage of DHCP will fail CCE-27021-5 (DISA FSO RHEL-06-000292). To use static IP configuration,
|
||||
+# "--bootproto=static" must be used. For example:
|
||||
+# network --bootproto=static --ip=10.0.2.15 --netmask=255.255.255.0 --gateway=10.0.2.254 --nameserver 192.168.2.1,192.168.3.1
|
||||
+#
|
||||
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
|
||||
+
|
||||
+# Set the system's root password (required)
|
||||
+# Plaintext password is: server
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+rootpw --iscrypted $6$/0RYeeRdK70ynvYz$jH2ZN/80HM6DjndHMxfUF9KIibwipitvizzXDH1zW.fTjyD3RD3tkNdNUaND18B/XqfAUW3vy1uebkBybCuIm0
|
||||
+
|
||||
+# The selected profile will restrict root login
|
||||
+# Add a user that can login and escalate privileges
|
||||
+# Plaintext password is: admin123
|
||||
+user --name=admin --groups=wheel --password=$6$Ga6ZnIlytrWpuCzO$q0LqT1USHpahzUafQM9jyHCY9BiE5/ahXLNWUMiVQnFGblu0WWGZ1e6icTaCGO4GNgZNtspp1Let/qpM7FMVB0 --iscrypted
|
||||
+
|
||||
+# Configure firewall settings for the system (optional)
|
||||
+# --enabled reject incoming connections that are not in response to outbound requests
|
||||
+# --ssh allow sshd service through the firewall
|
||||
+firewall --enabled --ssh
|
||||
+
|
||||
+# Set up the authentication options for the system (required)
|
||||
+# sssd profile sets sha512 to hash passwords
|
||||
+# passwords are shadowed by default
|
||||
+# See the manual page for authselect-profile for a complete list of possible options.
|
||||
+authselect select sssd
|
||||
+
|
||||
+# State of SELinux on the installed system (optional)
|
||||
+# Defaults to enforcing
|
||||
+selinux --enforcing
|
||||
+
|
||||
+# Set the system time zone (required)
|
||||
+timezone --utc America/New_York
|
||||
+
|
||||
+# Specify how the bootloader should be installed (required)
|
||||
+# Plaintext password is: password
|
||||
+# Refer to e.g. https://pykickstart.readthedocs.io/en/latest/commands.html#rootpw to see how to create
|
||||
+# encrypted password form for different plaintext password
|
||||
+bootloader --location=mbr --append="crashkernel=auto rhgb quiet" --password=$6$zCPaBARiNlBYUAS7$40phthWpqvaPVz3QUeIK6n5qoazJDJD5Nlc9OKy5SyYoX9Rt4jFaLjzqJCwpgR4RVAEFSADsqQot0WKs5qNto0
|
||||
+
|
||||
+# Initialize (format) all disks (optional)
|
||||
+zerombr
|
||||
+
|
||||
+# The following partition layout scheme assumes disk of size 20GB or larger
|
||||
+# Modify size of partitions appropriately to reflect actual machine's hardware
|
||||
+#
|
||||
+# Remove Linux partitions from the system prior to creating new ones (optional)
|
||||
+# --linux erase all Linux partitions
|
||||
+# --initlabel initialize the disk label to the default based on the underlying architecture
|
||||
+clearpart --linux --initlabel
|
||||
+
|
||||
+# Create primary system partitions (required for installs)
|
||||
+part /boot --fstype=xfs --size=512
|
||||
+part pv.01 --grow --size=1
|
||||
+
|
||||
+# Create a Logical Volume Management (LVM) group (optional)
|
||||
+volgroup VolGroup --pesize=4096 pv.01
|
||||
+
|
||||
+# Create particular logical volumes (optional)
|
||||
+logvol / --fstype=xfs --name=LogVol06 --vgname=VolGroup --size=10240 --grow
|
||||
+# Ensure /home Located On Separate Partition
|
||||
+logvol /home --fstype=xfs --name=LogVol02 --vgname=VolGroup --size=1024 --fsoptions="nodev"
|
||||
+# Ensure /tmp Located On Separate Partition
|
||||
+logvol /tmp --fstype=xfs --name=LogVol01 --vgname=VolGroup --size=1024 --fsoptions="nodev,noexec,nosuid"
|
||||
+# Ensure /var/tmp Located On Separate Partition
|
||||
+logvol /var/tmp --fstype=xfs --name=LogVol7 --vgname=VolGroup --size=1024 --fsoptions="nodev,nosuid,noexec"
|
||||
+# Ensure /var Located On Separate Partition
|
||||
+logvol /var --fstype=xfs --name=LogVol03 --vgname=VolGroup --size=3072
|
||||
+# Ensure /var/log Located On Separate Partition
|
||||
+logvol /var/log --fstype=xfs --name=LogVol04 --vgname=VolGroup --size=1024
|
||||
+# Ensure /var/log/audit Located On Separate Partition
|
||||
+logvol /var/log/audit --fstype=xfs --name=LogVol05 --vgname=VolGroup --size=512
|
||||
+logvol swap --name=lv_swap --vgname=VolGroup --size=2016
|
||||
+
|
||||
+
|
||||
+# Harden installation with CIS profile
|
||||
+# For more details and configuration options see
|
||||
+# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/performing_an_advanced_rhel_installation/index#addon-org_fedora_oscap_kickstart-commands-for-addons-supplied-with-the-rhel-installation-program
|
||||
+%addon org_fedora_oscap
|
||||
+ content-type = scap-security-guide
|
||||
+ profile = xccdf_org.ssgproject.content_profile_cis_workstation_l2
|
||||
+%end
|
||||
+
|
||||
+# Packages selection (%packages section is required)
|
||||
+%packages
|
||||
+
|
||||
+# Require @Base
|
||||
+@Base
|
||||
+
|
||||
+%end # End of %packages section
|
||||
+
|
||||
+# Reboot after the installation is complete (optional)
|
||||
+# --eject attempt to eject CD or DVD media before rebooting
|
||||
+reboot --eject
|
@ -1,687 +0,0 @@
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_approved_macs_ordered_stig/rule.yml b/linux_os/guide/services/ssh/ssh_server/sshd_use_approved_macs_ordered_stig/rule.yml
|
||||
index 194d7dfe2dc..b6c5e7f4b0d 100644
|
||||
--- a/linux_os/guide/services/ssh/ssh_server/sshd_use_approved_macs_ordered_stig/rule.yml
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_approved_macs_ordered_stig/rule.yml
|
||||
@@ -37,7 +37,7 @@ ocil: |-
|
||||
MACs are in use, run the following command:
|
||||
<pre>$ sudo grep -i macs /etc/ssh/sshd_config</pre>
|
||||
The output should contain only following MACs (or a subset) in the exact order:
|
||||
- <pre>hmac-sha2-512,hmac-sha2-256</pre>
|
||||
+ <pre>MACs {{{ xccdf_value("sshd_approved_macs") }}}</pre>
|
||||
|
||||
warnings:
|
||||
- general: |-
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/ansible/shared.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..1c9dde77ee2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/ansible/shared.yml
|
||||
@@ -0,0 +1,16 @@
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# reboot = true
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+{{{ ansible_instantiate_variables("sshd_approved_macs") }}}
|
||||
+
|
||||
+{{{ ansible_set_config_file(
|
||||
+ msg='Configure SSH Daemon to Use FIPS 140-2 Validated MACs: openssh.config',
|
||||
+ file='/etc/crypto-policies/back-ends/openssh.config',
|
||||
+ parameter='MACs',
|
||||
+ value="{{ sshd_approved_macs }}",
|
||||
+ create='yes',
|
||||
+ prefix_regex='^.*'
|
||||
+ )
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/bash/shared.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..b26992ce183
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/bash/shared.sh
|
||||
@@ -0,0 +1,13 @@
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+. /usr/share/scap-security-guide/remediation_functions
|
||||
+{{{ bash_instantiate_variables("sshd_approved_macs") }}}
|
||||
+
|
||||
+{{{ set_config_file(
|
||||
+ path="/etc/crypto-policies/back-ends/openssh.config",
|
||||
+ parameter="MACs",
|
||||
+ value="${sshd_approved_macs}",
|
||||
+ create=true,
|
||||
+ insensitive=false,
|
||||
+ prefix_regex="^.*"
|
||||
+ )
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/oval/shared.xml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..5239af10612
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/oval/shared.xml
|
||||
@@ -0,0 +1,35 @@
|
||||
+{{%- set PATH = "/etc/crypto-policies/back-ends/openssh.config" -%}}
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Limit the Message Authentication Codes (MACs) to those which are FIPS-approved.") }}}
|
||||
+ <criteria operator="AND" comment="Test conditions - presence of the file plus.">
|
||||
+ <criterion comment="Check that {{{ PATH }}} contains FIPS-approved SSHD MACs" test_ref="test_{{{ rule_id }}}" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all"
|
||||
+ comment="test the value of MACs setting in the {{{ PATH }}} file"
|
||||
+ id="test_{{{ rule_id }}}" version="1">
|
||||
+ <ind:object object_ref="obj_{{{ rule_id }}}" />
|
||||
+ <ind:state state_ref="ste_{{{ rule_id }}}" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{ rule_id }}}" version="1">
|
||||
+ <ind:filepath>{{{ PATH }}}</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^MACs.*$</ind:pattern>
|
||||
+ <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_state id="ste_{{{ rule_id }}}" version="1">
|
||||
+ <ind:text var_ref="sshd_macs_crypto" operation="equals"></ind:text>
|
||||
+ </ind:textfilecontent54_state>
|
||||
+
|
||||
+ <local_variable id="sshd_macs_crypto" datatype="string" comment="The regex of the directive" version="1">
|
||||
+ <concat>
|
||||
+ <literal_component>MACs </literal_component>
|
||||
+ <variable_component var_ref="sshd_approved_macs"/>
|
||||
+ </concat>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <external_variable comment="SSH Approved MACs by FIPS" datatype="string" id="sshd_approved_macs" version="1" />
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..1aeb987db2d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
@@ -0,0 +1,60 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Configure SSH Client to Use FIPS 140-2 Validated MACs: openssh.config'
|
||||
+
|
||||
+description: |-
|
||||
+ 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
|
||||
+ set up incorrectly.
|
||||
+
|
||||
+ To check that Crypto Policies settings are configured correctly, ensure that
|
||||
+ <tt>/etc/crypto-policies/back-ends/openssh.config</tt> contains the following
|
||||
+ line and is not commented out:
|
||||
+ <tt>MACs hmac-sha2-512,hmac-sha2-256</tt>
|
||||
+
|
||||
+rationale: |-
|
||||
+ Overriding the system crypto policy makes the behavior of the OpenSSH
|
||||
+ client violate expectations, and makes system configuration more
|
||||
+ fragmented.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85870-4
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001453
|
||||
+ nist: AC-17(2)
|
||||
+ srg: SRG-OS-000250-GPOS-00093
|
||||
+ stigid@rhel8: RHEL-08-010290
|
||||
+
|
||||
+ocil_clause: 'Crypto Policy for OpenSSH client is not configured correctly'
|
||||
+
|
||||
+ocil: |-
|
||||
+ To verify if the OpenSSH client uses defined MACs in the Crypto Policy, run:
|
||||
+ <pre>$ grep -i macs /etc/crypto-policies/back-ends/openssh.config</pre>
|
||||
+ and verify that the line matches:
|
||||
+ <pre>MACs hmac-sha2-512,hmac-sha2-256</pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ The system needs to be rebooted for these changes to take effect.
|
||||
+ - regulatory: |-
|
||||
+ System Crypto Modules must be provided by a vendor that undergoes
|
||||
+ FIPS-140 certifications.
|
||||
+ FIPS-140 is applicable to all Federal agencies that use
|
||||
+ cryptographic-based security systems to protect sensitive information
|
||||
+ in computer and telecommunication systems (including voice systems) as
|
||||
+ defined in Section 5131 of the Information Technology Management Reform
|
||||
+ Act of 1996, Public Law 104-106. This standard shall be used in
|
||||
+ designing and implementing cryptographic modules that Federal
|
||||
+ departments and agencies operate or are operated for them under
|
||||
+ contract. See <b>{{{ weblink(link="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.140-2.pdf") }}}</b>
|
||||
+ To meet this, the system has to have cryptographic software provided by
|
||||
+ a vendor that has undergone this certification. This means providing
|
||||
+ documentation, test results, design information, and independent third
|
||||
+ party review by an accredited lab. While open source software is
|
||||
+ capable of meeting this, it does not meet FIPS-140 unless the vendor
|
||||
+ submits to this process.
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct.pass.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..5a4b6887cba
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct.pass.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+sshd_approved_macs=hmac-sha2-512,hmac-sha2-256
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i "s/^.*MACs.*$/MACs ${sshd_approved_macs}/" $configfile
|
||||
+else
|
||||
+ echo "MACs ${sshd_approved_macs}" > "$configfile"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct_commented.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct_commented.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..e713d254f9c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct_commented.fail.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+sshd_approved_macs=hmac-sha2-512,hmac-sha2-256
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i "s/^.*MACs.*$/#MACs ${sshd_approved_macs}/" $configfile
|
||||
+else
|
||||
+ echo "#MACs ${sshd_approved_macs}" > "$configfile"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct_followed_by_incorrect_commented.pass.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct_followed_by_incorrect_commented.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..b8a63bec194
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_correct_followed_by_incorrect_commented.pass.sh
|
||||
@@ -0,0 +1,18 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+sshd_approved_macs=hmac-sha2-512,hmac-sha2-256
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i "s/^.*MACs.*$/MACs ${sshd_approved_macs}/" $configfile
|
||||
+else
|
||||
+ echo "MACs ${sshd_approved_macs}" > "$configfile"
|
||||
+fi
|
||||
+
|
||||
+# follow up with incorrect
|
||||
+echo "#MACs hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512" >> $configfile
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_empty_file.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_empty_file.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..55ef3f58422
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_empty_file.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+echo "" > $configfile
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_empty_policy.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_empty_policy.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..9980a45681c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_empty_policy.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i "s/^.*MACs.*$/MACs /" $configfile
|
||||
+else
|
||||
+ echo "MACs " > "$configfile"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_incorrect_followed_by_correct_commented.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_incorrect_followed_by_correct_commented.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..d1303d60746
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_incorrect_followed_by_correct_commented.fail.sh
|
||||
@@ -0,0 +1,19 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+sshd_approved_macs=hmac-sha2-512,hmac-sha2-256
|
||||
+incorrect_sshd_approved_macs=hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i "s/^.*MACs.*$/MACs ${incorrect_sshd_approved_macs}/" $configfile
|
||||
+else
|
||||
+ echo "MACs ${incorrect_sshd_approved_macs}" > "$configfile"
|
||||
+fi
|
||||
+
|
||||
+# follow up with correct value
|
||||
+echo "MACs ${sshd_approved_macs}" >> $configfile
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_incorrect_policy.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_incorrect_policy.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..8b21af46896
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_incorrect_policy.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i "s/^.*MACs.*$/MACs hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512/" $configfile
|
||||
+else
|
||||
+ echo "MACs hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,umac-128@openssh.com,hmac-sha2-512" > "$configfile"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_missing_file.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_missing_file.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..2138caad319
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/tests/stig_missing_file.fail.sh
|
||||
@@ -0,0 +1,11 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_fedora,Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/openssh.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+# If file exists, remove it
|
||||
+test -f $configfile && rm -f $configfile
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/ansible/shared.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..5ed618586ae
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/ansible/shared.yml
|
||||
@@ -0,0 +1,45 @@
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# reboot = true
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+{{{ ansible_instantiate_variables("sshd_approved_macs") }}}
|
||||
+
|
||||
+- name: "{{{ rule_title }}}: Set facts"
|
||||
+ set_fact:
|
||||
+ path: /etc/crypto-policies/back-ends/opensshserver.config
|
||||
+ correct_value: "-oMACs={{ sshd_approved_macs }}"
|
||||
+
|
||||
+- name: "{{{ rule_title }}}: Stat"
|
||||
+ stat:
|
||||
+ path: "{{ path }}"
|
||||
+ follow: yes
|
||||
+ register: opensshserver_file
|
||||
+
|
||||
+- name: "{{{ rule_title }}}: Create"
|
||||
+ lineinfile:
|
||||
+ path: "{{ path }}"
|
||||
+ line: "CRYPTO_POLICY='{{ correct_value }}'"
|
||||
+ create: yes
|
||||
+ when: not opensshserver_file.stat.exists or opensshserver_file.stat.size <= correct_value|length
|
||||
+
|
||||
+- name: "{{{ rule_title }}}"
|
||||
+ block:
|
||||
+ - name: "Existing value check"
|
||||
+ lineinfile:
|
||||
+ path: "{{ path }}"
|
||||
+ create: false
|
||||
+ regexp: "{{ correct_value }}"
|
||||
+ state: absent
|
||||
+ check_mode: true
|
||||
+ changed_when: false
|
||||
+ register: opensshserver
|
||||
+
|
||||
+ - name: "Update/Correct value"
|
||||
+ replace:
|
||||
+ path: "{{ path }}"
|
||||
+ regexp: (-oMACs=\S+)
|
||||
+ replace: "{{ correct_value }}"
|
||||
+ when: opensshserver.found is defined and opensshserver.found != 1
|
||||
+
|
||||
+ when: opensshserver_file.stat.exists and opensshserver_file.stat.size > correct_value|length
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/bash/shared.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..790a2951bab
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/bash/shared.sh
|
||||
@@ -0,0 +1,31 @@
|
||||
+# platform = Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+. /usr/share/scap-security-guide/remediation_functions
|
||||
+{{{ bash_instantiate_variables("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
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/oval/shared.xml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..18028157032
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/oval/shared.xml
|
||||
@@ -0,0 +1,35 @@
|
||||
+{{%- set PATH = "/etc/crypto-policies/back-ends/opensshserver.config" -%}}
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Limit the Message Authentication Codes (MACs) to those which are FIPS-approved.") }}}
|
||||
+ <criteria operator="AND" comment="Test conditions - presence of the file plus.">
|
||||
+ <criterion comment="Check that {{{ PATH }}} contains FIPS-approved SSHD MACs" test_ref="test_{{{ rule_id }}}" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <ind:textfilecontent54_test check="all"
|
||||
+ comment="test the value of MACs setting in the {{{ PATH }}} file"
|
||||
+ id="test_{{{ rule_id }}}" version="1">
|
||||
+ <ind:object object_ref="obj_{{{ rule_id }}}" />
|
||||
+ <ind:state state_ref="ste_{{{ rule_id }}}" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_{{{ rule_id }}}" version="1">
|
||||
+ <ind:filepath>{{{ PATH }}}</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^(?!#).*(-oMACs=\S+).+$</ind:pattern>
|
||||
+ <ind:instance operation="equals" datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <ind:textfilecontent54_state id="ste_{{{ rule_id }}}" version="1">
|
||||
+ <ind:subexpression var_ref="sshd_macs_crypto_opensshserver" operation="equals" />
|
||||
+ </ind:textfilecontent54_state>
|
||||
+
|
||||
+ <local_variable id="sshd_macs_crypto_opensshserver" datatype="string" comment="The regex of the directive" version="1">
|
||||
+ <concat>
|
||||
+ <literal_component>-oMACs=</literal_component>
|
||||
+ <variable_component var_ref="sshd_approved_macs"/>
|
||||
+ </concat>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <external_variable comment="SSH Approved MACs by FIPS" datatype="string" id="sshd_approved_macs" version="1" />
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..0fd107a1bbe
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/rule.yml
|
||||
@@ -0,0 +1,60 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel8
|
||||
+
|
||||
+title: 'Configure SSH Server to Use FIPS 140-2 Validated MACs: opensshserver.config'
|
||||
+
|
||||
+description: |-
|
||||
+ 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
|
||||
+ set up incorrectly.
|
||||
+
|
||||
+ To check that Crypto Policies settings are configured correctly, ensure that
|
||||
+ <tt>/etc/crypto-policies/back-ends/opensshserver.config</tt> contains the following
|
||||
+ text and is not commented out:
|
||||
+ <tt>-oMACS=hmac-sha2-512,hmac-sha2-256</tt>
|
||||
+
|
||||
+rationale: |-
|
||||
+ Overriding the system crypto policy makes the behavior of the OpenSSH
|
||||
+ server violate expectations, and makes system configuration more
|
||||
+ fragmented.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85899-3
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-001453
|
||||
+ nist: AC-17(2)
|
||||
+ srg: SRG-OS-000250-GPOS-00093
|
||||
+ stigid@rhel8: RHEL-08-010290
|
||||
+
|
||||
+ocil_clause: 'Crypto Policy for OpenSSH Server is not configured correctly'
|
||||
+
|
||||
+ocil: |-
|
||||
+ To verify if the OpenSSH server uses defined MACs in the Crypto Policy, run:
|
||||
+ <pre>$ grep -Po '(-oMACs=\S+)' /etc/crypto-policies/back-ends/opensshserver.config</pre>
|
||||
+ and verify that the line matches:
|
||||
+ <pre>-oMACS=hmac-sha2-512,hmac-sha2-256</pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ The system needs to be rebooted for these changes to take effect.
|
||||
+ - regulatory: |-
|
||||
+ System Crypto Modules must be provided by a vendor that undergoes
|
||||
+ FIPS-140 certifications.
|
||||
+ FIPS-140 is applicable to all Federal agencies that use
|
||||
+ cryptographic-based security systems to protect sensitive information
|
||||
+ in computer and telecommunication systems (including voice systems) as
|
||||
+ defined in Section 5131 of the Information Technology Management Reform
|
||||
+ Act of 1996, Public Law 104-106. This standard shall be used in
|
||||
+ designing and implementing cryptographic modules that Federal
|
||||
+ departments and agencies operate or are operated for them under
|
||||
+ contract. See <b>{{{ weblink(link="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.140-2.pdf") }}}</b>
|
||||
+ To meet this, the system has to have cryptographic software provided by
|
||||
+ a vendor that has undergone this certification. This means providing
|
||||
+ documentation, test results, design information, and independent third
|
||||
+ party review by an accredited lab. While open source software is
|
||||
+ capable of meeting this, it does not meet FIPS-140 unless the vendor
|
||||
+ submits to this process.
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_correct.pass.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_correct.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..14da92218dc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_correct.pass.sh
|
||||
@@ -0,0 +1,17 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+sshd_approved_macs=hmac-sha2-512,hmac-sha2-256
|
||||
+configfile=/etc/crypto-policies/back-ends/opensshserver.config
|
||||
+correct_value="-oMACs=${sshd_approved_macs}"
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+# Proceed when file exists
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i -r "s/-oMACs=\S+/${correct_value}/" $configfile
|
||||
+else
|
||||
+ echo "${correct_value}" > "$configfile"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_empty_policy.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_empty_policy.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..3dde1479296
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_empty_policy.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/opensshserver.config
|
||||
+
|
||||
+echo "" > "$configfile"
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_incorrect_policy.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_incorrect_policy.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..a50a0fc02bf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_incorrect_policy.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/opensshserver.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+if [[ -f $configfile ]]; then
|
||||
+ sed -i -r "s/-oMACs=\S+/-oMACs=hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com/" $configfile
|
||||
+else
|
||||
+ echo "-oMACs=hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com" > "$configfile"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_missing_file.fail.sh b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_missing_file.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..11e596ced87
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_opensshserver_conf_crypto_policy/tests/rhel8_stig_missing_file.fail.sh
|
||||
@@ -0,0 +1,11 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+configfile=/etc/crypto-policies/back-ends/opensshserver.config
|
||||
+
|
||||
+# Ensure directory + file is there
|
||||
+test -d /etc/crypto-policies/back-ends || mkdir -p /etc/crypto-policies/back-ends
|
||||
+
|
||||
+# If file exists, remove it
|
||||
+test -f $configfile && rm -f $configfile
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 6372d13cfc9..28b47cca487 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -50,6 +50,7 @@ selections:
|
||||
- var_password_pam_retry=3
|
||||
- var_password_pam_minlen=15
|
||||
- var_sshd_set_keepalive=0
|
||||
+ - sshd_approved_macs=stig
|
||||
- sshd_idle_timeout_value=10_minutes
|
||||
- var_accounts_passwords_pam_faillock_deny=3
|
||||
- var_accounts_passwords_pam_faillock_fail_interval=900
|
||||
@@ -174,11 +175,17 @@ selections:
|
||||
# RHEL-08-010260
|
||||
- file_groupowner_var_log
|
||||
|
||||
+ # *** SHARED *** #
|
||||
# RHEL-08-010290 && RHEL-08-010291
|
||||
- ### NOTE: This will get split out in future STIG releases, as well as we will break
|
||||
- ### these rules up to be more flexible in meeting the requirements.
|
||||
+ # *** SHARED *** #
|
||||
- configure_ssh_crypto_policy
|
||||
|
||||
+ # RHEL-08-010290
|
||||
+ - harden_sshd_macs_openssh_conf_crypto_policy
|
||||
+ - harden_sshd_macs_opensshserver_conf_crypto_policy
|
||||
+
|
||||
+ # RHEL-08-010291
|
||||
+
|
||||
# RHEL-08-010292
|
||||
- sshd_use_strong_rng
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 24e81491683..036d34cea1d 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -10,7 +10,6 @@ CCE-85866-2
|
||||
CCE-85867-0
|
||||
CCE-85868-8
|
||||
CCE-85869-6
|
||||
-CCE-85870-4
|
||||
CCE-85872-0
|
||||
CCE-85873-8
|
||||
CCE-85874-6
|
||||
@@ -36,7 +35,6 @@ CCE-85895-1
|
||||
CCE-85896-9
|
||||
CCE-85897-7
|
||||
CCE-85898-5
|
||||
-CCE-85899-3
|
||||
CCE-85900-9
|
||||
CCE-85901-7
|
||||
CCE-85902-5
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 32f1a24a7a4..393051a34ea 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -145,6 +145,8 @@ selections:
|
||||
- grub2_uefi_admin_username
|
||||
- grub2_uefi_password
|
||||
- grub2_vsyscall_argument
|
||||
+- harden_sshd_macs_openssh_conf_crypto_policy
|
||||
+- harden_sshd_macs_opensshserver_conf_crypto_policy
|
||||
- install_smartcard_packages
|
||||
- installed_OS_is_vendor_supported
|
||||
- kerberos_disable_no_keytab
|
||||
@@ -325,6 +327,7 @@ selections:
|
||||
- var_password_pam_lcredit=1
|
||||
- var_password_pam_retry=3
|
||||
- var_sshd_set_keepalive=0
|
||||
+- sshd_approved_macs=stig
|
||||
- sshd_idle_timeout_value=10_minutes
|
||||
- var_accounts_passwords_pam_faillock_deny=3
|
||||
- var_accounts_passwords_pam_faillock_fail_interval=900
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index d6a27c67dc0..de82fb34518 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -156,6 +156,8 @@ selections:
|
||||
- grub2_uefi_admin_username
|
||||
- grub2_uefi_password
|
||||
- grub2_vsyscall_argument
|
||||
+- harden_sshd_macs_openssh_conf_crypto_policy
|
||||
+- harden_sshd_macs_opensshserver_conf_crypto_policy
|
||||
- install_smartcard_packages
|
||||
- installed_OS_is_vendor_supported
|
||||
- kerberos_disable_no_keytab
|
||||
@@ -335,6 +337,7 @@ selections:
|
||||
- var_password_pam_lcredit=1
|
||||
- var_password_pam_retry=3
|
||||
- var_sshd_set_keepalive=0
|
||||
+- sshd_approved_macs=stig
|
||||
- sshd_idle_timeout_value=10_minutes
|
||||
- var_accounts_passwords_pam_faillock_deny=3
|
||||
- var_accounts_passwords_pam_faillock_fail_interval=900
|
File diff suppressed because it is too large
Load Diff
@ -1,546 +0,0 @@
|
||||
From f7bb6fc32091ad9d10ec8253505086670eb135ba Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Matos <cmatos@redhat.com>
|
||||
Date: Mon, 12 Jul 2021 10:06:41 -0400
|
||||
Subject: [PATCH 1/4] Initial commit for RHEL-08-010350 STIG rule
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 2 +-
|
||||
.../bash/shared.sh | 2 +-
|
||||
.../oval/shared.xml | 44 +++++++++++++------
|
||||
.../rule.yml | 26 ++++++-----
|
||||
.../tests/correct_group.pass.sh | 2 +-
|
||||
.../tests/incorrect_group.fail.sh | 8 +++-
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
10 files changed, 57 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
index f90c8e26b15..e0bb6b0dc1a 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
@@ -1,4 +1,4 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
# reboot = false
|
||||
# strategy = restrict
|
||||
# complexity = high
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
||||
index fba25be6132..d5fb89487d5 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
|
||||
find /lib \
|
||||
/lib64 \
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
index 00f733ddc78..e3d64a8390e 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
@@ -1,27 +1,45 @@
|
||||
<def-group>
|
||||
- <definition class="compliance" id="root_permissions_syslibrary_files" version="2">
|
||||
+ <definition class="compliance" id="root_permissions_syslibrary_files" version="1">
|
||||
{{{ oval_metadata("
|
||||
- Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
||||
- are owned by root.
|
||||
+ Checks that /lib, /lib64, /usr/lib, /usr/lib64, and
|
||||
+ objects therein, are group-owned by root.
|
||||
") }}}
|
||||
- <criteria >
|
||||
- <criterion test_ref="test_root_permissions_for_syslibrary_files" />
|
||||
+ <criteria operator="AND">
|
||||
+ <criterion test_ref="test_group_ownership_lib_dir" />
|
||||
+ <criterion test_ref="test_group_ownership_lib_files" />
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
- <unix:file_test check="all" check_existence="none_exist" comment="test if system-wide files have root permissions" id="test_root_permissions_for_syslibrary_files" version="1">
|
||||
- <unix:object object_ref="root_permissions_for_system_wide_library_files" />
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="library directories gid root" id="test_group_ownership_lib_dir" version="1">
|
||||
+ <unix:object object_ref="object_group_ownership_lib_dir" />
|
||||
</unix:file_test>
|
||||
|
||||
- <unix:file_object comment="system-wide directories" id="root_permissions_for_system_wide_library_files" version="1">
|
||||
- <!-- Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
||||
- are owned by root. -->
|
||||
- <unix:path operation="pattern match">^\/lib(64)?|^\/usr\/lib(64)?</unix:path >
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="library files gid root" id="test_group_ownership_lib_files" version="1">
|
||||
+ <unix:object object_ref="object_group_ownership_lib_files" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="library directories" id="object_group_ownership_lib_dir" version="1">
|
||||
+ <!-- Check that /lib, /lib64, /usr/lib, and /usr/lib64 directories belong to group with gid 0 (root) -->
|
||||
+ <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ <filter action="include">state_group_ownership_libraries_not_root</filter>
|
||||
+ <filter action="exclude">group_dir_perms_state_symlink</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_object comment="library files" id="object_group_ownership_lib_files" version="1">
|
||||
+ <!-- Check that files within /lib, /lib64, /usr/lib, and /usr/lib64 directories belong to group with gid 0 (root) -->
|
||||
+ <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
||||
<unix:filename operation="pattern match">^.*$</unix:filename>
|
||||
- <filter action="include">group_permissions_for_system_wide_files_are_not_root</filter>
|
||||
+ <filter action="include">state_group_ownership_libraries_not_root</filter>
|
||||
+ <filter action="exclude">group_dir_perms_state_symlink</filter>
|
||||
</unix:file_object>
|
||||
|
||||
- <unix:file_state id="group_permissions_for_system_wide_files_are_not_root" version="1" >
|
||||
+ <unix:file_state id="state_group_ownership_libraries_not_root" version="1">
|
||||
<unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
</unix:file_state>
|
||||
+
|
||||
+ <unix:file_state id="group_dir_perms_state_symlink" version="1">
|
||||
+ <unix:type operation="equals">symbolic link</unix:type>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
</def-group>
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
||||
index ff905dd08d..83371b8b9b 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: sle12,sle15
|
||||
+prodtype: sle12,sle15,rhel8,fedora
|
||||
|
||||
title: |-
|
||||
Verify the system-wide library files in directories
|
||||
@@ -17,18 +17,18 @@ description: |-
|
||||
All system-wide shared library files should be protected from unauthorised
|
||||
access. If any of these files is not owned by root, correct its owner with
|
||||
the following command:
|
||||
- <pre>$ sudo chgrp root <i>DIR</i></pre>
|
||||
+ <pre>$ sudo chgrp root <i>FILE</i></pre>
|
||||
|
||||
rationale: |-
|
||||
- If the operating system were to allow any user to make changes to software libraries,
|
||||
- then those changes might be implemented without undergoing the appropriate testing and
|
||||
- approvals that are part of a robust change management process.
|
||||
+ If the operating system were to allow any user to make changes to software libraries,
|
||||
+ then those changes might be implemented without undergoing the appropriate testing and
|
||||
+ approvals that are part of a robust change management process.
|
||||
|
||||
- This requirement applies to operating systems with software libraries that are
|
||||
- accessible and configurable, as in the case of interpreted languages. Software libraries
|
||||
- also include privileged programs which execute with 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.
|
||||
+ This requirement applies to operating systems with software libraries that are
|
||||
+ accessible and configurable, as in the case of interpreted languages. Software libraries
|
||||
+ also include privileged programs which execute with 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.
|
||||
|
||||
severity: medium
|
||||
|
||||
@@ -45,7 +45,7 @@ references:
|
||||
stigid@sle12: SLES-12-010875
|
||||
stigid@sle15: SLES-15-010355
|
||||
|
||||
-ocil_clause: 'any system wide library directory is returned'
|
||||
+ocil_clause: 'system wide library files are not group owned by root'
|
||||
|
||||
ocil: |-
|
||||
System-wide library files are stored in the following directories:
|
||||
@@ -54,6 +54,6 @@ ocil: |-
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
</pre>
|
||||
- To find if system-wide library files stored in these directories are group-owned by
|
||||
+ To find if system-wide library files stored in these directories are not group-owned by
|
||||
root run the following command for each directory <i>DIR</i>:
|
||||
<pre>$ sudo find -L <i>DIR</i> ! -group root -type f </pre>
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
index 7a8e65b4f3a..8722c2add65 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
@@ -4,6 +4,6 @@ for SYSLIBDIRS in /lib /lib64 /usr/lib /usr/lib64
|
||||
do
|
||||
if [[ -d $SYSLIBDIRS ]]
|
||||
then
|
||||
- find $SYSLIBDIRS ! -group root -type f -exec chgrp root '{}' \;
|
||||
+ find $SYSLIBDIRS ! -group root -exec chgrp root '{}' \;
|
||||
fi
|
||||
done
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
index a4b99a9da14..1079046d14e 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
-
|
||||
-for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me
|
||||
+
|
||||
+# There is a high probability that there will be nested subdirectories within the
|
||||
+# shared system library directories, therefore we should test to make sure we
|
||||
+# cover this. - cmm
|
||||
+test -d /usr/lib/test_dir || mkdir -p /usr/lib/test_dir && chown nobody.nobody /usr/lib/test_dir
|
||||
+for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me /usr/lib/test_dir/test_me
|
||||
do
|
||||
if [[ ! -f $TESTFILE ]]
|
||||
then
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 2508008d511..9569b2ad629 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -207,6 +207,7 @@ selections:
|
||||
- file_ownership_library_dirs
|
||||
|
||||
# RHEL-08-010350
|
||||
+ - root_permissions_syslibrary_files
|
||||
|
||||
# RHEL-08-010360
|
||||
- package_aide_installed
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index f139d2ed76f..e0eb5ac045c 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -662,7 +662,6 @@ CCE-86518-8
|
||||
CCE-86520-4
|
||||
CCE-86521-2
|
||||
CCE-86522-0
|
||||
-CCE-86523-8
|
||||
CCE-86524-6
|
||||
CCE-86525-3
|
||||
CCE-86526-1
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 765487c6f16..ebe7a91f45d 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -221,6 +221,7 @@ selections:
|
||||
- postfix_client_configure_mail_alias
|
||||
- require_emergency_target_auth
|
||||
- require_singleuser_auth
|
||||
+- root_permissions_syslibrary_files
|
||||
- rsyslog_cron_logging
|
||||
- rsyslog_remote_access_monitoring
|
||||
- rsyslog_remote_loghost
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 9fd80aac727..97f940dc9ed 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -232,6 +232,7 @@ selections:
|
||||
- postfix_client_configure_mail_alias
|
||||
- require_emergency_target_auth
|
||||
- require_singleuser_auth
|
||||
+- root_permissions_syslibrary_files
|
||||
- rsyslog_cron_logging
|
||||
- rsyslog_remote_access_monitoring
|
||||
- rsyslog_remote_loghost
|
||||
|
||||
From f16c085894e4dc7974637d44bf226d3acf19f3d1 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Matos <cmatos@redhat.com>
|
||||
Date: Mon, 12 Jul 2021 16:17:23 -0400
|
||||
Subject: [PATCH 2/4] Updated existing rules for syslibrary files/dirs
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 6 ++-
|
||||
.../bash/shared.sh | 7 +++
|
||||
.../dir_group_ownership_library_dirs/rule.yml | 4 ++
|
||||
.../tests/all_dirs_ok.pass.sh | 3 +-
|
||||
.../nobody_group_owned_dir_on_lib.fail.sh | 3 +-
|
||||
.../ansible/shared.yml | 23 ++++++++--
|
||||
.../oval/shared.xml | 44 ++++++-------------
|
||||
.../tests/correct_group.pass.sh | 4 +-
|
||||
.../tests/incorrect_group.fail.sh | 8 +---
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
13 files changed, 59 insertions(+), 47 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
||||
index 80562991ac5..f6f2ab48afd 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
||||
@@ -1,4 +1,4 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
# reboot = false
|
||||
# strategy = restrict
|
||||
# complexity = medium
|
||||
@@ -20,4 +20,6 @@
|
||||
state: "directory"
|
||||
mode: "{{ item.mode }}"
|
||||
with_items: "{{ library_dirs_not_group_owned_by_root.files }}"
|
||||
- when: library_dirs_not_group_owned_by_root.matched > 0
|
||||
+ when:
|
||||
+ - library_dirs_not_group_owned_by_root.matched > 0
|
||||
+ - item.gid != 0
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..365b9833188
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
+find /lib \
|
||||
+/lib64 \
|
||||
+/usr/lib \
|
||||
+/usr/lib64 \
|
||||
+\! -group root -type d -exec chgrp root '{}' \;
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
||||
index 4ff043270c8..cd02d95cb1c 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
||||
@@ -1,5 +1,7 @@
|
||||
documentation_complete: true
|
||||
|
||||
+prodtype: sle12,sle15,rhel8,fedora
|
||||
+
|
||||
title: 'Verify that Shared Library Directories Have Root Group Ownership'
|
||||
|
||||
description: |-
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/all_dirs_ok.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/all_dirs_ok.pass.sh
|
||||
index 2a38e9a88bc..50fdb17bd2e 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/all_dirs_ok.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/all_dirs_ok.pass.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
DIRS="/lib /lib64 /usr/lib /usr/lib64"
|
||||
for dirPath in $DIRS; do
|
||||
find "$dirPath" -type d -exec chgrp root '{}' \;
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh
|
||||
index f794d9e878f..277bd7d60de 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
DIRS="/lib /lib64"
|
||||
for dirPath in $DIRS; do
|
||||
mkdir -p "$dirPath/testme" && chown root:nogroup "$dirPath/testme"
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
index e0bb6b0dc1a..ab3e85c4f7c 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
@@ -4,7 +4,24 @@
|
||||
# complexity = high
|
||||
# disruption = medium
|
||||
|
||||
-- name: "Set ownership to root of system-wide library files"
|
||||
- command: "find {{ item }} ! -group root -type f -exec chgrp root '{}' \\;"
|
||||
- with_items: [ '/lib', '/lib64', '/usr/lib', '/usr/lib64' ]
|
||||
+- name: "Read list libraries without root ownership"
|
||||
+ find:
|
||||
+ paths:
|
||||
+ - "/usr/lib"
|
||||
+ - "/usr/lib64"
|
||||
+ - "/lib"
|
||||
+ - "/lib64"
|
||||
+ file_type: "file"
|
||||
+ register: library_files_not_group_owned_by_root
|
||||
+
|
||||
+- name: "Set group ownership of system library files to root"
|
||||
+ file:
|
||||
+ path: "{{ item.path }}"
|
||||
+ group: "root"
|
||||
+ state: "file"
|
||||
+ mode: "{{ item.mode }}"
|
||||
+ with_items: "{{ library_files_not_group_owned_by_root.files }}"
|
||||
+ when:
|
||||
+ - library_files_not_group_owned_by_root.matched > 0
|
||||
+ - item.gid != 0
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
index e3d64a8390e..926ff70d1e4 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
@@ -1,45 +1,27 @@
|
||||
<def-group>
|
||||
- <definition class="compliance" id="root_permissions_syslibrary_files" version="1">
|
||||
+ <definition class="compliance" id="root_permissions_syslibrary_files" version="2">
|
||||
{{{ oval_metadata("
|
||||
- Checks that /lib, /lib64, /usr/lib, /usr/lib64, and
|
||||
- objects therein, are group-owned by root.
|
||||
+ Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
||||
+ are owned by root.
|
||||
") }}}
|
||||
- <criteria operator="AND">
|
||||
- <criterion test_ref="test_group_ownership_lib_dir" />
|
||||
- <criterion test_ref="test_group_ownership_lib_files" />
|
||||
+ <criteria >
|
||||
+ <criterion test_ref="test_root_permissions_for_syslibrary_files" />
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
- <unix:file_test check="all" check_existence="none_exist" comment="library directories gid root" id="test_group_ownership_lib_dir" version="1">
|
||||
- <unix:object object_ref="object_group_ownership_lib_dir" />
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="test if system-wide files have root permissions" id="test_root_permissions_for_syslibrary_files" version="1">
|
||||
+ <unix:object object_ref="root_permissions_for_system_wide_library_files" />
|
||||
</unix:file_test>
|
||||
|
||||
- <unix:file_test check="all" check_existence="none_exist" comment="library files gid root" id="test_group_ownership_lib_files" version="1">
|
||||
- <unix:object object_ref="object_group_ownership_lib_files" />
|
||||
- </unix:file_test>
|
||||
-
|
||||
- <unix:file_object comment="library directories" id="object_group_ownership_lib_dir" version="1">
|
||||
- <!-- Check that /lib, /lib64, /usr/lib, and /usr/lib64 directories belong to group with gid 0 (root) -->
|
||||
- <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
||||
- <unix:filename xsi:nil="true" />
|
||||
- <filter action="include">state_group_ownership_libraries_not_root</filter>
|
||||
- <filter action="exclude">group_dir_perms_state_symlink</filter>
|
||||
- </unix:file_object>
|
||||
-
|
||||
- <unix:file_object comment="library files" id="object_group_ownership_lib_files" version="1">
|
||||
- <!-- Check that files within /lib, /lib64, /usr/lib, and /usr/lib64 directories belong to group with gid 0 (root) -->
|
||||
- <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
||||
+ <unix:file_object comment="system-wide directories" id="root_permissions_for_system_wide_library_files" version="1">
|
||||
+ <!-- Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
||||
+ are owned by root. -->
|
||||
+ <unix:path operation="pattern match">^\/lib\/|^\/lib64\/|^\/usr\/lib\/|^\/usr\/lib64\/</unix:path>
|
||||
<unix:filename operation="pattern match">^.*$</unix:filename>
|
||||
- <filter action="include">state_group_ownership_libraries_not_root</filter>
|
||||
- <filter action="exclude">group_dir_perms_state_symlink</filter>
|
||||
+ <filter action="include">group_permissions_for_system_wide_files_are_not_root</filter>
|
||||
</unix:file_object>
|
||||
|
||||
- <unix:file_state id="state_group_ownership_libraries_not_root" version="1">
|
||||
+ <unix:file_state id="group_permissions_for_system_wide_files_are_not_root" version="1" >
|
||||
<unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
</unix:file_state>
|
||||
-
|
||||
- <unix:file_state id="group_dir_perms_state_symlink" version="1">
|
||||
- <unix:type operation="equals">symbolic link</unix:type>
|
||||
- </unix:file_state>
|
||||
-
|
||||
</def-group>
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
index 8722c2add65..a4ae2854db1 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
@@ -1,9 +1,9 @@
|
||||
-#!/bin/bash
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
|
||||
for SYSLIBDIRS in /lib /lib64 /usr/lib /usr/lib64
|
||||
do
|
||||
if [[ -d $SYSLIBDIRS ]]
|
||||
then
|
||||
- find $SYSLIBDIRS ! -group root -exec chgrp root '{}' \;
|
||||
+ find $SYSLIBDIRS ! -group root -type f -exec chgrp root '{}' \;
|
||||
fi
|
||||
done
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
index 1079046d14e..c96f65b989c 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
@@ -1,10 +1,6 @@
|
||||
-#!/bin/bash
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
|
||||
-# There is a high probability that there will be nested subdirectories within the
|
||||
-# shared system library directories, therefore we should test to make sure we
|
||||
-# cover this. - cmm
|
||||
-test -d /usr/lib/test_dir || mkdir -p /usr/lib/test_dir && chown nobody.nobody /usr/lib/test_dir
|
||||
-for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me /usr/lib/test_dir/test_me
|
||||
+for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me
|
||||
do
|
||||
if [[ ! -f $TESTFILE ]]
|
||||
then
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 9569b2ad629..059750f59d0 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -208,6 +208,7 @@ selections:
|
||||
|
||||
# RHEL-08-010350
|
||||
- root_permissions_syslibrary_files
|
||||
+ - dir_group_ownership_library_dirs
|
||||
|
||||
# RHEL-08-010360
|
||||
- package_aide_installed
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index e0eb5ac045c..ae3375fd4d4 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -34,7 +34,6 @@ CCE-85890-2
|
||||
CCE-85891-0
|
||||
CCE-85892-8
|
||||
CCE-85893-6
|
||||
-CCE-85894-4
|
||||
CCE-85895-1
|
||||
CCE-85896-9
|
||||
CCE-85897-7
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index ebe7a91f45d..49cce4d81cc 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -99,6 +99,7 @@ selections:
|
||||
- dconf_gnome_login_banner_text
|
||||
- dconf_gnome_screensaver_idle_delay
|
||||
- dconf_gnome_screensaver_lock_enabled
|
||||
+- dir_group_ownership_library_dirs
|
||||
- dir_perms_world_writable_root_owned
|
||||
- dir_perms_world_writable_sticky_bits
|
||||
- directory_permissions_var_log_audit
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 97f940dc9ed..943a57d3eb8 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -110,6 +110,7 @@ selections:
|
||||
- dconf_gnome_login_banner_text
|
||||
- dconf_gnome_screensaver_idle_delay
|
||||
- dconf_gnome_screensaver_lock_enabled
|
||||
+- dir_group_ownership_library_dirs
|
||||
- dir_perms_world_writable_root_owned
|
||||
- dir_perms_world_writable_sticky_bits
|
||||
- directory_permissions_var_log_audit
|
||||
|
||||
From 71deac482753a13a9f98d6d7382b13e9031a2ce4 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Matos <cmatos@redhat.com>
|
||||
Date: Tue, 13 Jul 2021 13:40:25 -0400
|
||||
Subject: [PATCH 3/4] Updated test for nobody_group_owned_dir rule
|
||||
|
||||
---
|
||||
.../tests/nobody_group_owned_dir_on_lib.fail.sh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh
|
||||
index 277bd7d60de..043ad6b2dee 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/nobody_group_owned_dir_on_lib.fail.sh
|
||||
@@ -1,6 +1,6 @@
|
||||
# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
|
||||
-DIRS="/lib /lib64"
|
||||
+DIRS="/lib /lib64 /usr/lib /usr/lib64"
|
||||
for dirPath in $DIRS; do
|
||||
- mkdir -p "$dirPath/testme" && chown root:nogroup "$dirPath/testme"
|
||||
+ mkdir -p "$dirPath/testme" && chgrp nobody "$dirPath/testme"
|
||||
done
|
||||
|
||||
From 087359679e4f6794054b6772df6c84c4cd1fee94 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Matos <cmatos@redhat.com>
|
||||
Date: Wed, 14 Jul 2021 10:04:25 -0400
|
||||
Subject: [PATCH 4/4] Added recommended $ to end of regex pattern to properly
|
||||
match dirs
|
||||
|
||||
---
|
||||
.../root_permissions_syslibrary_files/oval/shared.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
index 926ff70d1e4..f5ca9380b55 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
@@ -16,7 +16,7 @@
|
||||
<unix:file_object comment="system-wide directories" id="root_permissions_for_system_wide_library_files" version="1">
|
||||
<!-- Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
||||
are owned by root. -->
|
||||
- <unix:path operation="pattern match">^\/lib\/|^\/lib64\/|^\/usr\/lib\/|^\/usr\/lib64\/</unix:path>
|
||||
+ <unix:path operation="pattern match">^\/lib(|64)?$|^\/usr\/lib(|64)?$</unix:path>
|
||||
<unix:filename operation="pattern match">^.*$</unix:filename>
|
||||
<filter action="include">group_permissions_for_system_wide_files_are_not_root</filter>
|
||||
</unix:file_object>
|
@ -1,120 +0,0 @@
|
||||
From eed29b1db9dd62d014842340abb8601570fe6655 Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Matos <cmatos@redhat.com>
|
||||
Date: Thu, 22 Jul 2021 14:26:49 -0400
|
||||
Subject: [PATCH] New rule for RHEL-08-020270
|
||||
|
||||
---
|
||||
.../account_emergency_expire_date/rule.yml | 52 +++++++++++++++++++
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
5 files changed, 55 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_emergency_expire_date/rule.yml
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_emergency_expire_date/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_emergency_expire_date/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000000..a47c7f39bc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/account_expiration/account_emergency_expire_date/rule.yml
|
||||
@@ -0,0 +1,52 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel8
|
||||
+
|
||||
+title: 'Assign Expiration Date to Emergency Accounts'
|
||||
+
|
||||
+description: |-
|
||||
+ Emergency accounts are privileged accounts established in response to
|
||||
+ crisis situations where the need for rapid account activation is required.
|
||||
+ In the event emergency accounts are required, configure the system to
|
||||
+ terminate them after a documented time period. For every emergency account,
|
||||
+ run the following command to set an expiration date on it, substituting
|
||||
+ <tt><i>ACCOUNT_NAME</i></tt> and <tt><i>YYYY-MM-DD</i></tt>
|
||||
+ appropriately:
|
||||
+ <pre>$ sudo chage -E <i>YYYY-MM-DD ACCOUNT_NAME</i></pre>
|
||||
+ <tt><i>YYYY-MM-DD</i></tt> indicates the documented expiration date for the
|
||||
+ account. For U.S. Government systems, the operating system must be
|
||||
+ configured to automatically terminate these types of accounts after a
|
||||
+ period of 72 hours.
|
||||
+
|
||||
+rationale: |-
|
||||
+ If emergency user accounts remain active when no longer needed or for
|
||||
+ an excessive period, these accounts may be used to gain unauthorized access.
|
||||
+ To mitigate this risk, automated termination of all emergency accounts
|
||||
+ must be set upon account creation.
|
||||
+ <br />
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-85910-8
|
||||
+
|
||||
+references:
|
||||
+ cis-csc: 1,12,13,14,15,16,18,3,5,7,8
|
||||
+ cobit5: DSS01.03,DSS03.05,DSS05.04,DSS05.05,DSS05.07,DSS06.03
|
||||
+ disa: CCI-000016,CCI-001682
|
||||
+ isa-62443-2009: 4.3.3.2.2,4.3.3.5.1,4.3.3.5.2,4.3.3.7.2,4.3.3.7.3,4.3.3.7.4
|
||||
+ isa-62443-2013: 'SR 1.1,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 6.2'
|
||||
+ iso27001-2013: A.12.4.1,A.12.4.3,A.6.1.2,A.7.1.1,A.9.1.2,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.1,A.9.4.2,A.9.4.3,A.9.4.4,A.9.4.5
|
||||
+ nist: AC-2(2),AC-2(3),CM-6(a)
|
||||
+ nist-csf: DE.CM-1,DE.CM-3,PR.AC-1,PR.AC-4,PR.AC-6
|
||||
+ srg: SRG-OS-000123-GPOS-00064,SRG-OS-000002-GPOS-00002
|
||||
+ stigid@rhel8: RHEL-08-020270
|
||||
+ vmmsrg: SRG-OS-000002-VMM-000020,SRG-OS-000123-VMM-000620
|
||||
+
|
||||
+ocil_clause: 'any emergency accounts have no expiration date set or do not expire within a documented time frame'
|
||||
+
|
||||
+ocil: |-
|
||||
+ For every emergency account, run the following command
|
||||
+ to obtain its account aging and expiration information:
|
||||
+ <pre>$ sudo chage -l <i>ACCOUNT_NAME</i></pre>
|
||||
+ Verify each of these accounts has an expiration date set as documented.
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 7270a8f91f..c4b9d02af5 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -558,6 +558,7 @@ selections:
|
||||
- account_disable_post_pw_expiration
|
||||
|
||||
# RHEL-08-020270
|
||||
+ - account_emergency_expire_date
|
||||
|
||||
# RHEL-08-020280
|
||||
- accounts_password_pam_ocredit
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 665f903ead..f500179292 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -43,7 +43,6 @@ CCE-85906-6
|
||||
CCE-85907-4
|
||||
CCE-85908-2
|
||||
CCE-85909-0
|
||||
-CCE-85910-8
|
||||
CCE-85911-6
|
||||
CCE-85912-4
|
||||
CCE-85913-2
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 7d59cfff62..72e205b695 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -24,6 +24,7 @@ documentation_complete: true
|
||||
reference: https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux
|
||||
selections:
|
||||
- account_disable_post_pw_expiration
|
||||
+- account_emergency_expire_date
|
||||
- account_temp_expire_date
|
||||
- accounts_have_homedir_login_defs
|
||||
- accounts_logon_fail_delay
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 2c2daad6f6..cc21621617 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -35,6 +35,7 @@ documentation_complete: true
|
||||
reference: https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux
|
||||
selections:
|
||||
- account_disable_post_pw_expiration
|
||||
+- account_emergency_expire_date
|
||||
- account_temp_expire_date
|
||||
- accounts_have_homedir_login_defs
|
||||
- accounts_logon_fail_delay
|
File diff suppressed because it is too large
Load Diff
@ -1,699 +0,0 @@
|
||||
From ad2267a48db738fe69bed6cc009d8be7bbc61c87 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu, 17 Jun 2021 17:46:26 +0200
|
||||
Subject: [PATCH] Add /var/log/audit individual ownership rules.
|
||||
|
||||
---
|
||||
.../bash/shared.sh | 12 +++++
|
||||
.../oval/shared.xml | 44 +++++++++++++++++++
|
||||
.../rule.yml | 39 ++++++++++++++++
|
||||
.../tests/correct_value.pass.sh | 5 +++
|
||||
.../correct_value_non-root_group.pass.sh | 8 ++++
|
||||
.../tests/wrong_value.fail.sh | 6 +++
|
||||
.../bash/shared.sh | 3 ++
|
||||
.../oval/shared.xml | 24 ++++++++++
|
||||
.../rule.yml | 37 ++++++++++++++++
|
||||
.../tests/correct_value.pass.sh | 3 ++
|
||||
.../tests/wrong_value.fail.sh | 4 ++
|
||||
.../bash/shared.sh | 12 +++++
|
||||
.../oval/shared.xml | 44 +++++++++++++++++++
|
||||
.../rule.yml | 39 ++++++++++++++++
|
||||
.../tests/correct_value.pass.sh | 5 +++
|
||||
.../correct_value_non-root_group.pass.sh | 8 ++++
|
||||
.../tests/wrong_value.fail.sh | 7 +++
|
||||
.../bash/shared.sh | 3 ++
|
||||
.../oval/shared.xml | 24 ++++++++++
|
||||
.../rule.yml | 36 +++++++++++++++
|
||||
.../tests/correct_value.pass.sh | 3 ++
|
||||
.../tests/wrong_value.fail.sh | 5 +++
|
||||
products/rhel8/profiles/stig.profile | 15 +++++--
|
||||
.../oval/auditd_conf_log_group_not_root.xml | 20 ++++++++-
|
||||
shared/references/cce-redhat-avail.txt | 4 --
|
||||
.../data/profile_stability/rhel8/stig.profile | 5 ++-
|
||||
.../profile_stability/rhel8/stig_gui.profile | 5 ++-
|
||||
27 files changed, 409 insertions(+), 11 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/rule.yml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/rule.yml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/rule.yml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/rule.yml
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/correct_value.pass.sh
|
||||
create mode 100644 linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/wrong_value.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/bash/shared.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..685aa0cf3f2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/bash/shared.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+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 ' ')
|
||||
+ if ! [ "${GROUP}" == 'root' ] ; then
|
||||
+ chgrp ${GROUP} /var/log/audit
|
||||
+ else
|
||||
+ chgrp root /var/log/audit
|
||||
+ fi
|
||||
+else
|
||||
+ chgrp root /var/log/audit
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/oval/shared.xml b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..4d6eee02a30
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/oval/shared.xml
|
||||
@@ -0,0 +1,44 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="directory_group_ownership_var_log_audit" version="1">
|
||||
+ {{{ oval_metadata("Checks that all /var/log/audit directories are group owned by the root user.") }}}
|
||||
+ <criteria operator="OR">
|
||||
+ <criterion test_ref="test_group_ownership_var_log_audit_directories" />
|
||||
+ <criteria operator="AND" comment="log_group in auditd.conf is not root">
|
||||
+ <extend_definition comment="log_group in auditd.conf is not root"
|
||||
+ definition_ref="auditd_conf_log_group_not_root" />
|
||||
+ <criterion test_ref="test_group_ownership_var_log_audit_directories-non_root" />
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="/var/log/audit directories uid root gid root" id="test_group_ownership_var_log_audit_directories" version="1">
|
||||
+ <unix:object object_ref="object_group_ownership_var_log_audit_directories" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="/var/log/audit directories" id="object_group_ownership_var_log_audit_directories" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
|
||||
+ <unix:path operation="equals">/var/log/audit</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ <filter action="include">state_group_owner_not_root_var_log_audit_directories</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_state id="state_group_owner_not_root_var_log_audit_directories" version="1" operator="OR">
|
||||
+ <unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <unix:file_test check="all" check_existence="all_exist" comment="/var/log/audit directories uid root gid root" id="test_group_ownership_var_log_audit_directories-non_root" version="1">
|
||||
+ <unix:object object_ref="object_group_ownership_var_log_audit_directories-non_root" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="/var/log/audit directories" id="object_group_ownership_var_log_audit_directories-non_root" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
|
||||
+ <unix:path operation="equals">/var/log/audit</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ <filter action="include">state_group_owner_not_root_var_log_audit_directories-non_root</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_state id="state_group_owner_not_root_var_log_audit_directories-non_root" version="1" operator="OR">
|
||||
+ <unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..3915300c106
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/rule.yml
|
||||
@@ -0,0 +1,39 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel8
|
||||
+
|
||||
+title: 'System Audit Directories Must Be Group Owned By Root'
|
||||
+
|
||||
+description: |-
|
||||
+ All audit directories must be group owned by root user. By default, the path for audit log is <pre>/var/log/audit/</pre>.
|
||||
+ {{{ describe_file_group_owner(file="/var/log/audit", group="root") }}}
|
||||
+ If <tt>log_group</tt> in <tt>/etc/audit/auditd.conf</tt> is set to a group other than the <tt>root</tt>
|
||||
+ group account, change the group ownership of the audit directories to this specific group.
|
||||
+
|
||||
+rationale: |-
|
||||
+ Unauthorized disclosure of audit records can reveal system and configuration data to
|
||||
+ attackers, thus compromising its confidentiality.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-88225-8
|
||||
+
|
||||
+references:
|
||||
+ cis-csc: 1,11,12,13,14,15,16,18,19,3,4,5,6,7,8
|
||||
+ cjis: 5.4.1.1
|
||||
+ cobit5: APO01.06,APO11.04,APO12.06,BAI03.05,BAI08.02,DSS02.02,DSS02.04,DSS02.07,DSS03.01,DSS05.04,DSS05.07,DSS06.02,MEA02.01
|
||||
+ cui: 3.3.1
|
||||
+ disa: CCI-000162,CCI-000163,CCI-000164,CCI-001314
|
||||
+ isa-62443-2009: 4.2.3.10,4.3.3.3.9,4.3.3.5.8,4.3.3.7.3,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
|
||||
+ isa-62443-2013: 'SR 2.1,SR 2.10,SR 2.11,SR 2.12,SR 2.8,SR 2.9,SR 5.2,SR 6.1'
|
||||
+ iso27001-2013: A.10.1.1,A.11.1.4,A.11.1.5,A.11.2.1,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.1.3,A.13.2.1,A.13.2.3,A.13.2.4,A.14.1.2,A.14.1.3,A.16.1.4,A.16.1.5,A.16.1.7,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
|
||||
+ nist: CM-6(a),AC-6(1),AU-9(4)
|
||||
+ nist-csf: DE.AE-3,DE.AE-5,PR.AC-4,PR.DS-5,PR.PT-1,RS.AN-1,RS.AN-4
|
||||
+ pcidss: Req-10.5.1
|
||||
+ srg: SRG-OS-000057-GPOS-00027,SRG-OS-000058-GPOS-00028,SRG-OS-000059-GPOS-00029,SRG-OS-000206-GPOS-00084
|
||||
+ stigid@rhel8: RHEL-08-030110
|
||||
+
|
||||
+ocil: |-
|
||||
+ {{{ describe_file_group_owner(file="/var/log/audit", group="root") }}}
|
||||
+
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..4e68a450c3d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+sed -i "/\s*log_group.*/d" /etc/audit/auditd.conf
|
||||
+echo "log_group = root" >> /etc/audit/auditd.conf
|
||||
+chgrp root /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..89995b11954
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+groupadd group_test
|
||||
+
|
||||
+sed -i "/\s*log_group.*/d" /etc/audit/auditd.conf
|
||||
+echo "log_group = group_test" >> /etc/audit/auditd.conf
|
||||
+
|
||||
+chgrp group_test /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/wrong_value.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..13d22ca8361
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_group_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+sed -i "/\s*log_group.*/d" /etc/audit/auditd.conf
|
||||
+echo "log_group = root" >> /etc/audit/auditd.conf
|
||||
+groupadd group_test
|
||||
+chgrp group_test /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/bash/shared.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..de63152c410
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/bash/shared.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+chown root /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/oval/shared.xml b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..fad17abe39a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/oval/shared.xml
|
||||
@@ -0,0 +1,24 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="directory_ownership_var_log_audit" version="1">
|
||||
+ {{{ oval_metadata("Checks that all /var/log/audit directories are owned by the root user.") }}}
|
||||
+ <criteria comment="directories are root owned">
|
||||
+ <criterion test_ref="test_user_ownership_var_log_audit_directories" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="/var/log/audit directories uid root gid root" id="test_user_ownership_var_log_audit_directories" version="1">
|
||||
+ <unix:object object_ref="object_user_ownership_var_log_audit_directories" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="/var/log/audit directories" id="object_user_ownership_var_log_audit_directories" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
|
||||
+ <unix:path operation="equals">/var/log/audit</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ <filter action="include">state_owner_not_root_var_log_audit_directories</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_state id="state_owner_not_root_var_log_audit_directories" version="1" operator="OR">
|
||||
+ <unix:user_id datatype="int" operation="not equal">0</unix:user_id>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..cd6c45e249b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/rule.yml
|
||||
@@ -0,0 +1,37 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel8
|
||||
+
|
||||
+title: 'System Audit Directories Must Be Owned By Root'
|
||||
+
|
||||
+description: |-
|
||||
+ All audit directories must be owned by root user. By default, the path for audit log is <pre>/var/log/audit/</pre>.
|
||||
+ {{{ describe_file_owner(file="/var/log/audit", owner="root") }}}
|
||||
+
|
||||
+rationale: |-
|
||||
+ Unauthorized disclosure of audit records can reveal system and configuration data to
|
||||
+ attackers, thus compromising its confidentiality.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-88226-6
|
||||
+
|
||||
+references:
|
||||
+ cis-csc: 1,11,12,13,14,15,16,18,19,3,4,5,6,7,8
|
||||
+ cjis: 5.4.1.1
|
||||
+ cobit5: APO01.06,APO11.04,APO12.06,BAI03.05,BAI08.02,DSS02.02,DSS02.04,DSS02.07,DSS03.01,DSS05.04,DSS05.07,DSS06.02,MEA02.01
|
||||
+ cui: 3.3.1
|
||||
+ disa: CCI-000162,CCI-000163,CCI-000164,CCI-001314
|
||||
+ isa-62443-2009: 4.2.3.10,4.3.3.3.9,4.3.3.5.8,4.3.3.7.3,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
|
||||
+ isa-62443-2013: 'SR 2.1,SR 2.10,SR 2.11,SR 2.12,SR 2.8,SR 2.9,SR 5.2,SR 6.1'
|
||||
+ iso27001-2013: A.10.1.1,A.11.1.4,A.11.1.5,A.11.2.1,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.1.3,A.13.2.1,A.13.2.3,A.13.2.4,A.14.1.2,A.14.1.3,A.16.1.4,A.16.1.5,A.16.1.7,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
|
||||
+ nist: CM-6(a),AC-6(1),AU-9(4)
|
||||
+ nist-csf: DE.AE-3,DE.AE-5,PR.AC-4,PR.DS-5,PR.PT-1,RS.AN-1,RS.AN-4
|
||||
+ pcidss: Req-10.5.1
|
||||
+ srg: SRG-OS-000057-GPOS-00027,SRG-OS-000058-GPOS-00028,SRG-OS-000059-GPOS-00029,SRG-OS-000206-GPOS-00084
|
||||
+ stigid@rhel8: RHEL-08-030100
|
||||
+
|
||||
+ocil: |-
|
||||
+ {{{ describe_file_owner(file="/var/log/audit", owner="root") }}}
|
||||
+
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/correct_value.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..fa70fdc9494
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+chown root /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/wrong_value.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..f65a1e67241
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/directory_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+useradd testuser_123
|
||||
+chown testuser_123 /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/bash/shared.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..3f53de5ba26
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/bash/shared.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+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 ' ')
|
||||
+ if ! [ "${GROUP}" == 'root' ] ; then
|
||||
+ chgrp ${GROUP} /var/log/audit/audit.log*
|
||||
+ else
|
||||
+ chgrp root /var/log/audit/audit.log*
|
||||
+ fi
|
||||
+else
|
||||
+ chgrp root /var/log/audit/audit.log*
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/oval/shared.xml b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..af5414a6c9c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/oval/shared.xml
|
||||
@@ -0,0 +1,44 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="file_group_ownership_var_log_audit" version="1">
|
||||
+ {{{ oval_metadata("Checks that all /var/log/audit files are group owned by the root user.") }}}
|
||||
+ <criteria operator="OR">
|
||||
+ <criterion comment="files are root group owned" test_ref="test_group_ownership_var_log_audit_files"/>
|
||||
+ <criteria operator="AND" comment="log_group in auditd.conf is not root">
|
||||
+ <extend_definition comment="log_group in auditd.conf is not root"
|
||||
+ definition_ref="auditd_conf_log_group_not_root" />
|
||||
+ <criterion test_ref="test_group_ownership_var_log_audit_files-non_root" />
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="/var/log/audit files gid root" id="test_group_ownership_var_log_audit_files" version="1">
|
||||
+ <unix:object object_ref="object_group_ownership_var_log_audit_files" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="/var/log/audit files" id="object_group_ownership_var_log_audit_files" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
|
||||
+ <unix:path operation="equals">/var/log/audit</unix:path>
|
||||
+ <unix:filename operation="pattern match">^.*$</unix:filename>
|
||||
+ <filter action="include">state_group_owner_not_root_var_log_audit</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_state id="state_group_owner_not_root_var_log_audit" version="1" operator="OR">
|
||||
+ <unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <unix:file_test check="all" check_existence="all_exist" comment="/var/log/audit files uid root " id="test_group_ownership_var_log_audit_files-non_root" version="1">
|
||||
+ <unix:object object_ref="object_group_ownership_var_log_audit_files-non_root" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="/var/log/audit files" id="object_group_ownership_var_log_audit_files-non_root" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
|
||||
+ <unix:path operation="equals">/var/log/audit</unix:path>
|
||||
+ <unix:filename operation="pattern match">^.*$</unix:filename>
|
||||
+ <filter action="include">state_group_owner_not_root_var_log_audit-non_root</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_state id="state_group_owner_not_root_var_log_audit-non_root" version="1" operator="OR">
|
||||
+ <unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..767c8c89bf7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/rule.yml
|
||||
@@ -0,0 +1,39 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel8
|
||||
+
|
||||
+title: 'System Audit Logs Must Be Group Owned By Root'
|
||||
+
|
||||
+description: |-
|
||||
+ All audit logs must be group owned by root user. By default, the path for audit log is <pre>/var/log/audit/</pre>.
|
||||
+ {{{ describe_file_group_owner(file="/var/log/audit/*", group="root") }}}
|
||||
+ If <tt>log_group</tt> in <tt>/etc/audit/auditd.conf</tt> is set to a group other than the <tt>root</tt>
|
||||
+ group account, change the group ownership of the audit logs to this specific group.
|
||||
+
|
||||
+rationale: |-
|
||||
+ Unauthorized disclosure of audit records can reveal system and configuration data to
|
||||
+ attackers, thus compromising its confidentiality.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-88227-4
|
||||
+
|
||||
+references:
|
||||
+ cis-csc: 1,11,12,13,14,15,16,18,19,3,4,5,6,7,8
|
||||
+ cjis: 5.4.1.1
|
||||
+ cobit5: APO01.06,APO11.04,APO12.06,BAI03.05,BAI08.02,DSS02.02,DSS02.04,DSS02.07,DSS03.01,DSS05.04,DSS05.07,DSS06.02,MEA02.01
|
||||
+ cui: 3.3.1
|
||||
+ disa: CCI-000162,CCI-000163,CCI-000164,CCI-001314
|
||||
+ isa-62443-2009: 4.2.3.10,4.3.3.3.9,4.3.3.5.8,4.3.3.7.3,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
|
||||
+ isa-62443-2013: 'SR 2.1,SR 2.10,SR 2.11,SR 2.12,SR 2.8,SR 2.9,SR 5.2,SR 6.1'
|
||||
+ iso27001-2013: A.10.1.1,A.11.1.4,A.11.1.5,A.11.2.1,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.1.3,A.13.2.1,A.13.2.3,A.13.2.4,A.14.1.2,A.14.1.3,A.16.1.4,A.16.1.5,A.16.1.7,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
|
||||
+ nist: CM-6(a),AC-6(1),AU-9(4)
|
||||
+ nist-csf: DE.AE-3,DE.AE-5,PR.AC-4,PR.DS-5,PR.PT-1,RS.AN-1,RS.AN-4
|
||||
+ pcidss: Req-10.5.1
|
||||
+ srg: SRG-OS-000057-GPOS-00027,SRG-OS-000058-GPOS-00028,SRG-OS-000059-GPOS-00029,SRG-OS-000206-GPOS-00084
|
||||
+ stigid@rhel8: RHEL-08-030090
|
||||
+
|
||||
+ocil: |-
|
||||
+ {{{ describe_file_group_owner(file="/var/log/audit/*", group="root") }}}
|
||||
+
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..e4e69bff538
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+sed -i "/\s*log_group.*/d" /etc/audit/auditd.conf
|
||||
+echo "log_group = root" >> /etc/audit/auditd.conf
|
||||
+chgrp root /var/log/audit/audit.log*
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..89995b11954
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/correct_value_non-root_group.pass.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+groupadd group_test
|
||||
+
|
||||
+sed -i "/\s*log_group.*/d" /etc/audit/auditd.conf
|
||||
+echo "log_group = group_test" >> /etc/audit/auditd.conf
|
||||
+
|
||||
+chgrp group_test /var/log/audit
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/wrong_value.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..37c0f070ae1
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_group_ownership_var_log_audit/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+sed -i "/\s*log_group.*/d" /etc/audit/auditd.conf
|
||||
+echo "log_group = root" >> /etc/audit/auditd.conf
|
||||
+touch /var/log/audit/audit.log.1
|
||||
+groupadd group_test
|
||||
+chgrp group_test /var/log/audit/audit.log.1
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/bash/shared.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ee2364a4a69
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/bash/shared.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+chown root /var/log/audit/audit.log*
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/oval/shared.xml b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..c20353b5926
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/oval/shared.xml
|
||||
@@ -0,0 +1,24 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="file_ownership_var_log_audit_stig" version="1">
|
||||
+ {{{ oval_metadata("Checks that all /var/log/audit files are owned by the root user.") }}}
|
||||
+ <criteria comment="files are root owned">
|
||||
+ <criterion test_ref="test_user_ownership_var_log_audit_files" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:file_test check="all" check_existence="none_exist" comment="/var/log/audit files uid root" id="test_user_ownership_var_log_audit_files" version="1">
|
||||
+ <unix:object object_ref="object_user_ownership_var_log_audit_files" />
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <unix:file_object comment="/var/log/audit files" id="object_user_ownership_var_log_audit_files" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
|
||||
+ <unix:path operation="equals">/var/log/audit</unix:path>
|
||||
+ <unix:filename operation="pattern match">^.*$</unix:filename>
|
||||
+ <filter action="include">state_group_user_owner_not_root_var_log_audit</filter>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <unix:file_state id="state_group_user_owner_not_root_var_log_audit" version="1" operator="OR">
|
||||
+ <unix:user_id datatype="int" operation="not equal">0</unix:user_id>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..7f895759486
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/rule.yml
|
||||
@@ -0,0 +1,36 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: rhel8
|
||||
+
|
||||
+title: 'System Audit Logs Must Be Owned By Root'
|
||||
+
|
||||
+description: |-
|
||||
+ All audit logs must be owned by root user. By default, the path for audit log is <pre>/var/log/audit/</pre>.
|
||||
+ {{{ describe_file_owner(file="/var/log/audit/*", owner="root") }}}
|
||||
+
|
||||
+rationale: |-
|
||||
+ Unauthorized disclosure of audit records can reveal system and configuration data to
|
||||
+ attackers, thus compromising its confidentiality.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel8: CCE-88228-2
|
||||
+
|
||||
+references:
|
||||
+ cis-csc: 1,11,12,13,14,15,16,18,19,3,4,5,6,7,8
|
||||
+ cjis: 5.4.1.1
|
||||
+ cobit5: APO01.06,APO11.04,APO12.06,BAI03.05,BAI08.02,DSS02.02,DSS02.04,DSS02.07,DSS03.01,DSS05.04,DSS05.07,DSS06.02,MEA02.01
|
||||
+ cui: 3.3.1
|
||||
+ disa: CCI-000162,CCI-000163,CCI-000164,CCI-001314
|
||||
+ isa-62443-2009: 4.2.3.10,4.3.3.3.9,4.3.3.5.8,4.3.3.7.3,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
|
||||
+ isa-62443-2013: 'SR 2.1,SR 2.10,SR 2.11,SR 2.12,SR 2.8,SR 2.9,SR 5.2,SR 6.1'
|
||||
+ iso27001-2013: A.10.1.1,A.11.1.4,A.11.1.5,A.11.2.1,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.1.3,A.13.2.1,A.13.2.3,A.13.2.4,A.14.1.2,A.14.1.3,A.16.1.4,A.16.1.5,A.16.1.7,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
|
||||
+ nist: CM-6(a),AC-6(1),AU-9(4)
|
||||
+ nist-csf: DE.AE-3,DE.AE-5,PR.AC-4,PR.DS-5,PR.PT-1,RS.AN-1,RS.AN-4
|
||||
+ pcidss: Req-10.5.1
|
||||
+ srg: SRG-OS-000057-GPOS-00027,SRG-OS-000058-GPOS-00028,SRG-OS-000059-GPOS-00029,SRG-OS-000206-GPOS-00084
|
||||
+ stigid@rhel8: RHEL-08-030080
|
||||
+
|
||||
+ocil: |-
|
||||
+ {{{ describe_file_owner(file="/var/log/audit/*", owner="root") }}}
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/correct_value.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..eed3164eb31
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+chown root /var/log/audit/audit.log*
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/wrong_value.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..32a678562cf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_var_log_audit_stig/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+touch /var/log/audit/audit.log.1
|
||||
+useradd testuser_123
|
||||
+chown testuser_123 /var/log/audit/audit.log.1
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 7270a8f91f2..7d2d386604e 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -625,10 +625,17 @@ selections:
|
||||
# RHEL-08-030070
|
||||
- file_permissions_var_log_audit
|
||||
|
||||
- # RHEL-08-030080, RHEL-08-030090, RHEL-08-030100, RHEL-08-030110
|
||||
- ### NOTE: These might get broken up, but currently the following
|
||||
- ### rule accounts for these STIG ID's
|
||||
- - file_ownership_var_log_audit
|
||||
+ # RHEL-08-030080
|
||||
+ - file_ownership_var_log_audit_stig
|
||||
+
|
||||
+ # RHEL-08-030090
|
||||
+ - file_group_ownership_var_log_audit
|
||||
+
|
||||
+ # RHEL-08-030100
|
||||
+ - directory_ownership_var_log_audit
|
||||
+
|
||||
+ # RHEL-08-030110
|
||||
+ - directory_group_ownership_var_log_audit
|
||||
|
||||
# RHEL-08-030120
|
||||
- directory_permissions_var_log_audit
|
||||
diff --git a/shared/checks/oval/auditd_conf_log_group_not_root.xml b/shared/checks/oval/auditd_conf_log_group_not_root.xml
|
||||
index 93e47d119ef..2871052796e 100644
|
||||
--- a/shared/checks/oval/auditd_conf_log_group_not_root.xml
|
||||
+++ b/shared/checks/oval/auditd_conf_log_group_not_root.xml
|
||||
@@ -8,9 +8,11 @@
|
||||
<description>Verify 'log_group' is not set to 'root' in
|
||||
/etc/audit/auditd.conf.</description>
|
||||
</metadata>
|
||||
- <criteria>
|
||||
+ <criteria operator="AND">
|
||||
<criterion test_ref="test_auditd_conf_log_group_not_root"
|
||||
comment="Verify 'log_group' not set to 'root' in /etc/audit/auditd.conf" />
|
||||
+ <criterion test_ref="test_auditd_conf_log_group_is_set"
|
||||
+ comment="Verify 'log_group' is set in /etc/audit/auditd.conf" />
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
@@ -26,4 +28,20 @@
|
||||
<ind:instance datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
+ <!--
|
||||
+ By default, log_group is set to root, so we need to make sure something is set
|
||||
+ to meet this criterion.
|
||||
+ -->
|
||||
+ <ind:textfilecontent54_test id="test_auditd_conf_log_group_is_set" check="all"
|
||||
+ check_existence="all_exist" comment="log_group is set" version="1">
|
||||
+ <ind:object object_ref="object_auditd_conf_log_group_is_set" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="object_auditd_conf_log_group_is_set"
|
||||
+ comment="log_group is set" version="1">
|
||||
+ <ind:filepath operation="equals">/etc/audit/auditd.conf</ind:filepath>
|
||||
+ <ind:pattern operation="pattern match">^[ ]*log_group[ ]+=.*$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
</def-group>
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 665f903ead4..b77e9abeb0b 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -2355,10 +2355,6 @@ CCE-88221-7
|
||||
CCE-88222-5
|
||||
CCE-88223-3
|
||||
CCE-88224-1
|
||||
-CCE-88225-8
|
||||
-CCE-88226-6
|
||||
-CCE-88227-4
|
||||
-CCE-88228-2
|
||||
CCE-88229-0
|
||||
CCE-88230-8
|
||||
CCE-88231-6
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 7d59cfff625..6c97a5a8ca3 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -103,6 +103,8 @@ selections:
|
||||
- dir_group_ownership_library_dirs
|
||||
- dir_perms_world_writable_root_owned
|
||||
- dir_perms_world_writable_sticky_bits
|
||||
+- directory_group_ownership_var_log_audit
|
||||
+- directory_ownership_var_log_audit
|
||||
- directory_permissions_var_log_audit
|
||||
- disable_ctrlaltdel_burstaction
|
||||
- disable_ctrlaltdel_reboot
|
||||
@@ -113,6 +115,7 @@ selections:
|
||||
- encrypt_partitions
|
||||
- ensure_gpgcheck_globally_activated
|
||||
- ensure_gpgcheck_local_packages
|
||||
+- file_group_ownership_var_log_audit
|
||||
- file_groupowner_var_log
|
||||
- file_groupowner_var_log_messages
|
||||
- file_groupownership_home_directories
|
||||
@@ -121,7 +124,7 @@ selections:
|
||||
- file_owner_var_log_messages
|
||||
- file_ownership_binary_dirs
|
||||
- file_ownership_library_dirs
|
||||
-- file_ownership_var_log_audit
|
||||
+- file_ownership_var_log_audit_stig
|
||||
- file_permission_user_init_files
|
||||
- file_permissions_binary_dirs
|
||||
- file_permissions_etc_audit_auditd
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 2c2daad6f6d..d026a40a02b 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -114,6 +114,8 @@ selections:
|
||||
- dir_group_ownership_library_dirs
|
||||
- dir_perms_world_writable_root_owned
|
||||
- dir_perms_world_writable_sticky_bits
|
||||
+- directory_group_ownership_var_log_audit
|
||||
+- directory_ownership_var_log_audit
|
||||
- directory_permissions_var_log_audit
|
||||
- disable_ctrlaltdel_burstaction
|
||||
- disable_ctrlaltdel_reboot
|
||||
@@ -124,6 +126,7 @@ selections:
|
||||
- encrypt_partitions
|
||||
- ensure_gpgcheck_globally_activated
|
||||
- ensure_gpgcheck_local_packages
|
||||
+- file_group_ownership_var_log_audit
|
||||
- file_groupowner_var_log
|
||||
- file_groupowner_var_log_messages
|
||||
- file_groupownership_home_directories
|
||||
@@ -132,7 +135,7 @@ selections:
|
||||
- file_owner_var_log_messages
|
||||
- file_ownership_binary_dirs
|
||||
- file_ownership_library_dirs
|
||||
-- file_ownership_var_log_audit
|
||||
+- file_ownership_var_log_audit_stig
|
||||
- file_permission_user_init_files
|
||||
- file_permissions_binary_dirs
|
||||
- file_permissions_etc_audit_auditd
|
@ -1,664 +0,0 @@
|
||||
From b951a896d3ef1e678e5d6b580521053e7a076ab0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
||||
Date: Thu, 29 Apr 2021 16:54:03 +0200
|
||||
Subject: [PATCH 1/6] Updated checks and remediations of the sshd template.
|
||||
|
||||
Configuration of sshd moves from one config file to a config directory.
|
||||
Therefore, checks should consider all those files, and the remediation should aim
|
||||
to deliver fixes to one of those files in the config directory.
|
||||
|
||||
Tests that interact with this behavior have been added and are applicable for Fedora and RHEL9 products.
|
||||
---
|
||||
.../tests/commented.fail.sh | 7 ++
|
||||
.../tests/conflict.fail.sh | 15 ++++
|
||||
.../tests/correct_value_directory.pass.sh | 14 ++++
|
||||
shared/macros-bash.jinja | 9 +++
|
||||
shared/macros-oval.jinja | 61 +++++++++++------
|
||||
.../templates/sshd_lineinfile/bash.template | 22 ++++++
|
||||
.../templates/sshd_lineinfile/oval.template | 68 +++++++++++++++++--
|
||||
7 files changed, 168 insertions(+), 28 deletions(-)
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/commented.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/commented.fail.sh b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/commented.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..484c2165532
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/commented.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+if grep -q "^PubkeyAuthentication" /etc/ssh/sshd_config; then
|
||||
+ sed -i "s/^PubkeyAuthentication.*/# PubkeyAuthentication no/" /etc/ssh/sshd_config
|
||||
+else
|
||||
+ echo "# PubkeyAuthentication no" >> /etc/ssh/sshd_config
|
||||
+fi
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..177a99e0b82
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# platform = Fedora,Red Hat Enterprise Linux 9
|
||||
+
|
||||
+mkdir -p /etc/ssh/sshd_config.d
|
||||
+touch /etc/ssh/sshd_config.d/nothing
|
||||
+
|
||||
+if grep -q "^PubkeyAuthentication" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* ; then
|
||||
+ sed -i "s/^PubkeyAuthentication.*/# PubkeyAuthentication no/" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*
|
||||
+else
|
||||
+ echo "# PubkeyAuthentication no" >> /etc/ssh/sshd_config
|
||||
+fi
|
||||
+
|
||||
+echo "PubkeyAuthentication no" > /etc/ssh/sshd_config.d/good_config
|
||||
+echo "PubkeyAuthentication yes" > /etc/ssh/sshd_config.d/rogue_config
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..0aa2e775dbe
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# platform = Fedora,Red Hat Enterprise Linux 9
|
||||
+
|
||||
+mkdir -p /etc/ssh/sshd_config.d
|
||||
+touch /etc/ssh/sshd_config.d/nothing
|
||||
+
|
||||
+if grep -q "^PubkeyAuthentication" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* ; then
|
||||
+ sed -i "s/^PubkeyAuthentication.*/# PubkeyAuthentication no/" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*
|
||||
+else
|
||||
+ echo "# PubkeyAuthentication no" >> /etc/ssh/sshd_config
|
||||
+fi
|
||||
+
|
||||
+echo "PubkeyAuthentication no" > /etc/ssh/sshd_config.d/correct
|
||||
diff --git a/shared/macros-bash.jinja b/shared/macros-bash.jinja
|
||||
index 1cd2c62b5e0..b4518d83c19 100644
|
||||
--- a/shared/macros-bash.jinja
|
||||
+++ b/shared/macros-bash.jinja
|
||||
@@ -471,6 +471,15 @@ fi
|
||||
LC_ALL=C sed -i "/{{{ regex }}}/{{{ modifier }}}" "{{{ path }}}"
|
||||
{{%- endmacro -%}}
|
||||
|
||||
+{{%- macro lineinfile_absent_in_directory(dirname, regex, insensitive=true) -%}}
|
||||
+ {{%- if insensitive -%}}
|
||||
+ {{%- set modifier="Id" -%}}
|
||||
+ {{%- else -%}}
|
||||
+ {{%- set modifier="d" -%}}
|
||||
+ {{%- endif -%}}
|
||||
+LC_ALL=C sed -i "/{{{ regex }}}/{{{ modifier }}}" "{{{ dirname }}}"/*
|
||||
+{{%- endmacro -%}}
|
||||
+
|
||||
{{%- macro lineinfile_present(path, line, insert_after="", insert_before="", insensitive=true) -%}}
|
||||
{{%- if insensitive -%}}
|
||||
{{%- set grep_args="-q -m 1 -i" -%}}
|
||||
diff --git a/shared/macros-oval.jinja b/shared/macros-oval.jinja
|
||||
index be2ac268206..d38db96d9e3 100644
|
||||
--- a/shared/macros-oval.jinja
|
||||
+++ b/shared/macros-oval.jinja
|
||||
@@ -92,15 +92,18 @@
|
||||
- parameter (String): The parameter to be checked in the configuration file.
|
||||
- missing_parameter_pass (boolean): If set, the check will also pass if the parameter is not present in the configuration file (default is applied).
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_criterion(path='', parameter='', missing_parameter_pass=false) -%}}
|
||||
+{{%- macro oval_line_in_file_criterion(path='', parameter='', missing_parameter_pass=false, comment='', id_stem=rule_id) -%}}
|
||||
{{%- set suffix_id = "" -%}}
|
||||
{{%- set prefix_text = "Check the" -%}}
|
||||
{{%- if missing_parameter_pass %}}
|
||||
{{%- set suffix_id = suffix_id_default_not_overriden -%}}
|
||||
{{%- set prefix_text = prefix_text + " absence of" -%}}
|
||||
{{%- endif %}}
|
||||
- <criterion comment="{{{ prefix_text }}} {{{ parameter }}} in {{{ path }}}"
|
||||
- test_ref="test_{{{ rule_id }}}{{{ suffix_id }}}" />
|
||||
+{{%- if not comment -%}}
|
||||
+{{%- set comment = prefix_text ~ " " ~ parameter ~ " in " ~ path -%}}
|
||||
+{{%- endif -%}}
|
||||
+<criterion comment="{{{ comment }}}"
|
||||
+ test_ref="test_{{{ id_stem }}}{{{ suffix_id }}}" />
|
||||
{{%- endmacro %}}
|
||||
|
||||
{{#
|
||||
@@ -110,7 +113,7 @@
|
||||
- parameter (String): The parameter to be checked in the configuration file.
|
||||
- missing_parameter_pass (boolean): If set, the check will also pass if the parameter is not present in the configuration file (default is applied).
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_test(path='', parameter='', missing_parameter_pass=false) -%}}
|
||||
+{{%- macro oval_line_in_file_test(path='', parameter='', missing_parameter_pass=false, id_stem=rule_id) -%}}
|
||||
{{%- set suffix_id = "" -%}}
|
||||
{{%- if missing_parameter_pass %}}
|
||||
{{%- set check_existence = "none_exist" -%}}
|
||||
@@ -120,14 +123,14 @@
|
||||
{{%- set check_existence = "all_exist" -%}}
|
||||
{{%- set prefix_text = "value" -%}}
|
||||
{{%- endif %}}
|
||||
- <ind:textfilecontent54_test check="all" check_existence="{{{ check_existence }}}"
|
||||
+<ind:textfilecontent54_test check="all" check_existence="{{{ check_existence }}}"
|
||||
comment="tests the {{{ prefix_text }}} of {{{ parameter }}} setting in the {{{ path }}} file"
|
||||
- id="test_{{{ rule_id }}}{{{ suffix_id }}}" version="1">
|
||||
- <ind:object object_ref="obj_{{{ rule_id }}}{{{ suffix_id }}}" />
|
||||
+ id="test_{{{ id_stem }}}{{{ suffix_id }}}" version="1">
|
||||
+ <ind:object object_ref="obj_{{{ id_stem }}}{{{ suffix_id }}}" />
|
||||
{{%- if not missing_parameter_pass %}}
|
||||
- <ind:state state_ref="state_{{{ rule_id }}}{{{ suffix_id }}}" />
|
||||
+ <ind:state state_ref="state_{{{ id_stem }}}{{{ suffix_id }}}" />
|
||||
{{%- endif %}}
|
||||
- </ind:textfilecontent54_test>
|
||||
+</ind:textfilecontent54_test>
|
||||
{{%- endmacro %}}
|
||||
|
||||
{{#
|
||||
@@ -141,7 +144,7 @@
|
||||
- missing_parameter_pass (boolean): If set, the check will also pass if the parameter is not present in the configuration file (default is applied).
|
||||
- multi_value (boolean): If set, it means that the parameter can accept multiple values and the expected value must be present in the current list of values.
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_object(path='', section='', prefix_regex='^[ \\t]*', parameter='', separator_regex='[ \\t]+', missing_parameter_pass=false, multi_value=false, filepath_regex='') -%}}
|
||||
+{{%- macro oval_line_in_file_object(path='', section='', prefix_regex='^[ \\t]*', parameter='', separator_regex='[ \\t]+', missing_parameter_pass=false, multi_value=false, filepath_regex='', id_stem=rule_id) -%}}
|
||||
{{%- set suffix_id = "" -%}}
|
||||
{{%- if multi_value -%}}
|
||||
{{%- set group_regex = "([^#]*).*$" -%}}
|
||||
@@ -173,16 +176,16 @@
|
||||
{{%- set regex = prefix_regex+parameter+separator_regex+group_regex -%}}
|
||||
{{%- endif %}}
|
||||
{{%- endif %}}
|
||||
- <ind:textfilecontent54_object id="obj_{{{ rule_id }}}{{{ suffix_id }}}" version="1">
|
||||
+<ind:textfilecontent54_object id="obj_{{{ id_stem }}}{{{ suffix_id }}}" version="1">
|
||||
{{%- if filepath_regex %}}
|
||||
- <ind:path>{{{ path }}}</ind:path>
|
||||
- <ind:filename operation="pattern match">{{{ filepath_regex }}}</ind:filename>
|
||||
+ <ind:path>{{{ path }}}</ind:path>
|
||||
+ <ind:filename operation="pattern match">{{{ filepath_regex }}}</ind:filename>
|
||||
{{%- else %}}
|
||||
- <ind:filepath>{{{ path }}}</ind:filepath>
|
||||
+ <ind:filepath>{{{ path }}}</ind:filepath>
|
||||
{{%- endif %}}
|
||||
- <ind:pattern operation="pattern match">{{{ regex }}}</ind:pattern>
|
||||
- <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
- </ind:textfilecontent54_object>
|
||||
+ <ind:pattern operation="pattern match">{{{ regex }}}</ind:pattern>
|
||||
+ <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
+</ind:textfilecontent54_object>
|
||||
{{%- endmacro %}}
|
||||
|
||||
{{#
|
||||
@@ -193,7 +196,7 @@
|
||||
- quotes (String): If non-empty, one level of matching quotes is considered when checking the value. Specify one or more quote types as a string.
|
||||
For example, for shell quoting, specify quotes="'\""), which will make sure that value, 'value' and "value" are matched, but 'value" or '"value"' won't be.
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_state(value='', multi_value='', quotes='') -%}}
|
||||
+{{%- macro oval_line_in_file_state(value='', multi_value='', quotes='', id_stem=rule_id) -%}}
|
||||
{{%- set regex = value -%}}
|
||||
{{%- if quotes != "" %}}
|
||||
{{%- if "\\1" in value > 0 %}}
|
||||
@@ -206,9 +209,25 @@
|
||||
{{%- else %}}
|
||||
{{%- set regex = "^"+regex+"$" -%}}
|
||||
{{%- endif %}}
|
||||
- <ind:textfilecontent54_state id="state_{{{ rule_id }}}" version="1">
|
||||
- <ind:subexpression datatype="string" operation="pattern match">{{{ regex }}}</ind:subexpression>
|
||||
- </ind:textfilecontent54_state>
|
||||
+<ind:textfilecontent54_state id="state_{{{ id_stem }}}" version="1">
|
||||
+ <ind:subexpression datatype="string" operation="pattern match">{{{ regex }}}</ind:subexpression>
|
||||
+</ind:textfilecontent54_state>
|
||||
+{{%- endmacro %}}
|
||||
+
|
||||
+{{%- macro oval_line_in_directory_criterion(path='', parameter='', missing_parameter_pass=false) -%}}
|
||||
+{{{- oval_line_in_file_criterion(path, parameter, missing_parameter_pass, id_stem=rule_id ~ "_config_dir") -}}}
|
||||
+{{%- endmacro %}}
|
||||
+
|
||||
+{{%- macro oval_line_in_directory_test(path='', parameter='', missing_parameter_pass=false) -%}}
|
||||
+{{{ oval_line_in_file_test(path, parameter, missing_parameter_pass, id_stem=rule_id ~ "_config_dir") }}}
|
||||
+{{%- endmacro %}}
|
||||
+
|
||||
+{{%- macro oval_line_in_directory_object(path='', section='', prefix_regex='^[ \\t]*', parameter='', separator_regex='[ \\t]+', missing_parameter_pass=false, multi_value=false) -%}}
|
||||
+{{{- oval_line_in_file_object(path=path, section=section, prefix_regex=prefix_regex, parameter=parameter, separator_regex=separator_regex, missing_parameter_pass=missing_parameter_pass, multi_value=multi_value, filepath_regex=".*", id_stem=rule_id ~ "_config_dir") -}}}
|
||||
+{{%- endmacro %}}
|
||||
+
|
||||
+{{%- macro oval_line_in_directory_state(value='', multi_value='', quotes='') -%}}
|
||||
+{{{- oval_line_in_file_state(value, multi_value, quotes, id_stem=rule_id ~ "_config_dir") -}}}
|
||||
{{%- endmacro %}}
|
||||
|
||||
{{#
|
||||
diff --git a/shared/templates/sshd_lineinfile/bash.template b/shared/templates/sshd_lineinfile/bash.template
|
||||
index ca1b512bb3d..eac758e310b 100644
|
||||
--- a/shared/templates/sshd_lineinfile/bash.template
|
||||
+++ b/shared/templates/sshd_lineinfile/bash.template
|
||||
@@ -3,4 +3,26 @@
|
||||
# strategy = restrict
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
+{{%- if product in ("fedora", "rhel9") %}}
|
||||
+{{%- set prefix_regex = "^\s*" -%}}
|
||||
+{{%- set separator_regex = "\s\+" -%}}
|
||||
+{{%- set line_regex = prefix_regex ~ PARAMETER ~ separator_regex %}}
|
||||
+mkdir -p /etc/ssh/sshd_config.d
|
||||
+touch /etc/ssh/sshd_config.d/hardening
|
||||
+{{{ lineinfile_absent("/etc/ssh/sshd_config", line_regex, insensitive=true) }}}
|
||||
+{{{ lineinfile_absent_in_directory("/etc/ssh/sshd_config.d", line_regex, insensitive=true) }}}
|
||||
+{{{ set_config_file(
|
||||
+ path="/etc/ssh/sshd_config.d/hardening",
|
||||
+ parameter=PARAMETER,
|
||||
+ value=VALUE,
|
||||
+ create=true,
|
||||
+ insert_after="",
|
||||
+ insert_before="^Match",
|
||||
+ insensitive=true,
|
||||
+ separator=" ",
|
||||
+ separator_regex=separator_regex,
|
||||
+ prefix_regex=prefix_regex)
|
||||
+ }}}
|
||||
+{{%- else %}}
|
||||
{{{ bash_sshd_config_set(parameter=PARAMETER, value=VALUE) }}}
|
||||
+{{%- endif %}}
|
||||
diff --git a/shared/templates/sshd_lineinfile/oval.template b/shared/templates/sshd_lineinfile/oval.template
|
||||
index df63d542505..2cc38776eb2 100644
|
||||
--- a/shared/templates/sshd_lineinfile/oval.template
|
||||
+++ b/shared/templates/sshd_lineinfile/oval.template
|
||||
@@ -1,7 +1,61 @@
|
||||
-{{{
|
||||
-oval_sshd_config(
|
||||
- parameter=PARAMETER,
|
||||
- value=VALUE,
|
||||
- missing_parameter_pass=MISSING_PARAMETER_PASS
|
||||
-)
|
||||
-}}}
|
||||
+{{%- set config_path = "/etc/ssh/sshd_config" %}}
|
||||
+{{%- set config_dir = "/etc/ssh/sshd_config.d" -%}}
|
||||
+{{%- set products_with_distributed_configuration = ("rhel9", "fedora") -%}}
|
||||
+{{%- set description = "Ensure '" ~ PARAMETER ~ "' is configured with value '" ~ VALUE ~ "' in " ~ config_path %}}
|
||||
+{{%- if product in products_with_distributed_configuration %}}
|
||||
+{{%- set description = description ~ " and in " ~ config_dir -%}}
|
||||
+{{%- endif %}}
|
||||
+{{%- set case_insensitivity_kwargs = dict(prefix_regex="^[ \\t]*(?i)", separator_regex = "(?-i)[ \\t]+") -%}}
|
||||
+
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata(description) }}}
|
||||
+ <criteria comment="sshd is configured correctly or is not installed" operator="OR">
|
||||
+ <criteria comment="sshd is not installed" operator="AND">
|
||||
+ <extend_definition comment="sshd is not required or requirement is unset"
|
||||
+ definition_ref="sshd_not_required_or_unset" />
|
||||
+ <extend_definition comment="rpm package openssh-server removed"
|
||||
+ definition_ref="package_openssh-server_removed" />
|
||||
+ </criteria>
|
||||
+ <criteria comment="sshd is installed and configured" operator="AND">
|
||||
+ <extend_definition comment="sshd is required or requirement is unset"
|
||||
+ definition_ref="sshd_required_or_unset" />
|
||||
+ <extend_definition comment="rpm package openssh-server installed"
|
||||
+ definition_ref="package_openssh-server_installed" />
|
||||
+ <criteria comment="sshd is configured correctly" operator="OR">
|
||||
+ {{{- oval_line_in_file_criterion(config_path, PARAMETER) | indent(8) }}}
|
||||
+ {{%- if MISSING_PARAMETER_PASS %}}
|
||||
+ <criteria comment="sshd is not configured incorrectly" operator="AND">
|
||||
+ {{{- oval_line_in_file_criterion(config_path, PARAMETER, MISSING_PARAMETER_PASS) | indent(10)}}}
|
||||
+ {{%- if product in products_with_distributed_configuration %}}
|
||||
+ {{{- oval_line_in_directory_criterion(config_dir, PARAMETER, MISSING_PARAMETER_PASS) | indent(10) }}}
|
||||
+ {{%- endif %}}
|
||||
+ </criteria>
|
||||
+ {{%- endif %}}
|
||||
+ {{%- if product in products_with_distributed_configuration %}}
|
||||
+ {{{- oval_line_in_directory_criterion(config_dir, PARAMETER) | indent(8) }}}
|
||||
+ {{%- endif %}}
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+ {{{ oval_line_in_file_test(config_path, PARAMETER) | indent (2) }}}
|
||||
+ {{{ oval_line_in_file_object(config_path, parameter=PARAMETER, ** case_insensitivity_kwargs)| indent (2) }}}
|
||||
+ {{{ oval_line_in_file_state(VALUE) | indent (2) }}}
|
||||
+
|
||||
+ {{%- if MISSING_PARAMETER_PASS %}}
|
||||
+ {{{ oval_line_in_file_test(config_path, PARAMETER, MISSING_PARAMETER_PASS) | indent(2) }}}
|
||||
+ {{{ oval_line_in_file_object(config_path, parameter=PARAMETER, missing_parameter_pass=MISSING_PARAMETER_PASS, ** case_insensitivity_kwargs) | indent(2) }}}
|
||||
+ {{%- endif %}}
|
||||
+
|
||||
+ {{%- if product in products_with_distributed_configuration %}}
|
||||
+ {{{ oval_line_in_directory_test(config_dir, PARAMETER) | indent (2) }}}
|
||||
+ {{{ oval_line_in_directory_object(config_dir, parameter=PARAMETER, ** case_insensitivity_kwargs) | indent (2) }}}
|
||||
+ {{{ oval_line_in_directory_state(VALUE) | indent (2) }}}
|
||||
+
|
||||
+ {{%- if MISSING_PARAMETER_PASS %}}
|
||||
+ {{{ oval_line_in_directory_test(config_path, PARAMETER, MISSING_PARAMETER_PASS) | indent(2) }}}
|
||||
+ {{{ oval_line_in_directory_object(config_path, parameter=PARAMETER, missing_parameter_pass=MISSING_PARAMETER_PASS, ** case_insensitivity_kwargs) | indent(2) }}}
|
||||
+ {{%- endif %}}
|
||||
+ {{%- endif %}}
|
||||
+</def-group>
|
||||
|
||||
From b0f86c11fa0fb45b32b53833b5d3565c7eb73cfe Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
||||
Date: Fri, 30 Apr 2021 11:52:22 +0200
|
||||
Subject: [PATCH 2/6] Improved the lineinfile template.
|
||||
|
||||
It now escapes the text contents if parts of them could be incorrectly interpreted as regexes.
|
||||
---
|
||||
shared/macros-bash.jinja | 2 +-
|
||||
shared/templates/lineinfile/oval.template | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/shared/macros-bash.jinja b/shared/macros-bash.jinja
|
||||
index b4518d83c19..d654a0e0e89 100644
|
||||
--- a/shared/macros-bash.jinja
|
||||
+++ b/shared/macros-bash.jinja
|
||||
@@ -445,7 +445,7 @@ printf '%s\n' "{{{ message | replace('"', '\\"') }}}" >&2
|
||||
# prefix_regex: regular expression describing allowed leading characters at each line
|
||||
#}}
|
||||
{{%- macro set_config_file(path, parameter, value, create, insert_after, insert_before, insensitive=true, separator=" ", separator_regex="\s\+", prefix_regex="^\s*") -%}}
|
||||
- {{%- set line_regex = prefix_regex+parameter+separator_regex -%}}
|
||||
+ {{%- set line_regex = prefix_regex + ((parameter | escape_regex) | replace("/", "\/")) + separator_regex -%}}
|
||||
{{%- set new_line = parameter+separator+value -%}}
|
||||
if [ -e "{{{ path }}}" ] ; then
|
||||
{{{ lineinfile_absent(path, line_regex, insensitive) | indent(4) }}}
|
||||
diff --git a/shared/templates/lineinfile/oval.template b/shared/templates/lineinfile/oval.template
|
||||
index a38856d9177..644327b7d6e 100644
|
||||
--- a/shared/templates/lineinfile/oval.template
|
||||
+++ b/shared/templates/lineinfile/oval.template
|
||||
@@ -1,4 +1,4 @@
|
||||
-{{%- set regex = "^[\s]*" + TEXT + "[\s]*$" -%}}
|
||||
+{{%- set regex = "^[\s]*" ~ (TEXT | escape_regex) ~ "[\s]*$" -%}}
|
||||
<def-group>
|
||||
<definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
{{{ oval_metadata("Check presence of " + TEXT + " in " + PATH) }}}
|
||||
|
||||
From 6953f74d1ab168e7ccc3f28877621edff317fef2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
||||
Date: Fri, 30 Apr 2021 11:54:12 +0200
|
||||
Subject: [PATCH 3/6] Introduced the sshd_use_directory_configuration rule.
|
||||
|
||||
The rule makes sure that the sshd configuration is distributed in the
|
||||
/etc/ssh/sshd_config.d/ directory, and therefore it makes sense to scan that directory
|
||||
in another rules.
|
||||
---
|
||||
.../bash/shared.sh | 15 ++++++++++
|
||||
.../oval/shared.xml | 29 +++++++++++++++++++
|
||||
.../sshd_use_directory_configuration/rule.yml | 26 +++++++++++++++++
|
||||
.../tests/match.fail.sh | 4 +++
|
||||
.../tests/simple.fail.sh | 3 ++
|
||||
.../tests/simple.pass.sh | 4 +++
|
||||
shared/references/cce-redhat-avail.txt | 1 -
|
||||
shared/templates/extra_ovals.yml | 6 ++++
|
||||
8 files changed, 87 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/rule.yml
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/match.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..2ff58ec373c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+{{% set target_file = "/etc/ssh/sshd_config.d/sshd_config_original.conf" -%}}
|
||||
+if test -f {{{ target_file}}}; then
|
||||
+ {{{ die("Remediation probably already happened, '" ~ target_file ~ "' already exists, not doing anything.", action="false") }}}
|
||||
+else
|
||||
+ mkdir -p /etc/ssh/sshd_config.d
|
||||
+ mv /etc/ssh/sshd_config {{{ target_file }}}
|
||||
+cat > /etc/ssh/sshd_config << EOF
|
||||
+# To modify the system-wide sshd configuration, create a *.conf file under
|
||||
+# /etc/ssh/sshd_config.d/ which will be automatically included below
|
||||
+
|
||||
+Include /etc/ssh/sshd_config.d/*.conf
|
||||
+EOF
|
||||
+fi
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/oval/shared.xml b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..0ffb429adff
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/oval/shared.xml
|
||||
@@ -0,0 +1,29 @@
|
||||
+{{%- set config_path = "/etc/ssh/sshd_config" %}}
|
||||
+
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("foo") }}}
|
||||
+ <criteria comment="sshd is configured correctly or is not installed" operator="OR">
|
||||
+ <criteria comment="sshd is not installed" operator="AND">
|
||||
+ <extend_definition comment="sshd is not required or requirement is unset"
|
||||
+ definition_ref="sshd_not_required_or_unset" />
|
||||
+ <extend_definition comment="rpm package openssh-server removed"
|
||||
+ definition_ref="package_openssh-server_removed" />
|
||||
+ </criteria>
|
||||
+ <criteria comment="sshd is installed and configured" operator="AND">
|
||||
+ <extend_definition comment="sshd is required or requirement is unset"
|
||||
+ definition_ref="sshd_required_or_unset" />
|
||||
+ <extend_definition comment="rpm package openssh-server installed"
|
||||
+ definition_ref="package_openssh-server_installed" />
|
||||
+ <criteria comment="sshd is configured correctly" operator="AND">
|
||||
+ <extend_definition comment="sshd includes config files from its .d directory"
|
||||
+ definition_ref="sshd_includes_config_files" />
|
||||
+ {{{- oval_line_in_file_criterion(config_path, "match", missing_parameter_pass=true) | indent(8) }}}
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+ {{{ oval_line_in_file_test(config_path, "match", missing_parameter_pass=true) | indent (2) }}}
|
||||
+ {{{ oval_line_in_file_object(config_path, parameter="match", missing_parameter_pass=true, prefix_regex="^[ \\t]*(?i)", separator_regex="(?-i)\s+\S+") | indent (2) }}}
|
||||
+</def-group>
|
||||
+
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/rule.yml b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..8c370036e61
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/rule.yml
|
||||
@@ -0,0 +1,26 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel9
|
||||
+
|
||||
+title: 'Distribute the SSH Server configuration to multiple files in a config directory.'
|
||||
+
|
||||
+description: |-
|
||||
+ Make sure to have the <tt>Include /etc/ssh/sshd_config.d/*.conf</tt> line in the <tt>/etc/ssh/sshd_config</tt> file.
|
||||
+ Ideally, don't have any active configuration directives in that file, and distribute the service configuration
|
||||
+ to several files in the <tt>/etc/ssh/sshd_config.d</tt> directory.
|
||||
+
|
||||
+rationale: |-
|
||||
+ This form of distributed configuration is considered as a good practice, and as other sshd rules assume that directives in files in the <tt>/etc/ssh/sshd_config.d</tt> config directory are effective, there has to be a rule that ensures this.
|
||||
+ Aside from that, having multiple configuration files makes the SSH Server configuration changes easier to partition according to the reason that they were introduced, and therefore it should help to perform merges of hardening updates.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel9: CCE-87681-3
|
||||
+
|
||||
+ocil_clause: "you don't include other configuration files from the main configuration file"
|
||||
+
|
||||
+ocil: |-
|
||||
+ To determine whether the SSH server includes configuration files from the right directory, run the following command:
|
||||
+ <pre>$ sudo grep -i '^Include' /etc/ssh/sshd_config</pre>
|
||||
+ If a line <tt>Include /etc/ssh/sshd_config.d/*.conf</tt> is returned, then the configuration file inclusion is set correctly.
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/match.fail.sh b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/match.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..fa2ee0654f2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/match.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+echo "Match something" >> /etc/ssh/sshd_config
|
||||
+echo "Include /etc/ssh/sshd_config.d/*.conf" >> /etc/ssh/sshd_config
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.fail.sh b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..a6013ad7cfa
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.fail.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+echo "include /etc/ssh/sshd_config.d/.*" > /etc/ssh/sshd_config
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.pass.sh b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..7a26f521415
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/tests/simple.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Handling of case-insensitivity of include is tricky
|
||||
+echo "Include /etc/ssh/sshd_config.d/*.conf" > /etc/ssh/sshd_config
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 73d025484e6..40a2b9b5868 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -1780,7 +1780,6 @@ CCE-87677-1
|
||||
CCE-87678-9
|
||||
CCE-87679-7
|
||||
CCE-87680-5
|
||||
-CCE-87681-3
|
||||
CCE-87682-1
|
||||
CCE-87683-9
|
||||
CCE-87684-7
|
||||
diff --git a/shared/templates/extra_ovals.yml b/shared/templates/extra_ovals.yml
|
||||
index 095d911ee1c..69062ebe541 100644
|
||||
--- a/shared/templates/extra_ovals.yml
|
||||
+++ b/shared/templates/extra_ovals.yml
|
||||
@@ -57,3 +57,9 @@ service_syslog_disabled:
|
||||
vars:
|
||||
servicename: syslog
|
||||
packagename: rsyslog
|
||||
+
|
||||
+sshd_includes_config_files:
|
||||
+ name: lineinfile
|
||||
+ vars:
|
||||
+ path: /etc/ssh/sshd_config
|
||||
+ text: "Include /etc/ssh/sshd_config.d/*.conf"
|
||||
|
||||
From d7fcab7ad66e77bb7ccba507e3f024bc892c3864 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
||||
Date: Tue, 11 May 2021 16:06:29 +0200
|
||||
Subject: [PATCH 4/6] Improved error reporting related to macros.
|
||||
|
||||
---
|
||||
ssg/jinja.py | 22 +++++++++++++---------
|
||||
1 file changed, 13 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/ssg/jinja.py b/ssg/jinja.py
|
||||
index a46246ad0fb..28edd9a6dcd 100644
|
||||
--- a/ssg/jinja.py
|
||||
+++ b/ssg/jinja.py
|
||||
@@ -153,16 +153,20 @@ def load_macros(substitutions_dict=None):
|
||||
|
||||
add_python_functions(substitutions_dict)
|
||||
try:
|
||||
- update_substitutions_dict(JINJA_MACROS_BASE_DEFINITIONS, substitutions_dict)
|
||||
- update_substitutions_dict(JINJA_MACROS_HIGHLEVEL_DEFINITIONS, substitutions_dict)
|
||||
- update_substitutions_dict(JINJA_MACROS_ANSIBLE_DEFINITIONS, substitutions_dict)
|
||||
- update_substitutions_dict(JINJA_MACROS_BASH_DEFINITIONS, substitutions_dict)
|
||||
- update_substitutions_dict(JINJA_MACROS_OVAL_DEFINITIONS, substitutions_dict)
|
||||
- update_substitutions_dict(JINJA_MACROS_IGNITION_DEFINITIONS, substitutions_dict)
|
||||
- update_substitutions_dict(JINJA_MACROS_KUBERNETES_DEFINITIONS, substitutions_dict)
|
||||
+ filenames = [
|
||||
+ JINJA_MACROS_BASE_DEFINITIONS,
|
||||
+ JINJA_MACROS_HIGHLEVEL_DEFINITIONS,
|
||||
+ JINJA_MACROS_ANSIBLE_DEFINITIONS,
|
||||
+ JINJA_MACROS_BASH_DEFINITIONS,
|
||||
+ JINJA_MACROS_OVAL_DEFINITIONS,
|
||||
+ JINJA_MACROS_IGNITION_DEFINITIONS,
|
||||
+ JINJA_MACROS_KUBERNETES_DEFINITIONS,
|
||||
+ ]
|
||||
+ for filename in filenames:
|
||||
+ update_substitutions_dict(filename, substitutions_dict)
|
||||
except Exception as exc:
|
||||
- msg = ("Error extracting macro definitions: {0}"
|
||||
- .format(str(exc)))
|
||||
+ msg = ("Error extracting macro definitions from '{1}': {0}"
|
||||
+ .format(str(exc), filename))
|
||||
raise RuntimeError(msg)
|
||||
|
||||
return substitutions_dict
|
||||
|
||||
From df45c3fa295a2dc5a23cc347657964df6453cbae Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
||||
Date: Tue, 11 May 2021 16:44:50 +0200
|
||||
Subject: [PATCH 5/6] Removed devault values that are variables from Jinja
|
||||
|
||||
Support in older jinja2 packages is not in a good shape.
|
||||
---
|
||||
shared/macros-oval.jinja | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/shared/macros-oval.jinja b/shared/macros-oval.jinja
|
||||
index d38db96d9e3..87e0fd7d87d 100644
|
||||
--- a/shared/macros-oval.jinja
|
||||
+++ b/shared/macros-oval.jinja
|
||||
@@ -92,7 +92,8 @@
|
||||
- parameter (String): The parameter to be checked in the configuration file.
|
||||
- missing_parameter_pass (boolean): If set, the check will also pass if the parameter is not present in the configuration file (default is applied).
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_criterion(path='', parameter='', missing_parameter_pass=false, comment='', id_stem=rule_id) -%}}
|
||||
+{{%- macro oval_line_in_file_criterion(path='', parameter='', missing_parameter_pass=false, comment='', id_stem='') -%}}
|
||||
+{{%- set id_stem = id_stem or rule_id -%}}
|
||||
{{%- set suffix_id = "" -%}}
|
||||
{{%- set prefix_text = "Check the" -%}}
|
||||
{{%- if missing_parameter_pass %}}
|
||||
@@ -113,7 +114,8 @@
|
||||
- parameter (String): The parameter to be checked in the configuration file.
|
||||
- missing_parameter_pass (boolean): If set, the check will also pass if the parameter is not present in the configuration file (default is applied).
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_test(path='', parameter='', missing_parameter_pass=false, id_stem=rule_id) -%}}
|
||||
+{{%- macro oval_line_in_file_test(path='', parameter='', missing_parameter_pass=false, id_stem='') -%}}
|
||||
+{{%- set id_stem = id_stem or rule_id -%}}
|
||||
{{%- set suffix_id = "" -%}}
|
||||
{{%- if missing_parameter_pass %}}
|
||||
{{%- set check_existence = "none_exist" -%}}
|
||||
@@ -144,7 +146,8 @@
|
||||
- missing_parameter_pass (boolean): If set, the check will also pass if the parameter is not present in the configuration file (default is applied).
|
||||
- multi_value (boolean): If set, it means that the parameter can accept multiple values and the expected value must be present in the current list of values.
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_object(path='', section='', prefix_regex='^[ \\t]*', parameter='', separator_regex='[ \\t]+', missing_parameter_pass=false, multi_value=false, filepath_regex='', id_stem=rule_id) -%}}
|
||||
+{{%- macro oval_line_in_file_object(path='', section='', prefix_regex='^[ \\t]*', parameter='', separator_regex='[ \\t]+', missing_parameter_pass=false, multi_value=false, filepath_regex='', id_stem='') -%}}
|
||||
+{{%- set id_stem = id_stem or rule_id -%}}
|
||||
{{%- set suffix_id = "" -%}}
|
||||
{{%- if multi_value -%}}
|
||||
{{%- set group_regex = "([^#]*).*$" -%}}
|
||||
@@ -196,7 +199,8 @@
|
||||
- quotes (String): If non-empty, one level of matching quotes is considered when checking the value. Specify one or more quote types as a string.
|
||||
For example, for shell quoting, specify quotes="'\""), which will make sure that value, 'value' and "value" are matched, but 'value" or '"value"' won't be.
|
||||
#}}
|
||||
-{{%- macro oval_line_in_file_state(value='', multi_value='', quotes='', id_stem=rule_id) -%}}
|
||||
+{{%- macro oval_line_in_file_state(value='', multi_value='', quotes='', id_stem='') -%}}
|
||||
+{{%- set id_stem = id_stem or rule_id -%}}
|
||||
{{%- set regex = value -%}}
|
||||
{{%- if quotes != "" %}}
|
||||
{{%- if "\\1" in value > 0 %}}
|
||||
|
||||
From a3ec49f75ac3059d7096985e08e10005db96330a Mon Sep 17 00:00:00 2001
|
||||
From: Matej Tyc <matyc@redhat.com>
|
||||
Date: Fri, 30 Jul 2021 17:25:25 +0200
|
||||
Subject: [PATCH 6/6] Don't remediate when it is inappropriate
|
||||
|
||||
Don't remediate when the config file already contains the include
|
||||
directive.
|
||||
---
|
||||
.../sshd_use_directory_configuration/bash/shared.sh | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh
|
||||
index 2ff58ec373c..9317b23992d 100644
|
||||
--- a/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/bash/shared.sh
|
||||
@@ -1,12 +1,15 @@
|
||||
# platform = multi_platform_all
|
||||
|
||||
{{% set target_file = "/etc/ssh/sshd_config.d/sshd_config_original.conf" -%}}
|
||||
+{{% set base_config = "/etc/ssh/sshd_config" -%}}
|
||||
if test -f {{{ target_file}}}; then
|
||||
{{{ die("Remediation probably already happened, '" ~ target_file ~ "' already exists, not doing anything.", action="false") }}}
|
||||
+elif grep -Eq '^\s*Include\s+/etc/ssh/sshd_config\.d/\*\.conf' {{{ base_config }}} && ! grep -Eq '^\s*Match\s' {{{ base_config }}}; then
|
||||
+ {{{ die("Remediation probably already happened, '" ~ base_config ~ "' already contains the include directive.", action="false") }}}
|
||||
else
|
||||
mkdir -p /etc/ssh/sshd_config.d
|
||||
- mv /etc/ssh/sshd_config {{{ target_file }}}
|
||||
-cat > /etc/ssh/sshd_config << EOF
|
||||
+ mv {{{ base_config }}} {{{ target_file }}}
|
||||
+cat > {{{ base_config }}} << EOF
|
||||
# To modify the system-wide sshd configuration, create a *.conf file under
|
||||
# /etc/ssh/sshd_config.d/ which will be automatically included below
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,524 +0,0 @@
|
||||
From bf018e9f8327b231b967db8ec74fabf01802b6a8 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Wed, 11 Aug 2021 09:45:04 +0200
|
||||
Subject: [PATCH 1/3] Add test for ansible files removed and readded
|
||||
|
||||
Check if any playbook removes a file and then add it back again.
|
||||
The file removal is based on the 'file' module with 'state: absent', and
|
||||
the reintroduction of the file is based on 'lineinfile', 'blockinfile'
|
||||
and 'copy' modules.
|
||||
---
|
||||
CMakeLists.txt | 2 +
|
||||
tests/CMakeLists.txt | 8 ++
|
||||
tests/test_ansible_file_removed_and_added.py | 97 ++++++++++++++++++++
|
||||
3 files changed, 107 insertions(+)
|
||||
create mode 100644 tests/test_ansible_file_removed_and_added.py
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 330b869d0f9..e41f2caa630 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -129,6 +129,7 @@ find_python_module(jinja2 REQUIRED)
|
||||
find_python_module(pytest)
|
||||
find_python_module(pytest_cov)
|
||||
find_python_module(json2html)
|
||||
+find_python_module(yamlpath)
|
||||
|
||||
# sphinx documentation requirements
|
||||
find_python_module(sphinx)
|
||||
@@ -231,6 +232,7 @@ message(STATUS "python pytest module (optional): ${PY_PYTEST}")
|
||||
message(STATUS "ansible-playbook module (optional): ${ANSIBLE_PLAYBOOK_EXECUTABLE}")
|
||||
message(STATUS "ansible-lint module (optional): ${ANSIBLE_LINT_EXECUTABLE}")
|
||||
message(STATUS "yamllint module (optional): ${YAMLLINT_EXECUTABLE}")
|
||||
+message(STATUS "yamlpath module (optional): ${PY_YAMLPATH}")
|
||||
message(STATUS "BATS framework (optional): ${BATS_EXECUTABLE}")
|
||||
message(STATUS "python sphinx module (optional): ${PY_SPHINX}")
|
||||
message(STATUS "python sphinxcontrib.autojinja module (optional): ${PY_SPHINXCONTRIB.AUTOJINJA}")
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index 3e2d8a4ec31..739cc124035 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -121,3 +121,11 @@ add_test(
|
||||
)
|
||||
set_tests_properties("fix_rules-sort_subkeys" PROPERTIES LABELS quick)
|
||||
set_tests_properties("fix_rules-sort_subkeys" PROPERTIES DEPENDS "test-rule-dir-json")
|
||||
+
|
||||
+if (PY_YAMLPATH)
|
||||
+ add_test(
|
||||
+ NAME "ansible-file-removed-and-added"
|
||||
+ COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/test_ansible_file_removed_and_added.py" --ansible_dir "${CMAKE_BINARY_DIR}/ansible"
|
||||
+ )
|
||||
+ set_tests_properties("fix_rules-sort_subkeys" PROPERTIES LABELS quick)
|
||||
+endif()
|
||||
diff --git a/tests/test_ansible_file_removed_and_added.py b/tests/test_ansible_file_removed_and_added.py
|
||||
new file mode 100644
|
||||
index 00000000000..23f6f888bda
|
||||
--- /dev/null
|
||||
+++ b/tests/test_ansible_file_removed_and_added.py
|
||||
@@ -0,0 +1,97 @@
|
||||
+#!/usr/bin/python3
|
||||
+
|
||||
+import argparse
|
||||
+import os
|
||||
+import sys
|
||||
+from types import SimpleNamespace
|
||||
+from yamlpath import Processor
|
||||
+from yamlpath import YAMLPath
|
||||
+from yamlpath.common import Parsers
|
||||
+from yamlpath.exceptions import YAMLPathException
|
||||
+from yamlpath.wrappers import ConsolePrinter
|
||||
+
|
||||
+
|
||||
+def parse_command_line_args():
|
||||
+ parser = argparse.ArgumentParser(
|
||||
+ description="Checks if an Ansible Playbook removes a file and then adds it again.")
|
||||
+ parser.add_argument("--ansible_dir", required=True,
|
||||
+ help="Directory containing Ansible Playbooks")
|
||||
+ args = parser.parse_args()
|
||||
+ return args
|
||||
+
|
||||
+
|
||||
+def check_playbook_file_removed_and_added(playbook_path):
|
||||
+ playbook_ok = True
|
||||
+
|
||||
+ yaml_parser = Parsers.get_yaml_editor()
|
||||
+
|
||||
+ logging_args = SimpleNamespace(quiet=False, verbose=False, debug=False)
|
||||
+ log = ConsolePrinter(logging_args)
|
||||
+
|
||||
+ # Find every path removed by a file Task (also matches tasks within blocks)
|
||||
+ files_absent_string = "tasks.**.file[state=absent][parent()].path"
|
||||
+ files_absent_yamlpath = YAMLPath(files_absent_string)
|
||||
+ path_editing_tasks_yamlpath = ""
|
||||
+
|
||||
+ log.info("Info: Evaluating playbook '{}'".format(playbook_path))
|
||||
+ (yaml_data, doc_loaded) = Parsers.get_yaml_data(yaml_parser, log, playbook_path)
|
||||
+ if not doc_loaded:
|
||||
+ # There was an issue loading the file; an error message has already been
|
||||
+ # printed via ConsolePrinter.
|
||||
+ return False
|
||||
+
|
||||
+ processor = Processor(log, yaml_data)
|
||||
+ try:
|
||||
+ for node in processor.get_nodes(files_absent_yamlpath, mustexist=False):
|
||||
+ path = str(node)
|
||||
+ # 'node' is a NodeCoords.
|
||||
+ if path == 'None':
|
||||
+ continue
|
||||
+ elif "{{" in path:
|
||||
+ # Identified path is a Jinja expression, unfortunately there is no easy way to get
|
||||
+ # the actual path without making this test very complicated
|
||||
+ continue
|
||||
+
|
||||
+ # Check if this paths is used in any of the following ansible modules
|
||||
+ ansible_modules = ["lineinfile", "blockinfile", "copy"]
|
||||
+ path_editing_tasks_string = "tasks.**.[.=~/{modules}/][*='{path}'][parent()].name"
|
||||
+ path_editing_tasks_yamlpath = YAMLPath(path_editing_tasks_string.format(
|
||||
+ modules="|".join(ansible_modules),
|
||||
+ path=node)
|
||||
+ )
|
||||
+ for task in processor.get_nodes(path_editing_tasks_yamlpath, mustexist=False):
|
||||
+ log.info("Error: Task '{}' manipulates a file that is removed by another task"
|
||||
+ .format(task))
|
||||
+ playbook_ok = False
|
||||
+ except YAMLPathException as ex:
|
||||
+ no_file_msg = ("Cannot add PathSegmentTypes.TRAVERSE subreference to lists at 'None' "
|
||||
+ "in '{}'.")
|
||||
+ if str(ex) == no_file_msg.format(files_absent_string):
|
||||
+ log.info("Info: Playbook {} has no 'file' tasks.".format(playbook_path))
|
||||
+ elif path_editing_tasks_yamlpath and str(ex) == no_file_msg.format(
|
||||
+ path_editing_tasks_yamlpath):
|
||||
+ log.info("Info: Playbook {} has no '{}' tasks.".format(
|
||||
+ playbook_path, " ".join(ansible_modules)))
|
||||
+ else:
|
||||
+ log.info("Error: {}.".format(ex))
|
||||
+
|
||||
+ return playbook_ok
|
||||
+
|
||||
+
|
||||
+def main():
|
||||
+ args = parse_command_line_args()
|
||||
+
|
||||
+ all_playbooks_ok = True
|
||||
+ for dir_item in os.listdir(args.ansible_dir):
|
||||
+ if dir_item.endswith(".yml"):
|
||||
+ playbook_path = os.path.join(args.ansible_dir, dir_item)
|
||||
+
|
||||
+ if not check_playbook_file_removed_and_added(playbook_path):
|
||||
+ all_playbooks_ok = False
|
||||
+
|
||||
+ if not all_playbooks_ok:
|
||||
+ sys.exit(1)
|
||||
+
|
||||
+
|
||||
+if __name__ == "__main__":
|
||||
+ main()
|
||||
|
||||
From e6d727762ba446cad94f1e002fa7a7fef0f1a4cb Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Wed, 11 Aug 2021 09:48:14 +0200
|
||||
Subject: [PATCH 2/3] Unit tests the function for file removed and added
|
||||
|
||||
Add a unit test for the core function that checks if any playbook
|
||||
removes a file and then reintroduces it back.
|
||||
---
|
||||
tests/CMakeLists.txt | 6 ++
|
||||
.../file_block_removed_and_added.yml | 69 +++++++++++++++++++
|
||||
.../file_not_removed_and_added.yml | 49 +++++++++++++
|
||||
.../file_removed_and_added.yml | 62 +++++++++++++++++
|
||||
.../file_removed_and_not_added.yml | 46 +++++++++++++
|
||||
...t_check_playbook_file_removed_and_added.py | 39 +++++++++++
|
||||
6 files changed, 271 insertions(+)
|
||||
create mode 100644 tests/ansible_file_removed_and_added/file_block_removed_and_added.yml
|
||||
create mode 100644 tests/ansible_file_removed_and_added/file_not_removed_and_added.yml
|
||||
create mode 100644 tests/ansible_file_removed_and_added/file_removed_and_added.yml
|
||||
create mode 100644 tests/ansible_file_removed_and_added/file_removed_and_not_added.yml
|
||||
create mode 100644 tests/test_check_playbook_file_removed_and_added.py
|
||||
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index 739cc124035..000a1b1385d 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -123,6 +123,12 @@ set_tests_properties("fix_rules-sort_subkeys" PROPERTIES LABELS quick)
|
||||
set_tests_properties("fix_rules-sort_subkeys" PROPERTIES DEPENDS "test-rule-dir-json")
|
||||
|
||||
if (PY_YAMLPATH)
|
||||
+ if (PY_PYTEST)
|
||||
+ add_test(
|
||||
+ NAME "test-function-check_playbook_file_removed_and_added"
|
||||
+ COMMAND "${PYTHON_EXECUTABLE}" -m pytest ${PYTEST_COVERAGE_OPTIONS} "${CMAKE_CURRENT_SOURCE_DIR}/test_check_playbook_file_removed_and_added.py"
|
||||
+ )
|
||||
+ endif()
|
||||
add_test(
|
||||
NAME "ansible-file-removed-and-added"
|
||||
COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/test_ansible_file_removed_and_added.py" --ansible_dir "${CMAKE_BINARY_DIR}/ansible"
|
||||
diff --git a/tests/ansible_file_removed_and_added/file_block_removed_and_added.yml b/tests/ansible_file_removed_and_added/file_block_removed_and_added.yml
|
||||
new file mode 100644
|
||||
index 00000000000..8863b333129
|
||||
--- /dev/null
|
||||
+++ b/tests/ansible_file_removed_and_added/file_block_removed_and_added.yml
|
||||
@@ -0,0 +1,69 @@
|
||||
+---
|
||||
+
|
||||
+- hosts: all
|
||||
+ vars:
|
||||
+ var_system_crypto_policy: !!str FUTURE
|
||||
+ var_sudo_logfile: !!str /var/log/sudo.log
|
||||
+
|
||||
+ tasks:
|
||||
+ - name: Modify the System Login Banner - add correct banner
|
||||
+ lineinfile:
|
||||
+ dest: /etc/issue
|
||||
+ line: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*)\|.*\)$",
|
||||
+ "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
|
||||
+ "\n") | regex_replace("\\", "") | wordwrap() }}'
|
||||
+ create: true
|
||||
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
+ tags:
|
||||
+ - banner_etc_issue
|
||||
+ - low_complexity
|
||||
+ - medium_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+ - unknown_strategy
|
||||
+
|
||||
+ - name: Test for existence /etc/issue
|
||||
+ stat:
|
||||
+ path: /etc/issue
|
||||
+ register: file_exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - name: Ensure permission 0644 on /etc/issue
|
||||
+ file:
|
||||
+ path: /etc/issue
|
||||
+ mode: '0644'
|
||||
+ when: file_exists.stat is defined and file_exists.stat.exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - block:
|
||||
+
|
||||
+ - name: Remove Rsh Trust Files
|
||||
+ file:
|
||||
+ path: /root/shosts.equiv
|
||||
+ state: absent
|
||||
+
|
||||
+ - name: Add line to /root/shosts.equiv
|
||||
+ lineinfile:
|
||||
+ dest: /root/shosts.equiv
|
||||
+ line: 'test host'
|
||||
+ create: true
|
||||
+ tags:
|
||||
+ - high_severity
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - no_reboot_needed
|
||||
+ - no_rsh_trust_files
|
||||
+ - restrict_strategy
|
||||
+
|
||||
diff --git a/tests/ansible_file_removed_and_added/file_not_removed_and_added.yml b/tests/ansible_file_removed_and_added/file_not_removed_and_added.yml
|
||||
new file mode 100644
|
||||
index 00000000000..3d3e53b958f
|
||||
--- /dev/null
|
||||
+++ b/tests/ansible_file_removed_and_added/file_not_removed_and_added.yml
|
||||
@@ -0,0 +1,49 @@
|
||||
+---
|
||||
+
|
||||
+- hosts: all
|
||||
+ vars:
|
||||
+ var_system_crypto_policy: !!str FUTURE
|
||||
+ var_sudo_logfile: !!str /var/log/sudo.log
|
||||
+
|
||||
+ tasks:
|
||||
+ - name: Modify the System Login Banner - add correct banner
|
||||
+ lineinfile:
|
||||
+ dest: /etc/issue
|
||||
+ line: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*)\|.*\)$",
|
||||
+ "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
|
||||
+ "\n") | regex_replace("\\", "") | wordwrap() }}'
|
||||
+ create: true
|
||||
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
+ tags:
|
||||
+ - banner_etc_issue
|
||||
+ - low_complexity
|
||||
+ - medium_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+ - unknown_strategy
|
||||
+
|
||||
+ - name: Test for existence /etc/issue
|
||||
+ stat:
|
||||
+ path: /etc/issue
|
||||
+ register: file_exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - name: Ensure permission 0644 on /etc/issue
|
||||
+ file:
|
||||
+ path: /etc/issue
|
||||
+ mode: '0644'
|
||||
+ when: file_exists.stat is defined and file_exists.stat.exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
diff --git a/tests/ansible_file_removed_and_added/file_removed_and_added.yml b/tests/ansible_file_removed_and_added/file_removed_and_added.yml
|
||||
new file mode 100644
|
||||
index 00000000000..a44c39a9db2
|
||||
--- /dev/null
|
||||
+++ b/tests/ansible_file_removed_and_added/file_removed_and_added.yml
|
||||
@@ -0,0 +1,62 @@
|
||||
+---
|
||||
+
|
||||
+- hosts: all
|
||||
+ vars:
|
||||
+ var_system_crypto_policy: !!str FUTURE
|
||||
+ var_sudo_logfile: !!str /var/log/sudo.log
|
||||
+
|
||||
+ tasks:
|
||||
+ - name: Modify the System Login Banner - remove incorrect banner
|
||||
+ file:
|
||||
+ state: absent
|
||||
+ path: /etc/issue
|
||||
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
+ tags:
|
||||
+ - banner_etc_issue
|
||||
+ - low_complexity
|
||||
+ - medium_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+ - unknown_strategy
|
||||
+
|
||||
+ - name: Modify the System Login Banner - add correct banner
|
||||
+ lineinfile:
|
||||
+ dest: /etc/issue
|
||||
+ line: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*)\|.*\)$",
|
||||
+ "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
|
||||
+ "\n") | regex_replace("\\", "") | wordwrap() }}'
|
||||
+ create: true
|
||||
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
+ tags:
|
||||
+ - banner_etc_issue
|
||||
+ - low_complexity
|
||||
+ - medium_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+ - unknown_strategy
|
||||
+
|
||||
+ - name: Test for existence /etc/issue
|
||||
+ stat:
|
||||
+ path: /etc/issue
|
||||
+ register: file_exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - name: Ensure permission 0644 on /etc/issue
|
||||
+ file:
|
||||
+ path: /etc/issue
|
||||
+ mode: '0644'
|
||||
+ when: file_exists.stat is defined and file_exists.stat.exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
diff --git a/tests/ansible_file_removed_and_added/file_removed_and_not_added.yml b/tests/ansible_file_removed_and_added/file_removed_and_not_added.yml
|
||||
new file mode 100644
|
||||
index 00000000000..08cda7e5063
|
||||
--- /dev/null
|
||||
+++ b/tests/ansible_file_removed_and_added/file_removed_and_not_added.yml
|
||||
@@ -0,0 +1,46 @@
|
||||
+---
|
||||
+
|
||||
+- hosts: all
|
||||
+ vars:
|
||||
+ var_system_crypto_policy: !!str FUTURE
|
||||
+ var_sudo_logfile: !!str /var/log/sudo.log
|
||||
+
|
||||
+ tasks:
|
||||
+ - name: Modify the System Login Banner - remove incorrect banner
|
||||
+ file:
|
||||
+ state: absent
|
||||
+ path: /etc/issue
|
||||
+ when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
|
||||
+ tags:
|
||||
+ - banner_etc_issue
|
||||
+ - low_complexity
|
||||
+ - medium_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+ - unknown_strategy
|
||||
+
|
||||
+ - name: Test for existence /etc/issue
|
||||
+ stat:
|
||||
+ path: /etc/issue
|
||||
+ register: file_exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
+ - name: Ensure permission 0644 on /etc/issue
|
||||
+ file:
|
||||
+ path: /etc/issue
|
||||
+ mode: '0644'
|
||||
+ when: file_exists.stat is defined and file_exists.stat.exists
|
||||
+ tags:
|
||||
+ - configure_strategy
|
||||
+ - file_permissions_etc_issue
|
||||
+ - low_complexity
|
||||
+ - low_disruption
|
||||
+ - medium_severity
|
||||
+ - no_reboot_needed
|
||||
+
|
||||
diff --git a/tests/test_check_playbook_file_removed_and_added.py b/tests/test_check_playbook_file_removed_and_added.py
|
||||
new file mode 100644
|
||||
index 00000000000..181bb14ed46
|
||||
--- /dev/null
|
||||
+++ b/tests/test_check_playbook_file_removed_and_added.py
|
||||
@@ -0,0 +1,39 @@
|
||||
+import os
|
||||
+import pytest
|
||||
+
|
||||
+from .test_ansible_file_removed_and_added import check_playbook_file_removed_and_added
|
||||
+
|
||||
+
|
||||
+def test_file_removed_and_added():
|
||||
+ playbook_path = os.path.join(os.path.dirname(__file__),
|
||||
+ "ansible_file_removed_and_added",
|
||||
+ "file_removed_and_added.yml")
|
||||
+ assert not check_playbook_file_removed_and_added(playbook_path)
|
||||
+
|
||||
+
|
||||
+def test_file_removed_and_not_added():
|
||||
+ playbook_path = os.path.join(os.path.dirname(__file__),
|
||||
+ "ansible_file_removed_and_added",
|
||||
+ "file_removed_and_not_added.yml")
|
||||
+ assert check_playbook_file_removed_and_added(playbook_path)
|
||||
+
|
||||
+
|
||||
+def test_file_not_removed_and_added():
|
||||
+ playbook_path = os.path.join(os.path.dirname(__file__),
|
||||
+ "ansible_file_removed_and_added",
|
||||
+ "file_not_removed_and_added.yml")
|
||||
+ assert check_playbook_file_removed_and_added(playbook_path)
|
||||
+
|
||||
+
|
||||
+def test_file_block_removed_and_added():
|
||||
+ playbook_path = os.path.join(os.path.dirname(__file__),
|
||||
+ "ansible_file_removed_and_added",
|
||||
+ "file_block_removed_and_added.yml")
|
||||
+ assert not check_playbook_file_removed_and_added(playbook_path)
|
||||
+
|
||||
+
|
||||
+def test_file_block_removed_and_not_added():
|
||||
+ playbook_path = os.path.join(os.path.dirname(__file__),
|
||||
+ "ansible_file_removed_and_added",
|
||||
+ "file_block_removed_and_not_added.yml")
|
||||
+ assert check_playbook_file_removed_and_added(playbook_path)
|
||||
|
||||
From 741ec823ac39341f8aa0649031b72d2ac36e8a64 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 12 Aug 2021 10:36:47 +0200
|
||||
Subject: [PATCH 3/3] Mention Ansible static yamlpath test in docs
|
||||
|
||||
---
|
||||
.../developer/02_building_complianceascode.md | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/docs/manual/developer/02_building_complianceascode.md b/docs/manual/developer/02_building_complianceascode.md
|
||||
index d536df0a259..87469bf5f9b 100644
|
||||
--- a/docs/manual/developer/02_building_complianceascode.md
|
||||
+++ b/docs/manual/developer/02_building_complianceascode.md
|
||||
@@ -64,6 +64,20 @@ yum install yamllint ansible-lint
|
||||
apt-get install yamllint ansible-lint
|
||||
```
|
||||
|
||||
+### Static Ansible Playbooks tests
|
||||
+
|
||||
+Install `yamlpath` and `pytest` to run tests cases that analyse the Ansible
|
||||
+Playbooks' yaml nodes.
|
||||
+```bash
|
||||
+pip3 install yamlpath
|
||||
+
|
||||
+# Fedora/RHEL
|
||||
+yum install python3-pytest
|
||||
+
|
||||
+# Ubuntu/Debian
|
||||
+apt-get install python-pytest
|
||||
+```
|
||||
+
|
||||
### Ninja (Faster Builds)
|
||||
|
||||
Install the `ninja` build system if you want to use it instead of
|
@ -1,21 +0,0 @@
|
||||
From 2452c1c69e6bda3b6130d8cf80c69c711c438fd0 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Wed, 7 Jul 2021 18:59:10 +0200
|
||||
Subject: [PATCH] Select two more rules in RHEL7 STIG.
|
||||
|
||||
- sysctl_net_ipv4_conf_all_rp_filter
|
||||
- sysctl_net_ipv4_conf_default_rp_filter
|
||||
---
|
||||
products/rhel7/profiles/stig.profile | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/products/rhel7/profiles/stig.profile b/products/rhel7/profiles/stig.profile
|
||||
index 23635ffed91..78133180ecc 100644
|
||||
--- a/products/rhel7/profiles/stig.profile
|
||||
+++ b/products/rhel7/profiles/stig.profile
|
||||
@@ -314,3 +314,5 @@ selections:
|
||||
- package_MFEhiplsm_installed
|
||||
- file_ownership_var_log_audit
|
||||
- file_permissions_var_log_audit
|
||||
+ - sysctl_net_ipv4_conf_all_rp_filter
|
||||
+ - sysctl_net_ipv4_conf_default_rp_filter
|
File diff suppressed because one or more lines are too long
@ -1,34 +0,0 @@
|
||||
From f151a439ce9199a0a4496c0bc55811b47bfd8b78 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Polasek <vpolasek@redhat.com>
|
||||
Date: Thu, 5 Aug 2021 16:45:29 +0200
|
||||
Subject: [PATCH] update version of rhel7 stig_gui profile
|
||||
|
||||
---
|
||||
products/rhel7/profiles/stig_gui.profile | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/products/rhel7/profiles/stig_gui.profile b/products/rhel7/profiles/stig_gui.profile
|
||||
index d41d2ef4f80..6dd433d6c21 100644
|
||||
--- a/products/rhel7/profiles/stig_gui.profile
|
||||
+++ b/products/rhel7/profiles/stig_gui.profile
|
||||
@@ -1,9 +1,9 @@
|
||||
documentation_complete: true
|
||||
|
||||
metadata:
|
||||
- version: V3R3
|
||||
+ version: V3R4
|
||||
SMEs:
|
||||
- - carlosmmatos
|
||||
+ - ggbecker
|
||||
|
||||
reference: https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux
|
||||
|
||||
@@ -11,7 +11,7 @@ title: 'DISA STIG with GUI for Red Hat Enterprise Linux 7'
|
||||
|
||||
description: |-
|
||||
This profile contains configuration checks that align to the
|
||||
- DISA STIG with GUI for Red Hat Enterprise Linux V3R3.
|
||||
+ DISA STIG with GUI for Red Hat Enterprise Linux V3R4.
|
||||
|
||||
In addition to being applicable to Red Hat Enterprise Linux 7, DISA recognizes this
|
||||
configuration baseline as applicable to the operating system tier of
|
@ -1,120 +0,0 @@
|
||||
From ea1bab197a17dd944e41a583c82c3cc757bb566b Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 12:23:05 +0200
|
||||
Subject: [PATCH] Update STIG mapping table to reflect statistics of coverage.
|
||||
|
||||
---
|
||||
.../shared_xccdf-apply-overlay-stig.xslt | 59 +++++++++++++------
|
||||
.../transforms/shared_xccdf2table-stig.xslt | 28 +++++++++
|
||||
2 files changed, 68 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/shared/transforms/shared_xccdf-apply-overlay-stig.xslt b/shared/transforms/shared_xccdf-apply-overlay-stig.xslt
|
||||
index 945f709b95..b7c000608c 100644
|
||||
--- a/shared/transforms/shared_xccdf-apply-overlay-stig.xslt
|
||||
+++ b/shared/transforms/shared_xccdf-apply-overlay-stig.xslt
|
||||
@@ -28,26 +28,47 @@
|
||||
<xsl:variable name="overlay_ref" select="@disa"/>
|
||||
<xsl:variable name="overlay_title" select="xccdf:title/@text"/>
|
||||
|
||||
- <xsl:for-each select="$rules">
|
||||
- <xsl:if test="@id=$overlay_rule">
|
||||
- <Group id="V-{$overlay_id}">
|
||||
- <title>SRG-OS-ID</title>
|
||||
- <description></description>
|
||||
- <Rule id="{$overlay_rule}" severity="{$overlay_severity}" >
|
||||
- <version><xsl:value-of select="$overlay_version"/></version>
|
||||
- <title><xsl:value-of select="$overlay_title"/></title>
|
||||
- <description><xsl:copy-of select="xccdf:rationale/node()" /></description>
|
||||
- <check system="C-{$overlay_id}_chk">
|
||||
- <check-content>
|
||||
- <xsl:apply-templates select="xccdf:check[@system='http://scap.nist.gov/schema/ocil/2']"/>
|
||||
- </check-content>
|
||||
- </check>
|
||||
- <ident system="https://public.cyber.mil/stigs/cci"><xsl:value-of select="$overlay_ref" /></ident>
|
||||
- <fixtext><xsl:copy-of select="xccdf:description/node()" /></fixtext>
|
||||
- </Rule>
|
||||
+ <xsl:choose>
|
||||
+ <xsl:when test="$overlay_rule='XXXX'">
|
||||
+ <Group id="V-{$overlay_id}">
|
||||
+ <title>SRG-OS-ID</title>
|
||||
+ <description></description>
|
||||
+ <Rule id="Missing Rule" severity="{$overlay_severity}" >
|
||||
+ <version><xsl:value-of select="$overlay_version"/></version>
|
||||
+ <title><xsl:value-of select="$overlay_title"/></title>
|
||||
+ <description></description>
|
||||
+ <check system="C-{$overlay_id}_chk">
|
||||
+ <check-content>
|
||||
+ </check-content>
|
||||
+ </check>
|
||||
+ <ident></ident>
|
||||
+ <fixtext></fixtext>
|
||||
+ </Rule>
|
||||
</Group>
|
||||
- </xsl:if>
|
||||
- </xsl:for-each>
|
||||
+ </xsl:when>
|
||||
+ <xsl:otherwise>
|
||||
+ <xsl:for-each select="$rules">
|
||||
+ <xsl:if test="@id=$overlay_rule">
|
||||
+ <Group id="V-{$overlay_id}">
|
||||
+ <title>SRG-OS-ID</title>
|
||||
+ <description></description>
|
||||
+ <Rule id="{$overlay_rule}" severity="{$overlay_severity}" >
|
||||
+ <version><xsl:value-of select="$overlay_version"/></version>
|
||||
+ <title><xsl:value-of select="$overlay_title"/></title>
|
||||
+ <description><xsl:copy-of select="xccdf:rationale/node()" /></description>
|
||||
+ <check system="C-{$overlay_id}_chk">
|
||||
+ <check-content>
|
||||
+ <xsl:apply-templates select="xccdf:check[@system='http://scap.nist.gov/schema/ocil/2']"/>
|
||||
+ </check-content>
|
||||
+ </check>
|
||||
+ <ident system="https://public.cyber.mil/stigs/cci"><xsl:value-of select="$overlay_ref" /></ident>
|
||||
+ <fixtext><xsl:copy-of select="xccdf:description/node()" /></fixtext>
|
||||
+ </Rule>
|
||||
+ </Group>
|
||||
+ </xsl:if>
|
||||
+ </xsl:for-each>
|
||||
+ </xsl:otherwise>
|
||||
+ </xsl:choose>
|
||||
|
||||
</xsl:for-each>
|
||||
</xsl:copy>
|
||||
diff --git a/shared/transforms/shared_xccdf2table-stig.xslt b/shared/transforms/shared_xccdf2table-stig.xslt
|
||||
index 3746c386c0..4c477542f4 100644
|
||||
--- a/shared/transforms/shared_xccdf2table-stig.xslt
|
||||
+++ b/shared/transforms/shared_xccdf2table-stig.xslt
|
||||
@@ -20,6 +20,34 @@
|
||||
</div>
|
||||
<br/>
|
||||
<br/>
|
||||
+
|
||||
+ <div>
|
||||
+ <table>
|
||||
+ <thead>
|
||||
+ <tr>
|
||||
+ <th>Total</th>
|
||||
+ <th>Missing</th>
|
||||
+ <th>Implemented</th>
|
||||
+ <th>Coverage</th>
|
||||
+ <th>STIG ids missing rule</th>
|
||||
+ </tr>
|
||||
+ </thead>
|
||||
+ <tbody>
|
||||
+ <tr>
|
||||
+ <td><xsl:value-of select="number(count(/cdf:Benchmark/cdf:Group/cdf:Rule))"/></td>
|
||||
+ <td><xsl:value-of select="number(count(/cdf:Benchmark/cdf:Group/cdf:Rule[@id='Missing Rule']))"/></td>
|
||||
+ <td><xsl:value-of select="number(count(/cdf:Benchmark/cdf:Group/cdf:Rule[@id!='Missing Rule']))"/></td>
|
||||
+ <td><xsl:value-of select="format-number(count(/cdf:Benchmark/cdf:Group/cdf:Rule[@id!='Missing Rule']) div count(/cdf:Benchmark/cdf:Group/cdf:Rule)*100, '#.00')"/>%</td>
|
||||
+ <td>
|
||||
+ <xsl:for-each select="/cdf:Benchmark/cdf:Group/cdf:Rule[@id='Missing Rule']">
|
||||
+ <xsl:value-of select="cdf:version/node()"/><xsl:text>
</xsl:text>
|
||||
+ </xsl:for-each>
|
||||
+ </td>
|
||||
+ </tr>
|
||||
+ </tbody>
|
||||
+ </table>
|
||||
+ </div>
|
||||
+
|
||||
<xsl:apply-templates select="cdf:Benchmark"/>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
@ -1,89 +0,0 @@
|
||||
From 3d7b01a7fdc27f7e5a31ba508f7f84dab446aa4b Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Barretto <eduardo.barretto@canonical.com>
|
||||
Date: Wed, 16 Jun 2021 16:34:59 +0200
|
||||
Subject: [PATCH 1/5] Add accounts_password_pam_dictcheck to UBTU-20-010056
|
||||
|
||||
---
|
||||
products/ubuntu2004/profiles/stig.profile | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/products/ubuntu2004/profiles/stig.profile b/products/ubuntu2004/profiles/stig.profile
|
||||
index 4d03bfe7ae..ac9685809c 100644
|
||||
--- a/products/ubuntu2004/profiles/stig.profile
|
||||
+++ b/products/ubuntu2004/profiles/stig.profile
|
||||
@@ -113,6 +113,8 @@ selections:
|
||||
- accounts_password_pam_ocredit
|
||||
|
||||
# UBTU-20-010056 The Ubuntu operating system must prevent the use of dictionary words for passwords.
|
||||
+ - var_password_pam_dictcheck=1
|
||||
+ - accounts_password_pam_dictcheck
|
||||
|
||||
# UBTU-20-010057 The Ubuntu operating system must be configured so that when passwords are changed or new passwords are established, pwquality must be used.
|
||||
- var_password_pam_retry=3
|
||||
|
||||
From 6c3c586a7fe27d68052428e02843c573f9cbd559 Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Barretto <eduardo.barretto@canonical.com>
|
||||
Date: Wed, 4 Aug 2021 18:11:48 +0200
|
||||
Subject: [PATCH 2/5] Add ubuntu2004 to prodtype in
|
||||
accounts_password_pam_dictcheck
|
||||
|
||||
---
|
||||
.../accounts_password_pam_dictcheck/rule.yml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
index 2990150c0a..00da0397b0 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: fedora,rhel8
|
||||
+prodtype: fedora,rhel8,ubuntu2004
|
||||
|
||||
title: 'Ensure PAM Enforces Password Requirements - Prevent the Use of Dictionary Words'
|
||||
|
||||
|
||||
From b523676430765ab7fff09f790618f091d3f916e2 Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Barretto <eduardo.barretto@canonical.com>
|
||||
Date: Wed, 4 Aug 2021 18:12:59 +0200
|
||||
Subject: [PATCH 4/5] Add stigid@ubuntu2004 to accounts_password_pam_dictcheck
|
||||
|
||||
---
|
||||
.../accounts_password_pam_dictcheck/rule.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
index bae2db25fe..226329d752 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
@@ -29,6 +29,7 @@ references:
|
||||
nist: IA-5(c),IA-5(1)(a),CM-6(a),IA-5(4)
|
||||
srg: SRG-OS-000480-GPOS-00225
|
||||
stigid@rhel8: RHEL-08-020300
|
||||
+ stigid@ubuntu2004: UBTU-20-010056
|
||||
|
||||
ocil_clause: 'dictcheck is not found or not equal to the required value'
|
||||
|
||||
|
||||
From 39973c39ea17fb13730f1bef239783464c1b4b01 Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Barretto <eduardo.barretto@canonical.com>
|
||||
Date: Wed, 4 Aug 2021 18:13:16 +0200
|
||||
Subject: [PATCH 5/5] Add pam platform to accounts_password_pam_dictcheck
|
||||
|
||||
---
|
||||
.../accounts_password_pam_dictcheck/rule.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
index 226329d752..d0d4b8c5c5 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_dictcheck/rule.yml
|
||||
@@ -39,6 +39,7 @@ ocil: |-
|
||||
The <tt>dictcheck</tt> parameter should be equal to 1. The value should look like
|
||||
<pre>dictcheck=1</pre>
|
||||
|
||||
+platform: pam
|
||||
|
||||
template:
|
||||
name: accounts_password
|
@ -1,821 +0,0 @@
|
||||
From 7899e18d486b6181f3213c3c1351f24cdce84bf8 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 10:34:47 -0500
|
||||
Subject: [PATCH 01/20] Split RHEL-08-040100 into two rules
|
||||
|
||||
One for the firewalld package and one for the firewalld service.
|
||||
---
|
||||
.../firewalld_activation/service_firewalld_enabled/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/network/network-firewalld/firewalld_activation/service_firewalld_enabled/rule.yml b/linux_os/guide/system/network/network-firewalld/firewalld_activation/service_firewalld_enabled/rule.yml
|
||||
index cff9581e76..42849bdd5a 100644
|
||||
--- a/linux_os/guide/system/network/network-firewalld/firewalld_activation/service_firewalld_enabled/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-firewalld/firewalld_activation/service_firewalld_enabled/rule.yml
|
||||
@@ -40,7 +40,7 @@ references:
|
||||
srg: SRG-OS-000096-GPOS-00050,SRG-OS-000297-GPOS-00115,SRG-OS-000480-GPOS-00227,SRG-OS-000480-GPOS-00231,SRG-OS-000480-GPOS-00232
|
||||
stigid@ol7: OL07-00-040520
|
||||
stigid@rhel7: RHEL-07-040520
|
||||
- stigid@rhel8: RHEL-08-040100
|
||||
+ stigid@rhel8: RHEL-08-040101
|
||||
stigid@sle15: SLES-15-010220
|
||||
|
||||
ocil: |-
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 965068a691..9d0145a96f 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -968,9 +968,11 @@ selections:
|
||||
# RHEL-08-040090
|
||||
|
||||
# RHEL-08-040100
|
||||
- - service_firewalld_enabled
|
||||
- package_firewalld_installed
|
||||
|
||||
+ # RHEL-08-040101
|
||||
+ - service_firewalld_enabled
|
||||
+
|
||||
# RHEL-08-040110
|
||||
- wireless_disable_interfaces
|
||||
|
||||
|
||||
From 7396acddc284acc54d66640e7e0bc5251334bc0b Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 11:44:59 -0500
|
||||
Subject: [PATCH 02/20] Split the rule for RHEL-08-020040
|
||||
|
||||
Split and package_tmux_installed and configure_tmux_lock_command
|
||||
---
|
||||
.../console_screen_locking/package_tmux_installed/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/package_tmux_installed/rule.yml b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/package_tmux_installed/rule.yml
|
||||
index 550eaea8bb..120d1c49e0 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/package_tmux_installed/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-physical/screen_locking/console_screen_locking/package_tmux_installed/rule.yml
|
||||
@@ -40,7 +40,7 @@ references:
|
||||
nist-csf: PR.AC-7
|
||||
ospp: FMT_MOF_EXT.1
|
||||
srg: SRG-OS-000030-GPOS-00011,SRG-OS-000028-GPOS-00009
|
||||
- stigid@rhel8: RHEL-08-020040
|
||||
+ stigid@rhel8: RHEL-08-020039
|
||||
vmmsrg: SRG-OS-000030-VMM-000110
|
||||
|
||||
ocil_clause: 'the package is not installed'
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 9d0145a96f..9f57b28f4f 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -481,8 +481,10 @@ selections:
|
||||
# RHEL-08-020030
|
||||
- dconf_gnome_screensaver_lock_enabled
|
||||
|
||||
- # RHEL-08-020040
|
||||
+ # RHEL-08-020039
|
||||
- package_tmux_installed
|
||||
+
|
||||
+ # RHEL-08-020040
|
||||
- configure_tmux_lock_command
|
||||
|
||||
# RHEL-08-020041
|
||||
|
||||
From 6e3a93e173fbd12640e585d579f1e1d0afd3f419 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 11:49:59 -0500
|
||||
Subject: [PATCH 03/20] Split RHEL-08-040100
|
||||
|
||||
One for the openssh-server package and one for the openssh-server service.
|
||||
---
|
||||
.../services/ssh/package_openssh-server_installed/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/package_openssh-server_installed/rule.yml b/linux_os/guide/services/ssh/package_openssh-server_installed/rule.yml
|
||||
index 0b2a660c29..b551f08f38 100644
|
||||
--- a/linux_os/guide/services/ssh/package_openssh-server_installed/rule.yml
|
||||
+++ b/linux_os/guide/services/ssh/package_openssh-server_installed/rule.yml
|
||||
@@ -30,7 +30,7 @@ references:
|
||||
srg: SRG-OS-000423-GPOS-00187,SRG-OS-000424-GPOS-00188,SRG-OS-000425-GPOS-00189,SRG-OS-000426-GPOS-00190
|
||||
stigid@ol7: OL07-00-040300
|
||||
stigid@rhel7: RHEL-07-040300
|
||||
- stigid@rhel8: RHEL-08-040160
|
||||
+ stigid@rhel8: RHEL-08-040159
|
||||
stigid@ubuntu2004: UBTU-20-010042
|
||||
|
||||
ocil_clause: 'the package is not installed'
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 9f57b28f4f..66f70cdfd5 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1037,8 +1037,10 @@ selections:
|
||||
|
||||
# RHEL-08-040150
|
||||
|
||||
- # RHEL-08-040160
|
||||
+ # RHEL-08-040159
|
||||
- package_openssh-server_installed
|
||||
+
|
||||
+ # RHEL-08-040160
|
||||
- service_sshd_enabled
|
||||
|
||||
# RHEL-08-040161
|
||||
|
||||
From 097682c4e225b7bdefd7b38c89cadf984540da04 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 11:56:17 -0500
|
||||
Subject: [PATCH 04/20] Split RHEL-08-040140
|
||||
|
||||
Package usbguard and service usbguard are split out into their own
|
||||
STIG ID. now.
|
||||
---
|
||||
.../services/usbguard/package_usbguard_installed/rule.yml | 2 +-
|
||||
.../services/usbguard/service_usbguard_enabled/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 8 ++++++--
|
||||
3 files changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/usbguard/package_usbguard_installed/rule.yml b/linux_os/guide/services/usbguard/package_usbguard_installed/rule.yml
|
||||
index 333718182e..19ef8aaca6 100644
|
||||
--- a/linux_os/guide/services/usbguard/package_usbguard_installed/rule.yml
|
||||
+++ b/linux_os/guide/services/usbguard/package_usbguard_installed/rule.yml
|
||||
@@ -48,7 +48,7 @@ references:
|
||||
disa: CCI-001958
|
||||
ism: "1418"
|
||||
srg: SRG-OS-000378-GPOS-00163
|
||||
- stigid@rhel8: RHEL-08-040140
|
||||
+ stigid@rhel8: RHEL-08-040139
|
||||
|
||||
ocil_clause: 'the package is not installed'
|
||||
|
||||
diff --git a/linux_os/guide/services/usbguard/service_usbguard_enabled/rule.yml b/linux_os/guide/services/usbguard/service_usbguard_enabled/rule.yml
|
||||
index 86adda9ecc..4f008129ea 100644
|
||||
--- a/linux_os/guide/services/usbguard/service_usbguard_enabled/rule.yml
|
||||
+++ b/linux_os/guide/services/usbguard/service_usbguard_enabled/rule.yml
|
||||
@@ -27,7 +27,7 @@ references:
|
||||
nist: CM-8(3)(a),IA-3
|
||||
ospp: FMT_SMF_EXT.1
|
||||
srg: SRG-OS-000378-GPOS-00163
|
||||
- stigid@rhel8: RHEL-08-040140
|
||||
+ stigid@rhel8: RHEL-08-040141
|
||||
|
||||
ocil_clause: 'the service is not enabled'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 66f70cdfd5..fd090e4058 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1030,11 +1030,15 @@ selections:
|
||||
- package_fapolicyd_installed
|
||||
- service_fapolicyd_enabled
|
||||
|
||||
- # RHEL-08-040140
|
||||
+ # RHEL-08-040139
|
||||
- package_usbguard_installed
|
||||
- - service_usbguard_enabled
|
||||
+
|
||||
+ # RHEL-08-040140
|
||||
- usbguard_generate_policy
|
||||
|
||||
+ # RHEL-08-040141
|
||||
+ - service_usbguard_enabled
|
||||
+
|
||||
# RHEL-08-040150
|
||||
|
||||
# RHEL-08-040159
|
||||
|
||||
From 1b28e2bed919e7f16519b051d39f7df640498d4f Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 08:01:13 -0500
|
||||
Subject: [PATCH 05/20] Split RHEL-08-030180
|
||||
|
||||
One for the auditd package and one for the auditd service.
|
||||
---
|
||||
linux_os/guide/system/auditing/service_auditd_enabled/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 3 +++
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml b/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml
|
||||
index e10e8c7782..c7ce75e87c 100644
|
||||
--- a/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml
|
||||
@@ -55,7 +55,7 @@ references:
|
||||
stigid@sle12: SLES-12-020010
|
||||
stigid@sle15: SLES-15-030050
|
||||
nist@sle12: AU-3,AU-3(1),AU-3(1).1(ii),AU-3.1,AU-6(4),AU-6(4).1,AU-7(1),AU-7(1).1,AU-7(a),AU-14(1),AU-14(1).1,CM-6(b),CM-6.1(iv),MA-4(1)(a)
|
||||
- stigid@rhel8: RHEL-08-010560
|
||||
+ stigid@rhel8: RHEL-08-030381
|
||||
|
||||
ocil: |-
|
||||
{{{ ocil_service_enabled(service="auditd") }}}
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index fd090e4058..682034af4d 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -683,6 +683,9 @@ selections:
|
||||
# RHEL-08-030180
|
||||
- package_audit_installed
|
||||
|
||||
+ # RHEL-08-030181
|
||||
+ - service_auditd_enabled
|
||||
+
|
||||
# RHEL-08-030190
|
||||
- audit_rules_privileged_commands_su
|
||||
|
||||
|
||||
From 0cf0bb3f6153be26abd4622221d73356be667d1f Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 12:04:34 -0500
|
||||
Subject: [PATCH 06/20] Split RHEL-08-010521
|
||||
|
||||
Disabling Kerb5 and gssapi auth for sshd move split into two STIG ids.
|
||||
---
|
||||
.../services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml
|
||||
index 946ba7f1d6..2134da2839 100644
|
||||
--- a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml
|
||||
@@ -36,7 +36,7 @@ references:
|
||||
srg: SRG-OS-000364-GPOS-00151,SRG-OS-000480-GPOS-00227
|
||||
stigid@ol7: OL07-00-040430
|
||||
stigid@rhel7: RHEL-07-040430
|
||||
- stigid@rhel8: RHEL-08-010521
|
||||
+ stigid@rhel8: RHEL-08-010522
|
||||
vmmsrg: SRG-OS-000480-VMM-002000
|
||||
|
||||
ocil_clause: 'it is commented out or is not disabled'
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 682034af4d..f913545106 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -318,6 +318,8 @@ selections:
|
||||
|
||||
# RHEL-08-010521
|
||||
- sshd_disable_kerb_auth
|
||||
+
|
||||
+ # RHEL-08-010522
|
||||
- sshd_disable_gssapi_auth
|
||||
|
||||
# RHEL-08-010540
|
||||
|
||||
From 994b19da2cb0f88d6eb0533d1ba4cae362351e56 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 12:10:06 -0500
|
||||
Subject: [PATCH 07/20] Split RHEL-08-010471
|
||||
|
||||
One for the rng-tools package and one for the rngd service.
|
||||
---
|
||||
.../software/system-tools/package_rng-tools_installed/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/system-tools/package_rng-tools_installed/rule.yml b/linux_os/guide/system/software/system-tools/package_rng-tools_installed/rule.yml
|
||||
index 33d5625fee..663a270626 100644
|
||||
--- a/linux_os/guide/system/software/system-tools/package_rng-tools_installed/rule.yml
|
||||
+++ b/linux_os/guide/system/software/system-tools/package_rng-tools_installed/rule.yml
|
||||
@@ -21,7 +21,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-000366
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
- stigid@rhel8: RHEL-08-010471
|
||||
+ stigid@rhel8: RHEL-08-010472
|
||||
|
||||
ocil_clause: 'the package is not installed'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index f913545106..e6ef5ee42c 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -299,6 +299,8 @@ selections:
|
||||
|
||||
# RHEL-08-010471
|
||||
- service_rngd_enabled
|
||||
+
|
||||
+ # RHEL-08-010472
|
||||
- package_rng-tools_installed
|
||||
|
||||
# RHEL-08-010480
|
||||
|
||||
From 2d1756e3fe017645922b1622dac139a249c48a12 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 12:14:53 -0500
|
||||
Subject: [PATCH 08/20] Split RHEL-08-010200
|
||||
|
||||
idle timeout and keepalive are now split
|
||||
---
|
||||
.../services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml b/linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml
|
||||
index 95c840fc5f..5a44255013 100644
|
||||
--- a/linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml
|
||||
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_set_idle_timeout/rule.yml
|
||||
@@ -53,7 +53,7 @@ references:
|
||||
srg: SRG-OS-000126-GPOS-00066,SRG-OS-000163-GPOS-00072,SRG-OS-000279-GPOS-00109,SRG-OS-000395-GPOS-00175
|
||||
stigid@ol7: OL07-00-040320
|
||||
stigid@rhel7: RHEL-07-040320
|
||||
- stigid@rhel8: RHEL-08-010200
|
||||
+ stigid@rhel8: RHEL-08-010201
|
||||
stigid@sle12: SLES-12-030190
|
||||
stigid@sle15: SLES-15-010280
|
||||
stigid@ubuntu2004: UBTU-20-010037
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index e6ef5ee42c..036fd00808 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -156,9 +156,11 @@ selections:
|
||||
- dir_perms_world_writable_sticky_bits
|
||||
|
||||
# RHEL-08-010200
|
||||
- - sshd_set_idle_timeout
|
||||
- sshd_set_keepalive_0
|
||||
|
||||
+ # RHEL-08-010201
|
||||
+ - sshd_set_idle_timeout
|
||||
+
|
||||
# RHEL-08-010210
|
||||
- file_permissions_var_log_messages
|
||||
|
||||
|
||||
From 0823a6f84d32338223502dfc93b09df5225debf6 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 12:23:31 -0500
|
||||
Subject: [PATCH 09/20] Split RHEL-08-010141
|
||||
|
||||
GRUB2 UEFI username and password split
|
||||
---
|
||||
.../bootloader-grub2/uefi/grub2_uefi_admin_username/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_admin_username/rule.yml b/linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_admin_username/rule.yml
|
||||
index a5f9349882..8a98cbdc95 100644
|
||||
--- a/linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_admin_username/rule.yml
|
||||
+++ b/linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_admin_username/rule.yml
|
||||
@@ -56,7 +56,7 @@ references:
|
||||
srg: SRG-OS-000080-GPOS-00048
|
||||
stigid@ol7: OL07-00-010490
|
||||
stigid@rhel7: RHEL-07-010490
|
||||
- stigid@rhel8: RHEL-08-010140
|
||||
+ stigid@rhel8: RHEL-08-010141
|
||||
|
||||
ocil_clause: 'it does not'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 036fd00808..83500c35b3 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -121,6 +121,8 @@ selections:
|
||||
|
||||
# RHEL-08-010140
|
||||
- grub2_uefi_password
|
||||
+
|
||||
+ # RHEL-08-010141
|
||||
- grub2_uefi_admin_username
|
||||
|
||||
# RHEL-08-010150
|
||||
|
||||
From a4dd46d84d9ab8a9fd4984cbc1b9432e2920d3f5 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 12:24:18 -0500
|
||||
Subject: [PATCH 10/20] Split RHEL-08-010150
|
||||
|
||||
GRUB admin username and password split
|
||||
---
|
||||
.../bootloader-grub2/non-uefi/grub2_admin_username/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/bootloader-grub2/non-uefi/grub2_admin_username/rule.yml b/linux_os/guide/system/bootloader-grub2/non-uefi/grub2_admin_username/rule.yml
|
||||
index f5cf144e0b..bb2f1bae21 100644
|
||||
--- a/linux_os/guide/system/bootloader-grub2/non-uefi/grub2_admin_username/rule.yml
|
||||
+++ b/linux_os/guide/system/bootloader-grub2/non-uefi/grub2_admin_username/rule.yml
|
||||
@@ -49,7 +49,7 @@ references:
|
||||
srg: SRG-OS-000080-GPOS-00048
|
||||
stigid@ol7: OL07-00-010480
|
||||
stigid@rhel7: RHEL-07-010480
|
||||
- stigid@rhel8: RHEL-08-010150
|
||||
+ stigid@rhel8: RHEL-08-010149
|
||||
|
||||
ocil_clause: 'it does not'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 83500c35b3..10d6fd6ebd 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -125,9 +125,11 @@ selections:
|
||||
# RHEL-08-010141
|
||||
- grub2_uefi_admin_username
|
||||
|
||||
+ # RHEL-08-010149
|
||||
+ - grub2_admin_username
|
||||
+
|
||||
# RHEL-08-010150
|
||||
- grub2_password
|
||||
- - grub2_admin_username
|
||||
|
||||
# RHEL-08-010151
|
||||
- require_singleuser_auth
|
||||
|
||||
From e1950738e3d5a35027d322589e736e8bfdba98b3 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 28 Jul 2021 12:44:27 -0500
|
||||
Subject: [PATCH 11/20] Split RHEL-08-040135
|
||||
|
||||
Package fapolicyd and service fapolicyd have been split.
|
||||
---
|
||||
.../guide/services/fapolicyd/service_fapolicyd_enabled/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/fapolicyd/service_fapolicyd_enabled/rule.yml b/linux_os/guide/services/fapolicyd/service_fapolicyd_enabled/rule.yml
|
||||
index 6c2663de9f..4a1cd16608 100644
|
||||
--- a/linux_os/guide/services/fapolicyd/service_fapolicyd_enabled/rule.yml
|
||||
+++ b/linux_os/guide/services/fapolicyd/service_fapolicyd_enabled/rule.yml
|
||||
@@ -24,7 +24,7 @@ references:
|
||||
nist: CM-6(a),SI-4(22)
|
||||
ospp: FMT_SMF_EXT.1
|
||||
srg: SRG-OS-000370-GPOS-00155,SRG-OS-000368-GPOS-00154
|
||||
- stigid@rhel8: RHEL-08-040135
|
||||
+ stigid@rhel8: RHEL-08-040136
|
||||
|
||||
ocil_clause: 'the service is not enabled'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 10d6fd6ebd..8272b25057 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1041,6 +1041,8 @@ selections:
|
||||
|
||||
# RHEL-08-040135
|
||||
- package_fapolicyd_installed
|
||||
+
|
||||
+ # RHEL-08-040136
|
||||
- service_fapolicyd_enabled
|
||||
|
||||
# RHEL-08-040139
|
||||
|
||||
From e259cdaeb85f7f1f371fa11c08a615d1828fe30e Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 08:42:38 -0500
|
||||
Subject: [PATCH 12/20] Split RHEL-08-020330
|
||||
|
||||
Also added a placeholder for RHEL-08-020332
|
||||
---
|
||||
.../password_storage/no_empty_passwords/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 6 +++++-
|
||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/rule.yml
|
||||
index 19e5e95d60..75f988ffb2 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/rule.yml
|
||||
@@ -53,7 +53,7 @@ references:
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@ol7: OL07-00-010290
|
||||
stigid@rhel7: RHEL-07-010290
|
||||
- stigid@rhel8: RHEL-08-020330
|
||||
+ stigid@rhel8: RHEL-08-020331
|
||||
stigid@sle12: SLES-12-010231
|
||||
stigid@sle15: SLES-15-020300
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 8272b25057..793fdd1e87 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -591,9 +591,13 @@ selections:
|
||||
# - accounts_authorized_local_users
|
||||
|
||||
# RHEL-08-020330
|
||||
- - no_empty_passwords
|
||||
- sshd_disable_empty_passwords
|
||||
|
||||
+ # RHEL-08-020331
|
||||
+ - no_empty_passwords
|
||||
+
|
||||
+ # RHEL-08-020332
|
||||
+
|
||||
# RHEL-08-020340
|
||||
- display_login_attempts
|
||||
|
||||
|
||||
From 5c2b73b5a4462225e876b29ead9f92da3c5f4331 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 08:45:28 -0500
|
||||
Subject: [PATCH 13/20] Split RHEL-08-010050
|
||||
|
||||
---
|
||||
.../gui_login_banner/dconf_gnome_banner_enabled/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-banners/gui_login_banner/dconf_gnome_banner_enabled/rule.yml b/linux_os/guide/system/accounts/accounts-banners/gui_login_banner/dconf_gnome_banner_enabled/rule.yml
|
||||
index c84cff33f3..b6ba3edc47 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-banners/gui_login_banner/dconf_gnome_banner_enabled/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-banners/gui_login_banner/dconf_gnome_banner_enabled/rule.yml
|
||||
@@ -54,7 +54,7 @@ references:
|
||||
srg: SRG-OS-000023-GPOS-00006,SRG-OS-000024-GPOS-00007,SRG-OS-000228-GPOS-00088
|
||||
stigid@ol7: OL07-00-010030
|
||||
stigid@rhel7: RHEL-07-010030
|
||||
- stigid@rhel8: RHEL-08-010050
|
||||
+ stigid@rhel8: RHEL-08-010049
|
||||
stigid@sle12: SLES-12-010040
|
||||
stigid@sle15: SLES-15-010080
|
||||
stigid@ubuntu2004: UBTU-20-010002
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 793fdd1e87..976c3f1892 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -95,8 +95,10 @@ selections:
|
||||
# RHEL-08-010040
|
||||
- sshd_enable_warning_banner
|
||||
|
||||
- # RHEL-08-010050
|
||||
+ # RHEL-08-010049
|
||||
- dconf_gnome_banner_enabled
|
||||
+
|
||||
+ # RHEL-08-010050
|
||||
- dconf_gnome_login_banner_text
|
||||
|
||||
# RHEL-08-010060
|
||||
|
||||
From d7c7cefd39de31bb484faad49766bbca22469aea Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 08:47:50 -0500
|
||||
Subject: [PATCH 14/20] Split RHEL-08-010130
|
||||
|
||||
---
|
||||
.../accounts_password_pam_unix_rounds_system_auth/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_rounds_system_auth/rule.yml b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_rounds_system_auth/rule.yml
|
||||
index d44119622a..0b694b0e0b 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_rounds_system_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_rounds_system_auth/rule.yml
|
||||
@@ -32,7 +32,7 @@ references:
|
||||
anssi: BP28(R32)
|
||||
disa: CCI-000196
|
||||
srg: SRG-OS-000073-GPOS-00041
|
||||
- stigid@rhel8: RHEL-08-010130
|
||||
+ stigid@rhel8: RHEL-08-010131
|
||||
|
||||
ocil_clause: 'it does not set the appropriate number of hashing rounds'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 976c3f1892..5230dcd9c5 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -118,9 +118,11 @@ selections:
|
||||
- accounts_password_all_shadowed_sha512
|
||||
|
||||
# RHEL-08-010130
|
||||
- - accounts_password_pam_unix_rounds_system_auth
|
||||
- accounts_password_pam_unix_rounds_password_auth
|
||||
|
||||
+ # RHEL-08-010131
|
||||
+ - accounts_password_pam_unix_rounds_system_auth
|
||||
+
|
||||
# RHEL-08-010140
|
||||
- grub2_uefi_password
|
||||
|
||||
|
||||
From f78b565e1f15cff194aef78af2184088fc41782a Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 08:50:42 -0500
|
||||
Subject: [PATCH 15/20] Split RHEL-08-010151
|
||||
|
||||
---
|
||||
.../accounts-physical/require_emergency_target_auth/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +---
|
||||
2 files changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-physical/require_emergency_target_auth/rule.yml b/linux_os/guide/system/accounts/accounts-physical/require_emergency_target_auth/rule.yml
|
||||
index 930d3a09fd..e2f61432ba 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-physical/require_emergency_target_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-physical/require_emergency_target_auth/rule.yml
|
||||
@@ -42,7 +42,7 @@ references:
|
||||
srg: SRG-OS-000080-GPOS-00048
|
||||
stigid@ol7: OL07-00-010481
|
||||
stigid@rhel7: RHEL-07-010481
|
||||
- stigid@rhel8: RHEL-08-010151
|
||||
+ stigid@rhel8: RHEL-08-010152
|
||||
|
||||
ocil_clause: 'the output is different'
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 5230dcd9c5..040228b832 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -137,11 +137,9 @@ selections:
|
||||
|
||||
# RHEL-08-010151
|
||||
- require_singleuser_auth
|
||||
- - require_emergency_target_auth
|
||||
|
||||
# RHEL-08-010152
|
||||
- # To be released in V1R3
|
||||
- # - require_emergency_target_auth
|
||||
+ - require_emergency_target_auth
|
||||
|
||||
# RHEL-08-010160
|
||||
- set_password_hashing_algorithm_systemauth
|
||||
|
||||
From a7766cf4ccfd00eaad910fb98b02694868000410 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 08:57:18 -0500
|
||||
Subject: [PATCH 16/20] Split RHEL-08-040210
|
||||
|
||||
---
|
||||
.../sysctl_net_ipv4_conf_default_accept_redirects/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_redirects/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_redirects/rule.yml
|
||||
index e8555a4895..bee6c117f3 100644
|
||||
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_redirects/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_redirects/rule.yml
|
||||
@@ -43,7 +43,7 @@ references:
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@ol7: OL07-00-040640
|
||||
stigid@rhel7: RHEL-07-040640
|
||||
- stigid@rhel8: RHEL-08-040210
|
||||
+ stigid@rhel8: RHEL-08-040209
|
||||
stigid@sle12: SLES-12-030400
|
||||
stigid@sle15: SLES-15-040340
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 040228b832..394a460c51 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1092,8 +1092,10 @@ selections:
|
||||
# RHEL-08-040200
|
||||
- accounts_no_uid_except_zero
|
||||
|
||||
- # RHEL-08-040210
|
||||
+ # RHEL-08-040209
|
||||
- sysctl_net_ipv4_conf_default_accept_redirects
|
||||
+
|
||||
+ # RHEL-08-040210
|
||||
- sysctl_net_ipv6_conf_default_accept_redirects
|
||||
|
||||
# RHEL-08-040220
|
||||
|
||||
From ac28c4231415be5e58bcea6f9fdd8652c6d39c45 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 09:08:27 -0500
|
||||
Subject: [PATCH 17/20] Split RHEL-08-040240
|
||||
|
||||
---
|
||||
.../sysctl_net_ipv4_conf_all_accept_source_route/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_source_route/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_source_route/rule.yml
|
||||
index b56f2891f5..f92772eb57 100644
|
||||
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_source_route/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_source_route/rule.yml
|
||||
@@ -45,7 +45,7 @@ references:
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@ol7: OL07-00-040610
|
||||
stigid@rhel7: RHEL-07-040610
|
||||
- stigid@rhel8: RHEL-08-040240
|
||||
+ stigid@rhel8: RHEL-08-040239
|
||||
stigid@sle12: SLES-12-030360
|
||||
stigid@sle15: SLES-15-040300
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 394a460c51..9cccd25963 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1104,8 +1104,10 @@ selections:
|
||||
# RHEL-08-040230
|
||||
- sysctl_net_ipv4_icmp_echo_ignore_broadcasts
|
||||
|
||||
- # RHEL-08-040240
|
||||
+ # RHEL-08-040239
|
||||
- sysctl_net_ipv4_conf_all_accept_source_route
|
||||
+
|
||||
+ # RHEL-08-040240
|
||||
- sysctl_net_ipv6_conf_all_accept_source_route
|
||||
|
||||
# RHEL-08-040250
|
||||
|
||||
From 717ed63c6ad9b69b75aee69bbf1198515011499f Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 09:11:08 -0500
|
||||
Subject: [PATCH 18/20] Split RHEL-08-040250
|
||||
|
||||
---
|
||||
.../sysctl_net_ipv4_conf_default_accept_source_route/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_source_route/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_source_route/rule.yml
|
||||
index 4df2465995..b1e7f247e2 100644
|
||||
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_source_route/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_default_accept_source_route/rule.yml
|
||||
@@ -46,7 +46,7 @@ references:
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@ol7: OL07-00-040620
|
||||
stigid@rhel7: RHEL-07-040620
|
||||
- stigid@rhel8: RHEL-08-040250
|
||||
+ stigid@rhel8: RHEL-08-040249
|
||||
stigid@sle12: SLES-12-030370
|
||||
stigid@sle15: SLES-15-040320
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 9cccd25963..4d1869c629 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1110,8 +1110,10 @@ selections:
|
||||
# RHEL-08-040240
|
||||
- sysctl_net_ipv6_conf_all_accept_source_route
|
||||
|
||||
- # RHEL-08-040250
|
||||
+ # RHEL-08-040249
|
||||
- sysctl_net_ipv4_conf_default_accept_source_route
|
||||
+
|
||||
+ # RHEL-08-040250
|
||||
- sysctl_net_ipv6_conf_default_accept_source_route
|
||||
|
||||
# RHEL-08-040260
|
||||
|
||||
From 9b244bc0828e2eb6ffe389d7ef590e6b967a4c07 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 4 Aug 2021 09:13:19 -0500
|
||||
Subject: [PATCH 19/20] Split RHEL-08-040280
|
||||
|
||||
---
|
||||
.../sysctl_net_ipv4_conf_all_accept_redirects/rule.yml | 2 +-
|
||||
products/rhel8/profiles/stig.profile | 4 +++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_redirects/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_redirects/rule.yml
|
||||
index d5e7fe4599..726042198e 100644
|
||||
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_redirects/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_accept_redirects/rule.yml
|
||||
@@ -44,7 +44,7 @@ references:
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@ol7: OL07-00-040641
|
||||
stigid@rhel7: RHEL-07-040641
|
||||
- stigid@rhel8: RHEL-08-040280
|
||||
+ stigid@rhel8: RHEL-08-040279
|
||||
stigid@sle12: SLES-12-030390
|
||||
stigid@sle15: SLES-15-040330
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 4d1869c629..0a1fdd15ca 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -1128,8 +1128,10 @@ selections:
|
||||
# RHEL-08-040270
|
||||
- sysctl_net_ipv4_conf_default_send_redirects
|
||||
|
||||
- # RHEL-08-040280
|
||||
+ # RHEL-08-040279
|
||||
- sysctl_net_ipv4_conf_all_accept_redirects
|
||||
+
|
||||
+ # RHEL-08-040280
|
||||
- sysctl_net_ipv6_conf_all_accept_redirects
|
||||
|
||||
# RHEL-08-040281
|
||||
|
||||
From 7723ff37c5abd8681b70ad686c5df45d7d0b44ed Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 5 Aug 2021 14:46:46 -0500
|
||||
Subject: [PATCH 20/20] Update couple of references for RHEL8 STIG
|
||||
|
||||
---
|
||||
.../enable_nx/bios_enable_execution_restrictions/rule.yml | 2 +-
|
||||
.../software/disk_partitioning/partition_for_var_tmp/rule.yml | 1 +
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
index 99f2c739c9..2176a0bb9b 100644
|
||||
--- a/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/enable_nx/bios_enable_execution_restrictions/rule.yml
|
||||
@@ -32,6 +32,6 @@ references:
|
||||
nist: SC-39,CM-6(a)
|
||||
nist-csf: PR.IP-1
|
||||
srg: SRG-OS-000433-GPOS-00192
|
||||
- stig@rhel8: RHEL-08-010420
|
||||
+ stigid@rhel8: RHEL-08-010420
|
||||
|
||||
platform: machine
|
||||
diff --git a/linux_os/guide/system/software/disk_partitioning/partition_for_var_tmp/rule.yml b/linux_os/guide/system/software/disk_partitioning/partition_for_var_tmp/rule.yml
|
||||
index 726975e808..d57c0f0ce9 100644
|
||||
--- a/linux_os/guide/system/software/disk_partitioning/partition_for_var_tmp/rule.yml
|
||||
+++ b/linux_os/guide/system/software/disk_partitioning/partition_for_var_tmp/rule.yml
|
||||
@@ -30,6 +30,7 @@ references:
|
||||
cis@ubuntu1804: 1.1.6
|
||||
cis@ubuntu2004: 1.1.11
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
+ stigid@rhel8: RHEL-08-010544
|
||||
|
||||
{{{ complete_ocil_entry_separate_partition(part="/var/tmp") }}}
|
||||
|
@ -1,841 +0,0 @@
|
||||
commit 549241cec9404bd211a580454fdd28cb72dfe520
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 17:24:17 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.59-BZ1884687-PR_7770.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..09d1984
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/ansible/shared.yml
|
||||
@@ -0,0 +1,31 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Test for existence of home directories to avoid creating them, but only fixing group ownership
|
||||
+ ansible.builtin.stat:
|
||||
+ path: '{{ item.value[4] }}'
|
||||
+ register: path_exists
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[2]|int >= {{{ gid_min }}}
|
||||
+ - item.value[2]|int != 65534
|
||||
+
|
||||
+- name: Ensure interactive local users are the group-owners of their respective home directories
|
||||
+ ansible.builtin.file:
|
||||
+ path: '{{ item.0.value[4] }}'
|
||||
+ group: '{{ item.0.value[2] }}'
|
||||
+ loop: '{{ local_users|zip(path_exists.results)|list }}'
|
||||
+ when:
|
||||
+ - item.1.stat is defined and item.1.stat.exists
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..08f7307
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+awk -F':' '{ if ($4 >= {{{ gid_min }}} && $4 != 65534) system("chgrp -f " $4" "$6) }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..a1d1f2e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/oval/shared.xml
|
||||
@@ -0,0 +1,89 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All interactive user's Home Directories must be group-owned by its user") }}}
|
||||
+ <criteria operator="AND">
|
||||
+ <criterion test_ref="test_file_groupownership_home_directories"
|
||||
+ comment="All interactive user's Home Directories must be group-owned by its user"/>
|
||||
+ <criterion test_ref="test_file_groupownership_home_directories_duplicated"
|
||||
+ comment="Interactive users should group-own only one Home Directory"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <!-- For detailed comments about logic used in this OVAL, check the
|
||||
+ "file_ownership_home_directories" rule. -->
|
||||
+ <unix:password_object id="object_file_groupownership_home_directories_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_file_groupownership_home_directories_interactive_gids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_file_groupownership_home_directories_interactive_gids" version="1">
|
||||
+ <unix:group_id datatype="int" operation="greater than or equal">{{{ gid_min }}}</unix:group_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!-- #### prepare for test_file_groupownership_home_directories #### -->
|
||||
+ <local_variable id="var_file_groupownership_home_directories_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from primary interactive groups">
|
||||
+ <object_component item_field="home_dir" object_ref="object_file_groupownership_home_directories_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <local_variable id="var_file_groupownership_home_directories_gids" datatype="int" version="1"
|
||||
+ comment="Variable including all gids from primary interactive group">
|
||||
+ <object_component item_field="group_id" object_ref="object_file_groupownership_home_directories_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_file_groupownership_home_directories_dirs" version="1">
|
||||
+ <unix:path var_ref="var_file_groupownership_home_directories_dirs" var_check="at least one"/>
|
||||
+ <unix:filename xsi:nil="true"/>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_file_groupownership_home_directories_gids" version="1">
|
||||
+ <unix:group_id datatype="int" var_check="only one" var_ref="var_file_groupownership_home_directories_gids"/>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <!-- #### creatin of test_file_groupownership_home_directories #### -->
|
||||
+ <unix:file_test id="test_file_groupownership_home_directories" check="all" check_existence="any_exist"
|
||||
+ version="1" comment="All home directories are group-owned by a local interactive group">
|
||||
+ <unix:object object_ref="object_file_groupownership_home_directories_dirs"/>
|
||||
+ <unix:state state_ref="state_file_groupownership_home_directories_gids"/>
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <!-- #### prepare for test_file_groupownership_home_directories_duplicated #### -->
|
||||
+ <local_variable id="var_file_groupownership_home_directories_gids_count" datatype="int" version="1"
|
||||
+ comment="Variable including count of gids from interactive group-owners">
|
||||
+ <count>
|
||||
+ <object_component item_field="group_id" object_ref="object_file_groupownership_home_directories_dirs"/>
|
||||
+ </count>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <local_variable id="var_file_groupownership_home_directories_gids_count_uniq" datatype="int" version="1"
|
||||
+ comment="Variable including count of uniq gids from interactive group-owners">
|
||||
+ <count>
|
||||
+ <unique>
|
||||
+ <object_component item_field="group_id" object_ref="object_file_groupownership_home_directories_dirs"/>
|
||||
+ </unique>
|
||||
+ </count>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <ind:variable_object id="object_file_groupownership_home_directories_gids_count" version="1">
|
||||
+ <ind:var_ref>var_file_groupownership_home_directories_gids_count</ind:var_ref>
|
||||
+ </ind:variable_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <!-- #### creation of state_no_duplicate_groupowners #### -->
|
||||
+ <ind:variable_state id="state_file_groupownership_home_directories_gids_count_uniq" version="1">
|
||||
+ <ind:value datatype="int" operation="equals" var_check="at least one"
|
||||
+ var_ref="var_file_groupownership_home_directories_gids_count_uniq"/>
|
||||
+ </ind:variable_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <ind:variable_test id="test_file_groupownership_home_directories_duplicated" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="It should not exist duplicated group-owners of home dirs">
|
||||
+ <ind:object object_ref="object_file_groupownership_home_directories_gids_count"/>
|
||||
+ <ind:state state_ref="state_file_groupownership_home_directories_gids_count_uniq"/>
|
||||
+ </ind:variable_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/rule.yml b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/rule.yml
|
||||
index 2e6ce60..e33660f 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/rule.yml
|
||||
@@ -10,6 +10,10 @@ description: |-
|
||||
interactive users home directory, use the following command:
|
||||
<pre>$ sudo chgrp <i>USER_GROUP</i> /home/<i>USER</i></pre>
|
||||
|
||||
+ This rule ensures every home directory related to an interactive user is
|
||||
+ group-owned by an interactive user. It also ensures that interactive users
|
||||
+ are group-owners of one and only one home directory.
|
||||
+
|
||||
rationale: |-
|
||||
If the Group Identifier (GID) of a local interactive users home directory is
|
||||
not the same as the primary GID of the user, this would allow unauthorized
|
||||
@@ -42,3 +46,9 @@ ocil: |-
|
||||
To verify the assigned home directory of all interactive users is group-
|
||||
owned by that users primary GID, run the following command:
|
||||
<pre># ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd)</pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to OVAL limitation, this rule can report a false negative in a
|
||||
+ specific situation where two interactive users swap the group-ownership
|
||||
+ of their respective home directories.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/expected_groupowner.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/expected_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..1605339
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/expected_groupowner.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chgrp $USER /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..af24025
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_one_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_one_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5bce517
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_one_absent.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_with_same_groupowner.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_with_same_groupowner.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..9d0f765
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/home_dirs_with_same_groupowner.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+# Define the same owner for two home directories
|
||||
+chgrp $USER1 /home/$USER1
|
||||
+chgrp $USER1 /home/$USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ed34f09
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_id.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..c1a87c1
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_id.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chgrp 2 /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_id.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..d352011
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_id.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chgrp 10005 /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/warning_home_dirs_crossed_groupowner.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/warning_home_dirs_crossed_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..0cffa4a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/warning_home_dirs_crossed_groupowner.pass.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+# Define the same owner for two home directories
|
||||
+chgrp $USER2 /home/$USER1
|
||||
+chgrp $USER1 /home/$USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/warning_home_dirs_swapped_groupowner.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/warning_home_dirs_swapped_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..3e5b778
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/warning_home_dirs_swapped_groupowner.pass.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+# Swap the group-ownership of two home directories
|
||||
+# WARNING: This test scenario will report a false negative, as explained in the
|
||||
+# warning section of this rule.
|
||||
+chgrp $USER2 /home/$USER1
|
||||
+chgrp $USER1 /home/$USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..97d4274
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/ansible/shared.yml
|
||||
@@ -0,0 +1,31 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Test for existence home directories to avoid creating them, but only fixing ownership
|
||||
+ ansible.builtin.stat:
|
||||
+ path: '{{ item.value[4] }}'
|
||||
+ register: path_exists
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[1]|int >= {{{ uid_min }}}
|
||||
+ - item.value[1]|int != 65534
|
||||
+
|
||||
+- name: Ensure interactive local users are the owners of their respective home directories
|
||||
+ ansible.builtin.file:
|
||||
+ path: '{{ item.0.value[4] }}'
|
||||
+ owner: '{{ item.0.value[1] }}'
|
||||
+ loop: '{{ local_users|zip(path_exists.results)|list }}'
|
||||
+ when:
|
||||
+ - item.1.stat is defined and item.1.stat.exists
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..1d1e675
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) system("chown -f " $3" "$6) }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..3d0b9ae
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/oval/shared.xml
|
||||
@@ -0,0 +1,142 @@
|
||||
+<def-group>
|
||||
+ <!-- Updated references of the OVAL language used in this file can be found in this link:
|
||||
+ https://oval-community-guidelines.readthedocs.io/en/latest/oval-schema-documentation/oval-definitions-schema.html
|
||||
+ -->
|
||||
+
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All interactive user's Home Directories must be owned by its user") }}}
|
||||
+ <criteria operator="AND">
|
||||
+ <criterion test_ref="test_file_ownership_home_directories"
|
||||
+ comment="All interactive user's Home Directories must be owned by its user"/>
|
||||
+ <criterion test_ref="test_file_ownership_home_directories_duplicated"
|
||||
+ comment="Interactive users should own only one Home Directory"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <!--
|
||||
+ Extract a list composed of password objects filtered by UIDs starting in {{{ uid_min }}} and
|
||||
+ not equal to "nobody". Most of (if not all) distros have the special user "nobody" with uid
|
||||
+ 65354. Despite it be technically classified as an interactive user, it is a special case with
|
||||
+ very limited access. So, we ignore it. The resulted password object will be further used to
|
||||
+ create local variables composed by UIDs e Home Dirs.
|
||||
+ -->
|
||||
+ <unix:password_object id="object_file_ownership_home_directories_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_file_ownership_home_directories_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <!--
|
||||
+ In distros which uses PAM (almost all), by default, the uid of interactive users and groups
|
||||
+ starts at 1000. We use this information to make sure this password_state object will be
|
||||
+ composed only with objects related to interactive users.
|
||||
+ -->
|
||||
+ <unix:password_state id="state_file_ownership_home_directories_interactive_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!--
|
||||
+ #### prepare for test_file_groupownership_home_directories ####
|
||||
+ From the list of interactive users objects we create a local variable composed of their home dirs.
|
||||
+ -->
|
||||
+ <local_variable id="var_file_ownership_home_directories_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir" object_ref="object_file_ownership_home_directories_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!--
|
||||
+ From the list of interactive users objects we create a local variable composed of their uids.
|
||||
+ -->
|
||||
+ <local_variable id="var_file_ownership_home_directories_uids" datatype="int" version="1"
|
||||
+ comment="List of interactive users uids">
|
||||
+ <object_component item_field="user_id" object_ref="object_file_ownership_home_directories_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!--
|
||||
+ #### creation of object ####
|
||||
+ We have the home dirs, but to test their ownership we need a "file_object" and not a password
|
||||
+ object, as the initial source of this information is. So, we create this file_object based on
|
||||
+ content from the previous local variable.
|
||||
+ -->
|
||||
+ <unix:file_object id="object_file_ownership_home_directories_dirs" version="1">
|
||||
+ <unix:path var_ref="var_file_ownership_home_directories_dirs" var_check="at least one"/>
|
||||
+ <unix:filename xsi:nil="true"/>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!--
|
||||
+ #### creation of state ####
|
||||
+ We have the relevant uids, but we need a "file_state" object to use in our intendend test.
|
||||
+ So, we create this file_state based on content from the previous local variable.
|
||||
+ -->
|
||||
+ <unix:file_state id="state_file_ownership_home_directories_uids" version="1">
|
||||
+ <unix:user_id datatype="int" var_check="only one" var_ref="var_file_ownership_home_directories_uids"/>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!--
|
||||
+ #### creation of test ####
|
||||
+ Perform the test to ensure that all home dirs are owned by an interactive user.
|
||||
+ This test will make sure that no foreign or system user is owner of an existing home dir.
|
||||
+ However, this can't ensure that one local interactive user is the owner of only one home dir.
|
||||
+ Currently this is an OVAL limitation which we try to mitigate with a second test below.
|
||||
+ -->
|
||||
+ <unix:file_test id="test_file_ownership_home_directories" check="all" check_existence="any_exist"
|
||||
+ version="1" comment="All home directories are owned by a local interactive user">
|
||||
+ <unix:object object_ref="object_file_ownership_home_directories_dirs"/>
|
||||
+ <unix:state state_ref="state_file_ownership_home_directories_uids"/>
|
||||
+ </unix:file_test>
|
||||
+
|
||||
+ <!--
|
||||
+ We create an extra test to make sure that the number of home dirs and their respective owners
|
||||
+ are the same. This is to catch situations where one local user owns more than one home dir.
|
||||
+ However, we still can have a situation where two local users cross the ownership of their
|
||||
+ respective home dirs. Although very atypical, we should be aware of this possible false
|
||||
+ positive and that it is not possible to be solved with the current OVAL capabilities.
|
||||
+ -->
|
||||
+ <!--
|
||||
+ This create an int variable composed by the count of file_object items.
|
||||
+ -->
|
||||
+ <local_variable id="var_file_ownership_home_directories_uids_count" datatype="int" version="1"
|
||||
+ comment="Count home dirs related to interactive users">
|
||||
+ <count>
|
||||
+ <object_component item_field="user_id" object_ref="object_file_ownership_home_directories_dirs"/>
|
||||
+ </count>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!--
|
||||
+ This create an int variable composed by the count of unique user_ids collected from
|
||||
+ file_object items.
|
||||
+ -->
|
||||
+ <local_variable id="var_file_ownership_home_directories_uids_count_uniq" datatype="int" version="1"
|
||||
+ comment="Count current owners of relevant home dirs">
|
||||
+ <count>
|
||||
+ <unique>
|
||||
+ <object_component item_field="user_id" object_ref="object_file_ownership_home_directories_dirs"/>
|
||||
+ </unique>
|
||||
+ </count>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!--
|
||||
+ #### creation of object ####
|
||||
+ Turn the OVAL variable representing count of home dirs into OVAL object.
|
||||
+ This way we can test it further.
|
||||
+ -->
|
||||
+ <ind:variable_object id="object_file_ownership_home_directories_uids_count" version="1">
|
||||
+ <ind:var_ref>var_file_ownership_home_directories_uids_count</ind:var_ref>
|
||||
+ </ind:variable_object>
|
||||
+
|
||||
+ <!--
|
||||
+ #### creation of state ####
|
||||
+ this state checks that both counts (unique and non-unique) are the same
|
||||
+ -->
|
||||
+ <ind:variable_state id="state_file_ownership_home_directories_uids_count_uniq" version="1">
|
||||
+ <ind:value datatype="int" operation="equals" var_check="at least one"
|
||||
+ var_ref="var_file_ownership_home_directories_uids_count_uniq"/>
|
||||
+ </ind:variable_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <ind:variable_test id="test_file_ownership_home_directories_duplicated" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="It should not exist duplicated owners of home dirs">
|
||||
+ <ind:object object_ref="object_file_ownership_home_directories_uids_count"/>
|
||||
+ <ind:state state_ref="state_file_ownership_home_directories_uids_count_uniq"/>
|
||||
+ </ind:variable_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/rule.yml b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/rule.yml
|
||||
index 198a9be..042f484 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/rule.yml
|
||||
@@ -10,6 +10,10 @@ description: |-
|
||||
the following command:
|
||||
<pre>$ sudo chown <i>USER</i> /home/<i>USER</i></pre>
|
||||
|
||||
+ This rule ensures every home directory related to an interactive user is
|
||||
+ owned by an interactive user. It also ensures that interactive users are
|
||||
+ owners of one and only one home directory.
|
||||
+
|
||||
rationale: |-
|
||||
If a local interactive user does not own their home directory, unauthorized
|
||||
users could access or modify the user's files, and the users may not be able to
|
||||
@@ -31,3 +35,9 @@ ocil_clause: 'the user ownership is incorrect'
|
||||
ocil: |-
|
||||
To verify the home directory ownership, run the following command:
|
||||
<pre># ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd)</pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to OVAL limitation, this rule can report a false negative in a
|
||||
+ specific situation where two interactive users swap the ownership of
|
||||
+ their respective home directories.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/expected_owner.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/expected_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..585f759
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/expected_owner.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chown $USER /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dir_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dir_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..7c181af
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dir_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..af24025
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_one_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_one_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5bce517
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_one_absent.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_with_same_owner.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_with_same_owner.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..e6aef9e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/home_dirs_with_same_owner.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+# Define the same owner for two home directories
|
||||
+chown $USER1 /home/$USER1
|
||||
+chown $USER1 /home/$USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ed34f09
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/unexpected_owner_system_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/unexpected_owner_system_id.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..011b315
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/unexpected_owner_system_id.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chown 2 /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/unexpected_owner_unknown_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/unexpected_owner_unknown_id.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..733af78
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/unexpected_owner_unknown_id.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chown 10005 /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/warning_home_dirs_crossed_owner.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/warning_home_dirs_crossed_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..df5655f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/warning_home_dirs_crossed_owner.pass.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+# Define the same owner for two home directories
|
||||
+chown $USER2 /home/$USER1
|
||||
+chown $USER1 /home/$USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/warning_home_dirs_swapped_owner.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/warning_home_dirs_swapped_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..e9cfd5b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_ownership_home_directories/tests/warning_home_dirs_swapped_owner.pass.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+# Swap the ownership of two home directories
|
||||
+# WARNING: This test scenario will report a false negative, as explained in the
|
||||
+# warning section of this rule.
|
||||
+chown $USER2 /home/$USER1
|
||||
+chown $USER1 /home/$USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..945ed7e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/ansible/shared.yml
|
||||
@@ -0,0 +1,31 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Test for existence home directories to avoid creating them, but only fixing group ownership
|
||||
+ ansible.builtin.stat:
|
||||
+ path: '{{ item.value[4] }}'
|
||||
+ register: path_exists
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[2]|int >= {{{ uid_min }}}
|
||||
+ - item.value[2]|int != 65534
|
||||
+
|
||||
+- name: Ensure interactive local users are the group-owners of their respective home directories
|
||||
+ ansible.builtin.file:
|
||||
+ path: '{{ item.0.value[4] }}'
|
||||
+ mode: '0700'
|
||||
+ loop: '{{ local_users|zip(path_exists.results)|list }}'
|
||||
+ when:
|
||||
+ - item.1.stat is defined and item.1.stat.exists
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..4ebc674
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) system("chmod -f 700 "$6) }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..0cb261e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/oval/shared.xml
|
||||
@@ -0,0 +1,51 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All Interactive User Home Directories Must Have mode 0750 Or Less Permissive") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_file_permissions_home_directories"
|
||||
+ comment="All interactive user's Home Directories must have proper permissions"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <!-- For detailed comments about logic used in this OVAL, check the
|
||||
+ "file_ownership_home_directories" rule. -->
|
||||
+ <unix:password_object id="object_file_permissions_home_directories_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_file_permissions_home_directories_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_file_permissions_home_directories_interactive_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!-- #### prepare for test_file_permissions_home_directories #### -->
|
||||
+ <local_variable id="var_file_permissions_home_directories_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir" object_ref="object_file_permissions_home_directories_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_file_permissions_home_directories_dirs" version="1">
|
||||
+ <unix:path var_ref="var_file_permissions_home_directories_dirs" var_check="at least one"/>
|
||||
+ <unix:filename xsi:nil="true"/>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_file_permissions_home_directories_dirs" version="1" operator='AND'>
|
||||
+ <unix:type operation="equals">directory</unix:type>
|
||||
+ <unix:suid datatype="boolean">false</unix:suid>
|
||||
+ <unix:sgid datatype="boolean">false</unix:sgid>
|
||||
+ <unix:sticky datatype="boolean">false</unix:sticky>
|
||||
+ <unix:gwrite datatype="boolean">false</unix:gwrite>
|
||||
+ <unix:oread datatype="boolean">false</unix:oread>
|
||||
+ <unix:owrite datatype="boolean">false</unix:owrite>
|
||||
+ <unix:oexec datatype="boolean">false</unix:oexec>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_file_permissions_home_directories" check="all" check_existence="any_exist"
|
||||
+ version="1" comment="All home directories have proper permissions">
|
||||
+ <unix:object object_ref="object_file_permissions_home_directories_dirs"/>
|
||||
+ <unix:state state_ref="state_file_permissions_home_directories_dirs"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/acceptable_permission.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/acceptable_permission.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..aaf939e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/acceptable_permission.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chmod 750 /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/expected_permissions.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/expected_permissions.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5dfd426
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/expected_permissions.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chmod 700 /home/$USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/home_dirs_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/home_dirs_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..af24025
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/home_dirs_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ed34f09
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/lenient_permission.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/lenient_permission.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..2f337d2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/file_permissions_home_directories/tests/lenient_permission.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+chmod 755 /home/$USER
|
||||
diff --git a/ssg/constants.py b/ssg/constants.py
|
||||
index e2d3077..64e2712 100644
|
||||
--- a/ssg/constants.py
|
||||
+++ b/ssg/constants.py
|
||||
@@ -380,6 +380,7 @@ MAKEFILE_ID_TO_PRODUCT_MAP = {
|
||||
|
||||
|
||||
# Application constants
|
||||
+DEFAULT_GID_MIN = 1000
|
||||
DEFAULT_UID_MIN = 1000
|
||||
DEFAULT_GRUB2_BOOT_PATH = '/boot/grub2'
|
||||
DEFAULT_DCONF_GDM_DIR = 'gdm.d'
|
||||
diff --git a/ssg/products.py b/ssg/products.py
|
||||
index 25178b7..e410e06 100644
|
||||
--- a/ssg/products.py
|
||||
+++ b/ssg/products.py
|
||||
@@ -7,6 +7,7 @@ from glob import glob
|
||||
|
||||
from .build_cpe import ProductCPEs
|
||||
from .constants import (product_directories,
|
||||
+ DEFAULT_GID_MIN,
|
||||
DEFAULT_UID_MIN,
|
||||
DEFAULT_GRUB2_BOOT_PATH,
|
||||
DEFAULT_DCONF_GDM_DIR,
|
||||
@@ -39,6 +40,9 @@ def _get_implied_properties(existing_properties):
|
||||
if pkg_manager in PKG_MANAGER_TO_CONFIG_FILE:
|
||||
result["pkg_manager_config_file"] = PKG_MANAGER_TO_CONFIG_FILE[pkg_manager]
|
||||
|
||||
+ if "gid_min" not in existing_properties:
|
||||
+ result["gid_min"] = DEFAULT_GID_MIN
|
||||
+
|
||||
if "uid_min" not in existing_properties:
|
||||
result["uid_min"] = DEFAULT_UID_MIN
|
||||
|
@ -1,507 +0,0 @@
|
||||
From 5ec53805a4aaf04752400eef826ff49222c0a3ba Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Wed, 20 Oct 2021 16:17:01 +0200
|
||||
Subject: [PATCH 1/3] OVAL, tests and remediation for the rule:
|
||||
|
||||
accounts_user_interactive_home_directory_defined
|
||||
---
|
||||
.../ansible/shared.yml | 24 +++++++++++++
|
||||
.../bash/shared.sh | 9 +++++
|
||||
.../oval/shared.xml | 36 +++++++++++++++++++
|
||||
.../tests/home_dir_all_empty.fail.sh | 6 ++++
|
||||
.../tests/home_dir_not_exclusive.fail.sh | 6 ++++
|
||||
.../tests/home_dir_one_empty.fail.sh | 8 +++++
|
||||
.../tests/home_dir_properly_defined.pass.sh | 4 +++
|
||||
.../tests/home_dir_root.fail.sh | 6 ++++
|
||||
.../tests/interactive_users_absent.pass.sh | 4 +++
|
||||
9 files changed, 103 insertions(+)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_all_empty.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_not_exclusive.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_one_empty.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_properly_defined.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_root.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/interactive_users_absent.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..fc9b780daa8
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml
|
||||
@@ -0,0 +1,24 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Ensure interactive users have a home directory defined
|
||||
+ ansible.builtin.user:
|
||||
+ name: '{{ item.key }}'
|
||||
+ home: '/home/{{ item.key }}'
|
||||
+ create_home: no
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[2]|int >= {{{ uid_min }}}
|
||||
+ - item.value[2]|int != 65534
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..23b0a85aa6a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+for user in `awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) print $1 }' /etc/passwd`; do
|
||||
+ sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd;
|
||||
+done
|
||||
\ No newline at end of file
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..5efb84ab2cf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/oval/shared.xml
|
||||
@@ -0,0 +1,36 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All Interactive Users Must Have A Home Directory Defined") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_user_interactive_home_directory_defined"
|
||||
+ comment="All Interactive Users Must Have A Home Directory Defined"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <!-- For detailed comments about logic used in this OVAL, check the
|
||||
+ "file_ownership_home_directories" rule.
|
||||
+ #### creation of object #### -->
|
||||
+ <unix:password_object id="object_accounts_user_interactive_home_directory_defined_objects"
|
||||
+ version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_user_interactive_home_directory_defined_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_user_interactive_home_directory_defined_uids"
|
||||
+ version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:password_state id="state_accounts_user_interactive_home_directory_defined" version="1">
|
||||
+ <unix:home_dir operation="pattern match">^\/\w*\/\w{1,}[\/\w]*$</unix:home_dir>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:password_test id="test_accounts_user_interactive_home_directory_defined" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="All Interactive Users Have A Home Directory Defined">
|
||||
+ <unix:object object_ref="object_accounts_user_interactive_home_directory_defined_objects"/>
|
||||
+ <unix:state state_ref="state_accounts_user_interactive_home_directory_defined"/>
|
||||
+ </unix:password_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_all_empty.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_all_empty.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..4bc9e10a21c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_all_empty.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+
|
||||
+sed -i "s/\(.*:x:[0-9]\{4,\}:[0-9]*:.*:\).*\(:.*\)$/\1\2/g" /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_not_exclusive.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_not_exclusive.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..5c905e03791
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_not_exclusive.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+
|
||||
+sed -i 's/\(.*:x:[0-9]\{4,\}:[0-9]*:.*:\).*\(:.*\)$/\1\/tmp\2/g' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_one_empty.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_one_empty.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..00d37799c77
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_one_empty.fail.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+useradd -M $USER1
|
||||
+useradd -M $USER2
|
||||
+
|
||||
+sed -i "s/\($USER1:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\2/g" /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_properly_defined.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_properly_defined.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..7c181afdd4b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_properly_defined.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_root.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_root.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..16bb94477bc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_root.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+
|
||||
+sed -i "s/\($USER:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/\2/g" /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed34f0940a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
|
||||
From 47cf69c176ce8e7ec1922bf8cdcd1d35b02552c9 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Tue, 26 Oct 2021 14:39:11 +0200
|
||||
Subject: [PATCH 2/3] OVAL, tests and remediation for the rule:
|
||||
|
||||
accounts_user_interactive_home_directory_exists
|
||||
---
|
||||
.../bash/shared.sh | 2 +-
|
||||
.../ansible/shared.yml | 24 +++++
|
||||
.../bash/shared.sh | 9 ++
|
||||
.../oval/shared.xml | 91 +++++++++++++++++++
|
||||
.../tests/home_dir_present.pass.sh | 10 ++
|
||||
.../tests/home_dirs_all_absent.fail.sh | 6 ++
|
||||
.../tests/home_dirs_one_absent.fail.sh | 7 ++
|
||||
.../tests/interactive_users_absent.pass.sh | 4 +
|
||||
8 files changed, 152 insertions(+), 1 deletion(-)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dir_present.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_all_absent.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_one_absent.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/interactive_users_absent.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
index 23b0a85aa6a..94f8a579f1f 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
for user in `awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) print $1 }' /etc/passwd`; do
|
||||
sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd;
|
||||
-done
|
||||
\ No newline at end of file
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..e7acc477d25
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml
|
||||
@@ -0,0 +1,24 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Ensure interactive users have a home directory defined
|
||||
+ ansible.builtin.user:
|
||||
+ name: '{{ item.key }}'
|
||||
+ home: '/home/{{ item.key }}'
|
||||
+ create_home: yes
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[2]|int >= {{{ uid_min }}}
|
||||
+ - item.value[2]|int != 65534
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..044b650f103
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/bash/shared.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+for user in $(awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) print $1}' /etc/passwd); do
|
||||
+ mkhomedir_helper $user 0077;
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..0a5b313f5b4
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/oval/shared.xml
|
||||
@@ -0,0 +1,91 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All Interactive Users Home Directories Must Exist") }}}
|
||||
+ <criteria operator="OR">
|
||||
+ <criterion test_ref="test_accounts_user_interactive_home_directory_exists"
|
||||
+ comment="All Interactive Users Home Directories Must Exist"/>
|
||||
+ <criterion test_ref="test_accounts_user_interactive_home_directory_exists_users"
|
||||
+ comment="Interactive users don't exist on the system"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <!-- #### prepare a password object for the two tests in this rule #### -->
|
||||
+ <unix:password_object id="object_accounts_user_interactive_home_directory_exists_objects"
|
||||
+ version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_user_interactive_home_directory_exists_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_user_interactive_home_directory_exists_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!-- #### create a local variable composed by the list of home dirs from /etc/passwd #### -->
|
||||
+ <local_variable id="var_accounts_user_interactive_home_directory_exists_dirs_list"
|
||||
+ datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_user_interactive_home_directory_exists_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### create a local variable composed by the number of home dirs from /etc/passwd #### -->
|
||||
+ <local_variable id="var_accounts_user_interactive_home_directory_exists_dirs_count"
|
||||
+ datatype="int" version="1"
|
||||
+ comment="Variable including expected count of home dirs present on the system">
|
||||
+ <count>
|
||||
+ <variable_component var_ref="var_accounts_user_interactive_home_directory_exists_dirs_list"/>
|
||||
+ </count>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### create a file_object to check existence of home dirs on file system #### -->
|
||||
+ <unix:file_object id="object_accounts_user_interactive_home_directory_exists_dirs_fs"
|
||||
+ version="1">
|
||||
+ <unix:path var_ref="var_accounts_user_interactive_home_directory_exists_dirs_list"
|
||||
+ var_check="at least one"/>
|
||||
+ <unix:filename xsi:nil="true"/>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### create a local variable with the number of home dirs present on file system #### -->
|
||||
+ <local_variable id="var_accounts_user_interactive_home_directory_exists_dirs_count_fs"
|
||||
+ datatype="int" version="1"
|
||||
+ comment="Variable including number of home dirs present on file system">
|
||||
+ <count>
|
||||
+ <object_component item_field="path"
|
||||
+ object_ref="object_accounts_user_interactive_home_directory_exists_dirs_fs"/>
|
||||
+ </count>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### create a variable object with count of home dirs from file system #### -->
|
||||
+ <ind:variable_object id="object_accounts_user_interactive_home_directory_exists_dirs_count_fs"
|
||||
+ version="1">
|
||||
+ <ind:var_ref>var_accounts_user_interactive_home_directory_exists_dirs_count_fs</ind:var_ref>
|
||||
+ </ind:variable_object>
|
||||
+
|
||||
+ <!-- #### create a variable state with count of home dirs from /etc/passwd #### -->
|
||||
+ <ind:variable_state id="state_accounts_user_interactive_home_directory_exists_dirs_count_pw"
|
||||
+ version="1">
|
||||
+ <ind:value datatype="int" operation="equals" var_check="at least one"
|
||||
+ var_ref="var_accounts_user_interactive_home_directory_exists_dirs_count"/>
|
||||
+ </ind:variable_state>
|
||||
+
|
||||
+ <!-- #### test_accounts_user_interactive_home_directory_exists #### -->
|
||||
+ <ind:variable_test id="test_accounts_user_interactive_home_directory_exists" check="all"
|
||||
+ check_existence="at_least_one_exists" version="1"
|
||||
+ comment="Check the existence of interactive users.">
|
||||
+ <ind:object object_ref="object_accounts_user_interactive_home_directory_exists_dirs_count_fs"/>
|
||||
+ <ind:state state_ref="state_accounts_user_interactive_home_directory_exists_dirs_count_pw"/>
|
||||
+ </ind:variable_test>
|
||||
+
|
||||
+ <!-- #### create of variable object with count of home dirs from /etc/passwd #### -->
|
||||
+ <ind:variable_object id="object_accounts_user_interactive_home_directory_exists_dirs_count_pw"
|
||||
+ version="1">
|
||||
+ <ind:var_ref>var_accounts_user_interactive_home_directory_exists_dirs_count</ind:var_ref>
|
||||
+ </ind:variable_object>
|
||||
+
|
||||
+ <!-- #### test_accounts_user_interactive_home_directory_exists_users #### -->
|
||||
+ <ind:variable_test id="test_accounts_user_interactive_home_directory_exists_users" check="all"
|
||||
+ check_existence="none_exist" version="1"
|
||||
+ comment="Check the existence of interactive users.">
|
||||
+ <ind:object object_ref="object_accounts_user_interactive_home_directory_exists_dirs_count_pw"/>
|
||||
+ </ind:variable_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dir_present.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dir_present.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..d5434cbe4f5
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dir_present.pass.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+
|
||||
+# This is to make sure that any possible user create in the test environment has also
|
||||
+# a home dir created on the system.
|
||||
+for user in $(awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) print $1}' /etc/passwd); do
|
||||
+ mkhomedir_helper $user 0077;
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_all_absent.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_all_absent.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..af240252de3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_all_absent.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_one_absent.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_one_absent.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..5bce517215c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/home_dirs_one_absent.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed34f0940a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
|
||||
From 0d6a5e588d71e927291641cbf2a23259995f0b2d Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Mon, 8 Nov 2021 15:09:12 +0100
|
||||
Subject: [PATCH 3/3] Improved the remediation and rule description
|
||||
|
||||
Included conditional on remediation to make sure that
|
||||
already compliant home directories are skipped.
|
||||
---
|
||||
.../ansible/shared.yml | 3 ++-
|
||||
.../bash/shared.sh | 7 +++++--
|
||||
.../rule.yml | 5 +++++
|
||||
.../tests/home_dir_defined_out_home.pass.sh | 4 ++++
|
||||
.../ansible/shared.yml | 3 +--
|
||||
5 files changed, 17 insertions(+), 5 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_defined_out_home.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml
|
||||
index fc9b780daa8..13fbdd1ca44 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/ansible/shared.yml
|
||||
@@ -13,7 +13,7 @@
|
||||
ansible.builtin.set_fact:
|
||||
local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
|
||||
-- name: Ensure interactive users have a home directory defined
|
||||
+- name: Ensure interactive users have an exclusive home directory defined
|
||||
ansible.builtin.user:
|
||||
name: '{{ item.key }}'
|
||||
home: '/home/{{ item.key }}'
|
||||
@@ -22,3 +22,4 @@
|
||||
when:
|
||||
- item.value[2]|int >= {{{ uid_min }}}
|
||||
- item.value[2]|int != 65534
|
||||
+ - not item.value[4] | regex_search('^\/\w*\/\w{1,}')
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
index 94f8a579f1f..7fac61d4892 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/bash/shared.sh
|
||||
@@ -4,6 +4,9 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
-for user in `awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) print $1 }' /etc/passwd`; do
|
||||
- sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd;
|
||||
+for user in $(awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 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
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/rule.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/rule.yml
|
||||
index 20d26032338..b58164c5403 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/rule.yml
|
||||
@@ -8,6 +8,11 @@ description: |-
|
||||
Assign home directories to all interactive users that currently do not
|
||||
have a home directory assigned.
|
||||
|
||||
+ This rule checks if the home directory is properly defined in a folder which has
|
||||
+ at least one parent folder, like "user" in "/home/user" or "/remote/users/user".
|
||||
+ Therefore, this rule will report a finding for home directories like <tt>/users</tt>,
|
||||
+ <tt>/tmp</tt> or <tt>/</tt>.
|
||||
+
|
||||
rationale: |-
|
||||
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.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_defined_out_home.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_defined_out_home.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..c7100f304ca
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_defined/tests/home_dir_defined_out_home.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M -d /data/$USER $USER
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml
|
||||
index e7acc477d25..84382a7f488 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_interactive_home_directory_exists/ansible/shared.yml
|
||||
@@ -13,10 +13,9 @@
|
||||
ansible.builtin.set_fact:
|
||||
local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
|
||||
-- name: Ensure interactive users have a home directory defined
|
||||
+- name: Ensure interactive users have a home directory exists
|
||||
ansible.builtin.user:
|
||||
name: '{{ item.key }}'
|
||||
- home: '/home/{{ item.key }}'
|
||||
create_home: yes
|
||||
loop: '{{ local_users }}'
|
||||
when:
|
@ -1,662 +0,0 @@
|
||||
commit dc273bb872cc53f2d52af4396f4d3bba0acc178f
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 17:30:42 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.59-BZ1884687C-PR_7824.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..ff41e19
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/ansible/shared.yml
|
||||
@@ -0,0 +1,32 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Test for existence home directories to avoid creating them, but only fixing ownership
|
||||
+ ansible.builtin.stat:
|
||||
+ path: '{{ item.value[4] }}'
|
||||
+ register: path_exists
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[2]|int >= {{{ gid_min }}}
|
||||
+ - item.value[2]|int != 65534
|
||||
+
|
||||
+- name: Ensure interactive local users are the owners of their respective home directories
|
||||
+ ansible.builtin.file:
|
||||
+ path: '{{ item.0.value[4] }}'
|
||||
+ group: '{{ item.0.value[2] }}'
|
||||
+ recurse: yes
|
||||
+ loop: '{{ local_users|zip(path_exists.results)|list }}'
|
||||
+ when:
|
||||
+ - item.1.stat is defined and item.1.stat.exists
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..e392d2f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/bash/shared.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+for user in $(awk -F':' '{ if ($4 >= {{{ gid_min }}} && $4 != 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
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..1fd016a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/oval/shared.xml
|
||||
@@ -0,0 +1,52 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All User Files and Directories In The Home Directory Must Be Group-Owned By The Primary User") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_users_home_files_groupownership"
|
||||
+ comment="All User Files and Directories In The Home Directory Must Be Group-Owned By The Primary User"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:password_object id="object_accounts_users_home_files_groupownership_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_users_home_files_groupownership_interactive_gids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_users_home_files_groupownership_interactive_gids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ gid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <local_variable id="var_accounts_users_home_files_groupownership_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_users_home_files_groupownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <local_variable id="var_accounts_users_home_files_groupownership_gids" datatype="int" version="1"
|
||||
+ comment="List of interactive users gids">
|
||||
+ <object_component item_field="group_id"
|
||||
+ object_ref="object_accounts_users_home_files_groupownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_accounts_users_home_files_groupownership_dirs" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1"
|
||||
+ recurse_file_system="local"/>
|
||||
+ <unix:path var_ref="var_accounts_users_home_files_groupownership_dirs" var_check="at least one"/>
|
||||
+ <unix:filename operation="pattern match">.*</unix:filename>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_accounts_users_home_files_groupownership_gids" version="1">
|
||||
+ <unix:group_id datatype="int" var_check="only one"
|
||||
+ var_ref="var_accounts_users_home_files_groupownership_gids"/>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_accounts_users_home_files_groupownership" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="All home directories files are group-owned by a local interactive user">
|
||||
+ <unix:object object_ref="object_accounts_users_home_files_groupownership_dirs"/>
|
||||
+ <unix:state state_ref="state_accounts_users_home_files_groupownership_gids"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/rule.yml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/rule.yml
|
||||
index 1c0f93a..31a0f1d 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/rule.yml
|
||||
@@ -10,6 +10,9 @@ description: |-
|
||||
local interactive users files and directories, use the following command:
|
||||
<pre>$ sudo chgrp <i>USER_GROUP</i> /home/<i>USER</i>/<i>FILE_DIR</i></pre>
|
||||
|
||||
+ This rule ensures every file or directory under the home directory related
|
||||
+ to an interactive user is group-owned by an interactive user.
|
||||
+
|
||||
rationale: |-
|
||||
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.
|
||||
@@ -33,3 +36,9 @@ ocil: |-
|
||||
group-owned by a group the user is a member of, run the
|
||||
following command:
|
||||
<pre>$ sudo ls -lLR /home/<i>USER</i></pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to OVAL limitation, this rule can report a false negative in a
|
||||
+ specific situation where two interactive users swap the group-ownership
|
||||
+ of folders or files in their respective home directories.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/expected_groupowner.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/expected_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..8538430
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/expected_groupowner.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chgrp -f $USER /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..af24025
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/home_dirs_one_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/home_dirs_one_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5bce517
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/home_dirs_one_absent.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ed34f09
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/unexpected_groupowner_system_gid.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/unexpected_groupowner_system_gid.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..f105723
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/unexpected_groupowner_system_gid.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chgrp 2 /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/unexpected_groupowner_unknown_gid.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/unexpected_groupowner_unknown_gid.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..00fa481
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/unexpected_groupowner_unknown_gid.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chgrp 10005 /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/warning_home_dirs_swapped_groupowner.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/warning_home_dirs_swapped_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..052aa7c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_groupownership/tests/warning_home_dirs_swapped_groupowner.pass.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+echo "$USER1" > /home/$USER1/$USER1.txt
|
||||
+echo "$USER2" > /home/$USER2/$USER2.txt
|
||||
+# Swap the ownership of files in two home directories
|
||||
+# WARNING: This test scenario will report a false negative, as explained in the
|
||||
+# warning section of this rule.
|
||||
+chgrp -f $USER2 /home/$USER1/$USER1.txt
|
||||
+chgrp -f $USER1 /home/$USER2/$USER2.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..40a0579
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/ansible/shared.yml
|
||||
@@ -0,0 +1,32 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Test for existence home directories to avoid creating them, but only fixing ownership
|
||||
+ ansible.builtin.stat:
|
||||
+ path: '{{ item.value[4] }}'
|
||||
+ register: path_exists
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[1]|int >= {{{ uid_min }}}
|
||||
+ - item.value[1]|int != 65534
|
||||
+
|
||||
+- name: Ensure interactive local users are the owners of their respective home directories
|
||||
+ ansible.builtin.file:
|
||||
+ path: '{{ item.0.value[4] }}'
|
||||
+ owner: '{{ item.0.value[1] }}'
|
||||
+ recurse: yes
|
||||
+ loop: '{{ local_users|zip(path_exists.results)|list }}'
|
||||
+ when:
|
||||
+ - item.1.stat is defined and item.1.stat.exists
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..236c800
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/bash/shared.sh
|
||||
@@ -0,0 +1,13 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+for user in $(awk -F':' '{ if ($3 >= {{{ uid_min }}} && $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
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..1850cfb
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/oval/shared.xml
|
||||
@@ -0,0 +1,52 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All User Files and Directories In The Home Directory Must Have a Valid Owner") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_users_home_files_ownership"
|
||||
+ comment="All User Files and Directories In The Home Directory Must Have a Valid Owner"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:password_object id="object_accounts_users_home_files_ownership_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_users_home_files_ownership_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_users_home_files_ownership_interactive_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <local_variable id="var_accounts_users_home_files_ownership_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_users_home_files_ownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <local_variable id="var_accounts_users_home_files_ownership_uids" datatype="int" version="1"
|
||||
+ comment="List of interactive users uids">
|
||||
+ <object_component item_field="user_id"
|
||||
+ object_ref="object_accounts_users_home_files_ownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_accounts_users_home_files_ownership_dirs" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1"
|
||||
+ recurse_file_system="local"/>
|
||||
+ <unix:path var_ref="var_accounts_users_home_files_ownership_dirs" var_check="at least one"/>
|
||||
+ <unix:filename operation="pattern match">.*</unix:filename>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_accounts_users_home_files_ownership_uids" version="1">
|
||||
+ <unix:user_id datatype="int" var_check="only one"
|
||||
+ var_ref="var_accounts_users_home_files_ownership_uids"/>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_accounts_users_home_files_ownership" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="All home directories files are owned by a local interactive user">
|
||||
+ <unix:object object_ref="object_accounts_users_home_files_ownership_dirs"/>
|
||||
+ <unix:state state_ref="state_accounts_users_home_files_ownership_uids"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/rule.yml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/rule.yml
|
||||
index 13f6bfe..5bfb388 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/rule.yml
|
||||
@@ -10,6 +10,9 @@ description: |-
|
||||
directories, use the following command:
|
||||
<pre>$ sudo chown -R <i>USER</i> /home/<i>USER</i></pre>
|
||||
|
||||
+ This rule ensures every file or directory under the home directory related
|
||||
+ to an interactive user is owned by an interactive user.
|
||||
+
|
||||
rationale: |-
|
||||
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
|
||||
@@ -34,3 +37,9 @@ ocil: |-
|
||||
To verify all files and directories in interactive users home directory
|
||||
are owned by the user, run the following command:
|
||||
<pre>$ sudo ls -lLR /home/<i>USER</i></pre>
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to OVAL limitation, this rule can report a false negative in a
|
||||
+ specific situation where two interactive users swap the ownership of
|
||||
+ folders or files in their respective home directories.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/expected_owner.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/expected_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..da68cb4
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/expected_owner.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chown $USER /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..af24025
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/home_dirs_one_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/home_dirs_one_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5bce517
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/home_dirs_one_absent.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ed34f09
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/unexpected_owner_system_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/unexpected_owner_system_id.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..59c46a9
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/unexpected_owner_system_id.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chown 2 /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/unexpected_owner_unknown_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/unexpected_owner_unknown_id.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..e0f5514
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/unexpected_owner_unknown_id.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chown 10005 /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/warning_home_dirs_swapped_owner.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/warning_home_dirs_swapped_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..1174ec6
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_ownership/tests/warning_home_dirs_swapped_owner.pass.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+echo "$USER1" > /home/$USER1/$USER1.txt
|
||||
+echo "$USER2" > /home/$USER2/$USER2.txt
|
||||
+# Swap the ownership of files in two home directories
|
||||
+# WARNING: This test scenario will report a false negative, as explained in the
|
||||
+# warning section of this rule.
|
||||
+chown -f $USER2 /home/$USER1/$USER1.txt
|
||||
+chown -f $USER1 /home/$USER2/$USER2.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..9473710
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/ansible/shared.yml
|
||||
@@ -0,0 +1,33 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Get all local users from /etc/passwd
|
||||
+ ansible.builtin.getent:
|
||||
+ database: passwd
|
||||
+ split: ':'
|
||||
+
|
||||
+- name: Create local_users variable from the getent output
|
||||
+ ansible.builtin.set_fact:
|
||||
+ local_users: '{{ ansible_facts.getent_passwd|dict2items }}'
|
||||
+
|
||||
+- name: Test for existence home directories to avoid creating them, but only fixing group ownership
|
||||
+ ansible.builtin.stat:
|
||||
+ path: '{{ item.value[4] }}'
|
||||
+ register: path_exists
|
||||
+ loop: '{{ local_users }}'
|
||||
+ when:
|
||||
+ - item.value[2]|int >= {{{ uid_min }}}
|
||||
+ - item.value[2]|int != 65534
|
||||
+
|
||||
+- name: Ensure interactive local users are the group-owners of their respective home directories
|
||||
+ ansible.builtin.file:
|
||||
+ path: '{{ item.0.value[4] }}'
|
||||
+ mode: 'g-w,o=-'
|
||||
+ follow: no
|
||||
+ recurse: yes
|
||||
+ loop: '{{ local_users|zip(path_exists.results)|list }}'
|
||||
+ when:
|
||||
+ - item.1.stat is defined and item.1.stat.exists
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..186d55d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/bash/shared.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+for home_dir in $(awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 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 /027 -exec chmod g-w,o=- {} \;
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..d3db46d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/oval/shared.xml
|
||||
@@ -0,0 +1,52 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("All User Files and Directories In The Home Directory Must Have Mode 0750 Or Less Permissive") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_users_home_files_permissions"
|
||||
+ comment="All files under interactive user's Home Directories must have proper permissions"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <!-- For detailed comments about logic used in this OVAL, check the
|
||||
+ "file_ownership_home_directories" rule. -->
|
||||
+ <unix:password_object id="object_accounts_users_home_files_permissions_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_users_home_files_permissions_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_users_home_files_permissions_interactive_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <!-- #### prepare for test_file_permissions_home_directories #### -->
|
||||
+ <local_variable id="var_accounts_users_home_files_permissions_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir" object_ref="object_accounts_users_home_files_permissions_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_accounts_users_home_files_permissions_dirs" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1"
|
||||
+ recurse_file_system="local"/>
|
||||
+ <unix:path var_ref="var_accounts_users_home_files_permissions_dirs" var_check="at least one"/>
|
||||
+ <unix:filename operation="pattern match">.*</unix:filename>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_accounts_users_home_files_permissions_dirs" version="1" operator='AND'>
|
||||
+ <unix:suid datatype="boolean">false</unix:suid>
|
||||
+ <unix:sgid datatype="boolean">false</unix:sgid>
|
||||
+ <unix:sticky datatype="boolean">false</unix:sticky>
|
||||
+ <unix:gwrite datatype="boolean">false</unix:gwrite>
|
||||
+ <unix:oread datatype="boolean">false</unix:oread>
|
||||
+ <unix:owrite datatype="boolean">false</unix:owrite>
|
||||
+ <unix:oexec datatype="boolean">false</unix:oexec>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_accounts_users_home_files_permissions" check="all" check_existence="any_exist"
|
||||
+ version="1" comment="All home directories have proper permissions">
|
||||
+ <unix:object object_ref="object_accounts_users_home_files_permissions_dirs"/>
|
||||
+ <unix:state state_ref="state_accounts_users_home_files_permissions_dirs"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/acceptable_permission.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/acceptable_permission.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..3561847
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/acceptable_permission.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chmod -Rf 750 /home/$USER/.*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/expected_permissions.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/expected_permissions.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..8ed7fa2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/expected_permissions.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chmod -Rf 700 /home/$USER/.*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/home_dirs_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/home_dirs_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..af24025
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/home_dirs_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ed34f09
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/lenient_permission.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/lenient_permission.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..b561671
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/lenient_permission.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chmod -Rf 700 /home/$USER/.*
|
||||
+chmod -f o+r /home/$USER/$USER.txt
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/lenient_permission_hidden_files.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/lenient_permission_hidden_files.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..d7811bc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_users_home_files_permissions/tests/lenient_permission_hidden_files.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/.init_file
|
||||
+chmod -Rf 700 /home/$USER/.*
|
||||
+chmod -f o+r /home/$USER/.init_file
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_uid.fail.sh
|
||||
similarity index 100%
|
||||
rename from linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_id.fail.sh
|
||||
rename to linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_system_uid.fail.sh
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_id.fail.sh b/linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_uid.fail.sh
|
||||
similarity index 100%
|
||||
rename from linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_id.fail.sh
|
||||
rename to linux_os/guide/system/accounts/accounts-session/file_groupownership_home_directories/tests/unexpected_groupowner_unknown_uid.fail.sh
|
@ -1,851 +0,0 @@
|
||||
From 55ec5c49441f6b99914eef15c6cc559910311934 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Fri, 5 Nov 2021 14:02:09 +0100
|
||||
Subject: [PATCH 1/4] OVAL, tests and remediation for rule:
|
||||
|
||||
accounts_user_dot_user_ownership
|
||||
---
|
||||
.../ansible/shared.yml | 10 ++++
|
||||
.../bash/shared.sh | 7 +++
|
||||
.../oval/shared.xml | 52 +++++++++++++++++++
|
||||
.../accounts_user_dot_user_ownership/rule.yml | 9 ++++
|
||||
.../tests/expected_owner.pass.sh | 6 +++
|
||||
.../tests/home_dirs_all_absent.pass.sh | 6 +++
|
||||
.../home_dirs_one_absent_owner_ok.pass.sh | 10 ++++
|
||||
.../tests/interactive_users_absent.pass.sh | 4 ++
|
||||
.../tests/no_dot_file_ignored.pass.sh | 6 +++
|
||||
.../tests/unexpected_owner_system_uid.fail.sh | 6 +++
|
||||
.../unexpected_owner_unknown_uid.fail.sh | 6 +++
|
||||
.../tests/warning_swapped_owners.pass.sh | 15 ++++++
|
||||
12 files changed, 137 insertions(+)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/expected_owner.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_one_absent_owner_ok.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/interactive_users_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/no_dot_file_ignored.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_system_uid.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_unknown_uid.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/warning_swapped_owners.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..3801e0cfdec
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/ansible/shared.yml
|
||||
@@ -0,0 +1,10 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Ensure interactive local users are the owners of their respective initialization files
|
||||
+ ansible.builtin.command:
|
||||
+ cmd: |
|
||||
+ awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) system("chown -f " $3" "$6"/.[^\.]?*") }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..f362a2656aa
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) system("chown -f " $3" "$6"/.[^\.]?*") }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..fb12ce73b23
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/oval/shared.xml
|
||||
@@ -0,0 +1,52 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("User Initialization Files Must Be Owned By the Primary User") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_user_dot_user_ownership"
|
||||
+ comment="User Initialization Files Must Be Owned By the Primary User"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:password_object id="object_accounts_user_dot_user_ownership_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_user_dot_user_ownership_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_user_dot_user_ownership_interactive_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <local_variable id="var_accounts_user_dot_user_ownership_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_user_dot_user_ownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <local_variable id="var_accounts_user_dot_user_ownership_uids" datatype="int" version="1"
|
||||
+ comment="List of interactive users uids">
|
||||
+ <object_component item_field="user_id"
|
||||
+ object_ref="object_accounts_user_dot_user_ownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_accounts_user_dot_user_ownership_init_files" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="1"
|
||||
+ recurse_file_system="local"/>
|
||||
+ <unix:path var_ref="var_accounts_user_dot_user_ownership_dirs" var_check="at least one"/>
|
||||
+ <unix:filename operation="pattern match">^\..*</unix:filename>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_accounts_user_dot_user_ownership_uids" version="1">
|
||||
+ <unix:user_id datatype="int" var_check="only one"
|
||||
+ var_ref="var_accounts_user_dot_user_ownership_uids"/>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_accounts_user_dot_user_ownership" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="All user initialization files are owned by a local interactive user">
|
||||
+ <unix:object object_ref="object_accounts_user_dot_user_ownership_init_files"/>
|
||||
+ <unix:state state_ref="state_accounts_user_dot_user_ownership_uids"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/rule.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/rule.yml
|
||||
index 37efb159c08..ec75aa01f12 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/rule.yml
|
||||
@@ -9,6 +9,9 @@ description: |-
|
||||
the primary owner with the following command:
|
||||
<pre>$ sudo chown <i>USER</i> /home/<i>USER</i>/.*</pre>
|
||||
|
||||
+ This rule ensures every initialization file related to an interactive user
|
||||
+ is owned by an interactive user.
|
||||
+
|
||||
rationale: |-
|
||||
Local initialization files are used to configure the user's shell environment
|
||||
upon logon. Malicious modification of these files could compromise accounts upon
|
||||
@@ -33,3 +36,9 @@ ocil: |-
|
||||
primary user, run the following command:
|
||||
<pre>$ sudo ls -al /home/<i>USER</i>/.*</pre>
|
||||
The user initialization files should be owned by <i>USER</i>.
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to OVAL limitation, this rule can report a false negative in a
|
||||
+ specific situation where two interactive users swap the ownership of
|
||||
+ their respective initialization files.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/expected_owner.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/expected_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..3d30238225e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/expected_owner.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chown $USER /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..af240252de3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_one_absent_owner_ok.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_one_absent_owner_ok.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..840477d2c83
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/home_dirs_one_absent_owner_ok.pass.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
+
|
||||
+touch /home/$USER1/.bashrc
|
||||
+chown $USER1 /home/$USER1/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed34f0940a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/no_dot_file_ignored.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/no_dot_file_ignored.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..9292a46b3b2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/no_dot_file_ignored.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/nodotfile
|
||||
+chown 2 /home/$USER/nodotfile
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_system_uid.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_system_uid.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..0373eb6a5f6
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_system_uid.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chown 2 /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_unknown_uid.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_unknown_uid.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..da7f50ce905
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/unexpected_owner_unknown_uid.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chown 10005 /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/warning_swapped_owners.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/warning_swapped_owners.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..b4a95ae2242
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_user_ownership/tests/warning_swapped_owners.pass.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+touch /home/$USER1/.bashrc
|
||||
+touch /home/$USER2/.bashrc
|
||||
+
|
||||
+# Swap the ownership of files in two home directories
|
||||
+# WARNING: This test scenario will report a false negative, as explained in the
|
||||
+# warning section of this rule.
|
||||
+chown -f $USER2 /home/$USER1/.bashrc
|
||||
+chown -f $USER1 /home/$USER2/.bashrc
|
||||
|
||||
From cc6318c8afc898190a090058fbdfbdfc741d4d85 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Fri, 5 Nov 2021 14:05:19 +0100
|
||||
Subject: [PATCH 2/4] OVAL, tests and remediation for rule:
|
||||
|
||||
accounts_user_dot_group_ownership
|
||||
---
|
||||
.../ansible/shared.yml | 10 ++++
|
||||
.../bash/shared.sh | 7 +++
|
||||
.../oval/shared.xml | 52 +++++++++++++++++++
|
||||
.../rule.yml | 9 ++++
|
||||
.../tests/expected_groupowner.pass.sh | 6 +++
|
||||
.../tests/home_dirs_all_absent.pass.sh | 6 +++
|
||||
.../home_dirs_one_absent_group_ok.pass.sh | 10 ++++
|
||||
.../tests/interactive_users_absent.pass.sh | 4 ++
|
||||
.../tests/no_dot_file_ignored.pass.sh | 6 +++
|
||||
.../unexpected_groupowner_system_gid.fail.sh | 6 +++
|
||||
.../unexpected_groupowner_unknown_gid.fail.sh | 6 +++
|
||||
.../tests/warning_swapped_groupowners.pass.sh | 15 ++++++
|
||||
12 files changed, 137 insertions(+)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/expected_groupowner.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_one_absent_group_ok.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/interactive_users_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/no_dot_file_ignored.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_system_gid.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_unknown_gid.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/warning_swapped_groupowners.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..1a9fa192359
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/ansible/shared.yml
|
||||
@@ -0,0 +1,10 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Ensure interactive local users are the group-owners of their respective initialization files
|
||||
+ ansible.builtin.command:
|
||||
+ cmd: |
|
||||
+ awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) system("chgrp -f " $3" "$6"/.[^\.]?*") }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..2b0fe395e29
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) system("chgrp -f " $3" "$6"/.[^\.]?*") }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..7ee39a3e794
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/oval/shared.xml
|
||||
@@ -0,0 +1,52 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("User Initialization Files Must Be Group-Owned By The Primary User") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_user_dot_group_ownership"
|
||||
+ comment="User Initialization Files Must Be Group-Owned By The Primary User"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:password_object id="object_accounts_user_dot_group_ownership_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_user_dot_group_ownership_interactive_gids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_user_dot_group_ownership_interactive_gids" version="1">
|
||||
+ <unix:group_id datatype="int" operation="greater than or equal">{{{ gid_min }}}</unix:group_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <local_variable id="var_accounts_user_dot_group_ownership_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_user_dot_group_ownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <local_variable id="var_accounts_user_dot_group_ownership_gids" datatype="int" version="1"
|
||||
+ comment="List of interactive users gids">
|
||||
+ <object_component item_field="group_id"
|
||||
+ object_ref="object_accounts_user_dot_group_ownership_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_accounts_user_dot_group_ownership_init_files" version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="1"
|
||||
+ recurse_file_system="local"/>
|
||||
+ <unix:path var_ref="var_accounts_user_dot_group_ownership_dirs" var_check="at least one"/>
|
||||
+ <unix:filename operation="pattern match">^\..*</unix:filename>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_accounts_user_dot_group_ownership_gids" version="1">
|
||||
+ <unix:group_id datatype="int" var_check="only one"
|
||||
+ var_ref="var_accounts_user_dot_group_ownership_gids"/>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_accounts_user_dot_group_ownership" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="All user initialization files are group-owned by a local interactive user">
|
||||
+ <unix:object object_ref="object_accounts_user_dot_group_ownership_init_files"/>
|
||||
+ <unix:state state_ref="state_accounts_user_dot_group_ownership_gids"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/rule.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/rule.yml
|
||||
index a9cf96afc8c..d7d75a6600f 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/rule.yml
|
||||
@@ -10,6 +10,9 @@ description: |-
|
||||
interactive user home directory, use the following command:
|
||||
<pre>$ sudo chgrp <i>USER_GROUP</i> /home/<i>USER</i>/.<i>INIT_FILE</i></pre>
|
||||
|
||||
+ This rule ensures every initialization file related to an interactive user
|
||||
+ is group-owned by an interactive user.
|
||||
+
|
||||
rationale: |-
|
||||
Local initialization files for interactive users are used to configure the
|
||||
user's shell environment upon logon. Malicious modification of these files could
|
||||
@@ -35,3 +38,9 @@ ocil: |-
|
||||
users in <tt>/etc/passwd</tt> and verify all initialization files under the
|
||||
respective users home directory. Check the group owner of all local interactive users
|
||||
initialization files.
|
||||
+
|
||||
+warnings:
|
||||
+ - general: |-
|
||||
+ Due to OVAL limitation, this rule can report a false negative in a
|
||||
+ specific situation where two interactive users swap the group-ownership
|
||||
+ of their respective initialization files.
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/expected_groupowner.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/expected_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..0b89e741fbf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/expected_groupowner.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chgrp $USER /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..af240252de3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_one_absent_group_ok.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_one_absent_group_ok.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..90e1787dccc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/home_dirs_one_absent_group_ok.pass.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
+
|
||||
+touch /home/$USER1/.bashrc
|
||||
+chgrp $USER1 /home/$USER1/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed34f0940a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/no_dot_file_ignored.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/no_dot_file_ignored.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..5b9e17c5384
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/no_dot_file_ignored.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/nodotfile
|
||||
+chgrp 2 /home/$USER/nodotfile
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_system_gid.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_system_gid.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..b21e7229ed2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_system_gid.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chgrp 2 /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_unknown_gid.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_unknown_gid.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..7c1bcac44d6
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/unexpected_groupowner_unknown_gid.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chgrp 10005 /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/warning_swapped_groupowners.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/warning_swapped_groupowners.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..d58a9dd63bf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_group_ownership/tests/warning_swapped_groupowners.pass.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -m $USER2
|
||||
+touch /home/$USER1/.bashrc
|
||||
+touch /home/$USER2/.bashrc
|
||||
+
|
||||
+# Swap the ownership of files in two home directories
|
||||
+# WARNING: This test scenario will report a false negative, as explained in the
|
||||
+# warning section of this rule.
|
||||
+chgrp -f $USER2 /home/$USER1/.bashrc
|
||||
+chgrp -f $USER1 /home/$USER2/.bashrc
|
||||
|
||||
From 2e28bd10bfec8466362e74b7c5d95481e95d0ae9 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Fri, 5 Nov 2021 14:06:56 +0100
|
||||
Subject: [PATCH 3/4] OVAL, tests and remediation for rule:
|
||||
|
||||
accounts_user_dot_no_world_writable_programs
|
||||
---
|
||||
.../ansible/shared.yml | 10 ++++
|
||||
.../bash/shared.sh | 7 +++
|
||||
.../oval/shared.xml | 52 +++++++++++++++++++
|
||||
.../tests/expected_permissions.pass.sh | 6 +++
|
||||
.../tests/home_dirs_absent.pass.sh | 6 +++
|
||||
.../tests/interactive_users_absent.pass.sh | 4 ++
|
||||
.../tests/lenient_permission.fail.sh | 6 +++
|
||||
.../tests/more_restrictive_permission.pass.sh | 6 +++
|
||||
.../tests/no_dot_file_ignored.pass.sh | 6 +++
|
||||
9 files changed, 103 insertions(+)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/expected_permissions.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/home_dirs_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/interactive_users_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/lenient_permission.fail.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/more_restrictive_permission.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/no_dot_file_ignored.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..210d12a53fe
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/ansible/shared.yml
|
||||
@@ -0,0 +1,10 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Ensure interactive local users are the group-owners of their respective initialization files
|
||||
+ ansible.builtin.command:
|
||||
+ cmd: |
|
||||
+ awk -F':' '{ if ($3 >= {{{ gid_min }}} && $3 != 65534) system("chmod -f g-w,o-w "$6"/.[^\.]?*") }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..24ff95c6cd7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/bash/shared.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+awk -F':' '{ if ($4 >= {{{ uid_min }}} && $4 != 65534) system("chmod -f g-w,o-w "$6"/.[^\.]?*") }' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..ca8ecb2b447
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/oval/shared.xml
|
||||
@@ -0,0 +1,52 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("User Initialization Files Must Not Run World-Writable Programs") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_user_dot_no_world_writable_programs"
|
||||
+ comment="User Initialization Files Must Not Run World-Writable Programs"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:password_object id="object_accounts_user_dot_no_world_writable_programs_objects"
|
||||
+ version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_user_dot_no_world_writable_programs_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_user_dot_no_world_writable_programs_interactive_uids"
|
||||
+ version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <local_variable id="var_accounts_user_dot_no_world_writable_programs_dirs"
|
||||
+ datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_user_dot_no_world_writable_programs_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <unix:file_object id="object_accounts_user_dot_no_world_writable_programs_init_files"
|
||||
+ version="1">
|
||||
+ <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1"
|
||||
+ recurse_file_system="local"/>
|
||||
+ <unix:path var_ref="var_accounts_user_dot_no_world_writable_programs_dirs"
|
||||
+ var_check="at least one"/>
|
||||
+ <unix:filename operation="pattern match">^\..*</unix:filename>
|
||||
+ </unix:file_object>
|
||||
+
|
||||
+ <!-- #### creation of state #### -->
|
||||
+ <unix:file_state id="state_accounts_user_dot_no_world_writable_programs" version="1"
|
||||
+ operator='AND'>
|
||||
+ <unix:gwrite datatype="boolean">false</unix:gwrite>
|
||||
+ <unix:owrite datatype="boolean">false</unix:owrite>
|
||||
+ </unix:file_state>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <unix:file_test id="test_accounts_user_dot_no_world_writable_programs" check="all"
|
||||
+ check_existence="any_exist" version="1"
|
||||
+ comment="All home directories have proper permissions">
|
||||
+ <unix:object object_ref="object_accounts_user_dot_no_world_writable_programs_init_files"/>
|
||||
+ <unix:state state_ref="state_accounts_user_dot_no_world_writable_programs"/>
|
||||
+ </unix:file_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/expected_permissions.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/expected_permissions.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..7a2b35eba77
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/expected_permissions.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chmod -f 755 /home/$USER/.*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/home_dirs_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/home_dirs_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..af240252de3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/home_dirs_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed34f0940a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/lenient_permission.fail.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/lenient_permission.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..5fcf95f5f96
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/lenient_permission.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+touch /home/$USER/.bashrc
|
||||
+chmod -f o+w /home/$USER/.bashrc
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/more_restrictive_permission.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/more_restrictive_permission.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..655c6d32e47
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/more_restrictive_permission.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chmod -f 700 /home/$USER/.*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/no_dot_file_ignored.pass.sh b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/no_dot_file_ignored.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..66439b768ca
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/accounts_user_dot_no_world_writable_programs/tests/no_dot_file_ignored.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "$USER" > /home/$USER/$USER.txt
|
||||
+chmod -f o+w /home/$USER/$USER.txt
|
||||
|
||||
From f7f5735115ad3fa98fac8644aa844ed54d4d5dd7 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Fri, 5 Nov 2021 14:07:55 +0100
|
||||
Subject: [PATCH 4/4] OVAL, tests and remediation for rule:
|
||||
|
||||
accounts_umask_interactive_users
|
||||
---
|
||||
.../ansible/shared.yml | 12 ++++++
|
||||
.../bash/shared.sh | 9 +++++
|
||||
.../oval/shared.xml | 40 +++++++++++++++++++
|
||||
.../tests/home_dirs_all_absent.pass.sh | 6 +++
|
||||
.../tests/home_dirs_one_absent.pass.sh | 10 +++++
|
||||
.../tests/interactive_users_absent.pass.sh | 4 ++
|
||||
.../tests/no_dot_file_ignored.pass.sh | 5 +++
|
||||
.../tests/umask_defined.fail.sh | 5 +++
|
||||
8 files changed, 91 insertions(+)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_all_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_one_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/interactive_users_absent.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/no_dot_file_ignored.pass.sh
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/umask_defined.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 00000000000..142f10a2157
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml
|
||||
@@ -0,0 +1,12 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+- name: Ensure interactive local users are the owners of their respective initialization files
|
||||
+ ansible.builtin.shell:
|
||||
+ cmd: |
|
||||
+ for dir in $(awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) print $6}' /etc/passwd); do
|
||||
+ sed -i 's/^\([\s]*umask\s*\)/#\1/g' $dir/.[^\.]?*
|
||||
+ done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 00000000000..0644b221df8
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = restrict
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+
|
||||
+for dir in $(awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) print $6}' /etc/passwd); do
|
||||
+ sed -i 's/^\([\s]*umask\s*\)/#\1/g' $dir/.[^\.]?*
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/oval/shared.xml b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 00000000000..42dbdbbae46
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/oval/shared.xml
|
||||
@@ -0,0 +1,40 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Ensure the Default Umask is Set Correctly For Interactive Users") }}}
|
||||
+ <criteria>
|
||||
+ <criterion test_ref="test_accounts_umask_interactive_users"
|
||||
+ comment="Ensure the Default Umask is Set Correctly For Interactive Users"/>
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
+ <unix:password_object id="object_accounts_umask_interactive_users_objects" version="1">
|
||||
+ <unix:username datatype="string" operation="not equal">nobody</unix:username>
|
||||
+ <filter action="include">state_accounts_umask_interactive_users_interactive_uids</filter>
|
||||
+ </unix:password_object>
|
||||
+
|
||||
+ <unix:password_state id="state_accounts_umask_interactive_users_interactive_uids" version="1">
|
||||
+ <unix:user_id datatype="int" operation="greater than or equal">{{{ uid_min }}}</unix:user_id>
|
||||
+ </unix:password_state>
|
||||
+
|
||||
+ <local_variable id="var_accounts_umask_interactive_users_dirs" datatype="string" version="1"
|
||||
+ comment="Variable including all home dirs from interactive users">
|
||||
+ <object_component item_field="home_dir"
|
||||
+ object_ref="object_accounts_umask_interactive_users_objects"/>
|
||||
+ </local_variable>
|
||||
+
|
||||
+ <!-- #### creation of object #### -->
|
||||
+ <ind:textfilecontent54_object id="object_accounts_umask_interactive_users"
|
||||
+ comment="Umask value from initialization files" version="1">
|
||||
+ <ind:path var_ref="var_accounts_umask_interactive_users_dirs" var_check="at least one"/>
|
||||
+ <ind:filename operation="pattern match">^\..*</ind:filename>
|
||||
+ <ind:pattern operation="pattern match">^[\s]*umask\s*</ind:pattern>
|
||||
+ <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+ <!-- #### creation of test #### -->
|
||||
+ <ind:textfilecontent54_test id="test_accounts_umask_interactive_users" check="all"
|
||||
+ check_existence="none_exist" version="1"
|
||||
+ comment="Umask must not be defined in user initialization files">
|
||||
+ <ind:object object_ref="object_accounts_umask_interactive_users"/>
|
||||
+ </ind:textfilecontent54_test>
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_all_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_all_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..af240252de3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_all_absent.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -M $USER
|
||||
+# This make sure home dirs related to test environment users are also removed.
|
||||
+rm -Rf /home/*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_one_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_one_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..0ad9248d14b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/home_dirs_one_absent.pass.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER1="cac_user1"
|
||||
+USER2="cac_user2"
|
||||
+
|
||||
+useradd -m $USER1
|
||||
+useradd -M $USER2
|
||||
+
|
||||
+# Make sure no umask definition exists in the startup files
|
||||
+sed -i 's/^\([\s]*umask\s*\)/#\1/g' /home/$USER1/.[^\.]?*
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/interactive_users_absent.pass.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/interactive_users_absent.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ed34f0940a7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/interactive_users_absent.pass.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# remove all interactive users (ID >= 1000) from /etc/passwd
|
||||
+sed -i '/.*:[0-9]\{4,\}:/d' /etc/passwd
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/no_dot_file_ignored.pass.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/no_dot_file_ignored.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..27f580ae45a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/no_dot_file_ignored.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "umask 022" > /home/$USER/nodotfile
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/umask_defined.fail.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/umask_defined.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..f7835392acf
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/umask_defined.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+echo "umask 022" >> /home/$USER/.bashrc
|
@ -1,74 +0,0 @@
|
||||
From 1b7bd47bd8fa3f828aca0bf0add7fc188893ef11 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Tue, 21 Sep 2021 07:44:29 -0500
|
||||
Subject: [PATCH 1/2] Add STIG references for FIPS
|
||||
|
||||
---
|
||||
.../integrity/crypto/configure_bind_crypto_policy/rule.yml | 1 +
|
||||
.../software/integrity/crypto/configure_crypto_policy/rule.yml | 1 +
|
||||
.../integrity/crypto/configure_kerberos_crypto_policy/rule.yml | 1 +
|
||||
.../integrity/crypto/configure_libreswan_crypto_policy/rule.yml | 1 +
|
||||
.../software/integrity/fips/enable_dracut_fips_module/rule.yml | 1 +
|
||||
5 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml
|
||||
index 5484e11ad9f..e58c9506083 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_bind_crypto_policy/rule.yml
|
||||
@@ -29,6 +29,7 @@ identifiers:
|
||||
references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1
|
||||
nist: SC-13,SC-12(2),SC-12(3)
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
srg: SRG-OS-000423-GPOS-00187,SRG-OS-000426-GPOS-00190
|
||||
|
||||
ocil_clause: |-
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml
|
||||
index d4ea4db6c14..5eea87ac006 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/rule.yml
|
||||
@@ -65,6 +65,7 @@ references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1,CIP-007-3 R7.1
|
||||
nist: AC-17(a),AC-17(2),CM-6(a),MA-4(6),SC-13,SC-12(2),SC-12(3)
|
||||
ospp: 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
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
srg: SRG-OS-000396-GPOS-00176,SRG-OS-000393-GPOS-00173,SRG-OS-000394-GPOS-00174
|
||||
|
||||
ocil_clause: 'cryptographic policy is not configured or is configured incorrectly'
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/rule.yml
|
||||
index b219c9d2801..e1f5e55e8cd 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/rule.yml
|
||||
@@ -28,6 +28,7 @@ references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1
|
||||
nist: SC-13,SC-12(2),SC-12(3)
|
||||
srg: SRG-OS-000120-GPOS-00061
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: 'the symlink does not exist or points to a different target'
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_libreswan_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_libreswan_crypto_policy/rule.yml
|
||||
index cd03ecf30d1..1fffb2ad2b7 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_libreswan_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_libreswan_crypto_policy/rule.yml
|
||||
@@ -33,6 +33,7 @@ references:
|
||||
nist: CM-6(a),MA-4(6),SC-13,SC-12(2),SC-12(3)
|
||||
ospp: FCS_IPSEC_EXT.1.4,FCS_IPSEC_EXT.1.6
|
||||
srg: SRG-OS-000033-GPOS-00014
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: |-
|
||||
Libreswan is installed and <tt>/etc/ipsec.conf</tt> does not contain <tt>include /etc/crypto-policies/back-ends/libreswan.config</tt>
|
||||
diff --git a/linux_os/guide/system/software/integrity/fips/enable_dracut_fips_module/rule.yml b/linux_os/guide/system/software/integrity/fips/enable_dracut_fips_module/rule.yml
|
||||
index 9486031be54..fe20c1958a6 100644
|
||||
--- a/linux_os/guide/system/software/integrity/fips/enable_dracut_fips_module/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/fips/enable_dracut_fips_module/rule.yml
|
||||
@@ -30,6 +30,7 @@ references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1
|
||||
nist: SC-12(2),SC-12(3),IA-7,SC-13,CM-6(a),SC-12
|
||||
srg: SRG-OS-000478-GPOS-00223
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
vmmsrg: SRG-OS-000120-VMM-000600,SRG-OS-000478-VMM-001980,SRG-OS-000396-VMM-001590
|
||||
|
||||
ocil_clause: 'the Dracut FIPS module is not enabled'
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 155a46f32b02fec3fa9a99d2a6fa2f1a5287fcaf Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 29 Sep 2021 09:43:56 -0500
|
||||
Subject: [PATCH] Add RHEL8 FIPS STIG ID to few rules
|
||||
|
||||
---
|
||||
.../integrity/crypto/configure_ssh_crypto_policy/rule.yml | 1 +
|
||||
.../harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml | 1 +
|
||||
.../crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_ssh_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/configure_ssh_crypto_policy/rule.yml
|
||||
index 9ac0b55f65a..2f4fb79eb54 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/configure_ssh_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/configure_ssh_crypto_policy/rule.yml
|
||||
@@ -29,6 +29,7 @@ references:
|
||||
nerc-cip: CIP-003-3 R4.2,CIP-007-3 R5.1,CIP-007-3 R7.1
|
||||
nist: AC-17(a),AC-17(2),CM-6(a),MA-4(6),SC-13
|
||||
srg: SRG-OS-000250-GPOS-00093
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: 'the CRYPTO_POLICY variable is not set or is commented in the /etc/sysconfig/sshd'
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml
|
||||
index 682ca436b8d..adeae314fff 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml
|
||||
@@ -30,6 +30,7 @@ references:
|
||||
disa: CCI-001453
|
||||
nist: AC-17(2)
|
||||
srg: SRG-OS-000250-GPOS-00093
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: 'Crypto Policy for OpenSSH client is not configured correctly'
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
index d21f68ac17a..12e527ca33d 100644
|
||||
--- a/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/crypto/harden_sshd_macs_openssh_conf_crypto_policy/rule.yml
|
||||
@@ -28,6 +28,7 @@ references:
|
||||
disa: CCI-001453
|
||||
nist: AC-17(2)
|
||||
srg: SRG-OS-000250-GPOS-00093
|
||||
+ stigid@rhel8: RHEL-08-010020
|
||||
|
||||
ocil_clause: 'Crypto Policy for OpenSSH client is not configured correctly'
|
||||
|
@ -1,91 +0,0 @@
|
||||
From c988807382a5c0e307567def55fcedcb2e3b75b7 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 4 Oct 2021 12:18:05 -0500
|
||||
Subject: [PATCH 1/4] Update rsyslog_remote_loghost to match STIG and CIS
|
||||
|
||||
STIG and CIS only match *.conf files and we matched all files.
|
||||
Moving to match the benchmarks.
|
||||
|
||||
Fixes #7333
|
||||
---
|
||||
.../rsyslog_remote_loghost/oval/shared.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml
|
||||
index 5895b7fab24..7b5d4968886 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<ind:textfilecontent54_object id="object_remote_loghost_rsyslog_d" version="1">
|
||||
<ind:path>/etc/rsyslog.d</ind:path>
|
||||
- <ind:filename operation="pattern match">.*</ind:filename>
|
||||
+ <ind:filename operation="pattern match">*.conf</ind:filename>
|
||||
<ind:pattern operation="pattern match">^\*\.\*[\s]+(?:@|\:omrelp\:)</ind:pattern>
|
||||
<ind:instance datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
From 19d72d76e6818f47e71245dece0d6faa62cfcdb1 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 4 Oct 2021 13:11:10 -0500
|
||||
Subject: [PATCH 3/4] Add packages so that test suite pass in a container
|
||||
|
||||
---
|
||||
.../rsyslog_remote_loghost/tests/line_commented.fail.sh | 1 +
|
||||
.../rsyslog_remote_loghost/tests/line_not_there.fail.sh | 1 +
|
||||
.../rsyslog_remote_loghost/tests/remote_configured.pass.sh | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_commented.fail.sh b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_commented.fail.sh
|
||||
index 52376effea2..760606278b3 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_commented.fail.sh
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_commented.fail.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
+# packages = rsyslog
|
||||
|
||||
CONF_FILE="/etc/rsyslog.conf"
|
||||
LOGHOST_LINE="*.* @@192.168.122.1:5000"
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_not_there.fail.sh b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_not_there.fail.sh
|
||||
index 8a55da88c8d..ac82180f21c 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_not_there.fail.sh
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/line_not_there.fail.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
+# packages = rsyslog
|
||||
|
||||
CONF_FILE="/etc/rsyslog.conf"
|
||||
sed -i "/^\*\.\*.*/d" "$CONF_FILE"
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/remote_configured.pass.sh b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/remote_configured.pass.sh
|
||||
index 8122a490f25..3c396b4e52a 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/remote_configured.pass.sh
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/tests/remote_configured.pass.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
+# packages = rsyslog
|
||||
|
||||
CONF_FILE="/etc/rsyslog.conf"
|
||||
LOGHOST_LINE="*.* @@192.168.122.1:5000"
|
||||
|
||||
From e7110e97c808b82a8d6d91c9da42f6c5422747cf Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Mon, 11 Oct 2021 11:33:13 -0500
|
||||
Subject: [PATCH 4/4] Fix regex on rsyslog_remote_loghost
|
||||
|
||||
---
|
||||
.../rsyslog_remote_loghost/oval/shared.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml
|
||||
index 7b5d4968886..0fdd24e18c2 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_loghost/oval/shared.xml
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
<ind:textfilecontent54_object id="object_remote_loghost_rsyslog_d" version="1">
|
||||
<ind:path>/etc/rsyslog.d</ind:path>
|
||||
- <ind:filename operation="pattern match">*.conf</ind:filename>
|
||||
+ <ind:filename operation="pattern match">^.+\.conf$</ind:filename>
|
||||
<ind:pattern operation="pattern match">^\*\.\*[\s]+(?:@|\:omrelp\:)</ind:pattern>
|
||||
<ind:instance datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
@ -1,51 +0,0 @@
|
||||
From f74121fc8b4074854e7cd96cc276711e80b54131 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Burghardt <maburgha@redhat.com>
|
||||
Date: Thu, 18 Nov 2021 10:23:10 +0100
|
||||
Subject: [PATCH] Fix remediation for accounts_umask_interactive_users
|
||||
|
||||
Included logic to ensure sed command considers only hidden files,
|
||||
ignoring possible hidden folders.
|
||||
---
|
||||
.../accounts_umask_interactive_users/ansible/shared.yml | 4 +++-
|
||||
.../accounts_umask_interactive_users/bash/shared.sh | 4 +++-
|
||||
.../tests/hidden_folder_ignored.pass.sh | 5 +++++
|
||||
3 files changed, 11 insertions(+), 2 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/hidden_folder_ignored.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml
|
||||
index 142f10a2157..67064ac4a3b 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/ansible/shared.yml
|
||||
@@ -8,5 +8,7 @@
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
for dir in $(awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) print $6}' /etc/passwd); do
|
||||
- sed -i 's/^\([\s]*umask\s*\)/#\1/g' $dir/.[^\.]?*
|
||||
+ for file in $(find $dir -maxdepth 1 -type f -name ".*"); do
|
||||
+ sed -i 's/^\([\s]*umask\s*\)/#\1/g' $file
|
||||
+ done
|
||||
done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh
|
||||
index 0644b221df8..f81fdfe41fd 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/bash/shared.sh
|
||||
@@ -5,5 +5,7 @@
|
||||
# disruption = low
|
||||
|
||||
for dir in $(awk -F':' '{ if ($3 >= {{{ uid_min }}} && $3 != 65534) print $6}' /etc/passwd); do
|
||||
- sed -i 's/^\([\s]*umask\s*\)/#\1/g' $dir/.[^\.]?*
|
||||
+ for file in $(find $dir -maxdepth 1 -type f -name ".*"); do
|
||||
+ sed -i 's/^\([\s]*umask\s*\)/#\1/g' $file
|
||||
+ done
|
||||
done
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/hidden_folder_ignored.pass.sh b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/hidden_folder_ignored.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..b9e1b7519ef
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/accounts/accounts-session/user_umask/accounts_umask_interactive_users/tests/hidden_folder_ignored.pass.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+USER="cac_user"
|
||||
+useradd -m $USER
|
||||
+mkdir /home/$USER/.hiddenfolder
|
@ -1,759 +0,0 @@
|
||||
commit 26f72c842ec184ed517fbf0d3224c421ad7cc9c6
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 18:33:50 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.59-multifile_templates-PR_7405.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
||||
deleted file mode 100644
|
||||
index f6f2ab4..0000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
||||
+++ /dev/null
|
||||
@@ -1,25 +0,0 @@
|
||||
-# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
-# reboot = false
|
||||
-# strategy = restrict
|
||||
-# complexity = medium
|
||||
-# disruption = medium
|
||||
-- name: "Read list libraries without root ownership"
|
||||
- find:
|
||||
- paths:
|
||||
- - "/usr/lib"
|
||||
- - "/usr/lib64"
|
||||
- - "/lib"
|
||||
- - "/lib64"
|
||||
- file_type: "directory"
|
||||
- register: library_dirs_not_group_owned_by_root
|
||||
-
|
||||
-- name: "Set group ownership of system library dirs to root"
|
||||
- file:
|
||||
- path: "{{ item.path }}"
|
||||
- group: "root"
|
||||
- state: "directory"
|
||||
- mode: "{{ item.mode }}"
|
||||
- with_items: "{{ library_dirs_not_group_owned_by_root.files }}"
|
||||
- when:
|
||||
- - library_dirs_not_group_owned_by_root.matched > 0
|
||||
- - item.gid != 0
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
||||
deleted file mode 100644
|
||||
index 365b983..0000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
-
|
||||
-find /lib \
|
||||
-/lib64 \
|
||||
-/usr/lib \
|
||||
-/usr/lib64 \
|
||||
-\! -group root -type d -exec chgrp root '{}' \;
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/oval/shared.xml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/oval/shared.xml
|
||||
deleted file mode 100644
|
||||
index 3af60ff..0000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/oval/shared.xml
|
||||
+++ /dev/null
|
||||
@@ -1,27 +0,0 @@
|
||||
-<def-group>
|
||||
- <definition class="compliance" id="dir_group_ownership_library_dirs" version="1">
|
||||
- {{{ oval_metadata("
|
||||
- Checks that /lib, /lib64, /usr/lib, /usr/lib64, /lib/modules, and
|
||||
- directories therein, are group-owned by root.
|
||||
- ") }}}
|
||||
- <criteria operator="AND">
|
||||
- <criterion test_ref="test_dir_group_ownership_lib_dir" />
|
||||
- </criteria>
|
||||
- </definition>
|
||||
-
|
||||
- <unix:file_test check="all" check_existence="none_exist" comment="library directories gid root" id="test_dir_group_ownership_lib_dir" version="1">
|
||||
- <unix:object object_ref="object_dir_group_ownership_lib_dir" />
|
||||
- </unix:file_test>
|
||||
-
|
||||
- <unix:file_object comment="library directories" id="object_dir_group_ownership_lib_dir" version="1">
|
||||
- <!-- Check that /lib, /lib64, /usr/lib, and /usr/lib64 directories belong to group with gid 0 (root) -->
|
||||
- <unix:path operation="pattern match">(^\/lib(|64)\/|^\/usr\/lib(|64)\/)</unix:path>
|
||||
- <unix:filename xsi:nil="true" />
|
||||
- <filter action="include">state_group_owner_library_dirs_not_root</filter>
|
||||
- </unix:file_object>
|
||||
-
|
||||
- <unix:file_state id="state_group_owner_library_dirs_not_root" version="1">
|
||||
- <unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
||||
- </unix:file_state>
|
||||
-
|
||||
-</def-group>
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
||||
index 8c0acc0..10203c9 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: sle12,sle15,rhel8,fedora
|
||||
+prodtype: fedora,rhel8,sle12,sle15,ubuntu2004
|
||||
|
||||
title: 'Verify that Shared Library Directories Have Root Group Ownership'
|
||||
|
||||
@@ -40,6 +40,7 @@ references:
|
||||
stigid@rhel8: RHEL-08-010350
|
||||
stigid@sle12: SLES-12-010876
|
||||
stigid@sle15: SLES-15-010356
|
||||
+ stigid@ubuntu2004: UBTU-20-010431
|
||||
|
||||
ocil_clause: 'any of these directories are not group-owned by root'
|
||||
|
||||
@@ -52,3 +53,14 @@ ocil: |-
|
||||
For each of these directories, run the following command to find files not
|
||||
owned by root:
|
||||
<pre>$ sudo find -L <i>$DIR</i> ! -user root -type d -exec chgrp root {} \;</pre>
|
||||
+
|
||||
+template:
|
||||
+ name: file_groupowner
|
||||
+ vars:
|
||||
+ filepath:
|
||||
+ - /lib/
|
||||
+ - /lib64/
|
||||
+ - /usr/lib/
|
||||
+ - /usr/lib64/
|
||||
+ recursive: 'true'
|
||||
+ filegid: '0'
|
||||
diff --git a/products/ubuntu2004/profiles/stig.profile b/products/ubuntu2004/profiles/stig.profile
|
||||
index ac96858..4c76824 100644
|
||||
--- a/products/ubuntu2004/profiles/stig.profile
|
||||
+++ b/products/ubuntu2004/profiles/stig.profile
|
||||
@@ -470,6 +470,7 @@ selections:
|
||||
# UBTU-20-010430 The Ubuntu operating system library files must be group-owned by root.
|
||||
|
||||
# UBTU-20-010431 The Ubuntu operating system library directories must be group-owned by root.
|
||||
+ - dir_group_ownership_library_dirs
|
||||
|
||||
# UBTU-20-010432 The Ubuntu operating system must be configured to preserve log records from failure events.
|
||||
- service_rsyslog_enabled
|
||||
diff --git a/shared/templates/file_groupowner/ansible.template b/shared/templates/file_groupowner/ansible.template
|
||||
index 073d356..68fc2e1 100644
|
||||
--- a/shared/templates/file_groupowner/ansible.template
|
||||
+++ b/shared/templates/file_groupowner/ansible.template
|
||||
@@ -4,33 +4,44 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
+{{% for path in FILEPATH %}}
|
||||
{{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
|
||||
-- name: Find {{{ FILEPATH }}} file(s) matching {{{ FILE_REGEX }}}
|
||||
+- name: Find {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}
|
||||
find:
|
||||
- paths: "{{{ FILEPATH }}}"
|
||||
- patterns: "{{{ FILE_REGEX }}}"
|
||||
+ paths: "{{{ path }}}"
|
||||
+ patterns: {{{ FILE_REGEX[loop.index0] }}}
|
||||
use_regex: yes
|
||||
register: files_found
|
||||
|
||||
-- name: Ensure group owner on {{{ FILEPATH }}} file(s) matching {{{ FILE_REGEX }}}
|
||||
+- name: Ensure group owner on {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
group: "{{{ FILEGID }}}"
|
||||
with_items:
|
||||
- "{{ files_found.files }}"
|
||||
|
||||
+{{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+
|
||||
+- name: Ensure group owner on {{{ path }}} recursively
|
||||
+ file:
|
||||
+ path: "{{{ path }}}"
|
||||
+ state: directory
|
||||
+ recurse: yes
|
||||
+ group: "{{{ FILEGID }}}"
|
||||
+
|
||||
{{% else %}}
|
||||
|
||||
-- name: Test for existence {{{ FILEPATH }}}
|
||||
+- name: Test for existence {{{ path }}}
|
||||
stat:
|
||||
- path: "{{{ FILEPATH }}}"
|
||||
+ path: "{{{ path }}}"
|
||||
register: file_exists
|
||||
|
||||
-- name: Ensure group owner {{{ FILEGID }}} on {{{ FILEPATH }}}
|
||||
+- name: Ensure group owner {{{ FILEGID }}} on {{{ path }}}
|
||||
file:
|
||||
- path: "{{{ FILEPATH }}}"
|
||||
+ path: "{{{ path }}}"
|
||||
group: "{{{ FILEGID }}}"
|
||||
when: file_exists.stat is defined and file_exists.stat.exists
|
||||
|
||||
{{% endif %}}
|
||||
+{{% endfor %}}
|
||||
diff --git a/shared/templates/file_groupowner/bash.template b/shared/templates/file_groupowner/bash.template
|
||||
index 442e015..982d2f3 100644
|
||||
--- a/shared/templates/file_groupowner/bash.template
|
||||
+++ b/shared/templates/file_groupowner/bash.template
|
||||
@@ -4,13 +4,17 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
+{{% for path in FILEPATH %}}
|
||||
{{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
-readarray -t files < <(find {{{ FILEPATH }}})
|
||||
+readarray -t files < <(find {{{ path }}})
|
||||
for file in "${files[@]}"; do
|
||||
- if basename $file | grep -q '{{{ FILE_REGEX }}}'; then
|
||||
+ if basename $file | grep -qE '{{{ FILE_REGEX[loop.index0] }}}'; then
|
||||
chgrp {{{ FILEGID }}} $file
|
||||
fi
|
||||
done
|
||||
+{{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+find -L {{{ path }}} -type d -exec chgrp {{{ FILEGID }}} {} \;
|
||||
{{% else %}}
|
||||
-chgrp {{{ FILEGID }}} {{{ FILEPATH }}}
|
||||
+chgrp {{{ FILEGID }}} {{{ path }}}
|
||||
{{% endif %}}
|
||||
+{{% endfor %}}
|
||||
diff --git a/shared/templates/file_groupowner/oval.template b/shared/templates/file_groupowner/oval.template
|
||||
index 1b637a6..fd2e5db 100644
|
||||
--- a/shared/templates/file_groupowner/oval.template
|
||||
+++ b/shared/templates/file_groupowner/oval.template
|
||||
@@ -1,8 +1,16 @@
|
||||
<def-group>
|
||||
<definition class="compliance" id="{{{ _RULE_ID }}}" version="1">
|
||||
+ {{% if FILEPATH is not string %}}
|
||||
+ {{{ oval_metadata("This test makes sure that FILEPATH is group owned by " + FILEGID + ".") }}}
|
||||
+ <criteria>
|
||||
+ {{% for filepath in FILEPATH %}}
|
||||
+ <criterion comment="Check file group ownership of {{{ filepath }}}" test_ref="test_file_groupowner{{{ FILEID }}}_{{{ loop.index0 }}}" />
|
||||
+ {{% endfor %}}
|
||||
+ {{% else %}}
|
||||
{{{ oval_metadata("This test makes sure that " + FILEPATH + " is group owned by " + FILEGID + ".") }}}
|
||||
<criteria>
|
||||
<criterion comment="Check file group ownership of {{{ FILEPATH }}}" test_ref="test_file_groupowner{{{ FILEID }}}" />
|
||||
+ {{% endif %}}
|
||||
</criteria>
|
||||
</definition>
|
||||
{{%- if MISSING_FILE_PASS -%}}
|
||||
@@ -12,23 +20,31 @@
|
||||
{{# All defined files must exist. When using regex, at least one file must match #}}
|
||||
{{% set FILE_EXISTENCE = "all_exist" %}}
|
||||
{{%- endif -%}}
|
||||
- <unix:file_test check="all" check_existence="{{{ FILE_EXISTENCE }}}" comment="Testing group ownership of {{{ FILEPATH }}}" id="test_file_groupowner{{{ FILEID }}}" version="1">
|
||||
- <unix:object object_ref="object_file_groupowner{{{ FILEID }}}" />
|
||||
- <unix:state state_ref="state_file_groupowner{{{ FILEID }}}_gid_{{{ FILEGID }}}" />
|
||||
+
|
||||
+
|
||||
+ {{% for filepath in FILEPATH %}}
|
||||
+ <unix:file_test check="all" check_existence="{{{ FILE_EXISTENCE }}}" comment="Testing group ownership of {{{ filepath }}}" id="test_file_groupowner{{{ FILEID }}}_{{{ loop.index0 }}}" version="1">
|
||||
+ <unix:object object_ref="object_file_groupowner{{{ FILEID }}}_{{{ loop.index0 }}}" />
|
||||
+ <unix:state state_ref="state_file_groupowner{{{ FILEID }}}_gid_{{{ FILEGID }}}_{{{ loop.index0 }}}" />
|
||||
</unix:file_test>
|
||||
- <unix:file_state id="state_file_groupowner{{{ FILEID }}}_gid_{{{ FILEGID }}}" version="1">
|
||||
+ <unix:file_state id="state_file_groupowner{{{ FILEID }}}_gid_{{{ FILEGID }}}_{{{ loop.index0 }}}" version="1">
|
||||
<unix:group_id datatype="int">{{{ FILEGID }}}</unix:group_id>
|
||||
</unix:file_state>
|
||||
- <unix:file_object comment="{{{ FILEPATH }}}" id="object_file_groupowner{{{ FILEID }}}" version="1">
|
||||
+ <unix:file_object comment="{{{ filepath }}}" id="object_file_groupowner{{{ FILEID }}}_{{{ loop.index0 }}}" version="1">
|
||||
{{%- if IS_DIRECTORY -%}}
|
||||
- <unix:path>{{{ FILEPATH }}}</unix:path>
|
||||
- {{%- if FILE_REGEX -%}}
|
||||
- <unix:filename operation="pattern match">{{{ FILE_REGEX }}}</unix:filename>
|
||||
- {{%- else -%}}
|
||||
- <unix:filename xsi:nil="true" />
|
||||
- {{%- endif -%}}
|
||||
- {{%- else -%}}
|
||||
- <unix:filepath{{% if FILEPATH_IS_REGEX %}} operation="pattern match"{{% endif %}}>{{{ FILEPATH }}}</unix:filepath>
|
||||
- {{%- endif -%}}
|
||||
+ {{%- if FILE_REGEX %}}
|
||||
+ <unix:path>{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename operation="pattern match">{{{ FILE_REGEX[loop.index0] }}}</unix:filename>
|
||||
+ {{%- elif RECURSIVE %}}
|
||||
+ <unix:path operation="pattern match">{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ {{%- else %}}
|
||||
+ <unix:path>{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ {{%- endif %}}
|
||||
+ {{%- else %}}
|
||||
+ <unix:filepath{{% if FILEPATH_IS_REGEX %}} operation="pattern match"{{% endif %}}>{{{ filepath }}}</unix:filepath>
|
||||
+ {{%- endif %}}
|
||||
</unix:file_object>
|
||||
+ {{% endfor %}}
|
||||
</def-group>
|
||||
diff --git a/shared/templates/file_groupowner/template.py b/shared/templates/file_groupowner/template.py
|
||||
index 2263ae8..10baed9 100644
|
||||
--- a/shared/templates/file_groupowner/template.py
|
||||
+++ b/shared/templates/file_groupowner/template.py
|
||||
@@ -1,12 +1,25 @@
|
||||
-from ssg.utils import parse_template_boolean_value
|
||||
+from ssg.utils import parse_template_boolean_value, check_conflict_regex_directory
|
||||
|
||||
def _file_owner_groupowner_permissions_regex(data):
|
||||
- data["is_directory"] = data["filepath"].endswith("/")
|
||||
- if "file_regex" in data and not data["is_directory"]:
|
||||
- raise ValueError(
|
||||
- "Used 'file_regex' key in rule '{0}' but filepath '{1}' does not "
|
||||
- "specify a directory. Append '/' to the filepath or remove the "
|
||||
- "'file_regex' key.".format(data["_rule_id"], data["filepath"]))
|
||||
+ # this avoids code duplicates
|
||||
+ if isinstance(data["filepath"], str):
|
||||
+ data["filepath"] = [data["filepath"]]
|
||||
+
|
||||
+ if "file_regex" in data:
|
||||
+ # we can have a list of filepaths, but only one regex
|
||||
+ # instead of declaring the same regex multiple times
|
||||
+ if isinstance(data["file_regex"], str):
|
||||
+ data["file_regex"] = [data["file_regex"]] * len(data["filepath"])
|
||||
+
|
||||
+ # if the length of filepaths and file_regex are not the same, then error.
|
||||
+ # in case we have multiple regexes for just one filepath, than we need
|
||||
+ # to declare that filepath multiple times
|
||||
+ if len(data["filepath"]) != len(data["file_regex"]):
|
||||
+ raise ValueError(
|
||||
+ "You should have one file_path per file_regex. Please check "
|
||||
+ "rule '{0}'".format(data["_rule_id"]))
|
||||
+
|
||||
+ check_conflict_regex_directory(data)
|
||||
|
||||
|
||||
def preprocess(data, lang):
|
||||
@@ -14,6 +27,10 @@ def preprocess(data, lang):
|
||||
|
||||
data["missing_file_pass"] = parse_template_boolean_value(data, parameter="missing_file_pass", default_value=False)
|
||||
|
||||
+ data["recursive"] = parse_template_boolean_value(data,
|
||||
+ parameter="recursive",
|
||||
+ default_value=False)
|
||||
+
|
||||
if lang == "oval":
|
||||
data["fileid"] = data["_rule_id"].replace("file_groupowner", "")
|
||||
return data
|
||||
diff --git a/shared/templates/file_owner/ansible.template b/shared/templates/file_owner/ansible.template
|
||||
index 6083fbe..80eaae8 100644
|
||||
--- a/shared/templates/file_owner/ansible.template
|
||||
+++ b/shared/templates/file_owner/ansible.template
|
||||
@@ -4,33 +4,44 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
+{{% for path in FILEPATH %}}
|
||||
{{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
|
||||
-- name: Find {{{ FILEPATH }}} file(s) matching {{{ FILE_REGEX }}}
|
||||
+- name: Find {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}
|
||||
find:
|
||||
- paths: "{{{ FILEPATH }}}"
|
||||
- patterns: "{{{ FILE_REGEX }}}"
|
||||
+ paths: "{{{ path }}}"
|
||||
+ patterns: {{{ FILE_REGEX[loop.index0] }}}
|
||||
use_regex: yes
|
||||
register: files_found
|
||||
|
||||
-- name: Ensure group owner on {{{ FILEPATH }}} file(s) matching {{{ FILE_REGEX }}}
|
||||
+- name: Ensure group owner on {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
owner: "{{{ FILEUID }}}"
|
||||
with_items:
|
||||
- "{{ files_found.files }}"
|
||||
|
||||
+{{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+
|
||||
+- name: Ensure owner on {{{ path }}} recursively
|
||||
+ file:
|
||||
+ paths "{{{ path }}}"
|
||||
+ state: directory
|
||||
+ recurse: yes
|
||||
+ owner: "{{{ FILEUID }}}"
|
||||
+
|
||||
{{% else %}}
|
||||
|
||||
-- name: Test for existence {{{ FILEPATH }}}
|
||||
+- name: Test for existence {{{ path }}}
|
||||
stat:
|
||||
- path: "{{{ FILEPATH }}}"
|
||||
+ path: "{{{ path }}}"
|
||||
register: file_exists
|
||||
|
||||
-- name: Ensure owner {{{ FILEUID }}} on {{{ FILEPATH }}}
|
||||
+- name: Ensure owner {{{ FILEUID }}} on {{{ path }}}
|
||||
file:
|
||||
- path: "{{{ FILEPATH }}}"
|
||||
+ path: "{{{ path }}}"
|
||||
owner: "{{{ FILEUID }}}"
|
||||
when: file_exists.stat is defined and file_exists.stat.exists
|
||||
|
||||
{{% endif %}}
|
||||
+{{% endfor %}}
|
||||
diff --git a/shared/templates/file_owner/bash.template b/shared/templates/file_owner/bash.template
|
||||
index 16025b7..27b5a2a 100644
|
||||
--- a/shared/templates/file_owner/bash.template
|
||||
+++ b/shared/templates/file_owner/bash.template
|
||||
@@ -4,13 +4,17 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
+{{% for path in FILEPATH %}}
|
||||
{{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
-readarray -t files < <(find {{{ FILEPATH }}})
|
||||
+readarray -t files < <(find {{{ path }}})
|
||||
for file in "${files[@]}"; do
|
||||
- if basename $file | grep -q '{{{ FILE_REGEX }}}'; then
|
||||
+ if basename $file | grep -qE '{{{ FILE_REGEX[loop.index0] }}}'; then
|
||||
chown {{{ FILEUID }}} $file
|
||||
fi
|
||||
done
|
||||
+{{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+find -L {{{ path }}} -type d -exec chown {{{ FILEUID }}} {} \;
|
||||
{{% else %}}
|
||||
-chown {{{ FILEUID }}} {{{ FILEPATH }}}
|
||||
+chown {{{ FILEUID }}} {{{ path }}}
|
||||
{{% endif %}}
|
||||
+{{% endfor %}}
|
||||
diff --git a/shared/templates/file_owner/oval.template b/shared/templates/file_owner/oval.template
|
||||
index 23ac161..105e29c 100644
|
||||
--- a/shared/templates/file_owner/oval.template
|
||||
+++ b/shared/templates/file_owner/oval.template
|
||||
@@ -1,8 +1,16 @@
|
||||
<def-group>
|
||||
<definition class="compliance" id="{{{ _RULE_ID }}}" version="1">
|
||||
+ {{% if FILEPATH is not string %}}
|
||||
+ {{{ oval_metadata("This test makes sure that FILEPATH is owned by " + FILEUID + ".") }}}
|
||||
+ <criteria>
|
||||
+ {{% for filepath in FILEPATH %}}
|
||||
+ <criterion comment="Check file ownership of {{{ filepath }}}" test_ref="test_file_owner{{{ FILEID }}}_{{{ loop.index0 }}}" />
|
||||
+ {{% endfor %}}
|
||||
+ {{% else %}}
|
||||
{{{ oval_metadata("This test makes sure that " + FILEPATH + " is owned by " + FILEUID + ".") }}}
|
||||
<criteria>
|
||||
<criterion comment="Check file ownership of {{{ FILEPATH }}}" test_ref="test_file_owner{{{ FILEID }}}" />
|
||||
+ {{% endif %}}
|
||||
</criteria>
|
||||
</definition>
|
||||
{{%- if MISSING_FILE_PASS -%}}
|
||||
@@ -12,23 +20,30 @@
|
||||
{{# All defined files must exist. When using regex, at least one file must match #}}
|
||||
{{% set FILE_EXISTENCE = "all_exist" %}}
|
||||
{{%- endif -%}}
|
||||
- <unix:file_test check="all" check_existence="{{{ FILE_EXISTENCE }}}" comment="Testing user ownership of {{{ FILEPATH }}}" id="test_file_owner{{{ FILEID }}}" version="1">
|
||||
- <unix:object object_ref="object_file_owner{{{ FILEID }}}" />
|
||||
- <unix:state state_ref="state_file_owner{{{ FILEID }}}_uid_{{{ FILEUID }}}" />
|
||||
+
|
||||
+ {{% for filepath in FILEPATH %}}
|
||||
+ <unix:file_test check="all" check_existence="{{{ FILE_EXISTENCE }}}" comment="Testing user ownership of {{{ filepath }}}" id="test_file_owner{{{ FILEID }}}_{{{ loop.index0 }}}" version="1">
|
||||
+ <unix:object object_ref="object_file_owner{{{ FILEID }}}_{{{ loop.index0 }}}" />
|
||||
+ <unix:state state_ref="state_file_owner{{{ FILEID }}}_uid_{{{ FILEUID }}}_{{{ loop.index0 }}}" />
|
||||
</unix:file_test>
|
||||
- <unix:file_state id="state_file_owner{{{ FILEID }}}_uid_{{{ FILEUID }}}" version="1">
|
||||
+ <unix:file_state id="state_file_owner{{{ FILEID }}}_uid_{{{ FILEUID }}}_{{{ loop.index0 }}}" version="1">
|
||||
<unix:user_id datatype="int">{{{ FILEUID }}}</unix:user_id>
|
||||
</unix:file_state>
|
||||
- <unix:file_object comment="{{{ FILEPATH }}}" id="object_file_owner{{{ FILEID }}}" version="1">
|
||||
+ <unix:file_object comment="{{{ filepath }}}" id="object_file_owner{{{ FILEID }}}_{{{ loop.index0 }}}" version="1">
|
||||
{{%- if IS_DIRECTORY -%}}
|
||||
- <unix:path>{{{ FILEPATH }}}</unix:path>
|
||||
- {{%- if FILE_REGEX -%}}
|
||||
- <unix:filename operation="pattern match">{{{ FILE_REGEX }}}</unix:filename>
|
||||
- {{%- else -%}}
|
||||
- <unix:filename xsi:nil="true" />
|
||||
- {{%- endif -%}}
|
||||
- {{%- else -%}}
|
||||
- <unix:filepath{{% if FILEPATH_IS_REGEX %}} operation="pattern match"{{% endif %}}>{{{ FILEPATH }}}</unix:filepath>
|
||||
- {{%- endif -%}}
|
||||
+ {{%- if FILE_REGEX %}}
|
||||
+ <unix:path>{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename operation="pattern match">{{{ FILE_REGEX[loop.index0] }}}</unix:filename>
|
||||
+ {{%- elif RECURSIVE %}}
|
||||
+ <unix:path operation="pattern match">{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ {{%- else %}}
|
||||
+ <unix:path>{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
+ {{%- endif %}}
|
||||
+ {{%- else %}}
|
||||
+ <unix:filepath{{% if FILEPATH_IS_REGEX %}} operation="pattern match"{{% endif %}}>{{{ filepath }}}</unix:filepath>
|
||||
+ {{%- endif %}}
|
||||
</unix:file_object>
|
||||
+ {{% endfor %}}
|
||||
</def-group>
|
||||
diff --git a/shared/templates/file_owner/template.py b/shared/templates/file_owner/template.py
|
||||
index 0dd0008..1391dcf 100644
|
||||
--- a/shared/templates/file_owner/template.py
|
||||
+++ b/shared/templates/file_owner/template.py
|
||||
@@ -1,12 +1,25 @@
|
||||
-from ssg.utils import parse_template_boolean_value
|
||||
+from ssg.utils import parse_template_boolean_value, check_conflict_regex_directory
|
||||
|
||||
def _file_owner_groupowner_permissions_regex(data):
|
||||
- data["is_directory"] = data["filepath"].endswith("/")
|
||||
- if "file_regex" in data and not data["is_directory"]:
|
||||
- raise ValueError(
|
||||
- "Used 'file_regex' key in rule '{0}' but filepath '{1}' does not "
|
||||
- "specify a directory. Append '/' to the filepath or remove the "
|
||||
- "'file_regex' key.".format(data["_rule_id"], data["filepath"]))
|
||||
+ # this avoids code duplicates
|
||||
+ if isinstance(data["filepath"], str):
|
||||
+ data["filepath"] = [data["filepath"]]
|
||||
+
|
||||
+ if "file_regex" in data:
|
||||
+ # we can have a list of filepaths, but only one regex
|
||||
+ # instead of declaring the same regex multiple times
|
||||
+ if isinstance(data["file_regex"], str):
|
||||
+ data["file_regex"] = [data["file_regex"]] * len(data["filepath"])
|
||||
+
|
||||
+ # if the length of filepaths and file_regex are not the same, then error.
|
||||
+ # in case we have multiple regexes for just one filepath, than we need
|
||||
+ # to declare that filepath multiple times
|
||||
+ if len(data["filepath"]) != len(data["file_regex"]):
|
||||
+ raise ValueError(
|
||||
+ "You should have one file_path per file_regex. Please check "
|
||||
+ "rule '{0}'".format(data["_rule_id"]))
|
||||
+
|
||||
+ check_conflict_regex_directory(data)
|
||||
|
||||
|
||||
def preprocess(data, lang):
|
||||
@@ -14,6 +27,10 @@ def preprocess(data, lang):
|
||||
|
||||
data["missing_file_pass"] = parse_template_boolean_value(data, parameter="missing_file_pass", default_value=False)
|
||||
|
||||
+ data["recursive"] = parse_template_boolean_value(data,
|
||||
+ parameter="recursive",
|
||||
+ default_value=False)
|
||||
+
|
||||
if lang == "oval":
|
||||
data["fileid"] = data["_rule_id"].replace("file_owner", "")
|
||||
return data
|
||||
diff --git a/shared/templates/file_permissions/ansible.template b/shared/templates/file_permissions/ansible.template
|
||||
index 029d03f..fc211bd 100644
|
||||
--- a/shared/templates/file_permissions/ansible.template
|
||||
+++ b/shared/templates/file_permissions/ansible.template
|
||||
@@ -3,33 +3,45 @@
|
||||
# strategy = configure
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
+
|
||||
+{{% for path in FILEPATH %}}
|
||||
{{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
|
||||
-- name: Find {{{ FILEPATH }}} file(s)
|
||||
+- name: Find {{{ path }}} file(s)
|
||||
find:
|
||||
- paths: "{{{ FILEPATH }}}"
|
||||
- patterns: "{{{ FILE_REGEX }}}"
|
||||
+ paths: "{{{ path }}}"
|
||||
+ patterns: {{{ FILE_REGEX[loop.index0] }}}
|
||||
use_regex: yes
|
||||
register: files_found
|
||||
|
||||
-- name: Set permissions for {{{ FILEPATH }}} file(s)
|
||||
+- name: Set permissions for {{{ path }}} file(s)
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
mode: "{{{ FILEMODE }}}"
|
||||
with_items:
|
||||
- "{{ files_found.files }}"
|
||||
|
||||
+{{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+
|
||||
+- name: Set permissions for {{{ path }}} recursively
|
||||
+ file:
|
||||
+ path: "{{{ path }}}"
|
||||
+ state: directory
|
||||
+ recurse: yes
|
||||
+ mode: "{{{ FILEMODE }}}"
|
||||
+
|
||||
{{% else %}}
|
||||
|
||||
-- name: Test for existence {{{ FILEPATH }}}
|
||||
+- name: Test for existence {{{ path }}}
|
||||
stat:
|
||||
- path: "{{{ FILEPATH }}}"
|
||||
+ path: "{{{ path }}}"
|
||||
register: file_exists
|
||||
|
||||
-- name: Ensure permission {{{ FILEMODE }}} on {{{ FILEPATH }}}
|
||||
+- name: Ensure permission {{{ FILEMODE }}} on {{{ path }}}
|
||||
file:
|
||||
- path: "{{{ FILEPATH }}}"
|
||||
+ path: "{{{ path }}}"
|
||||
mode: "{{{ FILEMODE }}}"
|
||||
when: file_exists.stat is defined and file_exists.stat.exists
|
||||
|
||||
{{% endif %}}
|
||||
+{{% endfor %}}
|
||||
diff --git a/shared/templates/file_permissions/bash.template b/shared/templates/file_permissions/bash.template
|
||||
index af9cf4e..e0d8fe9 100644
|
||||
--- a/shared/templates/file_permissions/bash.template
|
||||
+++ b/shared/templates/file_permissions/bash.template
|
||||
@@ -4,13 +4,17 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
+{{% for path in FILEPATH %}}
|
||||
{{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
-readarray -t files < <(find {{{ FILEPATH }}})
|
||||
+readarray -t files < <(find {{{ path }}})
|
||||
for file in "${files[@]}"; do
|
||||
- if basename $file | grep -q '{{{ FILE_REGEX }}}'; then
|
||||
+ if basename $file | grep -qE '{{{ FILE_REGEX[loop.index0] }}}'; then
|
||||
chmod {{{ FILEMODE }}} $file
|
||||
fi
|
||||
done
|
||||
+{{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+find -L {{{ path }}} -type d -exec chmod {{{ FILEMODE }}} {} \;
|
||||
{{% else %}}
|
||||
-chmod {{{ FILEMODE }}} {{{ FILEPATH }}}
|
||||
+chmod {{{ FILEMODE }}} {{{ path }}}
|
||||
{{% endif %}}
|
||||
+{{% endfor %}}
|
||||
diff --git a/shared/templates/file_permissions/oval.template b/shared/templates/file_permissions/oval.template
|
||||
index f570ff8..89083e8 100644
|
||||
--- a/shared/templates/file_permissions/oval.template
|
||||
+++ b/shared/templates/file_permissions/oval.template
|
||||
@@ -16,31 +16,47 @@
|
||||
{{%- endif -%}}
|
||||
<def-group>
|
||||
<definition class="compliance" id="{{{ _RULE_ID }}}" version="1">
|
||||
- {{{ oval_metadata("This test makes sure that " + FILEPATH + " has mode " + FILEMODE + ".
|
||||
+ {{% if FILEPATH is not string %}}
|
||||
+ {{{ oval_metadata("This test makes sure that FILEPATH has mode " + FILEMODE + ".
|
||||
+ If the target file or directory has an extended ACL, then it will fail the mode check.
|
||||
+ ") }}}
|
||||
+ <criteria>
|
||||
+ {{% for filepath in FILEPATH %}}
|
||||
+ <criterion comment="Check file mode of {{{ filepath }}}" test_ref="test_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}"{{{ ' negate="true"' if ALLOW_STRICTER_PERMISSIONS }}}/>
|
||||
+ {{% endfor %}}
|
||||
+ {{% else %}}
|
||||
+ {{{ oval_metadata("This test makes sure that " + FILEPATH + " has mode " + FILEMODE + ".
|
||||
If the target file or directory has an extended ACL, then it will fail the mode check.
|
||||
") }}}
|
||||
<criteria>
|
||||
<criterion comment="Check file mode of {{{ FILEPATH }}}" test_ref="test_file_permissions{{{ FILEID }}}"{{{ ' negate="true"' if ALLOW_STRICTER_PERMISSIONS }}}/>
|
||||
+ {{% endif %}}
|
||||
</criteria>
|
||||
</definition>
|
||||
- <unix:file_test check="all" check_existence="{{{ FILE_EXISTENCE }}}" comment="Testing mode of {{{ FILEPATH }}}" id="test_file_permissions{{{ FILEID }}}" version="2">
|
||||
- <unix:object object_ref="object_file_permissions{{{ FILEID }}}" />
|
||||
- <unix:state state_ref="state_file_permissions{{{ FILEID }}}_mode_{{{ 'not_' if ALLOW_STRICTER_PERMISSIONS }}}{{{ FILEMODE }}}" />
|
||||
- </unix:file_test>
|
||||
- <unix:file_state id="state_file_permissions{{{ FILEID }}}_mode_{{{ 'not_' if ALLOW_STRICTER_PERMISSIONS }}}{{{ FILEMODE }}}"{{{ ' operator="OR"' if ALLOW_STRICTER_PERMISSIONS }}} version="2">
|
||||
+
|
||||
+ {{% for filepath in FILEPATH %}}
|
||||
+ <unix:file_test check="all" check_existence="{{{ FILE_EXISTENCE }}}" comment="Testing mode of {{{ filepath }}}" id="test_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}" version="2">
|
||||
+ <unix:object object_ref="object_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}" />
|
||||
+ <unix:state state_ref="state_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}_mode_{{{ 'not_' if ALLOW_STRICTER_PERMISSIONS }}}{{{ FILEMODE }}}" />
|
||||
+ </unix:file_test>
|
||||
+ <unix:file_state id="state_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}_mode_{{{ 'not_' if ALLOW_STRICTER_PERMISSIONS }}}{{{ FILEMODE }}}"{{{ ' operator="OR"' if ALLOW_STRICTER_PERMISSIONS }}} version="2">
|
||||
{{{ STATEMODE | indent(6) }}}
|
||||
- </unix:file_state>
|
||||
- <unix:file_object comment="{{{ FILEPATH }}}" id="object_file_permissions{{{ FILEID }}}" version="1">
|
||||
+ </unix:file_state>
|
||||
+ <unix:file_object comment="{{{ filepath }}}" id="object_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}" version="1">
|
||||
|
||||
{{%- if IS_DIRECTORY %}}
|
||||
- <unix:path>{{{ FILEPATH }}}</unix:path>
|
||||
{{%- if FILE_REGEX %}}
|
||||
- <unix:filename operation="pattern match">{{{ FILE_REGEX }}}</unix:filename>
|
||||
+ <unix:path>{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename operation="pattern match">{{{ FILE_REGEX[loop.index0] }}}</unix:filename>
|
||||
+ {{%- elif RECURSIVE %}}
|
||||
+ <unix:path operation="pattern match">{{{ filepath[:-1] }}}</unix:path>
|
||||
+ <unix:filename xsi:nil="true" />
|
||||
{{%- else %}}
|
||||
+ <unix:path>{{{ filepath[:-1] }}}</unix:path>
|
||||
<unix:filename xsi:nil="true" />
|
||||
{{%- endif %}}
|
||||
{{%- else %}}
|
||||
- <unix:filepath{{% if FILEPATH_IS_REGEX %}} operation="pattern match"{{% endif %}}>{{{ FILEPATH }}}</unix:filepath>
|
||||
+ <unix:filepath{{% if FILEPATH_IS_REGEX %}} operation="pattern match"{{% endif %}}>{{{ filepath }}}</unix:filepath>
|
||||
{{%- endif %}}
|
||||
|
||||
{{%- if ALLOW_STRICTER_PERMISSIONS %}}
|
||||
@@ -49,8 +65,8 @@
|
||||
https://github.com/OpenSCAP/openscap/pull/1709 but this line should be kept until the
|
||||
fix is widely available. The fix is expected to be part of OpenSCAP >= 1.3.5.
|
||||
#}}
|
||||
- <filter action="include">state_file_permissions{{{ FILEID }}}_mode_not_{{{ FILEMODE }}}</filter>
|
||||
+ <filter action="include">state_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}_mode_not_{{{ FILEMODE }}}</filter>
|
||||
{{%- endif %}}
|
||||
-
|
||||
- </unix:file_object>
|
||||
+ </unix:file_object>
|
||||
+ {{% endfor %}}
|
||||
</def-group>
|
||||
diff --git a/shared/templates/file_permissions/template.py b/shared/templates/file_permissions/template.py
|
||||
index 677e083..6e20a62 100644
|
||||
--- a/shared/templates/file_permissions/template.py
|
||||
+++ b/shared/templates/file_permissions/template.py
|
||||
@@ -1,12 +1,25 @@
|
||||
-from ssg.utils import parse_template_boolean_value
|
||||
+from ssg.utils import parse_template_boolean_value, check_conflict_regex_directory
|
||||
|
||||
def _file_owner_groupowner_permissions_regex(data):
|
||||
- data["is_directory"] = data["filepath"].endswith("/")
|
||||
- if "file_regex" in data and not data["is_directory"]:
|
||||
- raise ValueError(
|
||||
- "Used 'file_regex' key in rule '{0}' but filepath '{1}' does not "
|
||||
- "specify a directory. Append '/' to the filepath or remove the "
|
||||
- "'file_regex' key.".format(data["_rule_id"], data["filepath"]))
|
||||
+ # this avoids code duplicates
|
||||
+ if isinstance(data["filepath"], str):
|
||||
+ data["filepath"] = [data["filepath"]]
|
||||
+
|
||||
+ if "file_regex" in data:
|
||||
+ # we can have a list of filepaths, but only one regex
|
||||
+ # instead of declaring the same regex multiple times
|
||||
+ if isinstance(data["file_regex"], str):
|
||||
+ data["file_regex"] = [data["file_regex"]] * len(data["filepath"])
|
||||
+
|
||||
+ # if the length of filepaths and file_regex are not the same, then error.
|
||||
+ # in case we have multiple regexes for just one filepath, than we need
|
||||
+ # to declare that filepath multiple times
|
||||
+ if len(data["filepath"]) != len(data["file_regex"]):
|
||||
+ raise ValueError(
|
||||
+ "You should have one file_path per file_regex. Please check "
|
||||
+ "rule '{0}'".format(data["_rule_id"]))
|
||||
+
|
||||
+ check_conflict_regex_directory(data)
|
||||
|
||||
|
||||
def preprocess(data, lang):
|
||||
@@ -16,6 +29,10 @@ def preprocess(data, lang):
|
||||
|
||||
data["missing_file_pass"] = parse_template_boolean_value(data, parameter="missing_file_pass", default_value=False)
|
||||
|
||||
+ data["recursive"] = parse_template_boolean_value(data,
|
||||
+ parameter="recursive",
|
||||
+ default_value=False)
|
||||
+
|
||||
if lang == "oval":
|
||||
data["fileid"] = data["_rule_id"].replace("file_permissions", "")
|
||||
# build the state that describes our mode
|
||||
diff --git a/ssg/utils.py b/ssg/utils.py
|
||||
index b0ded09..2248b1e 100644
|
||||
--- a/ssg/utils.py
|
||||
+++ b/ssg/utils.py
|
||||
@@ -303,3 +303,25 @@ def parse_template_boolean_value(data, parameter, default_value):
|
||||
raise ValueError(
|
||||
"Template parameter {} used in rule {} cannot accept the "
|
||||
"value {}".format(parameter, data["_rule_id"], value))
|
||||
+
|
||||
+
|
||||
+def check_conflict_regex_directory(data):
|
||||
+ """
|
||||
+ Validate that either all path are directories OR file_regex exists.
|
||||
+
|
||||
+ Throws ValueError.
|
||||
+ """
|
||||
+ for f in data["filepath"]:
|
||||
+ if "is_directory" in data and data["is_directory"] != f.endswith("/"):
|
||||
+ raise ValueError(
|
||||
+ "If passing a list of filepaths, all of them need to be "
|
||||
+ "either directories or files. Mixing is not possible. "
|
||||
+ "Please fix rules '{0}' filepath '{1}'".format(data["_rule_id"], f))
|
||||
+
|
||||
+ data["is_directory"] = f.endswith("/")
|
||||
+
|
||||
+ if "file_regex" in data and not data["is_directory"]:
|
||||
+ raise ValueError(
|
||||
+ "Used 'file_regex' key in rule '{0}' but filepath '{1}' does not "
|
||||
+ "specify a directory. Append '/' to the filepath or remove the "
|
||||
+ "'file_regex' key.".format(data["_rule_id"], f))
|
@ -1,245 +0,0 @@
|
||||
From b8fd95776ce894006163b2bb5e34682e5844ca1e Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 21 Oct 2021 14:43:51 -0500
|
||||
Subject: [PATCH 1/5] Always esacpe parameter in ansible_set_config_file
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 5 +++--
|
||||
.../ansible/shared.yml | 5 +++--
|
||||
.../ansible/shared.yml | 5 +++--
|
||||
shared/macros-ansible.jinja | 17 ++++++++++-------
|
||||
4 files changed, 19 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml
|
||||
index 637f90003b2..ca5a405f877 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdriverauthmode/ansible/shared.yml
|
||||
@@ -5,5 +5,6 @@
|
||||
# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file_dir(msg, "/etc/rsyslog.conf", "/etc/rsyslog.d", "/etc/rsyslog.conf",
|
||||
- "$ActionSendStreamDriverAuthMode", separator=' ', separator_regex='\s',
|
||||
- value="x509/name", create='yes') }}}
|
||||
+ "$ActionSendStreamDriverAuthMode", separator=' ', separator_regex='\s',
|
||||
+ value="x509/name", create='yes')
|
||||
+}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
index 5d11103fc0f..1f001f47e07 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_actionsendstreamdrivermode/ansible/shared.yml
|
||||
@@ -4,6 +4,7 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
-{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
- parameter="$ActionSendStreamDriverMode", value="1", create=true, separator=" ", separator_regex=" ")
|
||||
+{{{ ansible_set_config_file_dir(msg, "/etc/rsyslog.conf", "/etc/rsyslog.d", "/etc/rsyslog.conf",
|
||||
+ parameter="$ActionSendStreamDriverMode", value="1", create=true, separator=" ",
|
||||
+ separator_regex=" ")
|
||||
}}}
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
index 035ab152876..4016a08721e 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
@@ -4,6 +4,7 @@
|
||||
# complexity = low
|
||||
# disruption = low
|
||||
|
||||
-{{{ ansible_set_config_file(file="/etc/rsyslog.d/encrypt.conf",
|
||||
- parameter="$DefaultNetstreamDriver", value="gtls", create=true, separator=" ", separator_regex=" ")
|
||||
+{{{ ansible_set_config_file_dir(msg, "/etc/rsyslog.conf", "/etc/rsyslog.d", "/etc/rsyslog.conf",
|
||||
+ parameter="$DefaultNetstreamDriver", value="gtls", create=true, separator=" "
|
||||
+ , separator_regex=" ")
|
||||
}}}
|
||||
diff --git a/shared/macros-ansible.jinja b/shared/macros-ansible.jinja
|
||||
index 563350743fe..0f8dba56dab 100644
|
||||
--- a/shared/macros-ansible.jinja
|
||||
+++ b/shared/macros-ansible.jinja
|
||||
@@ -25,14 +25,17 @@ value: "Setting={{ varname1 }}"
|
||||
|
||||
Note that all string-like parameters are single quoted in the YAML.
|
||||
#}}
|
||||
-{{%- macro ansible_lineinfile(msg='', path='', regex='', new_line='', create='no', state='present', with_items='', register='', when='', validate='', insert_after='', insert_before='', check_mode=False) -%}}
|
||||
+{{%- macro ansible_lineinfile(msg='', path='', regex='', new_line='', create='no', state='present', with_items='', register='', when='', validate='', insert_after='', insert_before='', check_mode=False, escape_regex=False) -%}}
|
||||
- name: "{{{ msg or rule_title }}}"
|
||||
lineinfile:
|
||||
path: '{{{ path }}}'
|
||||
create: {{{ create }}}
|
||||
- {{%- if regex %}}
|
||||
+ {{%- if regex and not escape_regex %}}
|
||||
regexp: '{{{ regex }}}'
|
||||
{{%- endif %}}
|
||||
+ {{%- if regex and escape_regex %}}
|
||||
+ regexp: '{{ {{{ regex }}} | regex_escape }}'
|
||||
+ {{%- endif %}}
|
||||
{{%- if state == 'present' %}}
|
||||
line: '{{{ new_line }}}'
|
||||
state: present
|
||||
@@ -121,7 +124,7 @@ value: "Setting={{ varname1 }}"
|
||||
ini configuration files are best served with the ini Ansible module
|
||||
instead of lineinfile-based solutions.
|
||||
#}}
|
||||
-{{%- macro ansible_set_config_file(msg, file, parameter, separator=' ', separator_regex='\s+', value='', prefix_regex='^\s*', create='no', validate='', insert_after='', insert_before='') %}}
|
||||
+{{%- macro ansible_set_config_file(msg, file, parameter, separator=' ', separator_regex='\s+', value='', prefix_regex='^\s*', create='no', validate='', insert_after='', insert_before='', escape_regex=False) %}}
|
||||
{{{ ansible_only_lineinfile(msg, file, prefix_regex + parameter + separator_regex, parameter + separator + value, create=create, block=True, validate=validate, insert_after=insert_after, insert_before=insert_before) }}}
|
||||
{{%- endmacro %}}
|
||||
|
||||
@@ -143,12 +146,12 @@ value: "Setting={{ varname1 }}"
|
||||
{{%- set new_line = parameter + separator + value -%}}
|
||||
- name: '{{{ msg or rule_title }}}'
|
||||
block:
|
||||
- {{{ ansible_lineinfile("Check for duplicate values", config_file, regex=line_regex, create='no', state='absent', register='dupes', check_mode=True)|indent }}}
|
||||
- {{{ ansible_lineinfile("Deduplicate values from " + config_file, config_file, regex=line_regex, create='no', state='absent', when='dupes.found is defined and dupes.found > 1')|indent }}}
|
||||
+ {{{ ansible_lineinfile("Check for duplicate values", config_file, regex=line_regex, create='no', state='absent', register='dupes', check_mode=True, escape_regex=True)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Deduplicate values from " + config_file, config_file, regex=line_regex, create='no', state='absent', when='dupes.found is defined and dupes.found > 1', escape_regex=True)|indent }}}
|
||||
{{{ ansible_stat("Check if " + config_dir + " exists", path=config_dir, register=dir_exists)|indent }}}
|
||||
{{{ ansible_find("Check if the parameter " + parameter + " is present in " + config_dir, paths=config_dir, contains=line_regex, register=dir_parameter, when=find_when)|indent }}}
|
||||
- {{{ ansible_lineinfile("Remove parameter from files in " + config_dir, path="{{ item.path }}", regex=line_regex, state="absent", with_items=lineinfile_items, when=lineinfile_when)|indent }}}
|
||||
- {{{ ansible_lineinfile("Insert correct line to " + set_file, set_file, regex=line_regex, new_line=new_line, create=create, state='present', validate=validate, insert_after=insert_after, insert_before=insert_before)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Remove parameter from files in " + config_dir, path="{{ item.path }}", regex=line_regex, state="absent", with_items=lineinfile_items, when=lineinfile_when, escape_regex=True)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Insert correct line to " + set_file, set_file, regex=line_regex, new_line=new_line, create=create, state='present', validate=validate, insert_after=insert_after, insert_before=insert_before, escape_regex=True)|indent }}}
|
||||
{{%- endmacro %}}
|
||||
|
||||
{{#
|
||||
|
||||
From 5635bf94c9274511e3d63feb8d4082c4ec9144f3 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Tue, 26 Oct 2021 13:01:27 -0500
|
||||
Subject: [PATCH 2/5] Fix a couple items from reviewers on ansible_lineinfile
|
||||
escaping
|
||||
|
||||
---
|
||||
.../ansible/shared.yml | 4 ++--
|
||||
shared/macros-ansible.jinja | 3 +--
|
||||
2 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
index 4016a08721e..3cc18d4476e 100644
|
||||
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_encrypt_offload_defaultnetstreamdriver/ansible/shared.yml
|
||||
@@ -5,6 +5,6 @@
|
||||
# disruption = low
|
||||
|
||||
{{{ ansible_set_config_file_dir(msg, "/etc/rsyslog.conf", "/etc/rsyslog.d", "/etc/rsyslog.conf",
|
||||
- parameter="$DefaultNetstreamDriver", value="gtls", create=true, separator=" "
|
||||
- , separator_regex=" ")
|
||||
+ parameter="$DefaultNetstreamDriver", value="gtls", create=true,
|
||||
+ separator=" ", separator_regex=" ")
|
||||
}}}
|
||||
diff --git a/shared/macros-ansible.jinja b/shared/macros-ansible.jinja
|
||||
index 0f8dba56dab..752d220bbfc 100644
|
||||
--- a/shared/macros-ansible.jinja
|
||||
+++ b/shared/macros-ansible.jinja
|
||||
@@ -32,8 +32,7 @@ value: "Setting={{ varname1 }}"
|
||||
create: {{{ create }}}
|
||||
{{%- if regex and not escape_regex %}}
|
||||
regexp: '{{{ regex }}}'
|
||||
- {{%- endif %}}
|
||||
- {{%- if regex and escape_regex %}}
|
||||
+ {{%- elif regex and escape_regex %}}
|
||||
regexp: '{{ {{{ regex }}} | regex_escape }}'
|
||||
{{%- endif %}}
|
||||
{{%- if state == 'present' %}}
|
||||
|
||||
From f6541126a4d19bfef8752028467659ab9d9f74ed Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Tue, 2 Nov 2021 08:32:18 -0500
|
||||
Subject: [PATCH 3/5] Fix escaping in ansible_lineinfile macro
|
||||
|
||||
---
|
||||
shared/macros-ansible.jinja | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/shared/macros-ansible.jinja b/shared/macros-ansible.jinja
|
||||
index 752d220bbfc..1e0ba6260bb 100644
|
||||
--- a/shared/macros-ansible.jinja
|
||||
+++ b/shared/macros-ansible.jinja
|
||||
@@ -33,7 +33,7 @@ value: "Setting={{ varname1 }}"
|
||||
{{%- if regex and not escape_regex %}}
|
||||
regexp: '{{{ regex }}}'
|
||||
{{%- elif regex and escape_regex %}}
|
||||
- regexp: '{{ {{{ regex }}} | regex_escape }}'
|
||||
+ regexp: {{{ regex }}} | regex_escape
|
||||
{{%- endif %}}
|
||||
{{%- if state == 'present' %}}
|
||||
line: '{{{ new_line }}}'
|
||||
|
||||
From ef6d300a707dc272eaa9442ece135009287bfdf5 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 3 Nov 2021 11:15:11 -0500
|
||||
Subject: [PATCH 4/5] Move regex_escape to ansible_set_config_file_dir
|
||||
|
||||
---
|
||||
shared/macros-ansible.jinja | 16 +++++++---------
|
||||
1 file changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/shared/macros-ansible.jinja b/shared/macros-ansible.jinja
|
||||
index 1e0ba6260bb..8e7ce1a1206 100644
|
||||
--- a/shared/macros-ansible.jinja
|
||||
+++ b/shared/macros-ansible.jinja
|
||||
@@ -25,15 +25,13 @@ value: "Setting={{ varname1 }}"
|
||||
|
||||
Note that all string-like parameters are single quoted in the YAML.
|
||||
#}}
|
||||
-{{%- macro ansible_lineinfile(msg='', path='', regex='', new_line='', create='no', state='present', with_items='', register='', when='', validate='', insert_after='', insert_before='', check_mode=False, escape_regex=False) -%}}
|
||||
+{{%- macro ansible_lineinfile(msg='', path='', regex='', new_line='', create='no', state='present', with_items='', register='', when='', validate='', insert_after='', insert_before='', check_mode=False) -%}}
|
||||
- name: "{{{ msg or rule_title }}}"
|
||||
lineinfile:
|
||||
path: '{{{ path }}}'
|
||||
create: {{{ create }}}
|
||||
- {{%- if regex and not escape_regex %}}
|
||||
+ {{%- if regex %}}
|
||||
regexp: '{{{ regex }}}'
|
||||
- {{%- elif regex and escape_regex %}}
|
||||
- regexp: {{{ regex }}} | regex_escape
|
||||
{{%- endif %}}
|
||||
{{%- if state == 'present' %}}
|
||||
line: '{{{ new_line }}}'
|
||||
@@ -138,19 +136,19 @@ value: "Setting={{ varname1 }}"
|
||||
{{%- set var_dir = config_dir | replace("/", "_") | replace("-", "_") | replace(".", "_") -%}}
|
||||
{{%- set dir_exists = var_dir + "_exists" -%}}
|
||||
{{%- set dir_parameter = var_dir + "_has_parameter" -%}}
|
||||
-{{%- set line_regex = prefix_regex + parameter + separator_regex -%}}
|
||||
+{{%- set line_regex = prefix_regex + "{{\"" + parameter + "\"| regex_escape }}" + separator_regex -%}}
|
||||
{{%- set find_when = dir_exists + ".stat.isdir is defined and " + dir_exists + ".stat.isdir" -%}}
|
||||
{{%- set lineinfile_items = "{{ " + dir_parameter + ".files }}" -%}}
|
||||
{{%- set lineinfile_when = dir_parameter + ".matched" -%}}
|
||||
{{%- set new_line = parameter + separator + value -%}}
|
||||
- name: '{{{ msg or rule_title }}}'
|
||||
block:
|
||||
- {{{ ansible_lineinfile("Check for duplicate values", config_file, regex=line_regex, create='no', state='absent', register='dupes', check_mode=True, escape_regex=True)|indent }}}
|
||||
- {{{ ansible_lineinfile("Deduplicate values from " + config_file, config_file, regex=line_regex, create='no', state='absent', when='dupes.found is defined and dupes.found > 1', escape_regex=True)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Check for duplicate values", config_file, regex=line_regex, create='no', state='absent', register='dupes', check_mode=True)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Deduplicate values from " + config_file, config_file, regex=line_regex, create='no', state='absent', when='dupes.found is defined and dupes.found > 1')|indent }}}
|
||||
{{{ ansible_stat("Check if " + config_dir + " exists", path=config_dir, register=dir_exists)|indent }}}
|
||||
{{{ ansible_find("Check if the parameter " + parameter + " is present in " + config_dir, paths=config_dir, contains=line_regex, register=dir_parameter, when=find_when)|indent }}}
|
||||
- {{{ ansible_lineinfile("Remove parameter from files in " + config_dir, path="{{ item.path }}", regex=line_regex, state="absent", with_items=lineinfile_items, when=lineinfile_when, escape_regex=True)|indent }}}
|
||||
- {{{ ansible_lineinfile("Insert correct line to " + set_file, set_file, regex=line_regex, new_line=new_line, create=create, state='present', validate=validate, insert_after=insert_after, insert_before=insert_before, escape_regex=True)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Remove parameter from files in " + config_dir, path="{{ item.path }}", regex=line_regex, state="absent", with_items=lineinfile_items, when=lineinfile_when)|indent }}}
|
||||
+ {{{ ansible_lineinfile("Insert correct line to " + set_file, set_file, regex=line_regex, new_line=new_line, create=create, state='present', validate=validate, insert_after=insert_after, insert_before=insert_before)|indent }}}
|
||||
{{%- endmacro %}}
|
||||
|
||||
{{#
|
||||
|
||||
From c29550ef26fc283ce5e72038fddf70aa716f4d1c Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Thu, 4 Nov 2021 08:53:42 -0500
|
||||
Subject: [PATCH 5/5] Fix ansible-lint lint issues
|
||||
|
||||
---
|
||||
shared/macros-ansible.jinja | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/shared/macros-ansible.jinja b/shared/macros-ansible.jinja
|
||||
index 8e7ce1a1206..76f05e76b88 100644
|
||||
--- a/shared/macros-ansible.jinja
|
||||
+++ b/shared/macros-ansible.jinja
|
||||
@@ -136,7 +136,7 @@ value: "Setting={{ varname1 }}"
|
||||
{{%- set var_dir = config_dir | replace("/", "_") | replace("-", "_") | replace(".", "_") -%}}
|
||||
{{%- set dir_exists = var_dir + "_exists" -%}}
|
||||
{{%- set dir_parameter = var_dir + "_has_parameter" -%}}
|
||||
-{{%- set line_regex = prefix_regex + "{{\"" + parameter + "\"| regex_escape }}" + separator_regex -%}}
|
||||
+{{%- set line_regex = prefix_regex + "{{ \"" + parameter + "\"| regex_escape }}" + separator_regex -%}}
|
||||
{{%- set find_when = dir_exists + ".stat.isdir is defined and " + dir_exists + ".stat.isdir" -%}}
|
||||
{{%- set lineinfile_items = "{{ " + dir_parameter + ".files }}" -%}}
|
||||
{{%- set lineinfile_when = dir_parameter + ".matched" -%}}
|
@ -1,71 +0,0 @@
|
||||
From a5cce64337e8b8617f3bf3ee1311e80d652754ea Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu, 14 Oct 2021 12:12:16 +0200
|
||||
Subject: [PATCH] Set sshd priv keys permissions 600 for all products.
|
||||
|
||||
---
|
||||
.../file_permissions_sshd_private_key/rule.yml | 15 +++------------
|
||||
.../tests/correct_value.pass.sh | 8 +-------
|
||||
.../tests/multiple_keys.fail.sh | 2 +-
|
||||
4 files changed, 7 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/services/ssh/file_permissions_sshd_private_key/rule.yml b/linux_os/guide/services/ssh/file_permissions_sshd_private_key/rule.yml
|
||||
index bda7ae4d53b..ddda4075e21 100644
|
||||
--- a/linux_os/guide/services/ssh/file_permissions_sshd_private_key/rule.yml
|
||||
+++ b/linux_os/guide/services/ssh/file_permissions_sshd_private_key/rule.yml
|
||||
@@ -3,11 +3,7 @@ documentation_complete: true
|
||||
title: 'Verify Permissions on SSH Server Private *_key Key Files'
|
||||
|
||||
description: |-
|
||||
- {{% if product in ['ubuntu1804','opensuse', 'sle12', 'sle15'] %}}
|
||||
{{{ describe_file_permissions(file="/etc/ssh/*_key", perms="0600") }}}
|
||||
- {{% else %}}
|
||||
- {{{ describe_file_permissions(file="/etc/ssh/*_key", perms="0640") }}}
|
||||
- {{% endif %}}
|
||||
|
||||
rationale: |-
|
||||
If an unauthorized user obtains the private SSH host key file, the host could be
|
||||
@@ -45,10 +41,10 @@ references:
|
||||
stigid@sle12: SLES-12-030220
|
||||
stigid@sle15: SLES-15-040250
|
||||
|
||||
-ocil_clause: '{{{ ocil_clause_file_permissions(file="/etc/ssh/*_key", perms="-rw-r-----") }}}'
|
||||
+ocil_clause: '{{{ ocil_clause_file_permissions(file="/etc/ssh/*_key", perms="-rw-------") }}}'
|
||||
|
||||
ocil: |-
|
||||
- {{{ ocil_file_permissions(file="/etc/ssh/*_key", perms="-rw-r-----") }}}
|
||||
+ {{{ ocil_file_permissions(file="/etc/ssh/*_key", perms="-rw-------") }}}
|
||||
|
||||
template:
|
||||
name: file_permissions
|
||||
@@ -56,9 +52,4 @@ template:
|
||||
filepath: /etc/ssh/
|
||||
missing_file_pass: 'true'
|
||||
file_regex: ^.*_key$
|
||||
- filemode: '0640'
|
||||
- filemode@sle12: '0600'
|
||||
- filemode@sle15: '0600'
|
||||
- filemode@ubuntu1604: '0600'
|
||||
- filemode@ubuntu1804: '0600'
|
||||
- filemode@ubuntu2004: '0600'
|
||||
+ filemode: '0600'
|
||||
diff --git a/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/correct_value.pass.sh b/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/correct_value.pass.sh
|
||||
index 5790a48..f7cf8d9 100644
|
||||
--- a/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/correct_value.pass.sh
|
||||
+++ b/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/correct_value.pass.sh
|
||||
@@ -2,4 +2,4 @@
|
||||
#
|
||||
|
||||
FAKE_KEY=$(mktemp -p /etc/ssh/ XXXX_key)
|
||||
-chmod 0640 /etc/ssh/*_key
|
||||
+chmod 0600 /etc/ssh/*_key
|
||||
diff --git a/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/multiple_keys.fail.sh b/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/multiple_keys.fail.sh
|
||||
index 6df9d61b715..7c0d6019702 100644
|
||||
--- a/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/multiple_keys.fail.sh
|
||||
+++ b/linux_os/guide/services/ssh/file_permissions_sshd_private_key/tests/multiple_keys.fail.sh
|
||||
@@ -4,4 +4,4 @@
|
||||
FAKE_KEY=$(mktemp -p /etc/ssh/ XXXX_key)
|
||||
chmod 0777 $FAKE_KEY
|
||||
FAKE_KEY2=$(mktemp -p /etc/ssh/ XXXX_key)
|
||||
-chmod 0640 $FAKE_KEY2
|
||||
+chmod 0600 $FAKE_KEY2
|
@ -1,195 +0,0 @@
|
||||
From bac8ca5091aa74eab66691fcb7a6ac0c944de9c6 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Wed, 23 Mar 2022 17:50:18 +0100
|
||||
Subject: [PATCH] Manually edited patch
|
||||
scap-security-guide-0.1.60-address_pool_directives_maxpoll_rule-PR_7910.patch.
|
||||
|
||||
---
|
||||
.../chronyd_or_ntpd_set_maxpoll/ansible/shared.yml | 6 +++---
|
||||
.../ntp/chronyd_or_ntpd_set_maxpoll/bash/shared.sh | 6 +++---
|
||||
.../chronyd_or_ntpd_set_maxpoll/oval/shared.xml | 4 ++--
|
||||
.../ntp/chronyd_or_ntpd_set_maxpoll/rule.yml | 4 +++-
|
||||
.../tests/chrony.pass.sh | 3 +++
|
||||
.../tests/chrony_one_pool_configured.pass.sh | 14 ++++++++++++++
|
||||
.../tests/chrony_one_pool_misconfigured.fail.sh | 14 ++++++++++++++
|
||||
.../chrony_one_pool_missing_parameter.fail.sh | 14 ++++++++++++++
|
||||
.../tests/chrony_one_server_misconfigured.fail.sh | 3 +++
|
||||
9 files changed, 59 insertions(+), 9 deletions(-)
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_configured.pass.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_misconfigured.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_missing_parameter.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/ansible/shared.yml b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/ansible/shared.yml
|
||||
index 3c83850..da0a622 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/ansible/shared.yml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/ansible/shared.yml
|
||||
@@ -1,4 +1,4 @@
|
||||
-# platform = multi_platform_sle
|
||||
+# platform = multi_platform_sle,multi_platform_rhel
|
||||
# reboot = false
|
||||
# strategy = restrict
|
||||
# complexity = low
|
||||
@@ -27,7 +27,7 @@
|
||||
- name: Update the maxpoll values in /etc/chrony.conf
|
||||
lineinfile:
|
||||
path: /etc/chrony.conf
|
||||
- regex: '^(server.*maxpoll) [0-9]+(\s+.*)$'
|
||||
+ regex: '^((?:server|pool).*maxpoll) [0-9]+(\s+.*)$'
|
||||
line: '\1 {{ var_time_service_set_maxpoll }}\2'
|
||||
backrefs: yes
|
||||
when: chrony_conf_exist_result.stat.exists
|
||||
@@ -43,7 +43,7 @@
|
||||
- name: Set the maxpoll values in /etc/chrony.conf
|
||||
lineinfile:
|
||||
path: /etc/chrony.conf
|
||||
- regex: '(^server\s+((?!maxpoll).)*)$'
|
||||
+ regex: '(^(?:server|pool)\s+((?!maxpoll).)*)$'
|
||||
line: '\1 maxpoll {{ var_time_service_set_maxpoll }}\n'
|
||||
backrefs: yes
|
||||
when: chrony_conf_exist_result.stat.exists
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/bash/shared.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/bash/shared.sh
|
||||
index b23deff..54b1b73 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/bash/shared.sh
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/bash/shared.sh
|
||||
@@ -8,9 +8,9 @@ config_file="/etc/ntp.conf"
|
||||
|
||||
|
||||
# Set maxpoll values to var_time_service_set_maxpoll
|
||||
-sed -i "s/^\(server.*maxpoll\) [0-9][0-9]*\(.*\)$/\1 $var_time_service_set_maxpoll \2/" "$config_file"
|
||||
+sed -i "s/^\(\(server\|pool\).*maxpoll\) [0-9][0-9]*\(.*\)$/\1 $var_time_service_set_maxpoll \3/" "$config_file"
|
||||
|
||||
-# Add maxpoll to server entries without maxpoll
|
||||
-grep "^server" "$config_file" | grep -v maxpoll | while read -r line ; do
|
||||
+# Add maxpoll to server or pool entries without maxpoll
|
||||
+grep "^\(server\|pool\)" "$config_file" | grep -v maxpoll | while read -r line ; do
|
||||
sed -i "s/$line/& maxpoll $var_time_service_set_maxpoll/" "$config_file"
|
||||
done
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml
|
||||
index 25a8589..76f8101 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml
|
||||
@@ -46,7 +46,7 @@
|
||||
</ind:textfilecontent54_test>
|
||||
<ind:textfilecontent54_object id="obj_chrony_set_maxpoll" version="1">
|
||||
<ind:filepath operation="pattern match">^/etc/chrony\.(conf|d/.+\.conf)$</ind:filepath>
|
||||
- <ind:pattern operation="pattern match">^server[\s]+[\S]+.*maxpoll[\s]+(\d+)</ind:pattern>
|
||||
+ <ind:pattern operation="pattern match">^(?:server|pool)[\s]+[\S]+.*maxpoll[\s]+(\d+)</ind:pattern>
|
||||
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</ind:textfilecontent54_test>
|
||||
<ind:textfilecontent54_object id="obj_chrony_all_server_has_maxpoll" version="1">
|
||||
<ind:filepath operation="pattern match">^/etc/chrony\.(conf|d/.+\.conf)$</ind:filepath>
|
||||
- <ind:pattern operation="pattern match">^server[\s]+[\S]+[\s]+(.*)</ind:pattern>
|
||||
+ <ind:pattern operation="pattern match">^(?:server|pool)[\s]+[\S]+[\s]+(.*)</ind:pattern>
|
||||
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml
|
||||
index 77af724..bd5150b 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml
|
||||
@@ -9,8 +9,10 @@ description: |-
|
||||
{{{ xccdf_value("var_time_service_set_maxpoll") }}} in <tt>/etc/ntp.conf</tt> or
|
||||
<tt>/etc/chrony.conf</tt> to continuously poll time servers. To configure
|
||||
<tt>maxpoll</tt> in <tt>/etc/ntp.conf</tt> or <tt>/etc/chrony.conf</tt>
|
||||
- add the following:
|
||||
+ add the following after each `server` or `pool` entry:
|
||||
<pre>maxpoll {{{ xccdf_value("var_time_service_set_maxpoll") }}}</pre>
|
||||
+ to <pre>server</pre> directives. If using chrony any <pre>pool</pre> directives
|
||||
+ should be configured too.
|
||||
If no <tt>server</tt> or <tt>pool</tt> directives are configured, the rule evaluates
|
||||
to pass.
|
||||
{{% if product == "rhcos4" %}}
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony.pass.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony.pass.sh
|
||||
index 38f5031..60dfc29 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony.pass.sh
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony.pass.sh
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
yum remove -y ntp
|
||||
|
||||
+# Remove all pool options
|
||||
+sed -i "/^pool.*/d" /etc/chrony.conf
|
||||
+
|
||||
if ! grep "^server" /etc/chrony.conf ; then
|
||||
echo "server foo.example.net iburst maxpoll 10" >> /etc/chrony.conf
|
||||
elif ! grep "^server.*maxpoll 10" /etc/chrony.conf; then
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_configured.pass.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_configured.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..6cbeb0e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_configured.pass.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# packages = chrony
|
||||
+#
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+yum remove -y ntp
|
||||
+
|
||||
+# Remove all server or pool options
|
||||
+sed -i "/^\(server\|pool\).*/d" /etc/chrony.conf
|
||||
+
|
||||
+echo "pool pool.ntp.org iburst maxpoll 16" >> /etc/chrony.conf
|
||||
+
|
||||
+systemctl enable chronyd.service
|
||||
+
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_misconfigured.fail.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_misconfigured.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..12f2cda
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_misconfigured.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# packages = chrony
|
||||
+#
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+yum remove -y ntp
|
||||
+
|
||||
+# Remove all server or pool options
|
||||
+sed -i "/^\(server\|pool\).*/d" /etc/chrony.conf
|
||||
+
|
||||
+echo "pool pool.ntp.org iburst maxpoll 18" >> /etc/chrony.conf
|
||||
+
|
||||
+systemctl enable chronyd.service
|
||||
+
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_missing_parameter.fail.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_missing_parameter.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..1ef4798
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_pool_missing_parameter.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# packages = chrony
|
||||
+#
|
||||
+# profiles = xccdf_org.ssgproject.content_profile_stig
|
||||
+
|
||||
+yum remove -y ntp
|
||||
+
|
||||
+# Remove all server options
|
||||
+sed -i "/^\(server\|pool\).*/d" /etc/chrony.conf
|
||||
+
|
||||
+echo "pool pool.ntp.org iburst" >> /etc/chrony.conf
|
||||
+
|
||||
+systemctl enable chronyd.service
|
||||
+
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_server_misconfigured.fail.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_server_misconfigured.fail.sh
|
||||
index 0fc7840..6f86faf 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_server_misconfigured.fail.sh
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_one_server_misconfigured.fail.sh
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
yum remove -y ntp
|
||||
|
||||
+# Remove all pool options
|
||||
+sed -i "/^pool.*/d" /etc/chrony.conf
|
||||
+
|
||||
if ! grep "^server.*maxpoll 10" /etc/chrony.conf; then
|
||||
sed -i "s/^server.*/& maxpoll 10/" /etc/chrony.conf
|
||||
fi
|
||||
--
|
||||
2.34.1
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,324 +0,0 @@
|
||||
commit 2e1eeff365be8fde302620fae6691ccc523f6f9e
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 18:19:45 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.60-rhel9_stig_grub-PR_7931.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/oval/shared.xml b/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/oval/shared.xml
|
||||
index c95f1d4..9035eee 100644
|
||||
--- a/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/oval/shared.xml
|
||||
@@ -29,11 +29,34 @@
|
||||
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
-<ind:textfilecontent54_test id="test_trust_cpu_rng_boot_param_off"
|
||||
- comment="check forkernel command line parameters random.trust_cpu=off in {{{ grub2_boot_path }}}/grubenv for all kernels"
|
||||
- check="all" check_existence="all_exist" version="1">
|
||||
- <ind:object object_ref="object_trust_cpu_rng_boot_param" />
|
||||
- <ind:state state_ref="state_trust_cpu_rng_boot_param_off" />
|
||||
+ {{% if product in ['rhel9'] %}}
|
||||
+ <ind:textfilecontent54_test id="test_trust_cpu_rng_boot_param_off"
|
||||
+ comment="check kernel command line parameters for the argument for all boot entries."
|
||||
+ check="all" check_existence="all_exist" version="1">
|
||||
+ <ind:object object_ref="obj_grub2_kernel_trust_cpu_rng_entries"/>
|
||||
+ <ind:state state_ref="state_trust_cpu_rng_boot_param_off"/>
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_test id="test_trust_cpu_rng_boot_param_on"
|
||||
+ comment="check kernel command line parameters for the argument for all boot entries."
|
||||
+ check="all" check_existence="all_exist" version="1">
|
||||
+ <ind:object object_ref="obj_grub2_kernel_trust_cpu_rng_entries"/>
|
||||
+ <ind:state state_ref="state_trust_cpu_rng_boot_param_on"/>
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_grub2_kernel_trust_cpu_rng_entries" version="1">
|
||||
+ <ind:path>/boot/loader/entries/</ind:path>
|
||||
+ <ind:filename operation="pattern match">^.*\.conf$</ind:filename>
|
||||
+ <ind:pattern operation="pattern match">^options (.*)$</ind:pattern>
|
||||
+ <ind:instance datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+ {{% else %}}
|
||||
+
|
||||
+ <ind:textfilecontent54_test id="test_trust_cpu_rng_boot_param_off"
|
||||
+ comment="check for kernel command line parameters random.trust_cpu=off in {{{ grub2_boot_path }}}/grubenv for all kernels"
|
||||
+ check="all" check_existence="all_exist" version="1">
|
||||
+ <ind:object object_ref="object_trust_cpu_rng_boot_param"/>
|
||||
+ <ind:state state_ref="state_trust_cpu_rng_boot_param_off"/>
|
||||
</ind:textfilecontent54_test>
|
||||
|
||||
|
||||
@@ -50,6 +73,7 @@
|
||||
<ind:pattern operation="pattern match">^kernelopts=(.*)$</ind:pattern>
|
||||
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
+ {{% endif %}}
|
||||
|
||||
<ind:textfilecontent54_state id="state_trust_cpu_rng_boot_param_on"
|
||||
version="1">
|
||||
@@ -61,5 +85,4 @@
|
||||
<ind:subexpression datatype="string" operation="pattern match">^(?:.*\s)?random\.trust_cpu=off(?:\s.*)?$</ind:subexpression>
|
||||
</ind:textfilecontent54_state>
|
||||
|
||||
-
|
||||
</def-group>
|
||||
diff --git a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
|
||||
index dae640f..b8ff66c 100644
|
||||
--- a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
|
||||
+++ b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: fedora,rhcos4,ol7,ol8,rhel7,rhel8,rhv4,sle15
|
||||
+prodtype: fedora,ol7,ol8,rhcos4,rhel7,rhel8,rhel9,rhv4,sle15
|
||||
|
||||
title: 'Ensure IPv6 is disabled through kernel boot parameter'
|
||||
|
||||
diff --git a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/tests/arg_not_there_rhel9.fail.sh b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/tests/arg_not_there_rhel9.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..fc649d7
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/tests/arg_not_there_rhel9.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 9
|
||||
+
|
||||
+# Removes ipv6.disable argument from kernel command line in //boot/loader/entries/*.conf
|
||||
+
|
||||
+for file in /boot/loader/entries/*.conf ; do
|
||||
+ if grep -q '^.*ipv6\.disable=.*' "$file" ; then
|
||||
+ sed -i 's/\(^.*\)ipv6\.disable=[^[:space:]]*\(.*\)/\1 \2/' "$file"
|
||||
+ fi
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/tests/wrong_value_rhel9.fail.sh b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/tests/wrong_value_rhel9.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..3c1cde1
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/tests/wrong_value_rhel9.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 9
|
||||
+
|
||||
+# Break the ipv6.disable argument in kernel command line in /boot/loader/entries/*.conf
|
||||
+
|
||||
+for file in /boot/loader/entries/*.conf ; do
|
||||
+ if grep -q '^.*ipv6\.disable=.*' "$file" ; then
|
||||
+ # modify the GRUB command-line if an ipv6.disable= arg already exists
|
||||
+ sed -i 's/\(^.*\)ipv6\.disable=[^[:space:]]*\(.*\)/\1 ipv6\.disable=0 \2/' "$file"
|
||||
+ else
|
||||
+ # no ipv6.disable=arg is present, append it
|
||||
+ sed -i 's/\(^.*\(vmlinuz\|kernelopts|options\).*\)/\1 ipv6\.disable=0/' "$file"
|
||||
+ fi
|
||||
+done
|
||||
diff --git a/shared/macros-bash.jinja b/shared/macros-bash.jinja
|
||||
index b5f55ae..3eebbd9 100644
|
||||
--- a/shared/macros-bash.jinja
|
||||
+++ b/shared/macros-bash.jinja
|
||||
@@ -684,3 +684,43 @@ dpkg-query --show --showformat='${db:Status-Status}\n' "{{{ pkgname }}}" 2>/dev/
|
||||
rpm --quiet -q "{{{ pkgname }}}"
|
||||
{{%- endif -%}}
|
||||
{{%- endmacro -%}}
|
||||
+
|
||||
+{{#
|
||||
+
|
||||
+ Remediation for grub2 bootloader arguments
|
||||
+#}}
|
||||
+{{% macro grub2_bootloader_argument_remediation(ARG_NAME, ARG_NAME_VALUE) %}}
|
||||
+{{% if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product %}}
|
||||
+{{% if '/' in ARG_NAME %}}
|
||||
+{{{ raise("ARG_NAME (" + ARG_NAME + ") uses sed path separator (/) in " + rule_id) }}}
|
||||
+{{% elif '/' in ARG_NAME_VALUE %}}
|
||||
+{{{ raise("ARG_NAME_VALUE (" + ARG_NAME_VALUE + ") uses sed path separator (/) in " + rule_id) }}}
|
||||
+{{% endif %}}
|
||||
+# Correct the form of default kernel command line in GRUB
|
||||
+if grep -q '^GRUB_CMDLINE_LINUX=.*{{{ ARG_NAME }}}=.*"' '/etc/default/grub' ; then
|
||||
+ # modify the GRUB command-line if an {{{ ARG_NAME }}}= arg already exists
|
||||
+ sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\){{{ ARG_NAME }}}=[^[:space:]]*\(.*"\)/\1 {{{ ARG_NAME_VALUE }}} \2/' '/etc/default/grub'
|
||||
+else
|
||||
+ # no {{{ ARG_NAME }}}=arg is present, append it
|
||||
+ sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\)"/\1 {{{ ARG_NAME_VALUE }}}"/' '/etc/default/grub'
|
||||
+fi
|
||||
+
|
||||
+{{% if 'ubuntu' in product %}}
|
||||
+update-grub
|
||||
+{{% else %}}
|
||||
+# Correct the form of kernel command line for each installed kernel in the bootloader
|
||||
+grubby --update-kernel=ALL --args="{{{ ARG_NAME_VALUE }}}"
|
||||
+{{% endif %}}
|
||||
+{{% else %}}
|
||||
+# Correct grub2 kernelopts value using grub2-editenv
|
||||
+existing_kernelopts="$(grub2-editenv - list | grep kernelopts)"
|
||||
+if ! printf '%s' "$existing_kernelopts" | grep -qE '^kernelopts=(.*\s)?{{{ ARG_NAME_VALUE }}}(\s.*)?$'; then
|
||||
+ if test -n "$existing_kernelopts"; then
|
||||
+ grub2-editenv - set "$existing_kernelopts {{{ ARG_NAME_VALUE }}}"
|
||||
+ else
|
||||
+ grub2-editenv - set "kernelopts={{{ ARG_NAME_VALUE }}}"
|
||||
+ fi
|
||||
+fi
|
||||
+{{% endif %}}
|
||||
+
|
||||
+{{% endmacro %}}
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/bash.template b/shared/templates/grub2_bootloader_argument/bash.template
|
||||
index cecd1f9..fd75db4 100644
|
||||
--- a/shared/templates/grub2_bootloader_argument/bash.template
|
||||
+++ b/shared/templates/grub2_bootloader_argument/bash.template
|
||||
@@ -1,6 +1,6 @@
|
||||
# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_ubuntu
|
||||
|
||||
-{{% if product in ["rhel7", "ol7"] or 'ubuntu' in product %}}
|
||||
+{{% if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product %}}
|
||||
{{% if '/' in ARG_NAME %}}
|
||||
{{{ raise("ARG_NAME (" + ARG_NAME + ") uses sed path separator (/) in " + rule_id) }}}
|
||||
{{% elif '/' in ARG_NAME_VALUE %}}
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/oval.template b/shared/templates/grub2_bootloader_argument/oval.template
|
||||
index e8da1fe..3ea8acb 100644
|
||||
--- a/shared/templates/grub2_bootloader_argument/oval.template
|
||||
+++ b/shared/templates/grub2_bootloader_argument/oval.template
|
||||
@@ -2,9 +2,14 @@
|
||||
<definition class="compliance" id="{{{ _RULE_ID }}}" version="2">
|
||||
{{{ oval_metadata("Ensure " + ARG_NAME_VALUE + " is configured in the kernel line in /etc/default/grub.") }}}
|
||||
<criteria operator="AND">
|
||||
- {{% if product in ["rhel7", "ol7"] or 'ubuntu' in product %}}
|
||||
- <criterion test_ref="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_grub_cfg"
|
||||
- comment="Check if {{{ ARG_NAME_VALUE }}} is present in the boot parameters in the {{{ grub2_boot_path }}}/grub.cfg for all kernels" />
|
||||
+ {{% if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product %}}
|
||||
+ {{% if product in ['rhel9'] %}}
|
||||
+ <criterion test_ref="test_grub2_{{{ SANITIZED_ARG_NAME }}}_entries"
|
||||
+ comment="Check if {{{ ARG_NAME_VALUE }}} is present in the boot parameters in the /boot/loader/entries/*.conf" />
|
||||
+ {{% else %}}
|
||||
+ <criterion test_ref="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_grub_cfg"
|
||||
+ comment="Check if {{{ ARG_NAME_VALUE }}} is present in the boot parameters in the {{{ grub2_boot_path }}}/grub.cfg for all kernels" />
|
||||
+ {{% endif %}}
|
||||
<criteria operator="OR">
|
||||
<criterion test_ref="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument"
|
||||
comment="check for {{{ ARG_NAME_VALUE }}} in /etc/default/grub via GRUB_CMDLINE_LINUX" />
|
||||
@@ -22,7 +27,7 @@
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
-{{% if product in ["rhel7", "ol7"] or 'ubuntu' in product %}}
|
||||
+{{% if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product %}}
|
||||
<ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument"
|
||||
comment="check for {{{ ARG_NAME_VALUE }}} in /etc/default/grub via GRUB_CMDLINE_LINUX"
|
||||
check="all" check_existence="all_exist" version="1">
|
||||
@@ -50,6 +55,21 @@
|
||||
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
+ {{% if product in ["rhel9"] %}}
|
||||
+ <ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_entries"
|
||||
+ comment="check kernel command line parameters for {{{ ARG_NAME_VALUE }}} for all boot entries."
|
||||
+ check="all" check_existence="all_exist" version="1">
|
||||
+ <ind:object object_ref="obj_grub2_{{{ SANITIZED_ARG_NAME }}}_entries" />
|
||||
+ <ind:state state_ref="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument" />
|
||||
+ </ind:textfilecontent54_test>
|
||||
+
|
||||
+ <ind:textfilecontent54_object id="obj_grub2_{{{ SANITIZED_ARG_NAME }}}_entries" version="1">
|
||||
+ <ind:path>/boot/loader/entries/</ind:path>
|
||||
+ <ind:filename operation="pattern match">^.*\.conf$</ind:filename>
|
||||
+ <ind:pattern operation="pattern match">^options (.*)$</ind:pattern>
|
||||
+ <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+ {{% else %}}
|
||||
<ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_grub_cfg"
|
||||
comment="check kernel command line parameters for {{{ ARG_NAME_VALUE }}} in {{{ grub2_boot_path }}}/grub.cfg for all kernels"
|
||||
check="all" check_existence="all_exist" version="1">
|
||||
@@ -68,6 +88,8 @@
|
||||
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
||||
</ind:textfilecontent54_object>
|
||||
|
||||
+ {{% endif %}}
|
||||
+
|
||||
{{% else %}}
|
||||
|
||||
<ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_grub_env"
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/template.py b/shared/templates/grub2_bootloader_argument/template.py
|
||||
index 7c32daa..60951cf 100644
|
||||
--- a/shared/templates/grub2_bootloader_argument/template.py
|
||||
+++ b/shared/templates/grub2_bootloader_argument/template.py
|
||||
@@ -6,6 +6,7 @@ def preprocess(data, lang):
|
||||
if lang == "oval":
|
||||
# escape dot, this is used in oval regex
|
||||
data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.")
|
||||
+ data["escaped_arg_name"] = data["arg_name"].replace(".", "\\.")
|
||||
# replace . with _, this is used in test / object / state ids
|
||||
data["sanitized_arg_name"] = ssg.utils.escape_id(data["arg_name"])
|
||||
return data
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/tests/arg_not_there.fail.sh b/shared/templates/grub2_bootloader_argument/tests/arg_not_there.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..fdf2a5d
|
||||
--- /dev/null
|
||||
+++ b/shared/templates/grub2_bootloader_argument/tests/arg_not_there.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# platform = Red Hat Enterprise Linux 8
|
||||
+
|
||||
+# Removes audit argument from kernel command line in /boot/grub2/grubenv
|
||||
+file="/boot/grub2/grubenv"
|
||||
+if grep -q '^.*{{{ARG_NAME}}}=.*' "$file" ; then
|
||||
+ sed -i 's/\(^.*\){{{ARG_NAME}}}=[^[:space:]]*\(.*\)/\1 \2/' "$file"
|
||||
+fi
|
||||
+
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/tests/arg_not_there_etcdefaultgrub.fail.sh b/shared/templates/grub2_bootloader_argument/tests/arg_not_there_etcdefaultgrub.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..a56e6d0
|
||||
--- /dev/null
|
||||
+++ b/shared/templates/grub2_bootloader_argument/tests/arg_not_there_etcdefaultgrub.fail.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+# platform = Red Hat Enterprise Linux 7,Red Hat Enterprise Linux 9
|
||||
+
|
||||
+# Removes argument from kernel command line in /etc/default/grub
|
||||
+if grep -q '^GRUB_CMDLINE_LINUX=.*{{{ARG_NAME}}}=.*"' '/etc/default/grub' ; then
|
||||
+ sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\){{{ARG_NAME}}}=[^[:space:]]*\(.*"\)/\1 \2/' '/etc/default/grub'
|
||||
+fi
|
||||
+
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/tests/correct_value.pass.sh b/shared/templates/grub2_bootloader_argument/tests/correct_value.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..b6454a9
|
||||
--- /dev/null
|
||||
+++ b/shared/templates/grub2_bootloader_argument/tests/correct_value.pass.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+{{{ grub2_bootloader_argument_remediation(ARG_NAME, ARG_NAME_VALUE) }}}
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/tests/wrong_value.fail.sh b/shared/templates/grub2_bootloader_argument/tests/wrong_value.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..5a97ec2
|
||||
--- /dev/null
|
||||
+++ b/shared/templates/grub2_bootloader_argument/tests/wrong_value.fail.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 8
|
||||
+
|
||||
+# Break the argument in kernel command line in /boot/grub2/grubenv
|
||||
+file="/boot/grub2/grubenv"
|
||||
+if grep -q '^.*{{{ARG_NAME}}}=.*' "$file" ; then
|
||||
+ # modify the GRUB command-line if the arg already exists
|
||||
+ sed -i 's/\(^.*\){{{ARG_NAME}}}=[^[:space:]]*\(.*\)/\1 {{{ARG_NAME}}}=wrong \2/' "$file"
|
||||
+else
|
||||
+ # no arg is present, append it
|
||||
+ sed -i 's/\(^.*\(vmlinuz\|kernelopts\).*\)/\1 {{{ARG_NAME}}}=wrong/' "$file"
|
||||
+fi
|
||||
diff --git a/shared/templates/grub2_bootloader_argument/tests/wrong_value_entries.fail.sh b/shared/templates/grub2_bootloader_argument/tests/wrong_value_entries.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..09861aa
|
||||
--- /dev/null
|
||||
+++ b/shared/templates/grub2_bootloader_argument/tests/wrong_value_entries.fail.sh
|
||||
@@ -0,0 +1,14 @@
|
||||
+#!/bin/bash
|
||||
+# platform = Red Hat Enterprise Linux 9
|
||||
+
|
||||
+# Removes argument from kernel command line in /boot/loader/entries/*.conf
|
||||
+
|
||||
+for file in /boot/loader/entries/*.conf ; do
|
||||
+ if grep -q '^.*{{{ ESCAPED_ARG_NAME }}}=.*' "$file" ; then
|
||||
+ # modify the GRUB command-line if an audit= arg already exists
|
||||
+ sed -i 's/\(^.*\){{{ARG_NAME}}}=[^[:space:]]*\(.*\)/\1 {{{ARG_NAME}}}=wrong \2/' "$file"
|
||||
+ else
|
||||
+ # no audit=arg is present, append it
|
||||
+ sed -i 's/\(^.*\(vmlinuz\|kernelopts\).*\)/\1 {{{ARG_NAME}}}=wrong/' "$file"
|
||||
+ fi
|
||||
+done
|
@ -1,84 +0,0 @@
|
||||
commit c68d33e672264e1b4f2c664004d258ddfc198856
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 18:15:07 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.60-sysctl_d_directories-PR_7999.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_randomize_va_space/tests/wrong_value_d_directory.fail.sh b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_randomize_va_space/tests/wrong_value_d_directory.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..48a2665
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_randomize_va_space/tests/wrong_value_d_directory.fail.sh
|
||||
@@ -0,0 +1,23 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+. $SHARED/sysctl.sh
|
||||
+
|
||||
+setting_name="kernel.randomize_va_space"
|
||||
+setting_value="2"
|
||||
+# sysctl -w "$setting_name=$setting_value"
|
||||
+if grep -q "^$setting_name" /usr/lib/sysctl.d/50-sysctl.conf; then
|
||||
+ sed -i "s/^$setting_name.*/$setting_name = $setting_value/" /usr/lib/sysctl.d/50-sysctl.conf
|
||||
+else
|
||||
+ echo "$setting_name = $setting_value" >> /usr/lib/sysctl.d/50-sysctl.conf
|
||||
+fi
|
||||
+
|
||||
+setting_name="kernel.randomize_va_space"
|
||||
+setting_value="0"
|
||||
+# sysctl -w "$setting_name=$setting_value"
|
||||
+if grep -q "^$setting_name" /etc/sysctl.d/99-sysctl.conf; then
|
||||
+ sed -i "s/^$setting_name.*/$setting_name = $setting_value/" /etc/sysctl.d/99-sysctl.conf
|
||||
+else
|
||||
+ echo "$setting_name = $setting_value" >> /etc/sysctl.d/99-sysctl.conf
|
||||
+fi
|
||||
+
|
||||
+sysctl --system
|
||||
diff --git a/shared/templates/sysctl/ansible.template b/shared/templates/sysctl/ansible.template
|
||||
index e4ccd84..3837b31 100644
|
||||
--- a/shared/templates/sysctl/ansible.template
|
||||
+++ b/shared/templates/sysctl/ansible.template
|
||||
@@ -3,6 +3,21 @@
|
||||
# strategy = disable
|
||||
# complexity = low
|
||||
# disruption = medium
|
||||
+
|
||||
+- name: List /etc/sysctl.d/*.conf files
|
||||
+ find:
|
||||
+ paths: "/etc/sysctl.d/"
|
||||
+ contains: '^[\s]*{{{ SYSCTLVAR }}}.*$'
|
||||
+ patterns: "*.conf"
|
||||
+ register: find_sysctl_d
|
||||
+
|
||||
+- name: Comment out any occurrences of {{{ SYSCTLVAR }}} from /etc/sysctl.d/*.conf files
|
||||
+ replace:
|
||||
+ path: "{{ item }}"
|
||||
+ regexp: '^[\s]*{{{ SYSCTLVAR }}}'
|
||||
+ replace: '#{{{ SYSCTLVAR }}}'
|
||||
+ loop: "{{ find_sysctl_d.files }}"
|
||||
+
|
||||
{{%- if SYSCTLVAL == "" %}}
|
||||
- (xccdf-var sysctl_{{{ SYSCTLID }}}_value)
|
||||
|
||||
diff --git a/shared/templates/sysctl/bash.template b/shared/templates/sysctl/bash.template
|
||||
index a762794..5ec56fd 100644
|
||||
--- a/shared/templates/sysctl/bash.template
|
||||
+++ b/shared/templates/sysctl/bash.template
|
||||
@@ -4,6 +4,18 @@
|
||||
# complexity = low
|
||||
# disruption = medium
|
||||
. /usr/share/scap-security-guide/remediation_functions
|
||||
+
|
||||
+# Comment out any occurrences of {{{ SYSCTLVAR }}} from /etc/sysctl.d/*.conf files
|
||||
+for f in /etc/sysctl.d/*.conf ; do
|
||||
+ matching_list=$(grep -P '^(?!#).*[\s]+{{{ SYSCTLVAR }}}.*$' $f | uniq )
|
||||
+ if ! test -z "$matching_list"; then
|
||||
+ while IFS= read -r entry; do
|
||||
+ # comment out "{{{ SYSCTLVAR }}}" matches to preserve user data
|
||||
+ sed -i "s/^${entry}$/# &/g" $f
|
||||
+ done <<< "$matching_list"
|
||||
+ fi
|
||||
+done
|
||||
+
|
||||
{{%- if SYSCTLVAL == "" %}}
|
||||
{{{ bash_instantiate_variables("sysctl_" + SYSCTLID + "_value") }}}
|
||||
|
24
SOURCES/scap-security-guide-0.1.61-RC_244-PR_8133.patch
Normal file
24
SOURCES/scap-security-guide-0.1.61-RC_244-PR_8133.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
|
||||
index 9f036f83015..f94ddab2fe1 100644
|
||||
--- a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
|
||||
@@ -32,6 +32,7 @@ references:
|
||||
cis@ubuntu2004: 4.1.1.4
|
||||
disa: CCI-001849
|
||||
nist: CM-6(a)
|
||||
+ ospp: FAU_STG.1,FAU_STG.3
|
||||
srg: SRG-OS-000254-GPOS-00095,SRG-OS-000341-GPOS-00132
|
||||
stigid@ol8: OL08-00-030602
|
||||
stigid@rhel8: RHEL-08-030602
|
||||
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
|
||||
index 6d76e896ffc..7396b9167c6 100644
|
||||
--- a/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
|
||||
+++ b/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
|
||||
@@ -25,6 +25,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
cis@ubuntu2004: 4.1.1.4
|
||||
+ ospp: FAU_STG.1,FAU_STG.3
|
||||
|
||||
ocil_clause: 'audit backlog limit is not configured'
|
||||
|
26
SOURCES/scap-security-guide-0.1.61-RC_246_250-PR_8070.patch
Normal file
26
SOURCES/scap-security-guide-0.1.61-RC_246_250-PR_8070.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_local_events/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_local_events/rule.yml
|
||||
index 5841f378fe6..f4780b4ae6d 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_local_events/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_local_events/rule.yml
|
||||
@@ -22,7 +22,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-000366
|
||||
nist: CM-6
|
||||
- ospp: FAU_GEN.1.1.c
|
||||
+ ospp: FAU_GEN.1
|
||||
srg: SRG-OS-000062-GPOS-00031,SRG-OS-000480-GPOS-00227
|
||||
stigid@ol8: OL08-00-030061
|
||||
stigid@rhel8: RHEL-08-030061
|
||||
diff --git a/linux_os/guide/system/auditing/policy_rules/audit_basic_configuration/rule.yml b/linux_os/guide/system/auditing/policy_rules/audit_basic_configuration/rule.yml
|
||||
index ba60b9b2c98..19dc3320e85 100644
|
||||
--- a/linux_os/guide/system/auditing/policy_rules/audit_basic_configuration/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/policy_rules/audit_basic_configuration/rule.yml
|
||||
@@ -47,7 +47,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
nist: AU-2(a)
|
||||
- ospp: FAU_GEN.1.1.c
|
||||
+ ospp: FAU_GEN.1
|
||||
srg: SRG-OS-000365-GPOS-00152,SRG-OS-000475-GPOS-00220
|
||||
|
||||
ocil_clause: 'the file does not exist or the content differs'
|
13
SOURCES/scap-security-guide-0.1.61-RC_247-PR_8114.patch
Normal file
13
SOURCES/scap-security-guide-0.1.61-RC_247-PR_8114.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_write_logs/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_write_logs/rule.yml
|
||||
index 6c39a05550c..f169cba9f6b 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_write_logs/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_write_logs/rule.yml
|
||||
@@ -21,7 +21,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
nist: CM-6
|
||||
- ospp: FAU_GEN.1.1.c
|
||||
+ ospp: FAU_STG.1
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
|
||||
ocil_clause: write_logs isn't set to yes
|
26
SOURCES/scap-security-guide-0.1.61-RC_248_249-PR_8071.patch
Normal file
26
SOURCES/scap-security-guide-0.1.61-RC_248_249-PR_8071.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_log_format/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_log_format/rule.yml
|
||||
index 48ed2f31795..b536a68cf2a 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_log_format/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_log_format/rule.yml
|
||||
@@ -23,7 +23,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-000366
|
||||
nist: CM-6,AU-3
|
||||
- ospp: FAU_GEN.1
|
||||
+ ospp: FAU_GEN.1.2
|
||||
srg: SRG-OS-000255-GPOS-00096,SRG-OS-000480-GPOS-00227
|
||||
stigid@ol8: OL08-00-030063
|
||||
stigid@rhel8: RHEL-08-030063
|
||||
diff --git a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_name_format/rule.yml b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_name_format/rule.yml
|
||||
index a31e975c1c9..8da90cd760f 100644
|
||||
--- a/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_name_format/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/configure_auditd_data_retention/auditd_name_format/rule.yml
|
||||
@@ -24,7 +24,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-001851
|
||||
nist: CM-6,AU-3
|
||||
- ospp: FAU_GEN.1
|
||||
+ ospp: FAU_GEN.1.2
|
||||
srg: SRG-OS-000039-GPOS-00017,SRG-OS-000342-GPOS-00133,SRG-OS-000479-GPOS-00224
|
||||
stigid@ol7: OL07-00-030211
|
||||
stigid@ol8: OL08-00-030062
|
13
SOURCES/scap-security-guide-0.1.61-RC_251-PR_8072.patch
Normal file
13
SOURCES/scap-security-guide-0.1.61-RC_251-PR_8072.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/linux_os/guide/system/auditing/policy_rules/audit_immutable_login_uids/rule.yml b/linux_os/guide/system/auditing/policy_rules/audit_immutable_login_uids/rule.yml
|
||||
index ac43b654188..70357c153be 100644
|
||||
--- a/linux_os/guide/system/auditing/policy_rules/audit_immutable_login_uids/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/policy_rules/audit_immutable_login_uids/rule.yml
|
||||
@@ -37,7 +37,7 @@ identifiers:
|
||||
references:
|
||||
disa: CCI-000162
|
||||
nist: AU-2(a)
|
||||
- ospp: FAU_GEN.1.1.c
|
||||
+ ospp: FAU_GEN.1.2
|
||||
srg: SRG-OS-000462-GPOS-00206,SRG-OS-000475-GPOS-00220,SRG-OS-000057-GPOS-00027,SRG-OS-000058-GPOS-00028,SRG-OS-000059-GPOS-00029
|
||||
stigid@ol8: OL08-00-030122
|
||||
stigid@rhel8: RHEL-08-030122
|
12
SOURCES/scap-security-guide-0.1.61-RC_253-PR_8111.patch
Normal file
12
SOURCES/scap-security-guide-0.1.61-RC_253-PR_8111.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/linux_os/guide/system/logging/package_rsyslog_installed/rule.yml b/linux_os/guide/system/logging/package_rsyslog_installed/rule.yml
|
||||
index 5af94a56910..7968d90331e 100644
|
||||
--- a/linux_os/guide/system/logging/package_rsyslog_installed/rule.yml
|
||||
+++ b/linux_os/guide/system/logging/package_rsyslog_installed/rule.yml
|
||||
@@ -31,6 +31,7 @@ references:
|
||||
iso27001-2013: A.12.4.1,A.12.4.2,A.12.4.3,A.12.4.4,A.12.7.1
|
||||
nist: CM-6(a)
|
||||
nist-csf: PR.PT-1
|
||||
+ ospp: FTP_ITC_EXT.1.1
|
||||
srg: SRG-OS-000479-GPOS-00224,SRG-OS-000051-GPOS-00024,SRG-OS-000480-GPOS-00227
|
||||
stigid@ol8: OL08-00-030670
|
||||
stigid@rhel8: RHEL-08-030670
|
13
SOURCES/scap-security-guide-0.1.61-RC_254-PR_8113.patch
Normal file
13
SOURCES/scap-security-guide-0.1.61-RC_254-PR_8113.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls/rule.yml b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls/rule.yml
|
||||
index d5d49bf7426..83c6d9339de 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls/rule.yml
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls/rule.yml
|
||||
@@ -29,7 +29,7 @@ references:
|
||||
anssi: BP28(R43)
|
||||
ism: 0988,1405
|
||||
nist: AU-9(3),CM-6(a)
|
||||
- ospp: FCS_TLSC_EXT.1,FTP_ITC_EXT.1.1
|
||||
+ ospp: FCS_TLSC_EXT.1,FTP_ITC_EXT.1.1,FIA_X509_EXT.1.1,FMT_SMF_EXT.1.1
|
||||
srg: SRG-OS-000480-GPOS-00227,SRG-OS-000120-GPOS-00061
|
||||
|
||||
ocil_clause: 'omfwd is not configured with gtls and AuthMode'
|
13
SOURCES/scap-security-guide-0.1.61-RC_255-PR_8112.patch
Normal file
13
SOURCES/scap-security-guide-0.1.61-RC_255-PR_8112.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls_cacert/rule.yml b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls_cacert/rule.yml
|
||||
index 635207b571f..818f24718a0 100644
|
||||
--- a/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls_cacert/rule.yml
|
||||
+++ b/linux_os/guide/system/logging/rsyslog_sending_messages/rsyslog_remote_tls_cacert/rule.yml
|
||||
@@ -27,7 +27,7 @@ identifiers:
|
||||
references:
|
||||
anssi: BP28(R43)
|
||||
ism: 0988,1405
|
||||
- ospp: FCS_TLSC_EXT.1,FTP_ITC_EXT.1.1
|
||||
+ ospp: FCS_TLSC_EXT.1
|
||||
srg: SRG-OS-000480-GPOS-00227
|
||||
|
||||
ocil_clause: 'CA certificate for rsyslog remote logging via TLS is not set'
|
24
SOURCES/scap-security-guide-0.1.61-RC_277_245-PR_8069.patch
Normal file
24
SOURCES/scap-security-guide-0.1.61-RC_277_245-PR_8069.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/linux_os/guide/system/auditing/package_audit_installed/rule.yml b/linux_os/guide/system/auditing/package_audit_installed/rule.yml
|
||||
index 8b36f0c2fa3..795089c8b83 100644
|
||||
--- a/linux_os/guide/system/auditing/package_audit_installed/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/package_audit_installed/rule.yml
|
||||
@@ -27,6 +27,7 @@ references:
|
||||
nerc-cip: CIP-004-6 R3.3,CIP-007-3 R6.5
|
||||
nist: AC-7(a),AU-7(1),AU-7(2),AU-14,AU-12(2),AU-2(a),CM-6(a)
|
||||
nist@sle12: AU-7(a),AU-7(b),AU-8(b),AU-12.1(iv),AU-12(3),AU-12(c),CM-5(1)
|
||||
+ ospp: FAU_GEN.1
|
||||
srg: SRG-OS-000122-GPOS-00063,SRG-OS-000337-GPOS-00129,SRG-OS-000348-GPOS-00136,SRG-OS-000349-GPOS-00137,SRG-OS-000350-GPOS-00138,SRG-OS-000351-GPOS-00139,SRG-OS-000352-GPOS-00140,SRG-OS-000353-GPOS-00141,SRG-OS-000354-GPOS-00142,SRG-OS-000358-GPOS-00145,SRG-OS-000359-GPOS-00146,SRG-OS-000365-GPOS-00152,SRG-OS-000474-GPOS-00219,SRG-OS-000475-GPOS-00220,SRG-OS-000480-GPOS-00227,SRG-OS-000062-GPOS-00031
|
||||
stigid@ol8: OL08-00-030180
|
||||
stigid@rhel8: RHEL-08-030180
|
||||
diff --git a/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml b/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml
|
||||
index 320b69c3179..99edca3e270 100644
|
||||
--- a/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml
|
||||
+++ b/linux_os/guide/system/auditing/service_auditd_enabled/rule.yml
|
||||
@@ -50,6 +50,7 @@ references:
|
||||
nist: AC-2(g),AU-3,AU-10,AU-2(d),AU-12(c),AU-14(1),AC-6(9),CM-6(a),SI-4(23)
|
||||
nist-csf: 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
|
||||
nist@sle12: AU-3,AU-3(1),AU-3(1).1(ii),AU-3.1,AU-6(4),AU-6(4).1,AU-7(1),AU-7(1).1,AU-7(a),AU-14(1),AU-14(1).1,CM-6(b),CM-6.1(iv),MA-4(1)(a)
|
||||
+ ospp: FAU_GEN.1
|
||||
pcidss: Req-10.1
|
||||
srg: SRG-OS-000037-GPOS-00015,SRG-OS-000038-GPOS-00016,SRG-OS-000039-GPOS-00017,SRG-OS-000040-GPOS-00018,SRG-OS-000041-GPOS-00019,SRG-OS-000042-GPOS-00021,SRG-OS-000051-GPOS-00024,SRG-OS-000054-GPOS-00025,SRG-OS-000122-GPOS-00063,SRG-OS-000254-GPOS-00095,SRG-OS-000255-GPOS-00096,SRG-OS-000365-GPOS-00152,SRG-OS-000392-GPOS-00172,SRG-OS-000480-GPOS-00227,SRG-OS-000062-GPOS-00031
|
||||
stigid@ol7: OL07-00-030000
|
@ -1,11 +1,5 @@
|
||||
commit 3c9a97de3a91b2a8fd85f13bb902e2529dd6fa67
|
||||
Author: Watson Sato <wsato@redhat.com>
|
||||
Date: Fri Feb 25 13:51:41 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.61-add_RHEL_08_010331-PR_8055.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/ansible/shared.yml
|
||||
index 8a28af0..02c69bd 100644
|
||||
index 8a28af022a7..02c69bddd27 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/ansible/shared.yml
|
||||
@@ -1,4 +1,4 @@
|
||||
@ -15,7 +9,7 @@ index 8a28af0..02c69bd 100644
|
||||
# strategy = restrict
|
||||
# complexity = high
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/rule.yml
|
||||
index a0f5aeb..853f8ac 100644
|
||||
index a7182849548..db89a5e47a1 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/rule.yml
|
||||
@@ -31,6 +31,8 @@ rationale: |-
|
||||
@ -29,7 +23,7 @@ index a0f5aeb..853f8ac 100644
|
||||
|
||||
@@ -40,6 +42,8 @@ references:
|
||||
disa: CCI-001499
|
||||
nerc-cip: CIP-003-3 R6
|
||||
nerc-cip: CIP-003-8 R6
|
||||
nist: CM-5,CM-5(6),CM-5(6).1
|
||||
+ srg: SRG-OS-000259-GPOS-00100
|
||||
+ stigid@rhel8: RHEL-08-010331
|
||||
@ -37,7 +31,7 @@ index a0f5aeb..853f8ac 100644
|
||||
stigid@sle15: SLES-15-010352
|
||||
stigid@ubuntu2004: UBTU-20-010427
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/all_dirs_ok.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/all_dirs_ok.pass.sh
|
||||
index af07846..6e957c3 100644
|
||||
index af078463b05..6e957c302ac 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/all_dirs_ok.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/all_dirs_ok.pass.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
@ -47,7 +41,7 @@ index af07846..6e957c3 100644
|
||||
for dirPath in $DIRS; do
|
||||
find "$dirPath" -perm /022 -type d -exec chmod go-w '{}' \;
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/owner_only_writable_dir.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/owner_only_writable_dir.pass.sh
|
||||
index d58616b..55ff9ce 100644
|
||||
index d58616bcafb..55ff9cebd4f 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/owner_only_writable_dir.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/owner_only_writable_dir.pass.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
@ -57,7 +51,7 @@ index d58616b..55ff9ce 100644
|
||||
for dirPath in $DIRS; do
|
||||
chmod -R 755 "$dirPath"
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_lib.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_lib.fail.sh
|
||||
index 98d18cd..c2b5b6b 100644
|
||||
index 98d18cde3ea..c2b5b6bf029 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_lib.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_lib.fail.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
@ -67,7 +61,7 @@ index 98d18cd..c2b5b6b 100644
|
||||
for dirPath in $DIRS; do
|
||||
mkdir -p "$dirPath/testme" && chmod 777 "$dirPath/testme"
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_usr_lib.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_usr_lib.fail.sh
|
||||
index 6df6e2f..40e6c42 100644
|
||||
index 6df6e2f8f9b..40e6c42c829 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_usr_lib.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_usr_lib.fail.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
@ -77,7 +71,7 @@ index 6df6e2f..40e6c42 100644
|
||||
for dirPath in $DIRS; do
|
||||
mkdir -p "$dirPath/testme" && chmod 777 "$dirPath/testme"
|
||||
diff --git a/products/rhel8/profiles/cjis.profile b/products/rhel8/profiles/cjis.profile
|
||||
index adeae4a..fab5f3f 100644
|
||||
index decba0087e8..920a55659fd 100644
|
||||
--- a/products/rhel8/profiles/cjis.profile
|
||||
+++ b/products/rhel8/profiles/cjis.profile
|
||||
@@ -77,6 +77,7 @@ selections:
|
||||
@ -89,10 +83,10 @@ index adeae4a..fab5f3f 100644
|
||||
- set_password_hashing_algorithm_libuserconf
|
||||
- file_owner_etc_shadow
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 5d03125..d51e53a 100644
|
||||
index 04f158116ee..5d98b1c894e 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -224,6 +224,9 @@ selections:
|
||||
@@ -228,6 +228,9 @@ selections:
|
||||
# RHEL-08-010330
|
||||
- file_permissions_library_dirs
|
||||
|
||||
@ -103,10 +97,10 @@ index 5d03125..d51e53a 100644
|
||||
- file_ownership_library_dirs
|
||||
|
||||
diff --git a/products/rhel9/profiles/stig.profile b/products/rhel9/profiles/stig.profile
|
||||
index 9acb63a..b751a74 100644
|
||||
index 8f79b22e3e4..2614504e9cd 100644
|
||||
--- a/products/rhel9/profiles/stig.profile
|
||||
+++ b/products/rhel9/profiles/stig.profile
|
||||
@@ -195,6 +195,9 @@ selections:
|
||||
@@ -229,6 +229,9 @@ selections:
|
||||
# RHEL-08-010330
|
||||
- file_permissions_library_dirs
|
||||
|
||||
@ -117,10 +111,10 @@ index 9acb63a..b751a74 100644
|
||||
- file_ownership_library_dirs
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 1b83798..fef5fd8 100644
|
||||
index 3f6ec5e17c4..4a926bce5de 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -2758,8 +2758,6 @@ CCE-88688-7
|
||||
@@ -2645,8 +2645,6 @@ CCE-88688-7
|
||||
CCE-88689-5
|
||||
CCE-88690-3
|
||||
CCE-88691-1
|
||||
@ -130,10 +124,18 @@ index 1b83798..fef5fd8 100644
|
||||
CCE-88695-2
|
||||
CCE-88696-0
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index e4f9dd8..3b4b43a 100644
|
||||
index ed739e724f4..4df5c4a2e21 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -175,6 +175,7 @@ selections:
|
||||
@@ -25,6 +25,7 @@ extends: null
|
||||
metadata:
|
||||
version: V1R4
|
||||
SMEs:
|
||||
+ - mab879
|
||||
- ggbecker
|
||||
reference: https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux
|
||||
selections:
|
||||
@@ -180,6 +181,7 @@ selections:
|
||||
- dconf_gnome_screensaver_idle_delay
|
||||
- dconf_gnome_screensaver_lock_enabled
|
||||
- dir_group_ownership_library_dirs
|
||||
@ -142,10 +144,18 @@ index e4f9dd8..3b4b43a 100644
|
||||
- dir_perms_world_writable_sticky_bits
|
||||
- directory_group_ownership_var_log_audit
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index d37d2ec..2e0e161 100644
|
||||
index 56c3fcb9f59..98746158aed 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -186,6 +186,7 @@ selections:
|
||||
@@ -36,6 +36,7 @@ extends: null
|
||||
metadata:
|
||||
version: V1R4
|
||||
SMEs:
|
||||
+ - mab879
|
||||
- ggbecker
|
||||
reference: https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux
|
||||
selections:
|
||||
@@ -191,6 +192,7 @@ selections:
|
||||
- dconf_gnome_screensaver_idle_delay
|
||||
- dconf_gnome_screensaver_lock_enabled
|
||||
- dir_group_ownership_library_dirs
|
||||
|
@ -1,14 +1,8 @@
|
||||
commit ae056f1639768deba6f51427419eb73f2e6e7626
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Fri Feb 25 14:20:55 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.61-add_RHEL_08_010359-PR_8131.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/package_aide_installed/rule.yml b/linux_os/guide/system/software/integrity/software-integrity/aide/package_aide_installed/rule.yml
|
||||
index 51adb67..ed2734c 100644
|
||||
index 68b353965ec..ff106996f00 100644
|
||||
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/package_aide_installed/rule.yml
|
||||
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/package_aide_installed/rule.yml
|
||||
@@ -27,7 +27,7 @@ references:
|
||||
@@ -28,7 +28,7 @@ references:
|
||||
cis@ubuntu2004: 1.4.1
|
||||
cjis: 5.10.1.3
|
||||
cobit5: 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
|
||||
@ -17,22 +11,39 @@ index 51adb67..ed2734c 100644
|
||||
isa-62443-2009: 4.3.4.3.2,4.3.4.3.3,4.3.4.4.4
|
||||
isa-62443-2013: 'SR 3.1,SR 3.3,SR 3.4,SR 3.8,SR 4.1,SR 6.2,SR 7.6'
|
||||
ism: 1034,1288,1341,1417
|
||||
@@ -35,8 +35,8 @@ references:
|
||||
@@ -36,9 +36,9 @@ references:
|
||||
nist: CM-6(a)
|
||||
nist-csf: DE.CM-1,DE.CM-7,PR.DS-1,PR.DS-6,PR.DS-8,PR.IP-1,PR.IP-3
|
||||
pcidss: Req-11.5
|
||||
- srg: SRG-OS-000363-GPOS-00150
|
||||
- stigid@rhel8: RHEL-08-010360
|
||||
+ srg: SRG-OS-000363-GPOS-00150,SRG-OS-000445-GPOS-00199
|
||||
stigid@ol8: OL08-00-010360
|
||||
- stigid@rhel8: RHEL-08-010360
|
||||
+ stigid@rhel8: RHEL-08-010359
|
||||
stigid@sle12: SLES-12-010500
|
||||
stigid@sle15: SLES-15-010420
|
||||
stigid@ubuntu2004: UBTU-20-010450
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 705caa8..d6f0793 100644
|
||||
index ff23f83cfbf..cb72403e81a 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -237,8 +237,10 @@ selections:
|
||||
@@ -239,8 +239,10 @@ selections:
|
||||
- root_permissions_syslibrary_files
|
||||
- dir_group_ownership_library_dirs
|
||||
|
||||
- # RHEL-08-010360
|
||||
+ # RHEL-08-010359
|
||||
- package_aide_installed
|
||||
+
|
||||
+ # RHEL-08-010360
|
||||
- aide_scan_notification
|
||||
|
||||
# RHEL-08-010370
|
||||
diff --git a/products/rhel9/profiles/stig.profile b/products/rhel9/profiles/stig.profile
|
||||
index 31015d4b83c..93ecc404dc2 100644
|
||||
--- a/products/rhel9/profiles/stig.profile
|
||||
+++ b/products/rhel9/profiles/stig.profile
|
||||
@@ -240,8 +240,10 @@ selections:
|
||||
- root_permissions_syslibrary_files
|
||||
- dir_group_ownership_library_dirs
|
||||
|
||||
|
@ -1,76 +1,70 @@
|
||||
commit 804ab7d7e48d3d6a93aab8c99a1b71410553983b
|
||||
Author: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon Feb 28 11:44:13 2022 +0100
|
||||
From 19bd5adfd804590b15e42cc75287b792706286d5 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 10 Feb 2022 15:25:06 +0100
|
||||
Subject: [PATCH 1/9] Add rule to check for default sudoers includedir
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.61-add_RHEL_08_0103789_include_sudoers-PR_8196.patch.
|
||||
This rule supports RHEL-08-010379.
|
||||
---
|
||||
.../ansible/shared.yml | 7 ++++
|
||||
.../sudoers_default_includedir/bash/shared.sh | 11 ++++++
|
||||
.../oval/shared.xml | 23 +++++++++++
|
||||
.../sudo/sudoers_default_includedir/rule.yml | 38 +++++++++++++++++++
|
||||
.../tests/default_includedir.pass.sh | 7 ++++
|
||||
.../tests/duplicate_includedir.fail.sh | 7 ++++
|
||||
.../tests/no_includedir.fail.sh | 4 ++
|
||||
.../tests/two_includedir.fail.sh | 8 ++++
|
||||
shared/references/cce-redhat-avail.txt | 3 --
|
||||
9 files changed, 105 insertions(+), 3 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
new file mode 100644
|
||||
index 0000000..0d8c9e7
|
||||
index 00000000000..d9d5933285f
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
@@ -0,0 +1,21 @@
|
||||
@@ -0,0 +1,7 @@
|
||||
+# platform = multi_platform_all
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
+# # reboot = false
|
||||
+# # strategy = configure
|
||||
+# # complexity = low
|
||||
+# # disruption = low
|
||||
+
|
||||
+{{{ ansible_only_lineinfile(msg='Ensure sudo only has the default includedir', line_regex='^#includedir.*$', path='/etc/sudoers', new_line='#includedir /etc/sudoers.d') }}}
|
||||
+{{{ ansible_lineinfile(msg='Ensure sudoers doesn\'t include other non-default file', regex='^#include[\s]+.*$', path='/etc/sudoers', state='absent') }}}
|
||||
+- name: "Find out if /etc/sudoers.d/* files contain file or directory includes"
|
||||
+ find:
|
||||
+ path: "/etc/sudoers.d"
|
||||
+ patterns: "*"
|
||||
+ contains: '^#include(dir)?\s.*$'
|
||||
+ register: sudoers_d_includes
|
||||
+
|
||||
+- name: "Remove found occurrences of file and directory inclues from /etc/sudoers.d/* files"
|
||||
+ lineinfile:
|
||||
+ path: "{{ item.path }}"
|
||||
+ regexp: '^#include(dir)?\s.*$'
|
||||
+ state: absent
|
||||
+ with_items: "{{ sudoers_d_includes.files }}"
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
new file mode 100644
|
||||
index 0000000..fbff5eb
|
||||
index 00000000000..3a9e2da985b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
@@ -0,0 +1,21 @@
|
||||
@@ -0,0 +1,11 @@
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+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 -i "/^#include\s\+.*/d" "$sudoers_config_file"
|
||||
+
|
||||
+if grep -Pr "^#include(dir)? .*" "$sudoers_config_dir" ; then
|
||||
+ sed -i "/^#include\(dir\)\?\s\+.*/d" "$sudoers_config_dir"/*
|
||||
+if [ "$sudoers_includedir_count" -eq 0 ]; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..59cab0b
|
||||
index 00000000000..5618c64291c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -0,0 +1,23 @@
|
||||
+<def-group>
|
||||
+ <definition class="compliance" id="{{{ rule_id }}}" version="1">
|
||||
+ {{{ oval_metadata("Check if sudo includes only the default includedir") }}}
|
||||
+ <criteria operator="AND">
|
||||
+ <criterion comment="Check /etc/sudoers for #includedir" test_ref="test_sudoers_default_includedir" />
|
||||
+ <criterion comment="Check /etc/sudoers for #include" test_ref="test_sudoers_without_include" />
|
||||
+ <criterion comment="Check /etc/sudoers.d for includes" test_ref="test_sudoersd_without_includes" />
|
||||
+ </criteria>
|
||||
+ </definition>
|
||||
+
|
||||
@ -88,6 +82,336 @@ index 0000000..59cab0b
|
||||
+ <ind:subexpression operation="equals">/etc/sudoers.d</ind:subexpression>
|
||||
+ </ind:textfilecontent54_state>
|
||||
+
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
new file mode 100644
|
||||
index 00000000000..5c33121f911
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
@@ -0,0 +1,38 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel7,rhel8,rhel9
|
||||
+
|
||||
+title: 'Ensure sudo only includes the default configuration directory'
|
||||
+
|
||||
+description: |-
|
||||
+ Administrators can configure authorized <tt>sudo</tt> users via drop-in files, and it is possible to include
|
||||
+ other directories and configuration files from the file currently being parsed.
|
||||
+
|
||||
+ Make sure that <tt>/etc/sudoers</tt> only includes drop-in configuration files from <tt>/etc/sudoers.d</tt>.
|
||||
+ The <tt>/etc/sudoers</tt> should contain only one <tt>#includedir</tt> directive pointing to
|
||||
+ <tt>/etc/sudoers.d</tt>
|
||||
+ Note that the '#' character doesn't denote a comment in the configuration file.
|
||||
+
|
||||
+rationale: |-
|
||||
+ Some <tt>sudo</tt> configurtion options allow users to run programs without re-authenticating.
|
||||
+ Use of these configuration options makes it easier for one compromised accound to be used to
|
||||
+ compromise other accounts.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel7: CCE-86277-1
|
||||
+ cce@rhel8: CCE-86377-9
|
||||
+ cce@rhel9: CCE-86477-7
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-000366
|
||||
+ stigid@rhel8: RHEL-08-010379
|
||||
+
|
||||
+ocil_clause: "the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?"
|
||||
+
|
||||
+ocil: |-
|
||||
+ To determine whether <tt>sudo</tt> command includes configuration files from the appropriate directory,
|
||||
+ run the following command:
|
||||
+ <pre>$ sudo grep 'include' /etc/sudoers</pre>
|
||||
+ If only the line <tt>#includedir /etc/sudoers> is returned, then the drop-in file configuration is set correctly.
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ac0c808ccd6
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..5bad8225625
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# duplicate default entry
|
||||
+if grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..1e0ab8aea92
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+sed -i "/#includedir.*/d" /etc/sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..09d14eab630
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure that there are two different indludedirs
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+echo "#includedir /opt/extra_config.d" >> /etc/sudoers
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 41caad9f0d0..f2990adb537 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -340,7 +340,6 @@ CCE-86273-0
|
||||
CCE-86274-8
|
||||
CCE-86275-5
|
||||
CCE-86276-3
|
||||
-CCE-86277-1
|
||||
CCE-86278-9
|
||||
CCE-86279-7
|
||||
CCE-86281-3
|
||||
@@ -428,7 +427,6 @@ CCE-86373-8
|
||||
CCE-86374-6
|
||||
CCE-86375-3
|
||||
CCE-86376-1
|
||||
-CCE-86377-9
|
||||
CCE-86378-7
|
||||
CCE-86379-5
|
||||
CCE-86380-3
|
||||
@@ -524,7 +522,6 @@ CCE-86473-6
|
||||
CCE-86474-4
|
||||
CCE-86475-1
|
||||
CCE-86476-9
|
||||
-CCE-86477-7
|
||||
CCE-86478-5
|
||||
CCE-86479-3
|
||||
CCE-86480-1
|
||||
|
||||
From 99fe46922243e8dff5822e2ed6eb49addd000baa Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 10 Feb 2022 16:21:46 +0100
|
||||
Subject: [PATCH 2/9] Select rule in RHEL8 STIG
|
||||
|
||||
Select sudoers_default_indludedir aligning to RHEL8 STIG V1R5
|
||||
---
|
||||
products/rhel8/profiles/stig.profile | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index d92bc72971c..e13bda7a787 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -271,6 +271,9 @@ selections:
|
||||
# RHEL-08-010376
|
||||
- sysctl_kernel_perf_event_paranoid
|
||||
|
||||
+ # RHEL-08-010379
|
||||
+ - sudoers_default_includedir
|
||||
+
|
||||
# RHEL-08-010380
|
||||
- sudo_remove_nopasswd
|
||||
|
||||
|
||||
From 3686fe72a6e27049f1c46d0a4efa07e1b42b6a20 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Thu, 10 Feb 2022 17:26:59 +0100
|
||||
Subject: [PATCH 3/9] Add test and fix for case when the single includedir is
|
||||
wrong
|
||||
|
||||
---
|
||||
.../sudo/sudoers_default_includedir/bash/shared.sh | 7 +++++--
|
||||
.../tests/wrong_includedir.fail.sh | 5 +++++
|
||||
2 files changed, 10 insertions(+), 2 deletions(-)
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
index 3a9e2da985b..258af02c121 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
@@ -5,7 +5,10 @@ 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"
|
||||
-fi
|
||||
-if [ "$sudoers_includedir_count" -eq 0 ]; then
|
||||
+elif [ "$sudoers_includedir_count" -eq 0 ]; then
|
||||
echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
|
||||
+else
|
||||
+ if ! grep -q "^#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" /etc/sudoers
|
||||
+ fi
|
||||
fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..55a072adf3c
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+sed -i "/#includedir.*/d" /etc/sudoers
|
||||
+echo "#includedir /opt/extra_config.d" >> /etc/sudoers
|
||||
|
||||
From 0b20b495ed82cead1a033170b900c13da5260603 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 14:50:11 +0100
|
||||
Subject: [PATCH 4/9] Add tests for sudo file and dir includes in
|
||||
/etc/sudoers.d
|
||||
|
||||
---
|
||||
.../tests/sudoers.d_with_include.fail.sh | 9 +++++++++
|
||||
.../tests/sudoers.d_with_includedir.fail.sh | 9 +++++++++
|
||||
.../tests/sudoers_with_include.fail.sh | 11 +++++++++++
|
||||
3 files changed, 29 insertions(+)
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
create mode 100644 linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..554ef2e060d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+
|
||||
+echo "#include /etc/my-sudoers" > /etc/sudoers.d/my-sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..516b68b5a3e
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+
|
||||
+echo "#includedir /etc/my-sudoers.d" > /etc/sudoers.d/my-sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh
|
||||
new file mode 100644
|
||||
index 00000000000..ad04880e334
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh
|
||||
@@ -0,0 +1,11 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+
|
||||
+if ! grep -q "#include " /etc/sudoers; then
|
||||
+ echo "#include /etc/my-sudoers" >> /etc/sudoers
|
||||
+fi
|
||||
|
||||
From d91e3eefe6c265c27634cb15b0f276a298f81645 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 14:59:18 +0100
|
||||
Subject: [PATCH 5/9] Update rule catch and remove other sudo includes
|
||||
|
||||
Any other #include or #includedir besides:
|
||||
"/etc/sudoers: #includedir /etc/sudoers.d" should be removed.
|
||||
---
|
||||
.../ansible/shared.yml | 14 +++++++++++
|
||||
.../sudoers_default_includedir/bash/shared.sh | 7 ++++--
|
||||
.../oval/shared.xml | 23 +++++++++++++++++++
|
||||
.../sudo/sudoers_default_includedir/rule.yml | 7 +++---
|
||||
4 files changed, 46 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
index d9d5933285f..175a447e0d9 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
@@ -5,3 +5,17 @@
|
||||
# # disruption = low
|
||||
|
||||
{{{ ansible_only_lineinfile(msg='Ensure sudo only has the default includedir', line_regex='^#includedir.*$', path='/etc/sudoers', new_line='#includedir /etc/sudoers.d') }}}
|
||||
+{{{ ansible_lineinfile(msg='Ensure sudoers doesn\'t include other non-default file', regex='^#include[\s]+.*$', path='/etc/sudoers', state='absent') }}}
|
||||
+- name: "Find out if /etc/sudoers.d/* files contain file or directory includes"
|
||||
+ find:
|
||||
+ path: "/etc/sudoers.d"
|
||||
+ patterns: "*"
|
||||
+ contains: '^#include(dir)?\s.*$'
|
||||
+ register: sudoers_d_includes
|
||||
+
|
||||
+- name: "Remove found occurrences of file and directory inclues from /etc/sudoers.d/* files"
|
||||
+ lineinfile:
|
||||
+ path: "{{ item.path }}"
|
||||
+ regexp: '^#include(dir)?\s.*$'
|
||||
+ state: absent
|
||||
+ with_items: "{{ sudoers_d_includes.files }}"
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
index 258af02c121..2d00b471677 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
@@ -1,6 +1,7 @@
|
||||
# platform = multi_platform_all
|
||||
|
||||
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"
|
||||
@@ -8,7 +9,9 @@ if [ "$sudoers_includedir_count" -gt 1 ]; then
|
||||
elif [ "$sudoers_includedir_count" -eq 0 ]; then
|
||||
echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
|
||||
else
|
||||
- if ! grep -q "^#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
- sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" /etc/sudoers
|
||||
+ 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 -i "/^#include\s\+.*/d" "$sudoers_config_file" "${sudoers_config_dir}"/*
|
||||
+sed -i "/^#includedir\s\+.*/d" "${sudoers_config_dir}"/*
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml
|
||||
index 5618c64291c..59cab0b89de 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/oval/shared.xml
|
||||
@@ -3,6 +3,8 @@
|
||||
{{{ oval_metadata("Check if sudo includes only the default includedir") }}}
|
||||
<criteria operator="AND">
|
||||
<criterion comment="Check /etc/sudoers for #includedir" test_ref="test_sudoers_default_includedir" />
|
||||
+ <criterion comment="Check /etc/sudoers for #include" test_ref="test_sudoers_without_include" />
|
||||
+ <criterion comment="Check /etc/sudoers.d for includes" test_ref="test_sudoersd_without_includes" />
|
||||
</criteria>
|
||||
</definition>
|
||||
|
||||
@@ -20,4 +22,25 @@
|
||||
<ind:subexpression operation="equals">/etc/sudoers.d</ind:subexpression>
|
||||
</ind:textfilecontent54_state>
|
||||
|
||||
+ <ind:textfilecontent54_test check="all" check_existence="none_exist"
|
||||
+ comment="audit augenrules rmmod" id="test_sudoers_without_include" version="1">
|
||||
+ <ind:object object_ref="object_sudoers_without_include" />
|
||||
@ -109,202 +433,67 @@ index 0000000..59cab0b
|
||||
+ <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
|
||||
+ </ind:textfilecontent54_object>
|
||||
+
|
||||
+</def-group>
|
||||
</def-group>
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..a97bd3e
|
||||
--- /dev/null
|
||||
index 5c33121f911..3a8c22ac8af 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
+documentation_complete: true
|
||||
+
|
||||
+prodtype: fedora,rhel7,rhel8,rhel9
|
||||
+
|
||||
+title: 'Ensure sudo only includes the default configuration directory'
|
||||
+
|
||||
+description: |-
|
||||
+ Administrators can configure authorized <tt>sudo</tt> users via drop-in files, and it is possible to include
|
||||
+ other directories and configuration files from the file currently being parsed.
|
||||
+
|
||||
+ Make sure that <tt>/etc/sudoers</tt> only includes drop-in configuration files from <tt>/etc/sudoers.d</tt>.
|
||||
+ The <tt>/etc/sudoers</tt> should contain only one <tt>#includedir</tt> directive pointing to
|
||||
@@ -10,7 +10,7 @@ description: |-
|
||||
|
||||
Make sure that <tt>/etc/sudoers</tt> only includes drop-in configuration files from <tt>/etc/sudoers.d</tt>.
|
||||
The <tt>/etc/sudoers</tt> should contain only one <tt>#includedir</tt> directive pointing to
|
||||
- <tt>/etc/sudoers.d</tt>
|
||||
+ <tt>/etc/sudoers.d</tt>, and no file in <tt>/etc/sudoers.d/</tt> should include other files or directories.
|
||||
+ Note that the '#' character doesn't denote a comment in the configuration file.
|
||||
+
|
||||
+rationale: |-
|
||||
+ Some <tt>sudo</tt> configurtion options allow users to run programs without re-authenticating.
|
||||
+ Use of these configuration options makes it easier for one compromised accound to be used to
|
||||
+ compromise other accounts.
|
||||
+
|
||||
+severity: medium
|
||||
+
|
||||
+identifiers:
|
||||
+ cce@rhel7: CCE-86277-1
|
||||
+ cce@rhel8: CCE-86377-9
|
||||
+ cce@rhel9: CCE-86477-7
|
||||
+
|
||||
+references:
|
||||
+ disa: CCI-000366
|
||||
+ srg: SRG-OS-000480-GPOS-00227
|
||||
+ stigid@rhel8: RHEL-08-010379
|
||||
+
|
||||
+ocil_clause: "the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?"
|
||||
+
|
||||
+ocil: |-
|
||||
+ To determine whether <tt>sudo</tt> command includes configuration files from the appropriate directory,
|
||||
+ run the following command:
|
||||
Note that the '#' character doesn't denote a comment in the configuration file.
|
||||
|
||||
rationale: |-
|
||||
@@ -34,5 +34,6 @@ ocil_clause: "the /etc/sudoers doesn't include /etc/sudores.d or includes other
|
||||
ocil: |-
|
||||
To determine whether <tt>sudo</tt> command includes configuration files from the appropriate directory,
|
||||
run the following command:
|
||||
- <pre>$ sudo grep 'include' /etc/sudoers</pre>
|
||||
- If only the line <tt>#includedir /etc/sudoers> is returned, then the drop-in file configuration is set correctly.
|
||||
+ <pre>$ sudo grep -rP '^#include(dir)?' /etc/sudoers /etc/sudoers.d</pre>
|
||||
+ If only the line <tt>/etc/sudoers:#includedir /etc/sudoers.d</tt> is returned, then the drop-in include configuration is set correctly.
|
||||
+ Any other line returned is a finding.
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..ac0c808
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/default_includedir.pass.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..5bad822
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/duplicate_includedir.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# duplicate default entry
|
||||
+if grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..1e0ab8a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/no_includedir.fail.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+sed -i "/#includedir.*/d" /etc/sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..3f14ecc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+mkdir -p /etc/sudoers.d
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+
|
||||
+echo "#include /etc/my-sudoers" > /etc/sudoers.d/my-sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..8951507
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+mkdir -p /etc/sudoers.d
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+
|
||||
+echo "#includedir /etc/my-sudoers.d" > /etc/sudoers.d/my-sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..ad04880
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers_with_include.fail.sh
|
||||
@@ -0,0 +1,11 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure default config is there
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+
|
||||
+if ! grep -q "#include " /etc/sudoers; then
|
||||
+ echo "#include /etc/my-sudoers" >> /etc/sudoers
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..09d14ea
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/two_includedir.fail.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+# Ensure that there are two different indludedirs
|
||||
+if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
+ echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
+fi
|
||||
+echo "#includedir /opt/extra_config.d" >> /etc/sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..55a072a
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/wrong_includedir.fail.sh
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/bash
|
||||
+# platform = multi_platform_all
|
||||
+
|
||||
+sed -i "/#includedir.*/d" /etc/sudoers
|
||||
+echo "#includedir /opt/extra_config.d" >> /etc/sudoers
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index bfb3753..f5fed4a 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -271,6 +271,9 @@ selections:
|
||||
# RHEL-08-010376
|
||||
- sysctl_kernel_perf_event_paranoid
|
||||
|
||||
+ # RHEL-08-010379
|
||||
+ - sudoers_default_includedir
|
||||
+
|
||||
# RHEL-08-010380
|
||||
- sudo_remove_nopasswd
|
||||
From ead72b744f1fc03893184079c079df27780044c2 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 15:00:46 +0100
|
||||
Subject: [PATCH 6/9] Add SRG to sudoers_default_includedir
|
||||
|
||||
---
|
||||
.../system/software/sudo/sudoers_default_includedir/rule.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
index 3a8c22ac8af..a97bd3efb2c 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/rule.yml
|
||||
@@ -27,6 +27,7 @@ identifiers:
|
||||
|
||||
references:
|
||||
disa: CCI-000366
|
||||
+ srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@rhel8: RHEL-08-010379
|
||||
|
||||
ocil_clause: "the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?"
|
||||
|
||||
From c1a08fe6b8e6388b89b190ca74e57af06e7c999c Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 16:12:32 +0100
|
||||
Subject: [PATCH 7/9] Update RHEL8 STIG profile stability data
|
||||
|
||||
---
|
||||
tests/data/profile_stability/rhel8/stig.profile | 1 +
|
||||
tests/data/profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index ec92589..99bccc7 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -478,7 +478,6 @@ CCE-86373-8
|
||||
CCE-86374-6
|
||||
CCE-86375-3
|
||||
CCE-86376-1
|
||||
-CCE-86377-9
|
||||
CCE-86378-7
|
||||
CCE-86379-5
|
||||
CCE-86380-3
|
||||
@@ -576,7 +575,6 @@ CCE-86473-6
|
||||
CCE-86474-4
|
||||
CCE-86475-1
|
||||
CCE-86476-9
|
||||
-CCE-86477-7
|
||||
CCE-86478-5
|
||||
CCE-86479-3
|
||||
CCE-86480-1
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 2411f02..2dbc2e4 100644
|
||||
index e4fee44f9f9..974b28757e9 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -360,6 +360,7 @@ selections:
|
||||
@@ -365,6 +365,7 @@ selections:
|
||||
- sudo_remove_nopasswd
|
||||
- sudo_require_reauthentication
|
||||
- sudo_restrict_privilege_elevation_to_authorized
|
||||
@ -313,10 +502,10 @@ index 2411f02..2dbc2e4 100644
|
||||
- sysctl_crypto_fips_enabled
|
||||
- sysctl_fs_protected_hardlinks
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index f0a9601..cd76884 100644
|
||||
index 83d04775e3a..99e0af4f5a6 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -371,6 +371,7 @@ selections:
|
||||
@@ -376,6 +376,7 @@ selections:
|
||||
- sudo_remove_nopasswd
|
||||
- sudo_require_reauthentication
|
||||
- sudo_restrict_privilege_elevation_to_authorized
|
||||
@ -324,3 +513,84 @@ index f0a9601..cd76884 100644
|
||||
- sudoers_validate_passwd
|
||||
- sysctl_crypto_fips_enabled
|
||||
- sysctl_fs_protected_hardlinks
|
||||
|
||||
From adae3ecbda4362e23cd1f30e053db37d6a1d403b Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 16:59:22 +0100
|
||||
Subject: [PATCH 8/9] Fix Ansible remediation metadata
|
||||
|
||||
---
|
||||
.../sudo/sudoers_default_includedir/ansible/shared.yml | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml b/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
index 175a447e0d9..0d8c9e75184 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/ansible/shared.yml
|
||||
@@ -1,8 +1,8 @@
|
||||
# platform = multi_platform_all
|
||||
-# # reboot = false
|
||||
-# # strategy = configure
|
||||
-# # complexity = low
|
||||
-# # disruption = low
|
||||
+# reboot = false
|
||||
+# strategy = configure
|
||||
+# complexity = low
|
||||
+# disruption = low
|
||||
|
||||
{{{ ansible_only_lineinfile(msg='Ensure sudo only has the default includedir', line_regex='^#includedir.*$', path='/etc/sudoers', new_line='#includedir /etc/sudoers.d') }}}
|
||||
{{{ ansible_lineinfile(msg='Ensure sudoers doesn\'t include other non-default file', regex='^#include[\s]+.*$', path='/etc/sudoers', state='absent') }}}
|
||||
|
||||
From d3f048456908b316c0dcc0bff2328cf87fe6e7de Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 17:39:39 +0100
|
||||
Subject: [PATCH 9/9] Handle case when /etc/sudoers.d doesn't exist
|
||||
|
||||
The remediation skips the directory, and the test scenarios create the
|
||||
dir to ensure the test scenario works.
|
||||
---
|
||||
.../sudo/sudoers_default_includedir/bash/shared.sh | 8 ++++++--
|
||||
.../tests/sudoers.d_with_include.fail.sh | 1 +
|
||||
.../tests/sudoers.d_with_includedir.fail.sh | 1 +
|
||||
3 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
index 2d00b471677..fbff5eb6f30 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/bash/shared.sh
|
||||
@@ -13,5 +13,9 @@ else
|
||||
sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file"
|
||||
fi
|
||||
fi
|
||||
-sed -i "/^#include\s\+.*/d" "$sudoers_config_file" "${sudoers_config_dir}"/*
|
||||
-sed -i "/^#includedir\s\+.*/d" "${sudoers_config_dir}"/*
|
||||
+
|
||||
+sed -i "/^#include\s\+.*/d" "$sudoers_config_file"
|
||||
+
|
||||
+if grep -Pr "^#include(dir)? .*" "$sudoers_config_dir" ; then
|
||||
+ sed -i "/^#include\(dir\)\?\s\+.*/d" "$sudoers_config_dir"/*
|
||||
+fi
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
index 554ef2e060d..3f14ecc1627 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_include.fail.sh
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# platform = multi_platform_all
|
||||
|
||||
+mkdir -p /etc/sudoers.d
|
||||
# Ensure default config is there
|
||||
if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
diff --git a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
index 516b68b5a3e..89515076ff1 100644
|
||||
--- a/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
+++ b/linux_os/guide/system/software/sudo/sudoers_default_includedir/tests/sudoers.d_with_includedir.fail.sh
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# platform = multi_platform_all
|
||||
|
||||
+mkdir -p /etc/sudoers.d
|
||||
# Ensure default config is there
|
||||
if ! grep -q "#includedir /etc/sudoers.d" /etc/sudoers; then
|
||||
echo "#includedir /etc/sudoers.d" >> /etc/sudoers
|
||||
|
@ -1,16 +1,10 @@
|
||||
commit b7f5c68f8172e88aed6ce22fb70dc48ef3148ffa
|
||||
Author: Watson Sato <wsato@redhat.com>
|
||||
Date: Fri Feb 25 18:23:41 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.61-add_RHEL_08_020221-PR_8173.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember_password_auth/rule.yml b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember_password_auth/rule.yml
|
||||
index 62b6f55..523ab62 100644
|
||||
index 5353f60975c..69a36c4959a 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember_password_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember_password_auth/rule.yml
|
||||
@@ -41,7 +41,7 @@ references:
|
||||
srg: SRG-OS-000077-GPOS-00045
|
||||
@@ -43,7 +43,7 @@ references:
|
||||
stigid@ol7: OL07-00-010270
|
||||
stigid@ol8: OL08-00-020220
|
||||
stigid@rhel7: RHEL-07-010270
|
||||
- stigid@rhel8: RHEL-08-020220
|
||||
+ stigid@rhel8: RHEL-08-020221
|
||||
|
@ -1,17 +1,3 @@
|
||||
From f284885e417d86c408c9f94db02b4b7066d316be Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon, 7 Feb 2022 11:34:16 +0100
|
||||
Subject: [PATCH] Add RHEL-08-040321 to RHEL8 STIG profile
|
||||
|
||||
The STIG doesn't recommend the systems to target the graphical
|
||||
environment by default.
|
||||
---
|
||||
.../disabling_xwindows/xwindows_runlevel_target/rule.yml | 1 +
|
||||
products/rhel8/profiles/stig.profile | 3 +++
|
||||
products/rhel8/profiles/stig_gui.profile | 3 +++
|
||||
tests/data/profile_stability/rhel8/stig.profile | 1 +
|
||||
4 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/services/xwindows/disabling_xwindows/xwindows_runlevel_target/rule.yml b/linux_os/guide/services/xwindows/disabling_xwindows/xwindows_runlevel_target/rule.yml
|
||||
index de0e359a44e..df56a30be80 100644
|
||||
--- a/linux_os/guide/services/xwindows/disabling_xwindows/xwindows_runlevel_target/rule.yml
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 8605b236665b1022c7379e87d9445c9ca42e78f3 Mon Sep 17 00:00:00 2001
|
||||
From: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Mon, 14 Feb 2022 11:41:15 +0100
|
||||
Subject: [PATCH] Add SRG references to STIG rules.
|
||||
|
||||
Rules accounts_password_pam_pwquality_password_auth and accounts_password_pam_pwquality_system_auth
|
||||
were missing SRG required references.
|
||||
---
|
||||
.../accounts_password_pam_pwquality_password_auth/rule.yml | 2 ++
|
||||
.../accounts_password_pam_pwquality_system_auth/rule.yml | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_password_auth/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_password_auth/rule.yml
|
||||
index 6c7bb1ad7a0..34dd6e2fcca 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_password_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_password_auth/rule.yml
|
||||
@@ -22,6 +22,8 @@ identifiers:
|
||||
cce@rhel9: CCE-85878-7
|
||||
|
||||
references:
|
||||
+ disa: CCI-000366
|
||||
+ srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@rhel8: RHEL-08-020100
|
||||
|
||||
ocil_clause: 'pam_pwquality.so is not enabled in password-auth'
|
||||
diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_system_auth/rule.yml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_system_auth/rule.yml
|
||||
index ea42ff9b07a..a5189c61608 100644
|
||||
--- a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_system_auth/rule.yml
|
||||
+++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_system_auth/rule.yml
|
||||
@@ -22,6 +22,8 @@ identifiers:
|
||||
cce@rhel9: CCE-85873-8
|
||||
|
||||
references:
|
||||
+ disa: CCI-000366
|
||||
+ srg: SRG-OS-000480-GPOS-00227
|
||||
stigid@rhel8: RHEL-08-020101
|
||||
|
||||
ocil_clause: 'pam_pwquality.so is not enabled in system-auth'
|
@ -1,11 +1,19 @@
|
||||
commit ecedabee39e65415001ba59bf3c927329a10720f
|
||||
Author: Watson Sato <wsato@redhat.com>
|
||||
Date: Mon Feb 28 11:40:02 2022 +0100
|
||||
From bbafe0a7b4b9eb50bc622d9f9f3c0074fca932f9 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Wed, 9 Feb 2022 16:17:52 +0100
|
||||
Subject: [PATCH 1/2] Pass the rule when no time server nor pool is set
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.61-no_time_servers_chrony-PR_8187.patch.
|
||||
If no time server or pool is configured, there is no entry to add
|
||||
maxpoll option to, so the rule should evaluate to pass.
|
||||
---
|
||||
.../oval/shared.xml | 50 +++++++++++++++----
|
||||
.../ntp/chronyd_or_ntpd_set_maxpoll/rule.yml | 2 +
|
||||
.../tests/chrony_no_pool_nor_servers.pass.sh | 12 +++++
|
||||
3 files changed, 54 insertions(+), 10 deletions(-)
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_no_pool_nor_servers.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml
|
||||
index a7b2a62..25a8589 100644
|
||||
index 780c2e2d0ba..76f810123f3 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/oval/shared.xml
|
||||
@@ -3,17 +3,25 @@
|
||||
@ -72,13 +80,13 @@ index a7b2a62..25a8589 100644
|
||||
+
|
||||
</def-group>
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml
|
||||
index 854e8e8..77af724 100644
|
||||
index 20e7467a7b5..c115ad3c115 100644
|
||||
--- a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/rule.yml
|
||||
@@ -11,6 +11,8 @@ description: |-
|
||||
<tt>maxpoll</tt> in <tt>/etc/ntp.conf</tt> or <tt>/etc/chrony.conf</tt>
|
||||
add the following:
|
||||
@@ -13,6 +13,8 @@ description: |-
|
||||
<pre>maxpoll {{{ xccdf_value("var_time_service_set_maxpoll") }}}</pre>
|
||||
to <pre>server</pre> directives. If using chrony any <pre>pool</pre> directives
|
||||
should be configured too.
|
||||
+ If no <tt>server</tt> or <tt>pool</tt> directives are configured, the rule evaluates
|
||||
+ to pass.
|
||||
{{% if product == "rhcos4" %}}
|
||||
@ -86,7 +94,7 @@ index 854e8e8..77af724 100644
|
||||
Note that if the remediation shipping with this content is being used, the
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_no_pool_nor_servers.pass.sh b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_no_pool_nor_servers.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..bbae20f
|
||||
index 00000000000..bbae20fc696
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_or_ntpd_set_maxpoll/tests/chrony_no_pool_nor_servers.pass.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
@ -102,9 +110,43 @@ index 0000000..bbae20f
|
||||
+sed -i "/^server.*/d" /etc/chrony.conf
|
||||
+
|
||||
+systemctl enable chronyd.service
|
||||
|
||||
From 60ef6eb2cce9e53ea256738ff2583b332155a318 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Fri, 11 Feb 2022 12:14:30 +0100
|
||||
Subject: [PATCH 2/2] Add rule ensuring Chrony only uses server directive
|
||||
|
||||
This new rule only asserts that Chrony has at least one time source configured,
|
||||
and that it is done with the 'server' directive.
|
||||
No remediation is provided for rule, that is left for other specialized
|
||||
rules.
|
||||
---
|
||||
.../chronyd_server_directive/oval/shared.xml | 33 +++++++++++++++++++
|
||||
.../ntp/chronyd_server_directive/rule.yml | 32 ++++++++++++++++++
|
||||
.../tests/file_empty.fail.sh | 6 ++++
|
||||
.../tests/file_missing.fail.sh | 6 ++++
|
||||
.../tests/line_missing.fail.sh | 7 ++++
|
||||
.../tests/multiple_servers.pass.sh | 8 +++++
|
||||
.../tests/only_pool.fail.sh | 9 +++++
|
||||
.../tests/only_server.pass.sh | 6 ++++
|
||||
products/rhel8/profiles/stig.profile | 1 +
|
||||
products/rhel9/profiles/stig.profile | 1 +
|
||||
shared/references/cce-redhat-avail.txt | 2 --
|
||||
.../data/profile_stability/rhel8/stig.profile | 1 +
|
||||
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
||||
13 files changed, 111 insertions(+), 2 deletions(-)
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/oval/shared.xml
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/rule.yml
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/tests/file_empty.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/tests/file_missing.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/tests/line_missing.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/tests/multiple_servers.pass.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/tests/only_pool.fail.sh
|
||||
create mode 100644 linux_os/guide/services/ntp/chronyd_server_directive/tests/only_server.pass.sh
|
||||
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/oval/shared.xml b/linux_os/guide/services/ntp/chronyd_server_directive/oval/shared.xml
|
||||
new file mode 100644
|
||||
index 0000000..2244e60
|
||||
index 00000000000..2244e608047
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/oval/shared.xml
|
||||
@@ -0,0 +1,33 @@
|
||||
@ -143,7 +185,7 @@ index 0000000..2244e60
|
||||
+</def-group>
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/rule.yml b/linux_os/guide/services/ntp/chronyd_server_directive/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..6dc24f1
|
||||
index 00000000000..6dc24f1be85
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/rule.yml
|
||||
@@ -0,0 +1,32 @@
|
||||
@ -181,7 +223,7 @@ index 0000000..6dc24f1
|
||||
+ A line with the appropriate server should be returned, any line returned starting with <tt>pool</tt> is a finding.
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/tests/file_empty.fail.sh b/linux_os/guide/services/ntp/chronyd_server_directive/tests/file_empty.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..d1ba075
|
||||
index 00000000000..d1ba0755198
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/tests/file_empty.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
@ -193,7 +235,7 @@ index 0000000..d1ba075
|
||||
+echo "" > /etc/chrony.conf
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/tests/file_missing.fail.sh b/linux_os/guide/services/ntp/chronyd_server_directive/tests/file_missing.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..12a50eb
|
||||
index 00000000000..12a50ebc3d2
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/tests/file_missing.fail.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
@ -205,7 +247,7 @@ index 0000000..12a50eb
|
||||
+rm -f /etc/chrony.conf
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/tests/line_missing.fail.sh b/linux_os/guide/services/ntp/chronyd_server_directive/tests/line_missing.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..bffa8b6
|
||||
index 00000000000..bffa8b62b1b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/tests/line_missing.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
@ -218,7 +260,7 @@ index 0000000..bffa8b6
|
||||
+echo "another line" >> /etc/chrony.conf
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/tests/multiple_servers.pass.sh b/linux_os/guide/services/ntp/chronyd_server_directive/tests/multiple_servers.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5527f38
|
||||
index 00000000000..5527f389316
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/tests/multiple_servers.pass.sh
|
||||
@@ -0,0 +1,8 @@
|
||||
@ -232,7 +274,7 @@ index 0000000..5527f38
|
||||
+echo "server 1.pool.ntp.org" >> /etc/chrony.conf
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/tests/only_pool.fail.sh b/linux_os/guide/services/ntp/chronyd_server_directive/tests/only_pool.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..616fe88
|
||||
index 00000000000..616fe8844fc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/tests/only_pool.fail.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
@ -247,7 +289,7 @@ index 0000000..616fe88
|
||||
+fi
|
||||
diff --git a/linux_os/guide/services/ntp/chronyd_server_directive/tests/only_server.pass.sh b/linux_os/guide/services/ntp/chronyd_server_directive/tests/only_server.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..21a70dc
|
||||
index 00000000000..21a70dc4900
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/services/ntp/chronyd_server_directive/tests/only_server.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
@ -258,10 +300,22 @@ index 0000000..21a70dc
|
||||
+sed -i "^pool.*" /etc/chrony.conf
|
||||
+echo "server 0.pool.ntp.org" > /etc/chrony.conf
|
||||
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
||||
index 7e142a9..bfb3753 100644
|
||||
index 36f606ee461..2bd1fb54316 100644
|
||||
--- a/products/rhel8/profiles/stig.profile
|
||||
+++ b/products/rhel8/profiles/stig.profile
|
||||
@@ -910,6 +910,7 @@ selections:
|
||||
@@ -909,6 +909,7 @@ selections:
|
||||
# RHEL-08-030740
|
||||
# remediation fails because default configuration file contains pool instead of server keyword
|
||||
- chronyd_or_ntpd_set_maxpoll
|
||||
+ - chronyd_server_directive
|
||||
|
||||
# RHEL-08-030741
|
||||
- chronyd_client_only
|
||||
diff --git a/products/rhel9/profiles/stig.profile b/products/rhel9/profiles/stig.profile
|
||||
index 374932cfd32..0d4d7b0ff97 100644
|
||||
--- a/products/rhel9/profiles/stig.profile
|
||||
+++ b/products/rhel9/profiles/stig.profile
|
||||
@@ -909,6 +909,7 @@ selections:
|
||||
# RHEL-08-030740
|
||||
# remediation fails because default configuration file contains pool instead of server keyword
|
||||
- chronyd_or_ntpd_set_maxpoll
|
||||
@ -270,10 +324,10 @@ index 7e142a9..bfb3753 100644
|
||||
# RHEL-08-030741
|
||||
- chronyd_client_only
|
||||
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
||||
index 0584677..ec92589 100644
|
||||
index 8c59c5d3201..0081fe1938f 100644
|
||||
--- a/shared/references/cce-redhat-avail.txt
|
||||
+++ b/shared/references/cce-redhat-avail.txt
|
||||
@@ -188,7 +188,6 @@ CCE-86073-4
|
||||
@@ -152,7 +152,6 @@ CCE-86073-4
|
||||
CCE-86074-2
|
||||
CCE-86075-9
|
||||
CCE-86076-7
|
||||
@ -281,7 +335,7 @@ index 0584677..ec92589 100644
|
||||
CCE-86078-3
|
||||
CCE-86079-1
|
||||
CCE-86080-9
|
||||
@@ -1168,7 +1167,6 @@ CCE-87073-3
|
||||
@@ -1079,7 +1078,6 @@ CCE-87073-3
|
||||
CCE-87074-1
|
||||
CCE-87075-8
|
||||
CCE-87076-6
|
||||
@ -290,10 +344,10 @@ index 0584677..ec92589 100644
|
||||
CCE-87079-0
|
||||
CCE-87080-8
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
||||
index 26391b9..2411f02 100644
|
||||
index 5b06103d72e..7d44f8910d1 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
||||
@@ -154,6 +154,7 @@ selections:
|
||||
@@ -160,6 +160,7 @@ selections:
|
||||
- chronyd_client_only
|
||||
- chronyd_no_chronyc_network
|
||||
- chronyd_or_ntpd_set_maxpoll
|
||||
@ -302,10 +356,10 @@ index 26391b9..2411f02 100644
|
||||
- configure_bashrc_exec_tmux
|
||||
- configure_bind_crypto_policy
|
||||
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
index 31a3264..f0a9601 100644
|
||||
index 11e0ee9515a..91546d1d418 100644
|
||||
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
||||
@@ -165,6 +165,7 @@ selections:
|
||||
@@ -171,6 +171,7 @@ selections:
|
||||
- chronyd_client_only
|
||||
- chronyd_no_chronyc_network
|
||||
- chronyd_or_ntpd_set_maxpoll
|
@ -0,0 +1,50 @@
|
||||
From cd544b1ceec3cfc799faf24fc83e99f950d1c9c9 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Burket <mburket@redhat.com>
|
||||
Date: Wed, 23 Feb 2022 12:21:17 -0600
|
||||
Subject: [PATCH] Ensure that get_implemented_stigs in
|
||||
utils/create_scap_delta_tailoring.py works for all case
|
||||
|
||||
Before this commit using resolved_rules_dir would deselect all rules
|
||||
---
|
||||
utils/create_scap_delta_tailoring.py | 22 ++++++++++------------
|
||||
1 file changed, 10 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/utils/create_scap_delta_tailoring.py b/utils/create_scap_delta_tailoring.py
|
||||
index 90e131cd01a..b1a44858a0f 100755
|
||||
--- a/utils/create_scap_delta_tailoring.py
|
||||
+++ b/utils/create_scap_delta_tailoring.py
|
||||
@@ -103,24 +103,22 @@ def get_implemented_stigs(product, root_path, build_config_yaml_path,
|
||||
build_root):
|
||||
platform_rules = get_platform_rules(product, json_path, resolved_rules_dir, build_root)
|
||||
|
||||
- if resolved_rules_dir:
|
||||
- platform_rules_dict = dict()
|
||||
- for rule in platform_rules:
|
||||
- platform_rules_dict[rule['id']] = rule
|
||||
- return platform_rules_dict
|
||||
product_dir = os.path.join(root_path, "products", product)
|
||||
product_yaml_path = os.path.join(product_dir, "product.yml")
|
||||
env_yaml = ssg.environment.open_environment(build_config_yaml_path, str(product_yaml_path))
|
||||
|
||||
known_rules = dict()
|
||||
for rule in platform_rules:
|
||||
- try:
|
||||
- rule_obj = handle_rule_yaml(product, rule['id'],
|
||||
- rule['dir'], rule['guide'], env_yaml)
|
||||
- except ssg.yaml.DocumentationNotComplete:
|
||||
- sys.stderr.write('Rule %s throw DocumentationNotComplete' % rule['id'])
|
||||
- # Happens on non-debug build when a rule is "documentation-incomplete"
|
||||
- continue
|
||||
+ if resolved_rules_dir:
|
||||
+ rule_obj = rule
|
||||
+ else:
|
||||
+ try:
|
||||
+ rule_obj = handle_rule_yaml(product, rule['id'],
|
||||
+ rule['dir'], rule['guide'], env_yaml)
|
||||
+ except ssg.yaml.DocumentationNotComplete:
|
||||
+ sys.stderr.write('Rule %s throw DocumentationNotComplete' % rule['id'])
|
||||
+ # Happens on non-debug build when a rule is "documentation-incomplete"
|
||||
+ continue
|
||||
|
||||
if reference_str in rule_obj['references'].keys():
|
||||
ref = rule_obj['references'][reference_str]
|
@ -0,0 +1,26 @@
|
||||
From 9c57a8718f82458fe3784263fdb1e51bd08fff83 Mon Sep 17 00:00:00 2001
|
||||
From: Watson Sato <wsato@redhat.com>
|
||||
Date: Wed, 16 Feb 2022 12:46:21 +0100
|
||||
Subject: [PATCH] Do not remove krb5-workstation package on oVirt
|
||||
|
||||
---
|
||||
.../system-tools/package_krb5-workstation_removed/rule.yml | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/linux_os/guide/system/software/system-tools/package_krb5-workstation_removed/rule.yml b/linux_os/guide/system/software/system-tools/package_krb5-workstation_removed/rule.yml
|
||||
index 4d8951a9148..813474842ec 100644
|
||||
--- a/linux_os/guide/system/software/system-tools/package_krb5-workstation_removed/rule.yml
|
||||
+++ b/linux_os/guide/system/software/system-tools/package_krb5-workstation_removed/rule.yml
|
||||
@@ -27,6 +27,12 @@ references:
|
||||
stigid@ol8: OL08-00-010162
|
||||
stigid@rhel8: RHEL-08-010162
|
||||
|
||||
+platforms:
|
||||
+{{{ rule_notapplicable_when_ovirt_installed() | indent(4)}}}
|
||||
+
|
||||
+warnings:
|
||||
+{{{ ovirt_rule_notapplicable_warning("RHV hosts require ipa-client package, which has dependency on krb5-workstation") | indent(4) }}}
|
||||
+
|
||||
{{{ complete_ocil_entry_package(package="krb5-workstation") }}}
|
||||
|
||||
template:
|
@ -1,12 +1,6 @@
|
||||
commit 3cd2b8efbf9d91967e3e65bd2029f7ab3d400314
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 18:22:28 2022 +0100
|
||||
|
||||
Manual edited patch scap-security-guide-0.1.61-file_groupowner-PR_7791.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..de85c89
|
||||
index 00000000000..de85c892704
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/rule.yml
|
||||
@@ -0,0 +1,38 @@
|
||||
@ -50,7 +44,7 @@ index 0000000..de85c89
|
||||
+ filegid: '0'
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/tests/correct_groupowner.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/tests/correct_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..5235e0d
|
||||
index 00000000000..5235e0d05a3
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/tests/correct_groupowner.pass.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
@ -65,7 +59,7 @@ index 0000000..5235e0d
|
||||
+chgrp root $AUDITFILE
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/tests/incorrect_groupowner.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/tests/incorrect_groupowner.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..52378d8
|
||||
index 00000000000..52378d810a5
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_groupownership_audit_configuration/tests/incorrect_groupowner.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
@ -80,7 +74,7 @@ index 0000000..52378d8
|
||||
+chgrp group_test $TESTFILLE
|
||||
+chgrp group_test $AUDITFILE
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log/rule.yml b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log/rule.yml
|
||||
index 5ddaf9f..b99705d 100644
|
||||
index 5e2cabafc34..927d08d03d4 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log/rule.yml
|
||||
@@ -1,8 +1,15 @@
|
||||
@ -100,7 +94,7 @@ index 5ddaf9f..b99705d 100644
|
||||
|
||||
rationale: |-
|
||||
The <tt>/var/log</tt> directory contains files with logs of error
|
||||
@@ -21,13 +28,16 @@ references:
|
||||
@@ -22,13 +29,16 @@ references:
|
||||
stigid@rhel8: RHEL-08-010260
|
||||
stigid@ubuntu2004: UBTU-20-010417
|
||||
|
||||
@ -121,7 +115,7 @@ index 5ddaf9f..b99705d 100644
|
||||
+ filegid@ubuntu2004: '110'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log_syslog/rule.yml b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log_syslog/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..f654279
|
||||
index 00000000000..f654279fe54
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_groupowner_var_log_syslog/rule.yml
|
||||
@@ -0,0 +1,27 @@
|
||||
@ -154,7 +148,7 @@ index 0000000..f654279
|
||||
+ filegid: '4'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_groupownership_binary_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_groupownership_binary_dirs/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..655b2cd
|
||||
index 00000000000..655b2cd1aef
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_groupownership_binary_dirs/rule.yml
|
||||
@@ -0,0 +1,65 @@
|
||||
@ -225,7 +219,7 @@ index 0000000..655b2cd
|
||||
+ filegid: '0'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_library_dirs/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_library_dirs/ansible/shared.yml
|
||||
deleted file mode 100644
|
||||
index 28df783..0000000
|
||||
index 28df7839430..00000000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_library_dirs/ansible/shared.yml
|
||||
+++ /dev/null
|
||||
@@ -1,23 +0,0 @@
|
||||
@ -254,7 +248,7 @@ index 28df783..0000000
|
||||
- when: library_dirs_not_owned_by_root.matched > 0
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_audit_binaries/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_audit_binaries/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..f61a5f9
|
||||
index 00000000000..f61a5f988dc
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_audit_binaries/rule.yml
|
||||
@@ -0,0 +1,77 @@
|
||||
@ -336,17 +330,17 @@ index 0000000..f61a5f9
|
||||
+ - /sbin/augenrules
|
||||
+ filegid: '0'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/bash/shared.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/bash/shared.sh
|
||||
index 5598e47..a9e8c7d 100644
|
||||
index bb7c72550e9..a9e8c7d8e25 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/bash/shared.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/bash/shared.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
-# platform = multi_platform_sle,Oracle Linux 8,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# platform = multi_platform_sle,Oracle Linux 8,Red Hat Enterprise Linux 8,multi_platform_fedora,multi_platform_ubuntu
|
||||
|
||||
for SYSCMDFILES in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin
|
||||
do
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/tests/incorrect_groupownership.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/tests/incorrect_groupownership.fail.sh
|
||||
index 7cf507c..33a0c85 100644
|
||||
index 7cf507ca5f4..33a0c85d35b 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/tests/incorrect_groupownership.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_groupownership_system_commands_dirs/tests/incorrect_groupownership.fail.sh
|
||||
@@ -1,10 +1,12 @@
|
||||
@ -363,9 +357,54 @@ index 7cf507c..33a0c85 100644
|
||||
- chown nobody.nobody $TESTFILE
|
||||
+ chgrp group_test $TESTFILE
|
||||
done
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
deleted file mode 100644
|
||||
index 08019fd48bb..00000000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
||||
+++ /dev/null
|
||||
@@ -1,26 +0,0 @@
|
||||
-# platform = multi_platform_sle,Oracle Linux 8,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
-# reboot = false
|
||||
-# strategy = restrict
|
||||
-# complexity = high
|
||||
-# disruption = medium
|
||||
-
|
||||
-- name: "Read list libraries without root ownership"
|
||||
- find:
|
||||
- paths:
|
||||
- - "/usr/lib"
|
||||
- - "/usr/lib64"
|
||||
- - "/lib"
|
||||
- - "/lib64"
|
||||
- file_type: "file"
|
||||
- register: library_files_not_group_owned_by_root
|
||||
-
|
||||
-- name: "Set group ownership of system library files to root"
|
||||
- file:
|
||||
- path: "{{ item.path }}"
|
||||
- group: "root"
|
||||
- state: "file"
|
||||
- mode: "{{ item.mode }}"
|
||||
- with_items: "{{ library_files_not_group_owned_by_root.files }}"
|
||||
- when:
|
||||
- - library_files_not_group_owned_by_root.matched > 0
|
||||
- - item.gid != 0
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
||||
deleted file mode 100644
|
||||
index 3a42beafb8a..00000000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
||||
+++ /dev/null
|
||||
@@ -1,7 +0,0 @@
|
||||
-# platform = multi_platform_sle,Oracle Linux 8,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
-
|
||||
-find /lib \
|
||||
-/lib64 \
|
||||
-/usr/lib \
|
||||
-/usr/lib64 \
|
||||
-\! -group root -type f -exec chgrp root '{}' \;
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
deleted file mode 100644
|
||||
index f5ca938..0000000
|
||||
index f5ca9380b55..00000000000
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
||||
+++ /dev/null
|
||||
@@ -1,27 +0,0 @@
|
||||
@ -397,18 +436,18 @@ index f5ca938..0000000
|
||||
- </unix:file_state>
|
||||
-</def-group>
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
||||
index 83371b8..3b983de 100644
|
||||
index 17923f52ea6..eaf04c8d36c 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
documentation_complete: true
|
||||
|
||||
-prodtype: sle12,sle15,rhel8,fedora
|
||||
-prodtype: fedora,ol8,rhel8,rhel9,sle12,sle15
|
||||
+prodtype: fedora,ol8,rhel8,rhel9,sle12,sle15,ubuntu2004
|
||||
|
||||
title: |-
|
||||
Verify the system-wide library files in directories
|
||||
@@ -44,6 +44,7 @@ references:
|
||||
@@ -46,6 +46,7 @@ references:
|
||||
stigid@rhel8: RHEL-08-010350
|
||||
stigid@sle12: SLES-12-010875
|
||||
stigid@sle15: SLES-15-010355
|
||||
@ -416,7 +455,7 @@ index 83371b8..3b983de 100644
|
||||
|
||||
ocil_clause: 'system wide library files are not group owned by root'
|
||||
|
||||
@@ -57,3 +58,14 @@ ocil: |-
|
||||
@@ -59,3 +60,14 @@ ocil: |-
|
||||
To find if system-wide library files stored in these directories are not group-owned by
|
||||
root run the following command for each directory <i>DIR</i>:
|
||||
<pre>$ sudo find -L <i>DIR</i> ! -group root -type f </pre>
|
||||
@ -431,35 +470,26 @@ index 83371b8..3b983de 100644
|
||||
+ - /usr/lib64/
|
||||
+ file_regex: ^.*$
|
||||
+ filegid: '0'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
index a4ae285..0e982c3 100644
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_groupowner.pass.sh
|
||||
similarity index 86%
|
||||
rename from linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
rename to linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_groupowner.pass.sh
|
||||
index a4ae2854db1..0e982c3b8ca 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_groupowner.pass.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora,multi_platform_ubuntu
|
||||
|
||||
for SYSLIBDIRS in /lib /lib64 /usr/lib /usr/lib64
|
||||
do
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_groupowner.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_groupowner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..a4ae285
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_groupowner.pass.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
+for SYSLIBDIRS in /lib /lib64 /usr/lib /usr/lib64
|
||||
+do
|
||||
+ if [[ -d $SYSLIBDIRS ]]
|
||||
+ then
|
||||
+ find $SYSLIBDIRS ! -group root -type f -exec chgrp root '{}' \;
|
||||
+ fi
|
||||
+done
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
index c96f65b..23a7703 100644
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_groupowner.fail.sh
|
||||
similarity index 70%
|
||||
rename from linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
rename to linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_groupowner.fail.sh
|
||||
index c96f65b989c..23a7703f57d 100644
|
||||
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_groupowner.fail.sh
|
||||
@@ -1,10 +1,11 @@
|
||||
-# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora,multi_platform_ubuntu
|
||||
@ -474,19 +504,33 @@ index c96f65b..23a7703 100644
|
||||
- chown nobody.nobody $TESTFILE
|
||||
+ chgrp group_test $TESTFILE
|
||||
done
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_groupowner.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_groupowner.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..c96f65b
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_groupowner.fail.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
||||
+
|
||||
+for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me
|
||||
+do
|
||||
+ if [[ ! -f $TESTFILE ]]
|
||||
+ then
|
||||
+ touch $TESTFILE
|
||||
diff --git a/shared/templates/file_groupowner/tests/missing_file_test.pass.sh b/shared/templates/file_groupowner/tests/missing_file_test.pass.sh
|
||||
index 938e6b30819..015ff98c99d 100644
|
||||
--- a/shared/templates/file_groupowner/tests/missing_file_test.pass.sh
|
||||
+++ b/shared/templates/file_groupowner/tests/missing_file_test.pass.sh
|
||||
@@ -1,8 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
-{{% if MISSING_FILE_PASS %}}
|
||||
- rm -f {{{ FILEPATH }}}
|
||||
-{{% else %}}
|
||||
- true
|
||||
-{{% endif %}}
|
||||
+{{% for path in FILEPATH %}}
|
||||
+ {{% if MISSING_FILE_PASS %}}
|
||||
+ rm -f {{{ path }}}
|
||||
+ {{% else %}}
|
||||
+ {{% if IS_DIRECTORY and FILE_REGEX %}}
|
||||
+ echo "Create specific tests for this rule because of regex"
|
||||
+ {{% elif IS_DIRECTORY and RECURSIVE %}}
|
||||
+ find -L {{{ path }}} -type d -exec chgrp {{{ FILEGID }}} {} \;
|
||||
+ {{% else %}}
|
||||
+ if [ ! -f {{{ path }}} ]; then
|
||||
+ mkdir -p "$(dirname '{{{ path }}}')"
|
||||
+ touch {{{ path }}}
|
||||
+ fi
|
||||
+ chown nobody.nobody $TESTFILE
|
||||
+done
|
||||
+ chgrp {{{ FILEGID }}} {{{ path }}}
|
||||
+ {{% endif %}}
|
||||
+ {{% endif %}}
|
||||
+{{% endfor %}}
|
||||
|
@ -1,12 +1,6 @@
|
||||
commit 74bab352f4bb5b52beaf70c6f23f60d4af4f9518
|
||||
Author: Gabriel Becker <ggasparb@redhat.com>
|
||||
Date: Thu Feb 24 18:42:09 2022 +0100
|
||||
|
||||
Manual edited scap-security-guide-0.1.61-file_owner-PR_7789.patch.
|
||||
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..968ef33
|
||||
index 00000000000..968ef336148
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/rule.yml
|
||||
@@ -0,0 +1,39 @@
|
||||
@ -51,7 +45,7 @@ index 0000000..968ef33
|
||||
+ fileuid: '0'
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/correct_owner.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/correct_owner.pass.sh
|
||||
new file mode 100644
|
||||
index 0000000..4d67307
|
||||
index 00000000000..4d67307a1ef
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/correct_owner.pass.sh
|
||||
@@ -0,0 +1,6 @@
|
||||
@ -63,7 +57,7 @@ index 0000000..4d67307
|
||||
+chown 0 -R /etc/audit/rules.d/
|
||||
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/incorrect_owner.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/incorrect_owner.fail.sh
|
||||
new file mode 100644
|
||||
index 0000000..337074f
|
||||
index 00000000000..337074fab92
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/incorrect_owner.fail.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
@ -76,7 +70,7 @@ index 0000000..337074f
|
||||
+chown testuser_123 -R /etc/audit/rules.d/
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_owner_var_log_syslog/rule.yml b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_owner_var_log_syslog/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..f1bf515
|
||||
index 00000000000..f1bf515455d
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_owner_var_log_syslog/rule.yml
|
||||
@@ -0,0 +1,27 @@
|
||||
@ -109,7 +103,7 @@ index 0000000..f1bf515
|
||||
+ fileuid: '104'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_binary_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_binary_dirs/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..e236238
|
||||
index 00000000000..e2362388678
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_binary_dirs/rule.yml
|
||||
@@ -0,0 +1,55 @@
|
||||
@ -170,7 +164,7 @@ index 0000000..e236238
|
||||
+ fileuid: '0'
|
||||
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_ownership_audit_binaries/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_ownership_audit_binaries/rule.yml
|
||||
new file mode 100644
|
||||
index 0000000..0c7d9b3
|
||||
index 00000000000..0c7d9b313d5
|
||||
--- /dev/null
|
||||
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_ownership_audit_binaries/rule.yml
|
||||
@@ -0,0 +1,77 @@
|
||||
@ -251,20 +245,8 @@ index 0000000..0c7d9b3
|
||||
+ - /sbin/audispd
|
||||
+ - /sbin/augenrules
|
||||
+ fileuid: '0'
|
||||
diff --git a/products/ubuntu2004/profiles/stig.profile b/products/ubuntu2004/profiles/stig.profile
|
||||
index 4c76824..487de82 100644
|
||||
--- a/products/ubuntu2004/profiles/stig.profile
|
||||
+++ b/products/ubuntu2004/profiles/stig.profile
|
||||
@@ -452,6 +452,7 @@ selections:
|
||||
# UBTU-20-010423 The Ubuntu operating system must have directories that contain system commands set to a mode of 0755 or less permissive.
|
||||
|
||||
# UBTU-20-010424 The Ubuntu operating system must have directories that contain system commands owned by root.
|
||||
+ - dir_ownership_binary_dirs
|
||||
|
||||
# UBTU-20-010425 The Ubuntu operating system must have directories that contain system commands group-owned by root.
|
||||
|
||||
diff --git a/shared/templates/file_owner/ansible.template b/shared/templates/file_owner/ansible.template
|
||||
index 80eaae8..590c9fc 100644
|
||||
index 80eaae8d50b..590c9fc6055 100644
|
||||
--- a/shared/templates/file_owner/ansible.template
|
||||
+++ b/shared/templates/file_owner/ansible.template
|
||||
@@ -25,7 +25,7 @@
|
||||
@ -276,3 +258,31 @@ index 80eaae8..590c9fc 100644
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: "{{{ FILEUID }}}"
|
||||
diff --git a/shared/templates/file_owner/tests/missing_file_test.pass.sh b/shared/templates/file_owner/tests/missing_file_test.pass.sh
|
||||
index 938e6b30819..4e3683f9dcf 100644
|
||||
--- a/shared/templates/file_owner/tests/missing_file_test.pass.sh
|
||||
+++ b/shared/templates/file_owner/tests/missing_file_test.pass.sh
|
||||
@@ -1,8 +1,18 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
-{{% if MISSING_FILE_PASS %}}
|
||||
- rm -f {{{ FILEPATH }}}
|
||||
-{{% else %}}
|
||||
- true
|
||||
-{{% endif %}}
|
||||
+{{% for path in FILEPATH %}}
|
||||
+ {{% if MISSING_FILE_PASS %}}
|
||||
+ rm -f {{{ path }}}
|
||||
+ {{% else %}}
|
||||
+ {{% if IS_DIRECTORY and RECURSIVE %}}
|
||||
+ find -L {{{ path }}} -type d -exec chown {{{ FILEUID }}} {} \;
|
||||
+ {{% else %}}
|
||||
+ if [ ! -f {{{ path }}} ]; then
|
||||
+ mkdir -p "$(dirname '{{{ path }}}')"
|
||||
+ touch {{{ path }}}
|
||||
+ fi
|
||||
+ chown {{{ FILEUID }}} {{{ path }}}
|
||||
+ {{% endif %}}
|
||||
+ {{% endif %}}
|
||||
+{{% endfor %}}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user