Blame SOURCES/scap-security-guide-0.1.53-fix_aide_rules-PR_6152.patch

fe0dde
From 78b70a215233846bb1590b2c9fa436372e8cdf18 Mon Sep 17 00:00:00 2001
fe0dde
From: Gabriel Becker <ggasparb@redhat.com>
fe0dde
Date: Mon, 5 Oct 2020 13:34:22 +0200
fe0dde
Subject: [PATCH] Fix regex in aide rules to consider first letter as
fe0dde
 uppercase.
fe0dde
fe0dde
---
fe0dde
 .../aide/aide_use_fips_hashes/bash/shared.sh                  | 2 +-
fe0dde
 .../aide/aide_use_fips_hashes/oval/shared.xml                 | 4 ++--
fe0dde
 .../aide/aide_use_fips_hashes/tests/correct_value.pass.sh     | 1 +
fe0dde
 .../aide/aide_use_fips_hashes/tests/wrong_value.fail.sh       | 2 ++
fe0dde
 .../software-integrity/aide/aide_verify_acls/bash/shared.sh   | 2 +-
fe0dde
 .../software-integrity/aide/aide_verify_acls/oval/shared.xml  | 2 +-
fe0dde
 .../aide/aide_verify_acls/tests/correct_value.pass.sh         | 1 +
fe0dde
 .../aide/aide_verify_acls/tests/wrong_value.fail.sh           | 1 +
fe0dde
 .../aide/aide_verify_ext_attributes/bash/shared.sh            | 2 +-
fe0dde
 .../aide/aide_verify_ext_attributes/oval/shared.xml           | 2 +-
fe0dde
 .../aide_verify_ext_attributes/tests/correct_value.pass.sh    | 1 +
fe0dde
 .../aide/aide_verify_ext_attributes/tests/wrong_value.fail.sh | 1 +
fe0dde
 12 files changed, 14 insertions(+), 7 deletions(-)
fe0dde
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/bash/shared.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/bash/shared.sh
fe0dde
index f957996ecd..3e829abf72 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/bash/shared.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/bash/shared.sh
fe0dde
@@ -5,7 +5,7 @@
fe0dde
 aide_conf="/etc/aide.conf"
fe0dde
 forbidden_hashes=(sha1 rmd160 sha256 whirlpool tiger haval gost crc32)
fe0dde
 
fe0dde
-groups=$(LC_ALL=C grep "^[A-Za-z]\+" $aide_conf | cut -f1 -d ' ' | tr -d ' ' | sort -u)
fe0dde
+groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | cut -f1 -d ' ' | tr -d ' ' | sort -u)
fe0dde
 
fe0dde
 for group in $groups
fe0dde
 do
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/oval/shared.xml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/oval/shared.xml
fe0dde
index 8bd7901266..e800ba49bd 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/oval/shared.xml
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/oval/shared.xml
fe0dde
@@ -18,7 +18,7 @@
fe0dde
   
fe0dde
   version="1">
fe0dde
     <ind:filepath>/etc/aide.conf</ind:filepath>
fe0dde
-    <ind:pattern operation="pattern match">^[a-zA-Z]*[\s]*=[\s]*.*(sha1|rmd160|sha256|whirlpool|tiger|haval|gost|crc32).*$</ind:pattern>
fe0dde
+    <ind:pattern operation="pattern match">^[A-Z][a-zA-Z_]*[\s]*=[\s]*.*(sha1|rmd160|sha256|whirlpool|tiger|haval|gost|crc32).*$</ind:pattern>
fe0dde
     <ind:instance datatype="int" operation="greater than or equal">0</ind:instance>
fe0dde
   </ind:textfilecontent54_object>
fe0dde
 
fe0dde
@@ -31,7 +31,7 @@
fe0dde
   
fe0dde
   version="1">
fe0dde
     <ind:filepath>/etc/aide.conf</ind:filepath>
fe0dde
-    <ind:pattern operation="pattern match">^[a-zA-Z]*[\s]*=[\s]*([a-zA-Z0-9\+]*)$</ind:pattern>
fe0dde
+    <ind:pattern operation="pattern match">^[A-Z][A-Za-z_]*[\s]*=[\s]*([a-zA-Z0-9\+]*)$</ind:pattern>
fe0dde
     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
fe0dde
   </ind:textfilecontent54_object>
fe0dde
   <ind:textfilecontent54_state id="state_aide_use_fips_hashes" version="1">
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/correct_value.pass.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/correct_value.pass.sh
fe0dde
index fb305ce441..c40ce01f7e 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/correct_value.pass.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/correct_value.pass.sh
fe0dde
@@ -5,6 +5,7 @@ yum install -y aide
fe0dde
 
fe0dde
 cat >/etc/aide.conf <
fe0dde
 All = p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux
fe0dde
+option = yes
fe0dde
 /bin All # apply the custom rule to the files in bin 
fe0dde
 /sbin All # apply the same custom rule to the files in sbin 
fe0dde
 EOL
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/wrong_value.fail.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/wrong_value.fail.sh
fe0dde
index 19516ef3b3..f8ae79ce8a 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/wrong_value.fail.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_use_fips_hashes/tests/wrong_value.fail.sh
fe0dde
@@ -5,6 +5,8 @@ yum install -y aide
fe0dde
 
fe0dde
 cat >/etc/aide.conf <
fe0dde
 All = p+i+n+u+g+s+m+S+acl+xattrs+selinux
fe0dde
+option = yes
fe0dde
+Group = selinux
fe0dde
 /bin All # apply the custom rule to the files in bin 
fe0dde
 /sbin All # apply the same custom rule to the files in sbin 
fe0dde
 EOL
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/bash/shared.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/bash/shared.sh
fe0dde
index 31190a28de..1de7a6f893 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/bash/shared.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/bash/shared.sh
fe0dde
@@ -4,7 +4,7 @@
fe0dde
 
fe0dde
 aide_conf="/etc/aide.conf"
fe0dde
 
fe0dde
-groups=$(LC_ALL=C grep "^[A-Za-z]\+" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u)
fe0dde
+groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u)
fe0dde
 
fe0dde
 for group in $groups
fe0dde
 do
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/oval/shared.xml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/oval/shared.xml
fe0dde
index 5b7368a7f7..b9b45d28a2 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/oval/shared.xml
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/oval/shared.xml
fe0dde
@@ -16,7 +16,7 @@
fe0dde
   
fe0dde
   version="2">
fe0dde
     <ind:filepath>/etc/aide.conf</ind:filepath>
fe0dde
-    <ind:pattern operation="pattern match">^(?!ALLXTRAHASHES)[a-zA-Z]*[\s]*=[\s]*([a-zA-Z0-9\+]*)$</ind:pattern>
fe0dde
+    <ind:pattern operation="pattern match">^(?!ALLXTRAHASHES)[A-Z][a-zA-Z_]*[\s]*=[\s]*([a-zA-Z0-9\+]*)$</ind:pattern>
fe0dde
     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
fe0dde
   </ind:textfilecontent54_object>
fe0dde
 
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/correct_value.pass.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/correct_value.pass.sh
fe0dde
index fb305ce441..c40ce01f7e 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/correct_value.pass.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/correct_value.pass.sh
fe0dde
@@ -5,6 +5,7 @@ yum install -y aide
fe0dde
 
fe0dde
 cat >/etc/aide.conf <
fe0dde
 All = p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux
fe0dde
+option = yes
fe0dde
 /bin All # apply the custom rule to the files in bin 
fe0dde
 /sbin All # apply the same custom rule to the files in sbin 
fe0dde
 EOL
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/wrong_value.fail.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/wrong_value.fail.sh
fe0dde
index 651f7a631a..e6f18ff5b8 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/wrong_value.fail.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/tests/wrong_value.fail.sh
fe0dde
@@ -5,6 +5,7 @@ yum install -y aide
fe0dde
 
fe0dde
 cat >/etc/aide.conf <
fe0dde
 All = p+i+n+u+g+s+m+S+sha512+xattrs+selinux
fe0dde
+option = yes
fe0dde
 /bin All # apply the custom rule to the files in bin 
fe0dde
 /sbin All # apply the same custom rule to the files in sbin 
fe0dde
 EOL
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/bash/shared.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/bash/shared.sh
fe0dde
index a25ff2423e..1bce723a70 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/bash/shared.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/bash/shared.sh
fe0dde
@@ -4,7 +4,7 @@
fe0dde
 
fe0dde
 aide_conf="/etc/aide.conf"
fe0dde
 
fe0dde
-groups=$(LC_ALL=C grep "^[A-Za-z]\+" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u)
fe0dde
+groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u)
fe0dde
 
fe0dde
 for group in $groups
fe0dde
 do
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/oval/shared.xml b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/oval/shared.xml
fe0dde
index 8b64dddf9f..5ea93bb32a 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/oval/shared.xml
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/oval/shared.xml
fe0dde
@@ -16,7 +16,7 @@
fe0dde
   
fe0dde
   version="2">
fe0dde
     <ind:filepath>/etc/aide.conf</ind:filepath>
fe0dde
-    <ind:pattern operation="pattern match">^(?!ALLXTRAHASHES)[a-zA-Z]*[\s]*=[\s]*([a-zA-Z0-9\+]*)$</ind:pattern>
fe0dde
+    <ind:pattern operation="pattern match">^(?!ALLXTRAHASHES)[A-Z][a-zA-Z_]*[\s]*=[\s]*([a-zA-Z0-9\+]*)$</ind:pattern>
fe0dde
     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
fe0dde
   </ind:textfilecontent54_object>
fe0dde
 
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/correct_value.pass.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/correct_value.pass.sh
fe0dde
index fb305ce441..c40ce01f7e 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/correct_value.pass.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/correct_value.pass.sh
fe0dde
@@ -5,6 +5,7 @@ yum install -y aide
fe0dde
 
fe0dde
 cat >/etc/aide.conf <
fe0dde
 All = p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux
fe0dde
+option = yes
fe0dde
 /bin All # apply the custom rule to the files in bin 
fe0dde
 /sbin All # apply the same custom rule to the files in sbin 
fe0dde
 EOL
fe0dde
diff --git a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/wrong_value.fail.sh b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/wrong_value.fail.sh
fe0dde
index 970bd91536..9507131248 100644
fe0dde
--- a/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/wrong_value.fail.sh
fe0dde
+++ b/linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_ext_attributes/tests/wrong_value.fail.sh
fe0dde
@@ -5,6 +5,7 @@ yum install -y aide
fe0dde
 
fe0dde
 cat >/etc/aide.conf <
fe0dde
 All = p+i+n+u+g+s+m+S+sha512+acl+selinux
fe0dde
+option = yes
fe0dde
 /bin All # apply the custom rule to the files in bin 
fe0dde
 /sbin All # apply the same custom rule to the files in sbin 
fe0dde
 EOL