From 492a1009e04af3d02fb9c149c4b75361d719586b Mon Sep 17 00:00:00 2001 From: Watson Sato Date: Thu, 25 Jun 2020 22:37:12 +0200 Subject: [PATCH 1/4] Extend bls_entries option to check runtime options --- .../template_OVAL_bls_entries_option | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/shared/templates/template_OVAL_bls_entries_option b/shared/templates/template_OVAL_bls_entries_option index 7a64337b1f13..9c4fc3af8d1b 100644 --- a/shared/templates/template_OVAL_bls_entries_option +++ b/shared/templates/template_OVAL_bls_entries_option @@ -8,6 +8,8 @@ + @@ -15,9 +17,8 @@ comment="check for kernel option {{{ ARG_NAME_VALUE }}} for all snippets in /boot/loader/entries" check="all" check_existence="all_exist" version="1"> - + - ^/boot/loader/entries/.*\.conf$ @@ -25,7 +26,20 @@ 1 - + + + + + ^/proc/cmdline$ + ^(.*)$ + 1 + + + ^(?:.*\s)?{{{ ESCAPED_ARG_NAME_VALUE }}}(?:\s.*)?$ From cca801a0e72f7f818986355ac1579b89ea4a79dd Mon Sep 17 00:00:00 2001 From: Watson Sato Date: Fri, 26 Jun 2020 09:11:04 +0200 Subject: [PATCH 2/4] Enable bls_audit_option for fedora and rhel8 --- linux_os/guide/system/auditing/bls_audit_option/rule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux_os/guide/system/auditing/bls_audit_option/rule.yml b/linux_os/guide/system/auditing/bls_audit_option/rule.yml index 4c34721729b3..ec4b3d35b793 100644 --- a/linux_os/guide/system/auditing/bls_audit_option/rule.yml +++ b/linux_os/guide/system/auditing/bls_audit_option/rule.yml @@ -1,6 +1,6 @@ documentation_complete: true -prodtype: rhcos4 +prodtype: fedora,rhcos4,rhel8 title: 'Enable Auditing for Processes Which Start Prior to the Audit Daemon' From 511e53bd25ebba90aef2cdfeccc1156960536b89 Mon Sep 17 00:00:00 2001 From: Watson Sato Date: Fri, 26 Jun 2020 01:32:04 +0200 Subject: [PATCH 3/4] Check boot entries with $kernelopts If a boot entry has the kernel option, it is fine. If a boot entry doesn't have the kernel option, make sure that the entry has '$kernelopts' and /boot/grub2/grubenv has the kernel option. --- .../template_OVAL_bls_entries_option | 59 ++++++++++++++++--- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/shared/templates/template_OVAL_bls_entries_option b/shared/templates/template_OVAL_bls_entries_option index 9c4fc3af8d1b..2a3a2220fa85 100644 --- a/shared/templates/template_OVAL_bls_entries_option +++ b/shared/templates/template_OVAL_bls_entries_option @@ -6,24 +6,60 @@ Ensure {{{ ARG_NAME_VALUE }}} option is configured in the 'options' line in /boot/loader/entries/*.conf. - - + + + + + + + + - - + + - + ^/boot/loader/entries/.*\.conf$ + ^options (.*)$ + 1 + + + + + + + ^/boot/loader/entries/.*\.conf$ ^options (.*)$ 1 + state_{{{ SANITIZED_ARG_NAME }}}_option + + + + + + + + ^/boot/grub2/grubenv$ + ^kernelopts=(.*)$ + 1 ^(?:.*\s)?{{{ ESCAPED_ARG_NAME_VALUE }}}(?:\s.*)?$ + + + ^(?:.*\s)?\$kernelopts(?:\s.*)?$ + From 21016d21d9f327fd950315df3fd519b90e8ad7f8 Mon Sep 17 00:00:00 2001 From: Watson Sato Date: Fri, 26 Jun 2020 09:07:07 +0200 Subject: [PATCH 4/4] Ensure kernel updates retains configured options Add checks to ensure that kernel updates or execution of grub2-mkconfig won't remove "required" kernel options from /boot/grub2/grubenv --- .../template_OVAL_bls_entries_option | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shared/templates/template_OVAL_bls_entries_option b/shared/templates/template_OVAL_bls_entries_option index 2a3a2220fa85..3511b97d83b7 100644 --- a/shared/templates/template_OVAL_bls_entries_option +++ b/shared/templates/template_OVAL_bls_entries_option @@ -18,6 +18,11 @@ +{{% if product in ["rhel8", "fedora"] %}} + + +{{% endif %}} @@ -75,6 +80,21 @@ 1 +{{% if product in ["rhel8", "fedora"] %}} + + + + + + /etc/default/grub + ^\s*GRUB_CMDLINE_LINUX="(.*)"$ + 1 + +{{% endif %}} + ^(?:.*\s)?{{{ ESCAPED_ARG_NAME_VALUE }}}(?:\s.*)?$