Blame SOURCES/crypto_kerboeros_fix.patch

575137
From 78ae04d629ede2185093d7183eba57a1539fefef Mon Sep 17 00:00:00 2001
575137
From: Watson Sato <wsato@redhat.com>
575137
Date: Fri, 4 Jan 2019 15:46:48 +0100
575137
Subject: [PATCH] Enhance configure_kerberos_crypto_policy check
575137
575137
The goal of this check is to verify that /etc/krb5.conf.d/crypto-policies is
575137
a symlink, and points to /etc/crypto-policies/back-ends/krb5.config.
575137
575137
As the symlink_test goes all the way through to the canonical path,
575137
and the canonical path is the actual selected policy configuration, thus check
575137
was dependent on selected policy and was failing when symlink was
575137
correct, but selected crypto policy was wrong.
575137
575137
Making sure that /etc/krb5.conf.d/crypto-polices links to correct crypto-policy
575137
is not the poinof this check. With this changes, the check is now
575137
verifying the symlink independently of the selected crypto policy.
575137
---
575137
 .../oval/shared.xml                           | 50 +++++++++++--------
575137
 1 file changed, 28 insertions(+), 22 deletions(-)
575137
575137
diff --git a/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/oval/shared.xml b/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/oval/shared.xml
575137
index 23d9c077d2..235345e985 100644
575137
--- a/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/oval/shared.xml
575137
+++ b/linux_os/guide/system/software/integrity/crypto/configure_kerberos_crypto_policy/oval/shared.xml
575137
@@ -1,5 +1,5 @@
575137
 {{%- if target_oval_version == [5, 11] -%}}
575137
-{{# there is no good alternative for symlink_test for OVAL 5.10 #}}
575137
+{{# there is no good alternative for symlink_object for OVAL 5.10 #}}
575137
 <def-group>
575137
   <definition class="compliance" id="configure_kerberos_crypto_policy" version="1">
575137
     <metadata>
575137
@@ -11,33 +11,39 @@
575137
       <description>Kerberos should be configured to use the system-wide crypto policy setting.</description>
575137
     </metadata>
575137
     <criteria>
575137
-      <criterion comment="kerberos crypto-policy softlink exists" test_ref="test_configure_kerberos_crypto_policy" />
575137
+      <criterion comment="kerberos crypto-policy configuration links to same file as kerberos crypto-policy backend" test_ref="test_configure_kerberos_crypto_policy" />
575137
     </criteria>
575137
   </definition>
575137
 
575137
-  <external_variable comment="defined crypto policy" datatype="string" id="var_system_crypto_policy" version="1" />
575137
+  
575137
+  and it ignores any intermediary symlink,
575137
+  we check that both, /etc/krb5.conf.d/crypto-policies and,
575137
+  /etc/crypto-policies/back-ends/krb5.config point to the same file -->
575137
 
575137
-  
575137
-  and the canonical path is the actual selected policy configuration,
575137
-  we need to know the targeted crypto policy to check if kerberos crypto policy is linked correctly -->
575137
-  <local_variable id="var_kerberos_policy_regex" datatype="string" comment="regex variable for canonical path to targeted kerberos policy" version="1">
575137
-    <concat>
575137
-      <literal_component>^/usr/share/crypto-policies/</literal_component>
575137
-      <variable_component var_ref="var_system_crypto_policy"/>
575137
-      <literal_component>/krb5.txt$</literal_component>
575137
-    </concat>
575137
-  </local_variable>
575137
+  <ind:variable_test id="test_configure_kerberos_crypto_policy" check="all" check_existence="all_exist" comment="Check if kerberos configuration symlink and crypto policy kerberos backend symlink point to same file" version="1">
575137
+    <ind:object object_ref="object_symlink_kerberos_crypto_policy_configuration" />
575137
+    <ind:state state_ref="state_symlink_kerberos_crypto_policy_backend" />
575137
+  </ind:variable_test>
575137
+  <ind:variable_object id="object_symlink_kerberos_crypto_policy_configuration" version="1">
575137
+    <ind:var_ref>var_symlink_kerberos_crypto_policy_configuration</ind:var_ref>
575137
+  </ind:variable_object>
575137
+  <ind:variable_state id="state_symlink_kerberos_crypto_policy_backend" version="1">
575137
+    <ind:value datatype="string" operation="equals" var_ref="var_symlink_kerberos_crypto_policy_backend"/>
575137
+  </ind:variable_state>
575137
 
575137
-  <unix:symlink_test check="all" check_existence="all_exist" comment="kerberos crypto-policy softlink exists" id="test_configure_kerberos_crypto_policy" version="1">
575137
-    <unix:object object_ref="object_configure_kerberos_crypto_policy" />
575137
-    <unix:state state_ref="state_configure_kerberos_crypto_policy" />
575137
-  </unix:symlink_test>
575137
-  <unix:symlink_object comment="kerberos crypto-policy softlink exists" id="object_configure_kerberos_crypto_policy" version="1">
575137
+  <unix:symlink_object comment="kerberos crypto-policy configuration softlink" id="object_kerberos_crypto_policy_configuration" version="1">
575137
     <unix:filepath>/etc/krb5.conf.d/crypto-policies</unix:filepath>
575137
   </unix:symlink_object>
575137
-  <unix:symlink_state comment="kerberos crypto-policy is linked to crypto-policy kerberos config" id="state_configure_kerberos_crypto_policy" version="1">
575137
-    <unix:filepath>/etc/krb5.conf.d/crypto-policies</unix:filepath>
575137
-    <unix:canonical_path operation="pattern match" var_ref="var_kerberos_policy_regex"/>
575137
-  </unix:symlink_state>
575137
+  <local_variable id="var_symlink_kerberos_crypto_policy_configuration" datatype="string" comment="regex variable for canonical path to targeted kerberos policy" version="1">
575137
+    <object_component item_field="canonical_path" object_ref="object_kerberos_crypto_policy_configuration"/>
575137
+  </local_variable>
575137
+
575137
+  <unix:symlink_object comment="kerberos crypto-policy backend softlink" id="object_kerberos_crypto_policy_backend" version="1">
575137
+      <unix:filepath>/etc/crypto-policies/back-ends/krb5.config</unix:filepath>
575137
+  </unix:symlink_object>
575137
+  <local_variable id="var_symlink_kerberos_crypto_policy_backend" datatype="string" comment="regex variable for canonical path to targeted kerberos policy" version="1">
575137
+    <object_component item_field="canonical_path" object_ref="object_kerberos_crypto_policy_backend"/>
575137
+  </local_variable>
575137
+
575137
 </def-group>
575137
 {{%- endif -%}}