Blame SOURCES/scap-security-guide-0.1.52-reorganize-zipl-rules_PR_5888.patch

973b04
From 8cbec60a51b54df386bad72cdd82b83fbf9482fa Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Thu, 25 Jun 2020 18:29:31 +0200
973b04
Subject: [PATCH 01/14] Add rule to check for zIPL conformance to BLS
973b04
973b04
Instead of having each zIPL argument rule check for BLS compliance,
973b04
let's split into its own rule.
973b04
---
973b04
 .../zipl_audit_argument/rule.yml              |  6 -----
973b04
 .../rule.yml                                  |  6 -----
973b04
 .../zipl_bls_entries_only/rule.yml            | 24 +++++++++++++++++++
973b04
 .../zipl_enable_selinux/rule.yml              |  6 -----
973b04
 .../zipl_page_poison_argument/rule.yml        |  6 -----
973b04
 .../zipl_pti_argument/rule.yml                |  6 -----
973b04
 .../zipl_slub_debug_argument/rule.yml         |  6 -----
973b04
 .../zipl_vsyscall_argument/rule.yml           |  6 -----
973b04
 8 files changed, 24 insertions(+), 42 deletions(-)
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml
973b04
index 2d31ef8ee7..1211a53295 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To ensure all processes can be audited, even those which start prior to the audit daemon,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>audit=1</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
     To ensure that new kernels and boot entries continue to enable audit,
973b04
@@ -30,10 +28,6 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\baudit=1\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't enable audit.
973b04
 
973b04
-  Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-  
grep -R "^image\s*=" /etc/zipl.conf
973b04
-  No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
   And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
   and <tt>/etc/zipl.conf</tt>:
973b04
   
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
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
973b04
index 40db232257..7d88e38686 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To improve the kernel capacity to queue all log events, even those which start prior to the audit daemon,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>audit_backlog_limit=8192</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
     To ensure that new kernels and boot entries continue to extend the audit log events queue,
973b04
@@ -31,10 +29,6 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\baudit_backlog_limit=0\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that does not extend the log events queue.
973b04
 
973b04
-  Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-  
grep -R "^image\s*=" /etc/zipl.conf
973b04
-  No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
   And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
   and <tt>/etc/zipl.conf</tt>:
973b04
   
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
new file mode 100644
973b04
index 0000000000..b6ccbb5343
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
@@ -0,0 +1,24 @@
973b04
+documentation_complete: true
973b04
+
973b04
+prodtype: rhel8
973b04
+
973b04
+title: 'Ensure all zIPL boot entries are BLS compliant'
973b04
+
973b04
+description: |-
973b04
+    Ensure that zIPL boot entries fully adheres to Boot Loader Specification (BLS)
973b04
+    by checking that <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt>.
973b04
+
973b04
+rationale: |-
973b04
+    {{{ full_name }}} adheres to Boot Loader Specification (BLS) and is the prefered method of
973b04
+    configuration.
973b04
+
973b04
+severity: medium
973b04
+
973b04
+ocil_clause: 'a non BLS boot entry is configured'
973b04
+
973b04
+ocil: |-
973b04
+  Check that no boot image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
+  
grep -R "^image\s*=" /etc/zipl.conf
973b04
+  No line should be returned, if a line is returned non BLS compliant boot entries are configured for zIPL.
973b04
+
973b04
+platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml
973b04
index 8d28d5495f..1c3bfeb246 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To ensure SELinux is not disabled at boot time,
973b04
     check that no boot entry in <tt>/boot/loader/entries/*.conf</tt> has <tt>selinux=0</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
 rationale: |-
973b04
@@ -27,10 +25,6 @@ ocil: |-
973b04
     
sudo grep -L "^options\s+.*\bselinux=0\b" /boot/loader/entries/*.conf
973b04
     No line should be returned, each line returned is a boot entry that disables SELinux.
973b04
 
973b04
-    Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-    
grep -R "^image\s*=" /etc/zipl.conf
973b04
-    No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
     And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
     and <tt>/etc/zipl.conf</tt>:
973b04
     
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml
973b04
index 0a8e9a41e2..6dbfd501b7 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To enable poisoning of free pages,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>page_poison=1</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.
973b04
 
973b04
     To ensure that new kernels and boot entries continue to enable page poisoning,
973b04
@@ -31,10 +29,6 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bpage_poison=1\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't enable page poisoning.
973b04
 
973b04
-  Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-  
grep -R "^image\s*=" /etc/zipl.conf
973b04
-  No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
   And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
   and <tt>/etc/zipl.conf</tt>:
973b04
   
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml
973b04
index 20c1448cc8..555fdf2b66 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To enable Kernel page-table isolation,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>pti=on</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
     To ensure that new kernels and boot entries continue to enable page-table isolation,
973b04
@@ -30,10 +28,6 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bpti=on\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't enable page-table isolation .
973b04
 
973b04
-  Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-  
grep -R "^image\s*=" /etc/zipl.conf
973b04
-  No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
   And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
   and <tt>/etc/zipl.conf</tt>:
973b04
   
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml
973b04
index 54ac688ea0..dd7865bf81 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To enable poisoning of SLUB/SLAB objects,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>slub_debug=P</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
     To ensure that new kernels and boot entries continue to extend the audit log events queue,
973b04
@@ -31,10 +29,6 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bslub_debug=P\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that does not enable poisoning.
973b04
 
973b04
-  Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-  
grep -R "^image\s*=" /etc/zipl.conf
973b04
-  No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
   And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
   and <tt>/etc/zipl.conf</tt>:
973b04
   
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml
973b04
index c5979a2016..18b7ade460 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To disable use of virtual syscalls,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>vsyscall=none</tt>
973b04
     included in its options.
973b04
-    Make sure <tt>/etc/zipl.conf</tt> doesn't contain <tt>image = </tt> setting,
973b04
-    as {{{ full_name }}} adheres to Boot Loader Specification (BLS).
973b04
     And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
     To ensure that new kernels and boot entries continue to disable virtual syscalls,
973b04
@@ -28,10 +26,6 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bvsyscall=none\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't disable virtual syscalls.
973b04
 
973b04
-  Check that no image file is specified in <tt>/etc/zipl.conf</tt>:
973b04
-  
grep -R "^image\s*=" /etc/zipl.conf
973b04
-  No line should be returned, if a line is returned zipl may load a different kernel than intended.
973b04
-
973b04
   And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
   and <tt>/etc/zipl.conf</tt>:
973b04
   
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
973b04
From 5e3b19077d781d0441595019429c653efafede8e Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Thu, 2 Jul 2020 09:52:39 +0200
973b04
Subject: [PATCH 02/14] zipl_bls_entries_only: Add OVAL and tests
973b04
973b04
---
973b04
 .../zipl_bls_entries_only/oval/shared.xml     | 27 +++++++++++++++++++
973b04
 .../tests/image_configured.fail.sh            |  6 +++++
973b04
 .../tests/no_image.pass.sh                    |  7 +++++
973b04
 3 files changed, 40 insertions(+)
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/image_configured.fail.sh
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/no_image.pass.sh
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
new file mode 100644
973b04
index 0000000000..41e9773814
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
@@ -0,0 +1,27 @@
973b04
+<def-group>
973b04
+  <definition class="compliance" id="zipl_bls_entries_only" version="1">
973b04
+    <metadata>
973b04
+      <title>Ensure zIPL entries are BLS compliant</title>
973b04
+      {{{- oval_affected(products) }}}
973b04
+      <description>Check if /etc/zipl.conf configures any boot entry</description>
973b04
+    </metadata>
973b04
+    <criteria operator="AND">
973b04
+      
973b04
+      comment="Test presence of image configuration in /etc/zipl.conf" />
973b04
+    </criteria>
973b04
+  </definition>
973b04
+
973b04
+  
973b04
+  comment="Test presence of image configuration in /etc/zipl.conf"
973b04
+  check="all" check_existence="none_exist" version="1">
973b04
+    <ind:object object_ref="object_zipl_bls_entries_only" />
973b04
+  </ind:textfilecontent54_test>
973b04
+
973b04
+  
973b04
+  version="1">
973b04
+    <ind:filepath operation="pattern match">^/etc/zipl.conf$</ind:filepath>
973b04
+    <ind:pattern operation="pattern match">^image\s*=.*$</ind:pattern>
973b04
+    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
973b04
+  </ind:textfilecontent54_object>
973b04
+
973b04
+</def-group>
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/image_configured.fail.sh b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/image_configured.fail.sh
973b04
new file mode 100644
973b04
index 0000000000..e3adb99638
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/image_configured.fail.sh
973b04
@@ -0,0 +1,6 @@
973b04
+#!/bin/bash
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+# remediation = none
973b04
+
973b04
+# Make sure no image configured in zipl config file
973b04
+echo 'image = /boot/image' >> /etc/zipl.conf
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/no_image.pass.sh b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/no_image.pass.sh
973b04
new file mode 100644
973b04
index 0000000000..47626442f6
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/tests/no_image.pass.sh
973b04
@@ -0,0 +1,7 @@
973b04
+#!/bin/bash
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+# remediation = none
973b04
+
973b04
+# Make sure no image configured in zipl config file
973b04
+sed -Ei '/^image\s*=/d' /etc/zipl.conf
973b04
+true
973b04
973b04
From 05e5b05b41080b7fbfaf42469cbb366eeffe35ec Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Thu, 2 Jul 2020 11:09:08 +0200
973b04
Subject: [PATCH 03/14] zipl_bls_entries_only: Add no-remediation warning
973b04
973b04
Automated remediation to remove non-BLS boot entries from /etc/zipl.conf
973b04
is tricky and can lead to broken entries or removal of all of them.
973b04
---
973b04
 .../system/bootloader-zipl/zipl_bls_entries_only/rule.yml    | 5 +++++
973b04
 1 file changed, 5 insertions(+)
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
index b6ccbb5343..f792c5257f 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
@@ -22,3 +22,8 @@ ocil: |-
973b04
   No line should be returned, if a line is returned non BLS compliant boot entries are configured for zIPL.
973b04
 
973b04
 platform: machine
973b04
+
973b04
+warnings:
973b04
+  - general: |-
973b04
+      To prevent breakage or removal of all boot entries oconfigured in /etc/zipl.conf
973b04
+      automated remediation for this rule is not available.
973b04
973b04
From 53d811ed09cd63d4472a2133f3d9dc465dbd2962 Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Thu, 25 Jun 2020 18:51:04 +0200
973b04
Subject: [PATCH 04/14] Add rule to check hotness of zIPL bootmap
973b04
973b04
Instead of having each zIPL argument rule check if zIPL bootmap is up to
973b04
date, let's split it into its own rule.
973b04
---
973b04
 .../zipl_audit_argument/rule.yml              |  6 -----
973b04
 .../rule.yml                                  |  7 -----
973b04
 .../zipl_bootmap_is_up_to_date/rule.yml       | 27 +++++++++++++++++++
973b04
 .../zipl_enable_selinux/rule.yml              |  6 -----
973b04
 .../zipl_page_poison_argument/rule.yml        |  7 -----
973b04
 .../zipl_pti_argument/rule.yml                |  7 -----
973b04
 .../zipl_slub_debug_argument/rule.yml         |  7 -----
973b04
 .../zipl_vsyscall_argument/rule.yml           |  7 -----
973b04
 8 files changed, 27 insertions(+), 47 deletions(-)
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml
973b04
index 1211a53295..624b4e7041 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_audit_argument/rule.yml
973b04
@@ -8,7 +8,6 @@ description: |-
973b04
     To ensure all processes can be audited, even those which start prior to the audit daemon,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>audit=1</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
     To ensure that new kernels and boot entries continue to enable audit,
973b04
     add <tt>audit=1</tt> to <tt>/etc/kernel/cmdline</tt>.
973b04
@@ -28,9 +27,4 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\baudit=1\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't enable audit.
973b04
 
973b04
-  And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-  and <tt>/etc/zipl.conf</tt>:
973b04
-  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
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
973b04
index 7d88e38686..faf114591a 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_audit_backlog_limit_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To improve the kernel capacity to queue all log events, even those which start prior to the audit daemon,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>audit_backlog_limit=8192</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
-
973b04
     To ensure that new kernels and boot entries continue to extend the audit log events queue,
973b04
     add <tt>audit_backlog_limit=8192</tt> to <tt>/etc/kernel/cmdline</tt>.
973b04
 
973b04
@@ -29,9 +27,4 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\baudit_backlog_limit=0\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that does not extend the log events queue.
973b04
 
973b04
-  And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-  and <tt>/etc/zipl.conf</tt>:
973b04
-  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml
973b04
new file mode 100644
973b04
index 0000000000..082562d11e
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml
973b04
@@ -0,0 +1,27 @@
973b04
+documentation_complete: true
973b04
+
973b04
+prodtype: rhel8
973b04
+
973b04
+title: 'Ensure zIPL bootmap is up to date'
973b04
+
973b04
+description: |-
973b04
+    Make sure that <tt>/boot/bootmap</tt> is up to date.
973b04
+    Every time a boot entry or zIPL configuration is changed <tt>/boot/bootmap</tt> needs to
973b04
+    be updated to reflect the changes.
973b04
+    Run <tt>zipl</tt> command to generate an updated <tt>/boot/bootmap</tt>.
973b04
+
973b04
+rationale: |-
973b04
+    The file <tt>/boot/bootmap</tt> contains all boot data, keeping it up to date is crucial to
973b04
+    boot correct kernel and options.
973b04
+
973b04
+severity: medium
973b04
+
973b04
+ocil_clause: 'the bootmap is outdated'
973b04
+
973b04
+ocil: |-
973b04
+  Make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
+  and <tt>/etc/zipl.conf</tt>:
973b04
+  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
+  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> is outdated and needs to be regenerated.
973b04
+
973b04
+platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml
973b04
index 1c3bfeb246..b0bc0fc374 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_enable_selinux/rule.yml
973b04
@@ -8,7 +8,6 @@ description: |-
973b04
     To ensure SELinux is not disabled at boot time,
973b04
     check that no boot entry in <tt>/boot/loader/entries/*.conf</tt> has <tt>selinux=0</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
 
973b04
 rationale: |-
973b04
     Disabling a major host protection feature, such as SELinux, at boot time prevents
973b04
@@ -25,9 +24,4 @@ ocil: |-
973b04
     
sudo grep -L "^options\s+.*\bselinux=0\b" /boot/loader/entries/*.conf
973b04
     No line should be returned, each line returned is a boot entry that disables SELinux.
973b04
 
973b04
-    And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-    and <tt>/etc/zipl.conf</tt>:
973b04
-    
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-    No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml
973b04
index 6dbfd501b7..866664c01b 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_page_poison_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To enable poisoning of free pages,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>page_poison=1</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.
973b04
-
973b04
     To ensure that new kernels and boot entries continue to enable page poisoning,
973b04
     add <tt>page_poison=1</tt> to <tt>/etc/kernel/cmdline</tt>.
973b04
 
973b04
@@ -29,9 +27,4 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bpage_poison=1\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't enable page poisoning.
973b04
 
973b04
-  And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-  and <tt>/etc/zipl.conf</tt>:
973b04
-  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml
973b04
index 555fdf2b66..2f02d9668c 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_pti_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To enable Kernel page-table isolation,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>pti=on</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
-
973b04
     To ensure that new kernels and boot entries continue to enable page-table isolation,
973b04
     add <tt>pti=on</tt> to <tt>/etc/kernel/cmdline</tt>.
973b04
 
973b04
@@ -28,9 +26,4 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bpti=on\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't enable page-table isolation .
973b04
 
973b04
-  And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-  and <tt>/etc/zipl.conf</tt>:
973b04
-  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml
973b04
index dd7865bf81..0cb10d3cd8 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_slub_debug_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To enable poisoning of SLUB/SLAB objects,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>slub_debug=P</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
-
973b04
     To ensure that new kernels and boot entries continue to extend the audit log events queue,
973b04
     add <tt>slub_debug=P</tt> to <tt>/etc/kernel/cmdline</tt>.
973b04
 
973b04
@@ -29,9 +27,4 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bslub_debug=P\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that does not enable poisoning.
973b04
 
973b04
-  And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-  and <tt>/etc/zipl.conf</tt>:
973b04
-  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml
973b04
index 18b7ade460..f79adeb083 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_vsyscall_argument/rule.yml
973b04
@@ -8,8 +8,6 @@ description: |-
973b04
     To disable use of virtual syscalls,
973b04
     check that all boot entries in <tt>/boot/loader/entries/*.conf</tt> have <tt>vsyscall=none</tt>
973b04
     included in its options.
973b04
-    And run <tt>zipl</tt> command so that <tt>/boot/bootmap</tt> is updated.

973b04
-
973b04
     To ensure that new kernels and boot entries continue to disable virtual syscalls,
973b04
     add <tt>vsyscall=none</tt> to <tt>/etc/kernel/cmdline</tt>.
973b04
 
973b04
@@ -26,9 +24,4 @@ ocil: |-
973b04
   
sudo grep -L "^options\s+.*\bvsyscall=none\b" /boot/loader/entries/*.conf
973b04
   No line should be returned, each line returned is a boot entry that doesn't disable virtual syscalls.
973b04
 
973b04
-  And make sure that <tt>/boot/bootmap</tt> is newer than <tt>/boot/loader/entries/*.conf</tt>
973b04
-  and <tt>/etc/zipl.conf</tt>:
973b04
-  
find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap
973b04
-  No line should be returned, if a line is returned <tt>/boot/bootmap</tt> needs to be regenerated.
973b04
-
973b04
 platform: machine
973b04
973b04
From b9f27383a09afbc6cef61bbbaad0f18f9ebec075 Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Thu, 2 Jul 2020 15:59:31 +0200
973b04
Subject: [PATCH 05/14] zipl_bootmap_is_up_to_date: Add OVAL check
973b04
973b04
---
973b04
 .../oval/shared.xml                           | 46 +++++++++++++++++++
973b04
 1 file changed, 46 insertions(+)
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/oval/shared.xml
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/oval/shared.xml b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/oval/shared.xml
973b04
new file mode 100644
973b04
index 0000000000..6c446cbe59
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/oval/shared.xml
973b04
@@ -0,0 +1,46 @@
973b04
+<def-group>
973b04
+  <definition class="compliance" id="zipl_bootmap_is_up_to_date" version="1">
973b04
+    <metadata>
973b04
+      <title>Ensure zIPL bootmap is up to date</title>
973b04
+      {{{- oval_affected(products) }}}
973b04
+      <description>Check if /boot/bootmap is up to date</description>
973b04
+    </metadata>
973b04
+    <criteria operator="AND">
973b04
+      
973b04
+      comment="Compare mtime of /boot/bootmap against /etc/zipl.conf and /boot/loader/entries/*.conf" />
973b04
+    </criteria>
973b04
+  </definition>
973b04
+
973b04
+  <unix:file_test check="all" check_existence="all_exist" id="test_zipl_bootmap_is_up_to_date" version="1" comment="Check /boot/bootmap timestamps">
973b04
+    <unix:object object_ref="object_zipl_boot_bootmap_file" />
973b04
+    <unix:state state_ref="state_zipl_bootmap_is_newer_than_zipl_conf" />
973b04
+    <unix:state state_ref="state_zipl_bootmap_is_newer_than_boot_entries" />
973b04
+  </unix:file_test>
973b04
+
973b04
+  <unix:file_object id="object_zipl_boot_bootmap_file" comment="current bootmap state" version="1">
973b04
+    <unix:filepath>/boot/bootmap</unix:filepath>
973b04
+  </unix:file_object>
973b04
+
973b04
+  
973b04
+  <unix:file_state id="state_zipl_bootmap_is_newer_than_zipl_conf" version="1">
973b04
+    
973b04
+    var_ref="variable_zipl_conf_file_age" />
973b04
+  </unix:file_state>
973b04
+  <local_variable id="variable_zipl_conf_file_age" version="1" comment="Age of /etc/zipl.conf" datatype="int">
973b04
+    <object_component object_ref="zipl_conf_file" item_field="m_time"/>
973b04
+  </local_variable>
973b04
+  <unix:file_object id="zipl_conf_file" comment="/etc/zipl.conf state" version="1">
973b04
+    <unix:filepath datatype="string">/etc/zipl.conf</unix:filepath>
973b04
+  </unix:file_object>
973b04
+
973b04
+  <unix:file_state id="state_zipl_bootmap_is_newer_than_boot_entries" version="1">
973b04
+    
973b04
+    var_ref="variable_boot_entry_files_age" />
973b04
+  </unix:file_state>
973b04
+  <local_variable id="variable_boot_entry_files_age" version="1" comment="Age of /boot/loader/entries/*.conf files" datatype="int">
973b04
+    <object_component object_ref="boot_entry_files" item_field="m_time"/>
973b04
+  </local_variable>
973b04
+  <unix:file_object id="boot_entry_files" comment="/boot/loader/entries/*.conf states" version="1">
973b04
+    <unix:filepath datatype="string" operation="pattern match">^/boot/loader/entries/.*\.conf$</unix:filepath>
973b04
+  </unix:file_object>
973b04
+</def-group>
973b04
973b04
From 97aff87a403f9b319e87967561c43dc99e8a672e Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Thu, 2 Jul 2020 16:15:35 +0200
973b04
Subject: [PATCH 06/14] zipl_bootmap_is_up_to_date: Add mock tests
973b04
973b04
These tests mock existence of zIPL files.
973b04
---
973b04
 .../tests/newer_boot_entry.fail.sh                     | 10 ++++++++++
973b04
 .../tests/newer_zipl_conf.fail.sh                      | 10 ++++++++++
973b04
 .../tests/up_to_date.pass.sh                           |  9 +++++++++
973b04
 3 files changed, 29 insertions(+)
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_boot_entry.fail.sh
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_zipl_conf.fail.sh
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/up_to_date.pass.sh
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_boot_entry.fail.sh b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_boot_entry.fail.sh
973b04
new file mode 100644
973b04
index 0000000000..728c6b7bdb
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_boot_entry.fail.sh
973b04
@@ -0,0 +1,10 @@
973b04
+#!/bin/bash
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+# remediation = none
973b04
+
973b04
+touch /etc/zipl.conf
973b04
+touch /boot/loader/entries/*.conf # Update current existing entries
973b04
+touch /boot/loader/entries/zipl-entry-1.conf
973b04
+touch /boot/bootmap
973b04
+sleep 2
973b04
+touch /boot/loader/entries/zipl-entry-2.conf
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_zipl_conf.fail.sh b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_zipl_conf.fail.sh
973b04
new file mode 100644
973b04
index 0000000000..1ae4d631ee
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/newer_zipl_conf.fail.sh
973b04
@@ -0,0 +1,10 @@
973b04
+#!/bin/bash
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+# remediation = none
973b04
+
973b04
+touch /boot/loader/entries/*.conf # Update current existing entries
973b04
+touch /boot/loader/entries/zipl-entry-1.conf
973b04
+touch /boot/loader/entries/zipl-entry-2.conf
973b04
+touch /boot/bootmap
973b04
+sleep 2
973b04
+touch /etc/zipl.conf
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/up_to_date.pass.sh b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/up_to_date.pass.sh
973b04
new file mode 100644
973b04
index 0000000000..7981ba8c5c
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/tests/up_to_date.pass.sh
973b04
@@ -0,0 +1,9 @@
973b04
+#!/bin/bash
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+# remediation = none
973b04
+
973b04
+touch /etc/zipl.conf
973b04
+touch /boot/loader/entries/*.conf # Update current existing entries
973b04
+touch /boot/loader/entries/zipl-entry-1.conf
973b04
+touch /boot/loader/entries/zipl-entry-2.conf
973b04
+touch /boot/bootmap
973b04
973b04
From 180e57bd23154c1ed8dc2575fbf9660c2f83a803 Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Fri, 3 Jul 2020 18:35:06 +0200
973b04
Subject: [PATCH 07/14] zipl_bootmap_is_up_to_date: Add remediations
973b04
973b04
---
973b04
 .../ansible/shared.yml                        | 24 +++++++++++++++++++
973b04
 .../zipl_bootmap_is_up_to_date/bash/shared.sh |  3 +++
973b04
 2 files changed, 27 insertions(+)
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/ansible/shared.yml
973b04
 create mode 100644 linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/ansible/shared.yml b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/ansible/shared.yml
973b04
new file mode 100644
973b04
index 0000000000..e545eacc13
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/ansible/shared.yml
973b04
@@ -0,0 +1,24 @@
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+# reboot = false
973b04
+# strategy = configure
973b04
+# complexity = low
973b04
+# disruption = low
973b04
+
973b04
+- name: "Ensure zIPL bootmap is up to date"
973b04
+  block:
973b04
+    - name: "Obtain stats of /boot/bootmap"
973b04
+      stat:
973b04
+        path: /boot/bootmap
973b04
+      register: boot_bootmap
973b04
+
973b04
+    - name: "Obtain stats of /etc/zipl.conf"
973b04
+      stat:
973b04
+        path: /etc/zipl.conf
973b04
+      register: zipl_conf
973b04
+
973b04
+    # TODO: handle /boot/loader/entries/*.conf
973b04
+
973b04
+    - name: "Update zIPL bootmap"
973b04
+      command: /usr/sbin/zipl
973b04
+      changed_when: True
973b04
+      when: boot_bootmap.stat.mtime < zipl_conf.stat.mtime
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh
973b04
new file mode 100644
973b04
index 0000000000..2cf7e388f0
973b04
--- /dev/null
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh
973b04
@@ -0,0 +1,3 @@
973b04
+# platform = Red Hat Enterprise Linux 8
973b04
+
973b04
+/usr/bin/zipl
973b04
973b04
From 93703727b12a34edb26de25410bf23ff72fead2a Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 1 Jul 2020 17:16:41 +0200
973b04
Subject: [PATCH 08/14] Select zIPL specific rules in OSPP profile
973b04
973b04
---
973b04
 rhel8/profiles/ospp.profile | 4 ++++
973b04
 1 file changed, 4 insertions(+)
973b04
973b04
diff --git a/rhel8/profiles/ospp.profile b/rhel8/profiles/ospp.profile
973b04
index 07d32b814d..80e4b71fff 100644
973b04
--- a/rhel8/profiles/ospp.profile
973b04
+++ b/rhel8/profiles/ospp.profile
973b04
@@ -415,3 +415,7 @@ selections:
973b04
     - ssh_client_rekey_limit
973b04
     - var_ssh_client_rekey_limit_size=1G
973b04
     - var_ssh_client_rekey_limit_time=1hour
973b04
+
973b04
+    # zIPl specific rules
973b04
+    - zipl_bls_entries_only
973b04
+    - zipl_bootmap_is_up_to_date
973b04
973b04
From 260891e9b2f38d50fadf9eaacd9ee9ca98c977ee Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 8 Jul 2020 14:03:21 +0200
973b04
Subject: [PATCH 09/14] Fix path to zipl binary in Bash remediation
973b04
973b04
---
973b04
 .../bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh   | 2 +-
973b04
 1 file changed, 1 insertion(+), 1 deletion(-)
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh
973b04
index 2cf7e388f0..2310ca060d 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/bash/shared.sh
973b04
@@ -1,3 +1,3 @@
973b04
 # platform = Red Hat Enterprise Linux 8
973b04
 
973b04
-/usr/bin/zipl
973b04
+/usr/sbin/zipl
973b04
973b04
From 46d2b1584cf769ae8dbaaa2657541bd0db056a9c Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 8 Jul 2020 14:06:22 +0200
973b04
Subject: [PATCH 10/14] zipl_bls_entries_only: there can be leading spaces
973b04
973b04
There can be leading spaces before 'image'.
973b04
---
973b04
 .../bootloader-zipl/zipl_bls_entries_only/oval/shared.xml       | 2 +-
973b04
 1 file changed, 1 insertion(+), 1 deletion(-)
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
index 41e9773814..f68d91c128 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
@@ -20,7 +20,7 @@
973b04
   
973b04
   version="1">
973b04
     <ind:filepath operation="pattern match">^/etc/zipl.conf$</ind:filepath>
973b04
-    <ind:pattern operation="pattern match">^image\s*=.*$</ind:pattern>
973b04
+    <ind:pattern operation="pattern match">^\s*image\s*=.*$</ind:pattern>
973b04
     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
973b04
   </ind:textfilecontent54_object>
973b04
 
973b04
973b04
From 0a89ed181803c15e3b73cfb2e13f0ec1cb7689ad Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 8 Jul 2020 14:10:22 +0200
973b04
Subject: [PATCH 11/14] zipl_bls_entries_only: check file /etc/zipl.conf
973b04
973b04
There is no need to perform pattern match, the check just needs to
973b04
examine /etc/zipl.conf file.
973b04
---
973b04
 .../bootloader-zipl/zipl_bls_entries_only/oval/shared.xml       | 2 +-
973b04
 1 file changed, 1 insertion(+), 1 deletion(-)
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
index f68d91c128..1ebf03ee37 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/oval/shared.xml
973b04
@@ -19,7 +19,7 @@
973b04
 
973b04
   
973b04
   version="1">
973b04
-    <ind:filepath operation="pattern match">^/etc/zipl.conf$</ind:filepath>
973b04
+    <ind:filepath operation="equals">/etc/zipl.conf</ind:filepath>
973b04
     <ind:pattern operation="pattern match">^\s*image\s*=.*$</ind:pattern>
973b04
     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
973b04
   </ind:textfilecontent54_object>
973b04
973b04
From 699d5f5bd3075e019387e6fb6b3af81182987c43 Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 8 Jul 2020 14:13:26 +0200
973b04
Subject: [PATCH 12/14] Add CCE identifiers to bootmap and bls only rules
973b04
973b04
Add RHEL-8 CCE identifiers for:
973b04
- zipl_bls_entries_only
973b04
- zipl_bootmap_is_up_to_date
973b04
---
973b04
 .../system/bootloader-zipl/zipl_bls_entries_only/rule.yml      | 3 +++
973b04
 .../system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml | 3 +++
973b04
 3 files changed, 6 insertions(+), 2 deletions(-)
973b04
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
index f792c5257f..67cc061ce3 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bls_entries_only/rule.yml
973b04
@@ -14,6 +14,9 @@ rationale: |-
973b04
 
973b04
 severity: medium
973b04
 
973b04
+identifiers:
973b04
+    cce@rhel8: 83485-3
973b04
+
973b04
 ocil_clause: 'a non BLS boot entry is configured'
973b04
 
973b04
 ocil: |-
973b04
diff --git a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml
973b04
index 082562d11e..da9411d00b 100644
973b04
--- a/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml
973b04
+++ b/linux_os/guide/system/bootloader-zipl/zipl_bootmap_is_up_to_date/rule.yml
973b04
@@ -16,6 +16,9 @@ rationale: |-
973b04
 
973b04
 severity: medium
973b04
 
973b04
+identifiers:
973b04
+    cce@rhel8: 83486-1
973b04
+
973b04
 ocil_clause: 'the bootmap is outdated'
973b04
 
973b04
 ocil: |-
973b04
973b04
From 2ebc3d188e4c243d8e60a9e669d5b661b77f2301 Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 8 Jul 2020 14:16:58 +0200
973b04
Subject: [PATCH 13/14] Incorporate OSPP selection changes to profile test
973b04
973b04
Update the profile reference file.
973b04
---
973b04
 tests/data/profile_stability/rhel8/ospp.profile | 2 ++
973b04
 1 file changed, 2 insertions(+)
973b04
973b04
diff --git a/tests/data/profile_stability/rhel8/ospp.profile b/tests/data/profile_stability/rhel8/ospp.profile
973b04
index b0d7672c36..08dcccf24c 100644
973b04
--- a/tests/data/profile_stability/rhel8/ospp.profile
973b04
+++ b/tests/data/profile_stability/rhel8/ospp.profile
973b04
@@ -213,6 +213,8 @@ selections:
973b04
 - sysctl_user_max_user_namespaces
973b04
 - timer_dnf-automatic_enabled
973b04
 - usbguard_allow_hid_and_hub
973b04
+- zipl_bls_entries_only
973b04
+- zipl_bootmap_is_up_to_date
973b04
 - var_sshd_set_keepalive=0
973b04
 - var_rekey_limit_size=1G
973b04
 - var_rekey_limit_time=1hour
973b04
973b04
From 33bae25bd543880315433925214868917ec8e399 Mon Sep 17 00:00:00 2001
973b04
From: Watson Sato <wsato@redhat.com>
973b04
Date: Wed, 8 Jul 2020 15:28:09 +0200
973b04
Subject: [PATCH 14/14] Unselect zIPL rules from STIG Profile
973b04
973b04
The zIPL rules are inherited from OSPP profile
973b04
---
973b04
 rhel8/profiles/stig.profile | 4 ++++
973b04
 1 file changed, 4 insertions(+)
973b04
973b04
diff --git a/rhel8/profiles/stig.profile b/rhel8/profiles/stig.profile
973b04
index 8f12852e26..cfc2160be1 100644
973b04
--- a/rhel8/profiles/stig.profile
973b04
+++ b/rhel8/profiles/stig.profile
973b04
@@ -45,3 +45,7 @@ selections:
973b04
     - rsyslog_remote_tls
973b04
     - rsyslog_remote_tls_cacert
973b04
     - "!ssh_client_rekey_limit"
973b04
+
973b04
+    # Unselect zIPL rules from OSPP
973b04
+    - "!zipl_bls_entries_only"
973b04
+    - "!zipl_bootmap_is_up_to_date"