|
|
362bfa |
From f7bb6fc32091ad9d10ec8253505086670eb135ba Mon Sep 17 00:00:00 2001
|
|
|
362bfa |
From: Carlos Matos <cmatos@redhat.com>
|
|
|
362bfa |
Date: Mon, 12 Jul 2021 10:06:41 -0400
|
|
|
362bfa |
Subject: [PATCH 1/4] Initial commit for RHEL-08-010350 STIG rule
|
|
|
362bfa |
|
|
|
362bfa |
---
|
|
|
362bfa |
.../ansible/shared.yml | 2 +-
|
|
|
362bfa |
.../bash/shared.sh | 2 +-
|
|
|
362bfa |
.../oval/shared.xml | 44 +++++++++++++------
|
|
|
362bfa |
.../rule.yml | 26 ++++++-----
|
|
|
362bfa |
.../tests/correct_group.pass.sh | 2 +-
|
|
|
362bfa |
.../tests/incorrect_group.fail.sh | 8 +++-
|
|
|
362bfa |
products/rhel8/profiles/stig.profile | 1 +
|
|
|
362bfa |
shared/references/cce-redhat-avail.txt | 1 -
|
|
|
362bfa |
.../data/profile_stability/rhel8/stig.profile | 1 +
|
|
|
362bfa |
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
|
|
362bfa |
10 files changed, 57 insertions(+), 31 deletions(-)
|
|
|
362bfa |
|
|
|
362bfa |
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
|
|
|
362bfa |
index f90c8e26b15..e0bb6b0dc1a 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
|
|
362bfa |
@@ -1,4 +1,4 @@
|
|
|
362bfa |
-# platform = multi_platform_sle
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
# reboot = false
|
|
|
362bfa |
# strategy = restrict
|
|
|
362bfa |
# complexity = high
|
|
|
362bfa |
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
|
|
|
362bfa |
index fba25be6132..d5fb89487d5 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/bash/shared.sh
|
|
|
362bfa |
@@ -1,4 +1,4 @@
|
|
|
362bfa |
-# platform = multi_platform_sle
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
|
|
|
362bfa |
find /lib \
|
|
|
362bfa |
/lib64 \
|
|
|
362bfa |
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
|
|
|
362bfa |
index 00f733ddc78..e3d64a8390e 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
|
|
362bfa |
@@ -1,27 +1,45 @@
|
|
|
362bfa |
<def-group>
|
|
|
362bfa |
- <definition class="compliance" id="root_permissions_syslibrary_files" version="2">
|
|
|
362bfa |
+ <definition class="compliance" id="root_permissions_syslibrary_files" version="1">
|
|
|
362bfa |
{{{ oval_metadata("
|
|
|
362bfa |
- Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
|
|
362bfa |
- are owned by root.
|
|
|
362bfa |
+ Checks that /lib, /lib64, /usr/lib, /usr/lib64, and
|
|
|
362bfa |
+ objects therein, are group-owned by root.
|
|
|
362bfa |
") }}}
|
|
|
362bfa |
- <criteria >
|
|
|
362bfa |
- <criterion test_ref="test_root_permissions_for_syslibrary_files" />
|
|
|
362bfa |
+ <criteria operator="AND">
|
|
|
362bfa |
+ <criterion test_ref="test_group_ownership_lib_dir" />
|
|
|
362bfa |
+ <criterion test_ref="test_group_ownership_lib_files" />
|
|
|
362bfa |
</criteria>
|
|
|
362bfa |
</definition>
|
|
|
362bfa |
|
|
|
362bfa |
- <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">
|
|
|
362bfa |
- <unix:object object_ref="root_permissions_for_system_wide_library_files" />
|
|
|
362bfa |
+ <unix:file_test check="all" check_existence="none_exist" comment="library directories gid root" id="test_group_ownership_lib_dir" version="1">
|
|
|
362bfa |
+ <unix:object object_ref="object_group_ownership_lib_dir" />
|
|
|
362bfa |
</unix:file_test>
|
|
|
362bfa |
|
|
|
362bfa |
- <unix:file_object comment="system-wide directories" id="root_permissions_for_system_wide_library_files" version="1">
|
|
|
362bfa |
-
|
|
|
362bfa |
- are owned by root. -->
|
|
|
362bfa |
- <unix:path operation="pattern match">^\/lib(64)?|^\/usr\/lib(64)?</unix:path >
|
|
|
362bfa |
+ <unix:file_test check="all" check_existence="none_exist" comment="library files gid root" id="test_group_ownership_lib_files" version="1">
|
|
|
362bfa |
+ <unix:object object_ref="object_group_ownership_lib_files" />
|
|
|
362bfa |
+ </unix:file_test>
|
|
|
362bfa |
+
|
|
|
362bfa |
+ <unix:file_object comment="library directories" id="object_group_ownership_lib_dir" version="1">
|
|
|
362bfa |
+
|
|
|
362bfa |
+ <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
|
|
362bfa |
+ <unix:filename xsi:nil="true" />
|
|
|
362bfa |
+ <filter action="include">state_group_ownership_libraries_not_root</filter>
|
|
|
362bfa |
+ <filter action="exclude">group_dir_perms_state_symlink</filter>
|
|
|
362bfa |
+ </unix:file_object>
|
|
|
362bfa |
+
|
|
|
362bfa |
+ <unix:file_object comment="library files" id="object_group_ownership_lib_files" version="1">
|
|
|
362bfa |
+
|
|
|
362bfa |
+ <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
|
|
362bfa |
<unix:filename operation="pattern match">^.*$</unix:filename>
|
|
|
362bfa |
- <filter action="include">group_permissions_for_system_wide_files_are_not_root</filter>
|
|
|
362bfa |
+ <filter action="include">state_group_ownership_libraries_not_root</filter>
|
|
|
362bfa |
+ <filter action="exclude">group_dir_perms_state_symlink</filter>
|
|
|
362bfa |
</unix:file_object>
|
|
|
362bfa |
|
|
|
362bfa |
- <unix:file_state id="group_permissions_for_system_wide_files_are_not_root" version="1" >
|
|
|
362bfa |
+ <unix:file_state id="state_group_ownership_libraries_not_root" version="1">
|
|
|
362bfa |
<unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
|
|
362bfa |
</unix:file_state>
|
|
|
362bfa |
+
|
|
|
362bfa |
+ <unix:file_state id="group_dir_perms_state_symlink" version="1">
|
|
|
362bfa |
+ <unix:type operation="equals">symbolic link</unix:type>
|
|
|
362bfa |
+ </unix:file_state>
|
|
|
362bfa |
+
|
|
|
362bfa |
</def-group>
|
|
|
362bfa |
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
|
|
|
362bfa |
index ff905dd08d..83371b8b9b 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/rule.yml
|
|
|
362bfa |
@@ -1,6 +1,6 @@
|
|
|
362bfa |
documentation_complete: true
|
|
|
362bfa |
|
|
|
362bfa |
-prodtype: sle12,sle15
|
|
|
362bfa |
+prodtype: sle12,sle15,rhel8,fedora
|
|
|
362bfa |
|
|
|
362bfa |
title: |-
|
|
|
362bfa |
Verify the system-wide library files in directories
|
|
|
362bfa |
@@ -17,18 +17,18 @@ description: |-
|
|
|
362bfa |
All system-wide shared library files should be protected from unauthorised
|
|
|
362bfa |
access. If any of these files is not owned by root, correct its owner with
|
|
|
362bfa |
the following command:
|
|
|
362bfa |
- $ sudo chgrp root DIR
|
|
|
362bfa |
+ $ sudo chgrp root FILE
|
|
|
362bfa |
|
|
|
362bfa |
rationale: |-
|
|
|
362bfa |
- If the operating system were to allow any user to make changes to software libraries,
|
|
|
362bfa |
- then those changes might be implemented without undergoing the appropriate testing and
|
|
|
362bfa |
- approvals that are part of a robust change management process.
|
|
|
362bfa |
+ If the operating system were to allow any user to make changes to software libraries,
|
|
|
362bfa |
+ then those changes might be implemented without undergoing the appropriate testing and
|
|
|
362bfa |
+ approvals that are part of a robust change management process.
|
|
|
362bfa |
|
|
|
362bfa |
- This requirement applies to operating systems with software libraries that are
|
|
|
362bfa |
- accessible and configurable, as in the case of interpreted languages. Software libraries
|
|
|
362bfa |
- also include privileged programs which execute with escalated privileges. Only qualified
|
|
|
362bfa |
- and authorized individuals must be allowed to obtain access to information system components
|
|
|
362bfa |
- for purposes of initiating changes, including upgrades and modifications.
|
|
|
362bfa |
+ This requirement applies to operating systems with software libraries that are
|
|
|
362bfa |
+ accessible and configurable, as in the case of interpreted languages. Software libraries
|
|
|
362bfa |
+ also include privileged programs which execute with escalated privileges. Only qualified
|
|
|
362bfa |
+ and authorized individuals must be allowed to obtain access to information system components
|
|
|
362bfa |
+ for purposes of initiating changes, including upgrades and modifications.
|
|
|
362bfa |
|
|
|
362bfa |
severity: medium
|
|
|
362bfa |
|
|
|
362bfa |
@@ -45,7 +45,7 @@ references:
|
|
|
362bfa |
stigid@sle12: SLES-12-010875
|
|
|
362bfa |
stigid@sle15: SLES-15-010355
|
|
|
362bfa |
|
|
|
362bfa |
-ocil_clause: 'any system wide library directory is returned'
|
|
|
362bfa |
+ocil_clause: 'system wide library files are not group owned by root'
|
|
|
362bfa |
|
|
|
362bfa |
ocil: |-
|
|
|
362bfa |
System-wide library files are stored in the following directories:
|
|
|
362bfa |
@@ -54,6 +54,6 @@ ocil: |-
|
|
|
362bfa |
/usr/lib
|
|
|
362bfa |
/usr/lib64
|
|
|
362bfa |
|
|
|
362bfa |
- To find if system-wide library files stored in these directories are group-owned by
|
|
|
362bfa |
+ To find if system-wide library files stored in these directories are not group-owned by
|
|
|
362bfa |
root run the following command for each directory DIR:
|
|
|
362bfa |
$ sudo find -L DIR ! -group root -type f
|
|
|
362bfa |
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
|
|
|
362bfa |
index 7a8e65b4f3a..8722c2add65 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
|
|
362bfa |
@@ -4,6 +4,6 @@ for SYSLIBDIRS in /lib /lib64 /usr/lib /usr/lib64
|
|
|
362bfa |
do
|
|
|
362bfa |
if [[ -d $SYSLIBDIRS ]]
|
|
|
362bfa |
then
|
|
|
362bfa |
- find $SYSLIBDIRS ! -group root -type f -exec chgrp root '{}' \;
|
|
|
362bfa |
+ find $SYSLIBDIRS ! -group root -exec chgrp root '{}' \;
|
|
|
362bfa |
fi
|
|
|
362bfa |
done
|
|
|
362bfa |
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
|
|
|
362bfa |
index a4b99a9da14..1079046d14e 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
|
|
362bfa |
@@ -1,6 +1,10 @@
|
|
|
362bfa |
#!/bin/bash
|
|
|
362bfa |
-
|
|
|
362bfa |
-for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me
|
|
|
362bfa |
+
|
|
|
362bfa |
+# There is a high probability that there will be nested subdirectories within the
|
|
|
362bfa |
+# shared system library directories, therefore we should test to make sure we
|
|
|
362bfa |
+# cover this. - cmm
|
|
|
362bfa |
+test -d /usr/lib/test_dir || mkdir -p /usr/lib/test_dir && chown nobody.nobody /usr/lib/test_dir
|
|
|
362bfa |
+for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me /usr/lib/test_dir/test_me
|
|
|
362bfa |
do
|
|
|
362bfa |
if [[ ! -f $TESTFILE ]]
|
|
|
362bfa |
then
|
|
|
362bfa |
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
|
|
362bfa |
index 2508008d511..9569b2ad629 100644
|
|
|
362bfa |
--- a/products/rhel8/profiles/stig.profile
|
|
|
362bfa |
+++ b/products/rhel8/profiles/stig.profile
|
|
|
362bfa |
@@ -207,6 +207,7 @@ selections:
|
|
|
362bfa |
- file_ownership_library_dirs
|
|
|
362bfa |
|
|
|
362bfa |
# RHEL-08-010350
|
|
|
362bfa |
+ - root_permissions_syslibrary_files
|
|
|
362bfa |
|
|
|
362bfa |
# RHEL-08-010360
|
|
|
362bfa |
- package_aide_installed
|
|
|
362bfa |
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
|
|
362bfa |
index f139d2ed76f..e0eb5ac045c 100644
|
|
|
362bfa |
--- a/shared/references/cce-redhat-avail.txt
|
|
|
362bfa |
+++ b/shared/references/cce-redhat-avail.txt
|
|
|
362bfa |
@@ -662,7 +662,6 @@ CCE-86518-8
|
|
|
362bfa |
CCE-86520-4
|
|
|
362bfa |
CCE-86521-2
|
|
|
362bfa |
CCE-86522-0
|
|
|
362bfa |
-CCE-86523-8
|
|
|
362bfa |
CCE-86524-6
|
|
|
362bfa |
CCE-86525-3
|
|
|
362bfa |
CCE-86526-1
|
|
|
362bfa |
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
|
|
362bfa |
index 765487c6f16..ebe7a91f45d 100644
|
|
|
362bfa |
--- a/tests/data/profile_stability/rhel8/stig.profile
|
|
|
362bfa |
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
|
|
362bfa |
@@ -221,6 +221,7 @@ selections:
|
|
|
362bfa |
- postfix_client_configure_mail_alias
|
|
|
362bfa |
- require_emergency_target_auth
|
|
|
362bfa |
- require_singleuser_auth
|
|
|
362bfa |
+- root_permissions_syslibrary_files
|
|
|
362bfa |
- rsyslog_cron_logging
|
|
|
362bfa |
- rsyslog_remote_access_monitoring
|
|
|
362bfa |
- rsyslog_remote_loghost
|
|
|
362bfa |
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
|
|
362bfa |
index 9fd80aac727..97f940dc9ed 100644
|
|
|
362bfa |
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
|
|
362bfa |
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
|
|
362bfa |
@@ -232,6 +232,7 @@ selections:
|
|
|
362bfa |
- postfix_client_configure_mail_alias
|
|
|
362bfa |
- require_emergency_target_auth
|
|
|
362bfa |
- require_singleuser_auth
|
|
|
362bfa |
+- root_permissions_syslibrary_files
|
|
|
362bfa |
- rsyslog_cron_logging
|
|
|
362bfa |
- rsyslog_remote_access_monitoring
|
|
|
362bfa |
- rsyslog_remote_loghost
|
|
|
362bfa |
|
|
|
362bfa |
From f16c085894e4dc7974637d44bf226d3acf19f3d1 Mon Sep 17 00:00:00 2001
|
|
|
362bfa |
From: Carlos Matos <cmatos@redhat.com>
|
|
|
362bfa |
Date: Mon, 12 Jul 2021 16:17:23 -0400
|
|
|
362bfa |
Subject: [PATCH 2/4] Updated existing rules for syslibrary files/dirs
|
|
|
362bfa |
|
|
|
362bfa |
---
|
|
|
362bfa |
.../ansible/shared.yml | 6 ++-
|
|
|
362bfa |
.../bash/shared.sh | 7 +++
|
|
|
362bfa |
.../dir_group_ownership_library_dirs/rule.yml | 4 ++
|
|
|
362bfa |
.../tests/all_dirs_ok.pass.sh | 3 +-
|
|
|
362bfa |
.../nobody_group_owned_dir_on_lib.fail.sh | 3 +-
|
|
|
362bfa |
.../ansible/shared.yml | 23 ++++++++--
|
|
|
362bfa |
.../oval/shared.xml | 44 ++++++-------------
|
|
|
362bfa |
.../tests/correct_group.pass.sh | 4 +-
|
|
|
362bfa |
.../tests/incorrect_group.fail.sh | 8 +---
|
|
|
362bfa |
products/rhel8/profiles/stig.profile | 1 +
|
|
|
362bfa |
shared/references/cce-redhat-avail.txt | 1 -
|
|
|
362bfa |
.../data/profile_stability/rhel8/stig.profile | 1 +
|
|
|
362bfa |
.../profile_stability/rhel8/stig_gui.profile | 1 +
|
|
|
362bfa |
13 files changed, 59 insertions(+), 47 deletions(-)
|
|
|
362bfa |
create mode 100644 linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
|
|
362bfa |
|
|
|
362bfa |
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
|
|
|
362bfa |
index 80562991ac5..f6f2ab48afd 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/ansible/shared.yml
|
|
|
362bfa |
@@ -1,4 +1,4 @@
|
|
|
362bfa |
-# platform = multi_platform_sle
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
# reboot = false
|
|
|
362bfa |
# strategy = restrict
|
|
|
362bfa |
# complexity = medium
|
|
|
362bfa |
@@ -20,4 +20,6 @@
|
|
|
362bfa |
state: "directory"
|
|
|
362bfa |
mode: "{{ item.mode }}"
|
|
|
362bfa |
with_items: "{{ library_dirs_not_group_owned_by_root.files }}"
|
|
|
362bfa |
- when: library_dirs_not_group_owned_by_root.matched > 0
|
|
|
362bfa |
+ when:
|
|
|
362bfa |
+ - library_dirs_not_group_owned_by_root.matched > 0
|
|
|
362bfa |
+ - item.gid != 0
|
|
|
362bfa |
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
|
|
|
362bfa |
new file mode 100644
|
|
|
362bfa |
index 00000000000..365b9833188
|
|
|
362bfa |
--- /dev/null
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/bash/shared.sh
|
|
|
362bfa |
@@ -0,0 +1,7 @@
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
+
|
|
|
362bfa |
+find /lib \
|
|
|
362bfa |
+/lib64 \
|
|
|
362bfa |
+/usr/lib \
|
|
|
362bfa |
+/usr/lib64 \
|
|
|
362bfa |
+\! -group root -type d -exec chgrp root '{}' \;
|
|
|
362bfa |
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
|
|
|
362bfa |
index 4ff043270c8..cd02d95cb1c 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/rule.yml
|
|
|
362bfa |
@@ -1,5 +1,7 @@
|
|
|
362bfa |
documentation_complete: true
|
|
|
362bfa |
|
|
|
362bfa |
+prodtype: sle12,sle15,rhel8,fedora
|
|
|
362bfa |
+
|
|
|
362bfa |
title: 'Verify that Shared Library Directories Have Root Group Ownership'
|
|
|
362bfa |
|
|
|
362bfa |
description: |-
|
|
|
362bfa |
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
|
|
|
362bfa |
index 2a38e9a88bc..50fdb17bd2e 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/all_dirs_ok.pass.sh
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_group_ownership_library_dirs/tests/all_dirs_ok.pass.sh
|
|
|
362bfa |
@@ -1,4 +1,5 @@
|
|
|
362bfa |
-# platform = multi_platform_sle
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
+
|
|
|
362bfa |
DIRS="/lib /lib64 /usr/lib /usr/lib64"
|
|
|
362bfa |
for dirPath in $DIRS; do
|
|
|
362bfa |
find "$dirPath" -type d -exec chgrp root '{}' \;
|
|
|
362bfa |
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
|
|
|
362bfa |
index f794d9e878f..277bd7d60de 100644
|
|
|
362bfa |
--- 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
|
|
|
362bfa |
+++ 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
|
|
|
362bfa |
@@ -1,4 +1,5 @@
|
|
|
362bfa |
-# platform = multi_platform_sle
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
+
|
|
|
362bfa |
DIRS="/lib /lib64"
|
|
|
362bfa |
for dirPath in $DIRS; do
|
|
|
362bfa |
mkdir -p "$dirPath/testme" && chown root:nogroup "$dirPath/testme"
|
|
|
362bfa |
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
|
|
|
362bfa |
index e0bb6b0dc1a..ab3e85c4f7c 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/ansible/shared.yml
|
|
|
362bfa |
@@ -4,7 +4,24 @@
|
|
|
362bfa |
# complexity = high
|
|
|
362bfa |
# disruption = medium
|
|
|
362bfa |
|
|
|
362bfa |
-- name: "Set ownership to root of system-wide library files"
|
|
|
362bfa |
- command: "find {{ item }} ! -group root -type f -exec chgrp root '{}' \\;"
|
|
|
362bfa |
- with_items: [ '/lib', '/lib64', '/usr/lib', '/usr/lib64' ]
|
|
|
362bfa |
+- name: "Read list libraries without root ownership"
|
|
|
362bfa |
+ find:
|
|
|
362bfa |
+ paths:
|
|
|
362bfa |
+ - "/usr/lib"
|
|
|
362bfa |
+ - "/usr/lib64"
|
|
|
362bfa |
+ - "/lib"
|
|
|
362bfa |
+ - "/lib64"
|
|
|
362bfa |
+ file_type: "file"
|
|
|
362bfa |
+ register: library_files_not_group_owned_by_root
|
|
|
362bfa |
+
|
|
|
362bfa |
+- name: "Set group ownership of system library files to root"
|
|
|
362bfa |
+ file:
|
|
|
362bfa |
+ path: "{{ item.path }}"
|
|
|
362bfa |
+ group: "root"
|
|
|
362bfa |
+ state: "file"
|
|
|
362bfa |
+ mode: "{{ item.mode }}"
|
|
|
362bfa |
+ with_items: "{{ library_files_not_group_owned_by_root.files }}"
|
|
|
362bfa |
+ when:
|
|
|
362bfa |
+ - library_files_not_group_owned_by_root.matched > 0
|
|
|
362bfa |
+ - item.gid != 0
|
|
|
362bfa |
|
|
|
362bfa |
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
|
|
|
362bfa |
index e3d64a8390e..926ff70d1e4 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
|
|
362bfa |
@@ -1,45 +1,27 @@
|
|
|
362bfa |
<def-group>
|
|
|
362bfa |
- <definition class="compliance" id="root_permissions_syslibrary_files" version="1">
|
|
|
362bfa |
+ <definition class="compliance" id="root_permissions_syslibrary_files" version="2">
|
|
|
362bfa |
{{{ oval_metadata("
|
|
|
362bfa |
- Checks that /lib, /lib64, /usr/lib, /usr/lib64, and
|
|
|
362bfa |
- objects therein, are group-owned by root.
|
|
|
362bfa |
+ Checks that system-wide library files in /lib, /lib64, /usr/lib, /usr/lib64
|
|
|
362bfa |
+ are owned by root.
|
|
|
362bfa |
") }}}
|
|
|
362bfa |
- <criteria operator="AND">
|
|
|
362bfa |
- <criterion test_ref="test_group_ownership_lib_dir" />
|
|
|
362bfa |
- <criterion test_ref="test_group_ownership_lib_files" />
|
|
|
362bfa |
+ <criteria >
|
|
|
362bfa |
+ <criterion test_ref="test_root_permissions_for_syslibrary_files" />
|
|
|
362bfa |
</criteria>
|
|
|
362bfa |
</definition>
|
|
|
362bfa |
|
|
|
362bfa |
- <unix:file_test check="all" check_existence="none_exist" comment="library directories gid root" id="test_group_ownership_lib_dir" version="1">
|
|
|
362bfa |
- <unix:object object_ref="object_group_ownership_lib_dir" />
|
|
|
362bfa |
+ <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">
|
|
|
362bfa |
+ <unix:object object_ref="root_permissions_for_system_wide_library_files" />
|
|
|
362bfa |
</unix:file_test>
|
|
|
362bfa |
|
|
|
362bfa |
- <unix:file_test check="all" check_existence="none_exist" comment="library files gid root" id="test_group_ownership_lib_files" version="1">
|
|
|
362bfa |
- <unix:object object_ref="object_group_ownership_lib_files" />
|
|
|
362bfa |
- </unix:file_test>
|
|
|
362bfa |
-
|
|
|
362bfa |
- <unix:file_object comment="library directories" id="object_group_ownership_lib_dir" version="1">
|
|
|
362bfa |
-
|
|
|
362bfa |
- <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
|
|
362bfa |
- <unix:filename xsi:nil="true" />
|
|
|
362bfa |
- <filter action="include">state_group_ownership_libraries_not_root</filter>
|
|
|
362bfa |
- <filter action="exclude">group_dir_perms_state_symlink</filter>
|
|
|
362bfa |
- </unix:file_object>
|
|
|
362bfa |
-
|
|
|
362bfa |
- <unix:file_object comment="library files" id="object_group_ownership_lib_files" version="1">
|
|
|
362bfa |
-
|
|
|
362bfa |
- <unix:path operation="pattern match">^\/lib(|64)?\/|^\/usr\/lib(|64)?\/</unix:path>
|
|
|
362bfa |
+ <unix:file_object comment="system-wide directories" id="root_permissions_for_system_wide_library_files" version="1">
|
|
|
362bfa |
+
|
|
|
362bfa |
+ are owned by root. -->
|
|
|
362bfa |
+ <unix:path operation="pattern match">^\/lib\/|^\/lib64\/|^\/usr\/lib\/|^\/usr\/lib64\/</unix:path>
|
|
|
362bfa |
<unix:filename operation="pattern match">^.*$</unix:filename>
|
|
|
362bfa |
- <filter action="include">state_group_ownership_libraries_not_root</filter>
|
|
|
362bfa |
- <filter action="exclude">group_dir_perms_state_symlink</filter>
|
|
|
362bfa |
+ <filter action="include">group_permissions_for_system_wide_files_are_not_root</filter>
|
|
|
362bfa |
</unix:file_object>
|
|
|
362bfa |
|
|
|
362bfa |
- <unix:file_state id="state_group_ownership_libraries_not_root" version="1">
|
|
|
362bfa |
+ <unix:file_state id="group_permissions_for_system_wide_files_are_not_root" version="1" >
|
|
|
362bfa |
<unix:group_id datatype="int" operation="not equal">0</unix:group_id>
|
|
|
362bfa |
</unix:file_state>
|
|
|
362bfa |
-
|
|
|
362bfa |
- <unix:file_state id="group_dir_perms_state_symlink" version="1">
|
|
|
362bfa |
- <unix:type operation="equals">symbolic link</unix:type>
|
|
|
362bfa |
- </unix:file_state>
|
|
|
362bfa |
-
|
|
|
362bfa |
</def-group>
|
|
|
362bfa |
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
|
|
|
362bfa |
index 8722c2add65..a4ae2854db1 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/correct_group.pass.sh
|
|
|
362bfa |
@@ -1,9 +1,9 @@
|
|
|
362bfa |
-#!/bin/bash
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
|
|
|
362bfa |
for SYSLIBDIRS in /lib /lib64 /usr/lib /usr/lib64
|
|
|
362bfa |
do
|
|
|
362bfa |
if [[ -d $SYSLIBDIRS ]]
|
|
|
362bfa |
then
|
|
|
362bfa |
- find $SYSLIBDIRS ! -group root -exec chgrp root '{}' \;
|
|
|
362bfa |
+ find $SYSLIBDIRS ! -group root -type f -exec chgrp root '{}' \;
|
|
|
362bfa |
fi
|
|
|
362bfa |
done
|
|
|
362bfa |
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
|
|
|
362bfa |
index 1079046d14e..c96f65b989c 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/tests/incorrect_group.fail.sh
|
|
|
362bfa |
@@ -1,10 +1,6 @@
|
|
|
362bfa |
-#!/bin/bash
|
|
|
362bfa |
+# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
|
|
|
362bfa |
-# There is a high probability that there will be nested subdirectories within the
|
|
|
362bfa |
-# shared system library directories, therefore we should test to make sure we
|
|
|
362bfa |
-# cover this. - cmm
|
|
|
362bfa |
-test -d /usr/lib/test_dir || mkdir -p /usr/lib/test_dir && chown nobody.nobody /usr/lib/test_dir
|
|
|
362bfa |
-for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me /usr/lib/test_dir/test_me
|
|
|
362bfa |
+for TESTFILE in /lib/test_me /lib64/test_me /usr/lib/test_me /usr/lib64/test_me
|
|
|
362bfa |
do
|
|
|
362bfa |
if [[ ! -f $TESTFILE ]]
|
|
|
362bfa |
then
|
|
|
362bfa |
diff --git a/products/rhel8/profiles/stig.profile b/products/rhel8/profiles/stig.profile
|
|
|
362bfa |
index 9569b2ad629..059750f59d0 100644
|
|
|
362bfa |
--- a/products/rhel8/profiles/stig.profile
|
|
|
362bfa |
+++ b/products/rhel8/profiles/stig.profile
|
|
|
362bfa |
@@ -208,6 +208,7 @@ selections:
|
|
|
362bfa |
|
|
|
362bfa |
# RHEL-08-010350
|
|
|
362bfa |
- root_permissions_syslibrary_files
|
|
|
362bfa |
+ - dir_group_ownership_library_dirs
|
|
|
362bfa |
|
|
|
362bfa |
# RHEL-08-010360
|
|
|
362bfa |
- package_aide_installed
|
|
|
362bfa |
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
|
|
|
362bfa |
index e0eb5ac045c..ae3375fd4d4 100644
|
|
|
362bfa |
--- a/shared/references/cce-redhat-avail.txt
|
|
|
362bfa |
+++ b/shared/references/cce-redhat-avail.txt
|
|
|
362bfa |
@@ -34,7 +34,6 @@ CCE-85890-2
|
|
|
362bfa |
CCE-85891-0
|
|
|
362bfa |
CCE-85892-8
|
|
|
362bfa |
CCE-85893-6
|
|
|
362bfa |
-CCE-85894-4
|
|
|
362bfa |
CCE-85895-1
|
|
|
362bfa |
CCE-85896-9
|
|
|
362bfa |
CCE-85897-7
|
|
|
362bfa |
diff --git a/tests/data/profile_stability/rhel8/stig.profile b/tests/data/profile_stability/rhel8/stig.profile
|
|
|
362bfa |
index ebe7a91f45d..49cce4d81cc 100644
|
|
|
362bfa |
--- a/tests/data/profile_stability/rhel8/stig.profile
|
|
|
362bfa |
+++ b/tests/data/profile_stability/rhel8/stig.profile
|
|
|
362bfa |
@@ -99,6 +99,7 @@ selections:
|
|
|
362bfa |
- dconf_gnome_login_banner_text
|
|
|
362bfa |
- dconf_gnome_screensaver_idle_delay
|
|
|
362bfa |
- dconf_gnome_screensaver_lock_enabled
|
|
|
362bfa |
+- dir_group_ownership_library_dirs
|
|
|
362bfa |
- dir_perms_world_writable_root_owned
|
|
|
362bfa |
- dir_perms_world_writable_sticky_bits
|
|
|
362bfa |
- directory_permissions_var_log_audit
|
|
|
362bfa |
diff --git a/tests/data/profile_stability/rhel8/stig_gui.profile b/tests/data/profile_stability/rhel8/stig_gui.profile
|
|
|
362bfa |
index 97f940dc9ed..943a57d3eb8 100644
|
|
|
362bfa |
--- a/tests/data/profile_stability/rhel8/stig_gui.profile
|
|
|
362bfa |
+++ b/tests/data/profile_stability/rhel8/stig_gui.profile
|
|
|
362bfa |
@@ -110,6 +110,7 @@ selections:
|
|
|
362bfa |
- dconf_gnome_login_banner_text
|
|
|
362bfa |
- dconf_gnome_screensaver_idle_delay
|
|
|
362bfa |
- dconf_gnome_screensaver_lock_enabled
|
|
|
362bfa |
+- dir_group_ownership_library_dirs
|
|
|
362bfa |
- dir_perms_world_writable_root_owned
|
|
|
362bfa |
- dir_perms_world_writable_sticky_bits
|
|
|
362bfa |
- directory_permissions_var_log_audit
|
|
|
362bfa |
|
|
|
362bfa |
From 71deac482753a13a9f98d6d7382b13e9031a2ce4 Mon Sep 17 00:00:00 2001
|
|
|
362bfa |
From: Carlos Matos <cmatos@redhat.com>
|
|
|
362bfa |
Date: Tue, 13 Jul 2021 13:40:25 -0400
|
|
|
362bfa |
Subject: [PATCH 3/4] Updated test for nobody_group_owned_dir rule
|
|
|
362bfa |
|
|
|
362bfa |
---
|
|
|
362bfa |
.../tests/nobody_group_owned_dir_on_lib.fail.sh | 4 ++--
|
|
|
362bfa |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
362bfa |
|
|
|
362bfa |
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
|
|
|
362bfa |
index 277bd7d60de..043ad6b2dee 100644
|
|
|
362bfa |
--- 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
|
|
|
362bfa |
+++ 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
|
|
|
362bfa |
@@ -1,6 +1,6 @@
|
|
|
362bfa |
# platform = multi_platform_sle,Red Hat Enterprise Linux 8,multi_platform_fedora
|
|
|
362bfa |
|
|
|
362bfa |
-DIRS="/lib /lib64"
|
|
|
362bfa |
+DIRS="/lib /lib64 /usr/lib /usr/lib64"
|
|
|
362bfa |
for dirPath in $DIRS; do
|
|
|
362bfa |
- mkdir -p "$dirPath/testme" && chown root:nogroup "$dirPath/testme"
|
|
|
362bfa |
+ mkdir -p "$dirPath/testme" && chgrp nobody "$dirPath/testme"
|
|
|
362bfa |
done
|
|
|
362bfa |
|
|
|
362bfa |
From 087359679e4f6794054b6772df6c84c4cd1fee94 Mon Sep 17 00:00:00 2001
|
|
|
362bfa |
From: Carlos Matos <cmatos@redhat.com>
|
|
|
362bfa |
Date: Wed, 14 Jul 2021 10:04:25 -0400
|
|
|
362bfa |
Subject: [PATCH 4/4] Added recommended $ to end of regex pattern to properly
|
|
|
362bfa |
match dirs
|
|
|
362bfa |
|
|
|
362bfa |
---
|
|
|
362bfa |
.../root_permissions_syslibrary_files/oval/shared.xml | 2 +-
|
|
|
362bfa |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
362bfa |
|
|
|
362bfa |
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
|
|
|
362bfa |
index 926ff70d1e4..f5ca9380b55 100644
|
|
|
362bfa |
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
|
|
362bfa |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/root_permissions_syslibrary_files/oval/shared.xml
|
|
|
362bfa |
@@ -16,7 +16,7 @@
|
|
|
362bfa |
<unix:file_object comment="system-wide directories" id="root_permissions_for_system_wide_library_files" version="1">
|
|
|
362bfa |
|
|
|
362bfa |
are owned by root. -->
|
|
|
362bfa |
- <unix:path operation="pattern match">^\/lib\/|^\/lib64\/|^\/usr\/lib\/|^\/usr\/lib64\/</unix:path>
|
|
|
362bfa |
+ <unix:path operation="pattern match">^\/lib(|64)?$|^\/usr\/lib(|64)?$</unix:path>
|
|
|
362bfa |
<unix:filename operation="pattern match">^.*$</unix:filename>
|
|
|
362bfa |
<filter action="include">group_permissions_for_system_wide_files_are_not_root</filter>
|
|
|
362bfa |
</unix:file_object>
|