Blame SOURCES/scap-security-guide-0.1.61-file_permissions-PR_7788.patch

07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_local_var_log/bash/ubuntu.sh b/linux_os/guide/system/permissions/files/permissions_local_var_log/bash/ubuntu.sh
07cb6b
new file mode 100644
07cb6b
index 00000000000..93fd73e6ece
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_local_var_log/bash/ubuntu.sh
07cb6b
@@ -0,0 +1,14 @@
07cb6b
+# platform = multi_platform_ubuntu
07cb6b
+
07cb6b
+readarray -t files < <(find /var/log/)
07cb6b
+for file in "${files[@]}"; do
07cb6b
+    if basename $file | grep -qE '^.*$'; then
07cb6b
+        chmod 0640 $file
07cb6b
+    fi
07cb6b
+done
07cb6b
+
07cb6b
+if grep -qE "^f \/var\/log\/(btmp|wtmp|lastlog)? " /usr/lib/tmpfiles.d/var.conf; then
07cb6b
+    sed -i --follow-symlinks "s/\(^f[[:space:]]\+\/var\/log\/btmp[[:space:]]\+\)\(\([[:digit:]]\+\)[^ $]*\)/\10640/" /usr/lib/tmpfiles.d/var.conf
07cb6b
+    sed -i --follow-symlinks "s/\(^f[[:space:]]\+\/var\/log\/wtmp[[:space:]]\+\)\(\([[:digit:]]\+\)[^ $]*\)/\10640/" /usr/lib/tmpfiles.d/var.conf
07cb6b
+    sed -i --follow-symlinks "s/\(^f[[:space:]]\+\/var\/log\/lastlog[[:space:]]\+\)\(\([[:digit:]]\+\)[^ $]*\)/\10640/" /usr/lib/tmpfiles.d/var.conf
07cb6b
+fi
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_local_var_log/oval/shared.xml b/linux_os/guide/system/permissions/files/permissions_local_var_log/oval/shared.xml
07cb6b
deleted file mode 100644
07cb6b
index dd95ce05936..00000000000
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_local_var_log/oval/shared.xml
07cb6b
+++ /dev/null
07cb6b
@@ -1,36 +0,0 @@
07cb6b
-<def-group>
07cb6b
-  <definition class="compliance" id="permissions_local_var_log" version="1">
07cb6b
-    {{{ oval_metadata("
07cb6b
-        Checks that files in /var/log have permission at least 0640
07cb6b
-      ") }}}
07cb6b
-    <criteria operator="AND">
07cb6b
-      <criterion test_ref="test_mode_log_files" />
07cb6b
-    </criteria>
07cb6b
-  </definition>
07cb6b
-
07cb6b
-  <unix:file_test  check="all" check_existence="none_exist" comment="log file with less restrictive permission than 0640" id="test_mode_log_files" version="1">
07cb6b
-    <unix:object object_ref="object_file_mode_log_files" />
07cb6b
-  </unix:file_test>
07cb6b
-
07cb6b
-  <unix:file_object comment="log files" id="object_file_mode_log_files" version="1">
07cb6b
-    <unix:path operation="pattern match">^\/var\/log\/</unix:path>
07cb6b
-    <unix:filename operation="pattern match">^.*$</unix:filename>
07cb6b
-    <filter action="include">log_files_permission_more_0640</filter>
07cb6b
-    <filter action="exclude">var_log_symlinks</filter>
07cb6b
-  </unix:file_object>
07cb6b
-
07cb6b
-  <unix:file_state id="log_files_permission_more_0640" version="1" operator="OR">
07cb6b
-     
07cb6b
-    <unix:uexec datatype="boolean">true</unix:uexec>
07cb6b
-    <unix:gwrite datatype="boolean">true</unix:gwrite>
07cb6b
-    <unix:gexec datatype="boolean">true</unix:gexec>
07cb6b
-    <unix:oread datatype="boolean">true</unix:oread>
07cb6b
-    <unix:owrite datatype="boolean">true</unix:owrite>
07cb6b
-    <unix:oexec datatype="boolean">true</unix:oexec>
07cb6b
-  </unix:file_state>
07cb6b
-
07cb6b
-  <unix:file_state id="var_log_symlinks" version="1">
07cb6b
-    <unix:type operation="equals">symbolic link</unix:type>
07cb6b
-  </unix:file_state>
07cb6b
-
07cb6b
-</def-group>
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_local_var_log/rule.yml b/linux_os/guide/system/permissions/files/permissions_local_var_log/rule.yml
07cb6b
index 2b0431b7763..9ce79cfde4e 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_local_var_log/rule.yml
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_local_var_log/rule.yml
07cb6b
@@ -47,3 +47,10 @@ ocil: |-
07cb6b
     
07cb6b
     sudo find /var/log -perm /137 -type f -exec stat -c "%n %a" {} \;
07cb6b
     
07cb6b
+
07cb6b
+template:
07cb6b
+    name: file_permissions
07cb6b
+    vars:
07cb6b
+        filepath: /var/log/
07cb6b
+        file_regex: '.*'
07cb6b
+        filemode: '0640'
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/var_logfile_correct_mode.pass.sh b/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/var_logfile_correct_mode.pass.sh
07cb6b
index 5317ef272b8..1793259cff5 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/var_logfile_correct_mode.pass.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/var_logfile_correct_mode.pass.sh
07cb6b
@@ -1,5 +1,6 @@
07cb6b
 #!/bin/bash
07cb6b
 
07cb6b
+chmod -R 640 /var/log
07cb6b
 mkdir -p /var/log/testme
07cb6b
 touch /var/log/testme/test.log
07cb6b
 chmod 640 /var/log/testme/test.log
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/world_writable_dir.pass.sh b/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/world_writable_dir.pass.sh
07cb6b
index 83db1acf8d3..69b081473a5 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/world_writable_dir.pass.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_local_var_log/tests/world_writable_dir.pass.sh
07cb6b
@@ -1,4 +1,5 @@
07cb6b
 #!/bin/bash
07cb6b
 
07cb6b
+chmod -R 640 /var/log/
07cb6b
 mkdir -p /var/log/testme
07cb6b
 chmod 777 /var/log/testme
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_permissions_var_log/bash/ubuntu.sh b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_permissions_var_log/bash/ubuntu.sh
07cb6b
new file mode 100644
07cb6b
index 00000000000..93962ea66a7
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_permissions_var_log/bash/ubuntu.sh
07cb6b
@@ -0,0 +1,7 @@
07cb6b
+# platform = multi_platform_ubuntu
07cb6b
+
07cb6b
+chmod 0755 /var/log/
07cb6b
+
07cb6b
+if grep -q "^z \/var\/log " /usr/lib/tmpfiles.d/00rsyslog.conf; then
07cb6b
+    sed -i --follow-symlinks "s/\(^z[[:space:]]\+\/var\/log[[:space:]]\+\)\(\([[:digit:]]\+\)[^ $]*\)/\10755/" /usr/lib/tmpfiles.d/00rsyslog.conf
07cb6b
+fi
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_permissions_var_log_syslog/rule.yml b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_permissions_var_log_syslog/rule.yml
07cb6b
new file mode 100644
07cb6b
index 00000000000..73258d40fdc
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_permissions_var_log_syslog/rule.yml
07cb6b
@@ -0,0 +1,28 @@
07cb6b
+documentation_complete: true
07cb6b
+
07cb6b
+title: 'Verify Permissions on /var/log/syslog File'
07cb6b
+
07cb6b
+description: |-
07cb6b
+    {{{ describe_file_permissions(file="/var/log/syslog", perms="0640") }}}
07cb6b
+
07cb6b
+rationale: |-
07cb6b
+    The <tt>/var/log/syslog</tt> file contains logs of error messages in
07cb6b
+    the system and should only be accessed by authorized personnel.
07cb6b
+
07cb6b
+severity: medium
07cb6b
+
07cb6b
+references:
07cb6b
+    disa: CCI-001314
07cb6b
+    srg: SRG-OS-000206-GPOS-00084
07cb6b
+    stigid@ubuntu2004: UBTU-20-010422
07cb6b
+
07cb6b
+ocil_clause: '{{{ ocil_clause_file_permissions(file="/var/log/syslog", perms="-rw-r-----") }}}'
07cb6b
+
07cb6b
+ocil: |-
07cb6b
+    {{{ ocil_file_permissions(file="/var/log/syslog", perms="-rw-r-----") }}}
07cb6b
+
07cb6b
+template:
07cb6b
+    name: file_permissions
07cb6b
+    vars:
07cb6b
+        filepath: /var/log/syslog
07cb6b
+        filemode: '0640'
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_binary_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_binary_dirs/rule.yml
07cb6b
new file mode 100644
07cb6b
index 00000000000..a666c768870
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_binary_dirs/rule.yml
07cb6b
@@ -0,0 +1,57 @@
07cb6b
+documentation_complete: true
07cb6b
+
07cb6b
+title: 'Verify that System Executable Directories Have Restrictive Permissions'
07cb6b
+
07cb6b
+description: |-
07cb6b
+    System executables are stored in the following directories by default:
07cb6b
+    
/bin
07cb6b
+    /sbin
07cb6b
+    /usr/bin
07cb6b
+    /usr/sbin
07cb6b
+    /usr/local/bin
07cb6b
+    /usr/local/sbin
07cb6b
+    These directories should not be group-writable or world-writable.
07cb6b
+    If any directory DIR in these directories is found to be
07cb6b
+    group-writable or world-writable, correct its permission with the
07cb6b
+    following command:
07cb6b
+    
$ sudo chmod go-w DIR
07cb6b
+
07cb6b
+rationale: |-
07cb6b
+    System binaries are executed by privileged users, as well as system services,
07cb6b
+    and restrictive permissions are necessary to ensure execution of these programs
07cb6b
+    cannot be co-opted.
07cb6b
+
07cb6b
+severity: medium
07cb6b
+
07cb6b
+references:
07cb6b
+    disa: CCI-001495
07cb6b
+    srg: SRG-OS-000258-GPOS-00099
07cb6b
+    stigid@ubuntu2004: UBTU-20-010423
07cb6b
+
07cb6b
+ocil_clause: 'any of these files are group-writable or world-writable'
07cb6b
+
07cb6b
+ocil: |-
07cb6b
+    System executables are stored in the following directories by default:
07cb6b
+    
/bin
07cb6b
+    /sbin
07cb6b
+    /usr/bin
07cb6b
+    /usr/sbin
07cb6b
+    /usr/local/bin
07cb6b
+    /usr/local/sbin
07cb6b
+    To find system executables directories that are group-writable or
07cb6b
+    world-writable, run the following command for each directory DIR
07cb6b
+    which contains system executables:
07cb6b
+    
$ sudo find -L DIR -perm /022 -type d
07cb6b
+
07cb6b
+template:
07cb6b
+    name: file_permissions
07cb6b
+    vars:
07cb6b
+        filepath:
07cb6b
+            - /bin/
07cb6b
+            - /sbin/
07cb6b
+            - /usr/bin/
07cb6b
+            - /usr/sbin/
07cb6b
+            - /usr/local/bin/
07cb6b
+            - /usr/local/sbin/
07cb6b
+        recursive: 'true'
07cb6b
+        filemode: '0755'
07cb6b
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
07cb6b
index 3f7239deef9..af078463b05 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/all_dirs_ok.pass.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/all_dirs_ok.pass.sh
07cb6b
@@ -1,4 +1,4 @@
07cb6b
-# platform = multi_platform_sle
07cb6b
+# platform = multi_platform_sle,multi_platform_ubuntu
07cb6b
 DIRS="/lib /lib64 /usr/lib /usr/lib64"
07cb6b
 for dirPath in $DIRS; do
07cb6b
 	find "$dirPath" -perm /022 -type d -exec chmod go-w '{}' \;
07cb6b
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
07cb6b
index 1f68586853d..d58616bcafb 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/owner_only_writable_dir.pass.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/owner_only_writable_dir.pass.sh
07cb6b
@@ -1,5 +1,6 @@
07cb6b
-# platform = multi_platform_sle
07cb6b
+# platform = multi_platform_sle,multi_platform_ubuntu
07cb6b
 DIRS="/lib /lib64 /usr/lib /usr/lib64"
07cb6b
 for dirPath in $DIRS; do
07cb6b
+    chmod -R 755 "$dirPath"
07cb6b
 	mkdir -p "$dirPath/testme" && chmod 700  "$dirPath/testme"
07cb6b
 done
07cb6b
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
07cb6b
index b60a7269568..98d18cde3ea 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_lib.fail.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_lib.fail.sh
07cb6b
@@ -1,4 +1,4 @@
07cb6b
-# platform = multi_platform_sle
07cb6b
+# platform = multi_platform_sle,multi_platform_ubuntu
07cb6b
 DIRS="/lib /lib64"
07cb6b
 for dirPath in $DIRS; do
07cb6b
 	mkdir -p "$dirPath/testme" && chmod 777  "$dirPath/testme"
07cb6b
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
07cb6b
index 5438b51bb6a..6df6e2f8f9b 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_usr_lib.fail.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_permissions_library_dirs/tests/world_writable_dir_on_usr_lib.fail.sh
07cb6b
@@ -1,4 +1,4 @@
07cb6b
-# platform = multi_platform_sle
07cb6b
+# platform = multi_platform_sle,multi_platform_ubuntu
07cb6b
 DIRS="/usr/lib /usr/lib64"
07cb6b
 for dirPath in $DIRS; do
07cb6b
 	mkdir -p "$dirPath/testme" && chmod 777 "$dirPath/testme"
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_audit_binaries/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_audit_binaries/rule.yml
07cb6b
new file mode 100644
07cb6b
index 00000000000..da42e997478
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_audit_binaries/rule.yml
07cb6b
@@ -0,0 +1,78 @@
07cb6b
+documentation_complete: true
07cb6b
+
07cb6b
+prodtype: ubuntu2004
07cb6b
+
07cb6b
+title: 'Verify that audit tools Have Mode 0755 or less'
07cb6b
+
07cb6b
+description: |-
07cb6b
+    The {{{ full_name }}} operating system audit tools must have the proper
07cb6b
+    permissions configured to protected against unauthorized access.
07cb6b
+
07cb6b
+    Verify it by running the following command:
07cb6b
+    
$ stat -c "%n %a" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules
07cb6b
+
07cb6b
+    /sbin/auditctl 755
07cb6b
+    /sbin/aureport 755
07cb6b
+    /sbin/ausearch 755
07cb6b
+    /sbin/autrace 755
07cb6b
+    /sbin/auditd 755
07cb6b
+    /sbin/audispd 755
07cb6b
+    /sbin/augenrules 755
07cb6b
+    
07cb6b
+
07cb6b
+    Audit tools needed to successfully view and manipulate audit information
07cb6b
+    system activity and records. Audit tools include custom queries and report
07cb6b
+    generators
07cb6b
+
07cb6b
+rationale: |-
07cb6b
+    Protecting audit information also includes identifying and protecting the
07cb6b
+    tools used to view and manipulate log data. Therefore, protecting audit
07cb6b
+    tools is necessary to prevent unauthorized operation on audit information.
07cb6b
+ 
07cb6b
+    Operating systems providing tools to interface with audit information
07cb6b
+    will leverage user permissions and roles identifying the user accessing the
07cb6b
+    tools and the corresponding rights the user enjoys to make access decisions
07cb6b
+    regarding the access to audit tools.
07cb6b
+
07cb6b
+severity: medium
07cb6b
+
07cb6b
+references:
07cb6b
+    disa: CCI-001493,CCI-001494
07cb6b
+    srg: SRG-OS-000256-GPOS-00097,SRG-OS-000257-GPOS-00098
07cb6b
+    stigid@ubuntu2004: UBTU-20-010199
07cb6b
+
07cb6b
+ocil: |-
07cb6b
+    Verify it by running the following command:
07cb6b
+    
$ stat -c "%n %a" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules
07cb6b
+
07cb6b
+    /sbin/auditctl 755
07cb6b
+    /sbin/aureport 755
07cb6b
+    /sbin/ausearch 755
07cb6b
+    /sbin/autrace 755
07cb6b
+    /sbin/auditd 755
07cb6b
+    /sbin/audispd 755
07cb6b
+    /sbin/augenrules 755
07cb6b
+    
07cb6b
+
07cb6b
+    If the command does not return all the above lines, the missing ones
07cb6b
+    need to be added.
07cb6b
+
07cb6b
+    Run the following command to correct the permissions of the missing
07cb6b
+    entries:
07cb6b
+    
$ sudo chmod 0755 [audit_tool] 
07cb6b
+
07cb6b
+    Replace "[audit_tool]" with the audit tool that does not have the
07cb6b
+    correct permissions.
07cb6b
+
07cb6b
+template:
07cb6b
+    name: file_permissions
07cb6b
+    vars:
07cb6b
+        filepath:
07cb6b
+            - /sbin/auditctl
07cb6b
+            - /sbin/aureport
07cb6b
+            - /sbin/ausearch
07cb6b
+            - /sbin/autrace
07cb6b
+            - /sbin/auditd
07cb6b
+            - /sbin/audispd
07cb6b
+            - /sbin/augenrules
07cb6b
+        filemode: '0755'
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/bash/shared.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/bash/shared.sh
07cb6b
index de2e1e98dfa..ab89b277a52 100644
07cb6b
--- a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/bash/shared.sh
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/bash/shared.sh
07cb6b
@@ -1,4 +1,4 @@
07cb6b
-# platform = Red Hat Virtualization 4,multi_platform_rhel,multi_platform_ol,multi_platform_sle
07cb6b
+# platform = Red Hat Virtualization 4,multi_platform_rhel,multi_platform_ol,multi_platform_sle,multi_platform_ubuntu
07cb6b
 DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec"
07cb6b
 for dirPath in $DIRS; do
07cb6b
 	find "$dirPath" -perm /022 -exec chmod go-w '{}' \;
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/tests/correct_permissions.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/tests/correct_permissions.pass.sh
07cb6b
new file mode 100644
07cb6b
index 00000000000..59b8838581c
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/tests/correct_permissions.pass.sh
07cb6b
@@ -0,0 +1,6 @@
07cb6b
+#!/bin/bash
07cb6b
+
07cb6b
+DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec"
07cb6b
+for dirPath in $DIRS; do
07cb6b
+    find "$dirPath" -perm /022 -type f -exec chmod 0755 '{}' \;
07cb6b
+done
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/tests/incorrect_permissions.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/tests/incorrect_permissions.fail.sh
07cb6b
new file mode 100644
07cb6b
index 00000000000..9d9ce30064b
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_binary_dirs/tests/incorrect_permissions.fail.sh
07cb6b
@@ -0,0 +1,6 @@
07cb6b
+#!/bin/bash
07cb6b
+
07cb6b
+DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec"
07cb6b
+for dirPath in $DIRS; do
07cb6b
+    find "$dirPath" -type f -exec chmod 0777 '{}' \;
07cb6b
+done
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_library_dirs/tests/correct_permissions.pass.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_library_dirs/tests/correct_permissions.pass.sh
07cb6b
new file mode 100644
07cb6b
index 00000000000..de388e63325
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_library_dirs/tests/correct_permissions.pass.sh
07cb6b
@@ -0,0 +1,6 @@
07cb6b
+#!/bin/bash
07cb6b
+
07cb6b
+DIRS="/lib /lib64 /usr/lib /usr/lib64"
07cb6b
+for dirPath in $DIRS; do
07cb6b
+    chmod -R 755 "$dirPath"
07cb6b
+done
07cb6b
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_library_dirs/tests/incorrect_permissions.fail.sh b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_library_dirs/tests/incorrect_permissions.fail.sh
07cb6b
new file mode 100644
07cb6b
index 00000000000..913e75e7b17
07cb6b
--- /dev/null
07cb6b
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_permissions_library_dirs/tests/incorrect_permissions.fail.sh
07cb6b
@@ -0,0 +1,7 @@
07cb6b
+#!/bin/bash
07cb6b
+
07cb6b
+DIRS="/lib /lib64 /usr/lib /usr/lib64"
07cb6b
+for dirPath in $DIRS; do
07cb6b
+    find "$dirPath" -type d -exec chmod go-w '{}' \;
07cb6b
+    find "$dirPath" -type f -exec chmod go+w '{}' \;
07cb6b
+done
07cb6b
diff --git a/shared/templates/file_permissions/oval.template b/shared/templates/file_permissions/oval.template
07cb6b
index 89083e812c1..6b3616a7f42 100644
07cb6b
--- a/shared/templates/file_permissions/oval.template
07cb6b
+++ b/shared/templates/file_permissions/oval.template
07cb6b
@@ -67,6 +67,11 @@
07cb6b
       #}}
07cb6b
       <filter action="include">state_file_permissions{{{ FILEID }}}_{{{ loop.index0 }}}_mode_not_{{{ FILEMODE }}}</filter>
07cb6b
     {{%- endif %}}
07cb6b
+      <filter action="exclude">exclude_symlinks_{{{ FILEID }}}</filter>
07cb6b
   </unix:file_object>
07cb6b
   {{% endfor %}}
07cb6b
+
07cb6b
+  <unix:file_state id="exclude_symlinks_{{{ FILEID }}}" version="1">
07cb6b
+    <unix:type operation="equals">symbolic link</unix:type>
07cb6b
+  </unix:file_state>
07cb6b
 </def-group>