Blame SOURCES/scap-security-guide-0.1.64-stig_sysctl_multivalue_rules-PR_9286.patch

1053e7
From f647d546d03b9296861f18673b0ac9efaa0db3ab Mon Sep 17 00:00:00 2001
1053e7
From: Watson Sato <wsato@redhat.com>
1053e7
Date: Wed, 3 Aug 2022 09:57:33 +0200
1053e7
Subject: [PATCH 1/5] Make rule sysctl ipv4 rp_filter accept two values
1053e7
1053e7
This also removes value '0' from the list of possible configurations.
1053e7
This change aligns the rule better with STIG.
1053e7
---
1053e7
 .../sysctl_net_ipv4_conf_all_rp_filter/rule.yml        |  4 ++++
1053e7
 .../tests/value_1.pass.sh                              | 10 ++++++++++
1053e7
 .../tests/value_2.pass.sh                              | 10 ++++++++++
1053e7
 .../sysctl_net_ipv4_conf_all_rp_filter_value.var       |  2 +-
1053e7
 4 files changed, 25 insertions(+), 1 deletion(-)
1053e7
 create mode 100644 linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh
1053e7
 create mode 100644 linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh
1053e7
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
index 496a8491f32..697f79fa872 100644
1053e7
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
@@ -59,4 +59,8 @@ template:
1053e7
     name: sysctl
1053e7
     vars:
1053e7
         sysctlvar: net.ipv4.conf.all.rp_filter
1053e7
+        sysctlval:
1053e7
+        - '1'
1053e7
+        - '2'
1053e7
+        wrong_sysctlval_for_testing: "0"
1053e7
         datatype: int
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh
1053e7
new file mode 100644
1053e7
index 00000000000..516bfaf1369
1053e7
--- /dev/null
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh
1053e7
@@ -0,0 +1,10 @@
1053e7
+#!/bin/bash
1053e7
+
1053e7
+# Clean sysctl config directories
1053e7
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
+
1053e7
+sed -i "/net.ipv4.conf.all.rp_filter/d" /etc/sysctl.conf
1053e7
+echo "net.ipv4.conf.all.rp_filter = 1" >> /etc/sysctl.conf
1053e7
+
1053e7
+# set correct runtime value to check if the filesystem configuration is evaluated properly
1053e7
+sysctl -w net.ipv4.conf.all.rp_filter="1"
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh
1053e7
new file mode 100644
1053e7
index 00000000000..ef1b8da0479
1053e7
--- /dev/null
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh
1053e7
@@ -0,0 +1,10 @@
1053e7
+#!/bin/bash
1053e7
+
1053e7
+# Clean sysctl config directories
1053e7
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
+
1053e7
+sed -i "/net.ipv4.conf.all.rp_filter/d" /etc/sysctl.conf
1053e7
+echo "net.ipv4.conf.all.rp_filter = 2" >> /etc/sysctl.conf
1053e7
+
1053e7
+# set correct runtime value to check if the filesystem configuration is evaluated properly
1053e7
+sysctl -w net.ipv4.conf.all.rp_filter="2"
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter_value.var b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter_value.var
1053e7
index e3fc78e3f05..1eae854f6b0 100644
1053e7
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter_value.var
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter_value.var
1053e7
@@ -17,5 +17,5 @@ interactive: false
1053e7
 
1053e7
 options:
1053e7
     default: 1
1053e7
-    disabled: "0"
1053e7
     enabled: 1
1053e7
+    loose: 2
1053e7
1053e7
From f903b6b257659cfe79bfd17a13ae72d1a48f40d9 Mon Sep 17 00:00:00 2001
1053e7
From: Watson Sato <wsato@redhat.com>
1053e7
Date: Wed, 3 Aug 2022 10:53:40 +0200
1053e7
Subject: [PATCH 2/5] Make rule for kptr_restrict accept two values
1053e7
1053e7
This also removes value '0' from the list of possible configurations.
1053e7
This change aligns the rule better with STIG.
1053e7
---
1053e7
 .../sysctl_kernel_kptr_restrict/rule.yml               |  4 ++++
1053e7
 .../sysctl_kernel_kptr_restrict/tests/value_1.pass.sh  | 10 ++++++++++
1053e7
 .../sysctl_kernel_kptr_restrict/tests/value_2.pass.sh  | 10 ++++++++++
1053e7
 .../sysctl_kernel_kptr_restrict_value.var              |  1 -
1053e7
 4 files changed, 24 insertions(+), 1 deletion(-)
1053e7
 create mode 100644 linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh
1053e7
 create mode 100644 linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh
1053e7
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
index 1984b3c8691..5706eee0a0a 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
@@ -42,6 +42,10 @@ template:
1053e7
     name: sysctl
1053e7
     vars:
1053e7
         sysctlvar: kernel.kptr_restrict
1053e7
+        sysctlval:
1053e7
+        - '1'
1053e7
+        - '2'
1053e7
+        wrong_sysctlval_for_testing: "0"
1053e7
         datatype: int
1053e7
 
1053e7
 fixtext: |-
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh
1053e7
new file mode 100644
1053e7
index 00000000000..e6efae48b25
1053e7
--- /dev/null
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh
1053e7
@@ -0,0 +1,10 @@
1053e7
+#!/bin/bash
1053e7
+
1053e7
+# Clean sysctl config directories
1053e7
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
+
1053e7
+sed -i "/kernel.kptr_restrict/d" /etc/sysctl.conf
1053e7
+echo "kernel.kptr_restrict = 1" >> /etc/sysctl.conf
1053e7
+
1053e7
+# set correct runtime value to check if the filesystem configuration is evaluated properly
1053e7
+sysctl -w kernel.kptr_restrict="1"
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh
1053e7
new file mode 100644
1053e7
index 00000000000..be3f2b743ef
1053e7
--- /dev/null
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh
1053e7
@@ -0,0 +1,10 @@
1053e7
+#!/bin/bash
1053e7
+
1053e7
+# Clean sysctl config directories
1053e7
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
+
1053e7
+sed -i "/kernel.kptr_restrict/d" /etc/sysctl.conf
1053e7
+echo "kernel.kptr_restrict = 2" >> /etc/sysctl.conf
1053e7
+
1053e7
+# set correct runtime value to check if the filesystem configuration is evaluated properly
1053e7
+sysctl -w kernel.kptr_restrict="2"
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict_value.var b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict_value.var
1053e7
index 452328e3efd..268550de53d 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict_value.var
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict_value.var
1053e7
@@ -12,6 +12,5 @@ interactive: false
1053e7
 
1053e7
 options:
1053e7
     default: 1
1053e7
-    0: 0
1053e7
     1: 1
1053e7
     2: 2
1053e7
1053e7
From 932d00c370c8dc1c964354dd4bc111fbc18b9303 Mon Sep 17 00:00:00 2001
1053e7
From: Watson Sato <wsato@redhat.com>
1053e7
Date: Wed, 3 Aug 2022 11:08:34 +0200
1053e7
Subject: [PATCH 3/5] Remove variable selector that will result in error
1053e7
1053e7
The rule only accepts values 1 or 2 as compliant, the XCCDF Variable
1053e7
cannot have the value 0, it will never result in pass.
1053e7
---
1053e7
 .../sysctl_kernel_unprivileged_bpf_disabled_value.var            | 1 -
1053e7
 1 file changed, 1 deletion(-)
1053e7
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_value.var b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_value.var
1053e7
index b8bf965a255..cbfd9bafa91 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_value.var
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_value.var
1053e7
@@ -13,6 +13,5 @@ interactive: false
1053e7
 
1053e7
 options:
1053e7
     default: 2
1053e7
-    0: "0"
1053e7
     1: "1"
1053e7
     2: "2"
1053e7
1053e7
From 7127380e294a7e112fc427d0a46c21f15404aaa5 Mon Sep 17 00:00:00 2001
1053e7
From: Watson Sato <wsato@redhat.com>
1053e7
Date: Wed, 3 Aug 2022 11:33:03 +0200
1053e7
Subject: [PATCH 4/5] Restrict sysctl multivalue compliance to rhel and ol
1053e7
1053e7
For now, the only STIGs I see that adopted this change were RHEL's and
1053e7
OL's.
1053e7
---
1053e7
 .../sysctl_net_ipv4_conf_all_rp_filter/rule.yml                 | 2 ++
1053e7
 .../sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh    | 1 +
1053e7
 .../sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh    | 1 +
1053e7
 .../sysctl_kernel_kptr_restrict/rule.yml                        | 2 ++
1053e7
 .../sysctl_kernel_kptr_restrict/tests/value_1.pass.sh           | 1 +
1053e7
 .../sysctl_kernel_kptr_restrict/tests/value_2.pass.sh           | 1 +
1053e7
 6 files changed, 8 insertions(+)
1053e7
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
index 697f79fa872..f04ae37c13d 100644
1053e7
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
@@ -59,8 +59,10 @@ template:
1053e7
     name: sysctl
1053e7
     vars:
1053e7
         sysctlvar: net.ipv4.conf.all.rp_filter
1053e7
+        {{% if 'ol' in product or 'rhel' in product %}}
1053e7
         sysctlval:
1053e7
         - '1'
1053e7
         - '2'
1053e7
         wrong_sysctlval_for_testing: "0"
1053e7
+        {{% endif %}}
1053e7
         datatype: int
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh
1053e7
index 516bfaf1369..583b70a3b97 100644
1053e7
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_1.pass.sh
1053e7
@@ -1,4 +1,5 @@
1053e7
 #!/bin/bash
1053e7
+# platform = multi_platform_ol,multi_platform_rhel
1053e7
 
1053e7
 # Clean sysctl config directories
1053e7
 rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh
1053e7
index ef1b8da0479..ef545976dc6 100644
1053e7
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/tests/value_2.pass.sh
1053e7
@@ -1,4 +1,5 @@
1053e7
 #!/bin/bash
1053e7
+# platform = multi_platform_ol,multi_platform_rhel
1053e7
 
1053e7
 # Clean sysctl config directories
1053e7
 rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
index 5706eee0a0a..f53e035effa 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
@@ -42,10 +42,12 @@ template:
1053e7
     name: sysctl
1053e7
     vars:
1053e7
         sysctlvar: kernel.kptr_restrict
1053e7
+        {{% if 'ol' in product or 'rhel' in product %}}
1053e7
         sysctlval:
1053e7
         - '1'
1053e7
         - '2'
1053e7
         wrong_sysctlval_for_testing: "0"
1053e7
+        {{% endif %}}
1053e7
         datatype: int
1053e7
 
1053e7
 fixtext: |-
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh
1053e7
index e6efae48b25..70189666c16 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_1.pass.sh
1053e7
@@ -1,4 +1,5 @@
1053e7
 #!/bin/bash
1053e7
+# platform = multi_platform_ol,multi_platform_rhel
1053e7
 
1053e7
 # Clean sysctl config directories
1053e7
 rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh
1053e7
index be3f2b743ef..209395fa9a1 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/tests/value_2.pass.sh
1053e7
@@ -1,4 +1,5 @@
1053e7
 #!/bin/bash
1053e7
+# platform = multi_platform_ol,multi_platform_rhel
1053e7
 
1053e7
 # Clean sysctl config directories
1053e7
 rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
1053e7
1053e7
From a159f7d62b200c79b6ec2b47ffa643ed6219f35b Mon Sep 17 00:00:00 2001
1053e7
From: Watson Sato <wsato@redhat.com>
1053e7
Date: Wed, 3 Aug 2022 14:01:40 +0200
1053e7
Subject: [PATCH 5/5] Update OCIL check along with the rule
1053e7
1053e7
The OCIL should should mention both compliant values.
1053e7
---
1053e7
 .../rule.yml                                  | 29 +++++++++++++++++--
1053e7
 .../sysctl_kernel_kptr_restrict/rule.yml      | 29 ++++++++++++++++++-
1053e7
 2 files changed, 55 insertions(+), 3 deletions(-)
1053e7
1053e7
diff --git a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
index f04ae37c13d..4d31c6c3ebd 100644
1053e7
--- a/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
+++ b/linux_os/guide/system/network/network-kernel/network_host_and_router_parameters/sysctl_net_ipv4_conf_all_rp_filter/rule.yml
1053e7
@@ -47,11 +47,36 @@ references:
1053e7
     stigid@rhel7: RHEL-07-040611
1053e7
     stigid@rhel8: RHEL-08-040285
1053e7
 
1053e7
-{{{ complete_ocil_entry_sysctl_option_value(sysctl="net.ipv4.conf.all.rp_filter", value="1") }}}
1053e7
+ocil: |-
1053e7
+    The runtime status of the net.ipv4.conf.all.rp_filter parameter can be queried
1053e7
+    by running the following command:
1053e7
+    
$ sysctl net.ipv4.conf.all.rp_filter
1053e7
+    The output of the command should indicate either:
1053e7
+    net.ipv4.conf.all.rp_filter = 1
1053e7
+    or:
1053e7
+    net.ipv4.conf.all.rp_filter = 2
1053e7
+    The output of the command should not indicate:
1053e7
+    net.ipv4.conf.all.rp_filter = 0
1053e7
+
1053e7
+    The preferable way how to assure the runtime compliance is to have
1053e7
+    correct persistent configuration, and rebooting the system.
1053e7
+
1053e7
+    The persistent sysctl parameter configuration is performed by specifying the appropriate
1053e7
+    assignment in any file located in the 
/etc/sysctl.d
directory.
1053e7
+    Verify that there is not any existing incorrect configuration by executing the following command:
1053e7
+    
$ grep -r '^\s*net.ipv4.conf.all.rp_filter\s*=' /etc/sysctl.conf /etc/sysctl.d
1053e7
+    The command should not find any assignments other than:
1053e7
+    net.ipv4.conf.all.rp_filter = 1
1053e7
+    or:
1053e7
+    net.ipv4.conf.all.rp_filter = 2
1053e7
+
1053e7
+    Conflicting assignments are not allowed.
1053e7
+
1053e7
+ocil_clause: "the net.ipv4.conf.all.rp_filter is not set to 1 or 2 or is configured to be 0"
1053e7
 
1053e7
 fixtext: |-
1053e7
     Configure {{{ full_name }}} to use reverse path filtering on all IPv4 interfaces.
1053e7
-    {{{ fixtext_sysctl(sysctl="net.ipv4.conf.all.rp_filter", value="1") | indent(4) }}}
1053e7
+    {{{ fixtext_sysctl(sysctl="net.ipv4.conf.all.rp_filter", value=xccdf_value("sysctl_net_ipv4_conf_all_rp_filter_value")) | indent(4) }}}
1053e7
 
1053e7
 srg_requirement: '{{{ full_name }}} must use reverse path filtering on all IPv4 interfaces.'
1053e7
 
1053e7
diff --git a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
index f53e035effa..367934b5672 100644
1053e7
--- a/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
+++ b/linux_os/guide/system/permissions/restrictions/enable_execshield_settings/sysctl_kernel_kptr_restrict/rule.yml
1053e7
@@ -34,6 +34,33 @@ references:
1053e7
 
1053e7
 {{{ complete_ocil_entry_sysctl_option_value(sysctl="kernel.kptr_restrict", value="1") }}}
1053e7
 
1053e7
+ocil: |-
1053e7
+    The runtime status of the kernel.kptr_restrict kernel parameter can be queried
1053e7
+    by running the following command:
1053e7
+    
$ sysctl kernel.kptr_restrict
1053e7
+    The output of the command should indicate either:
1053e7
+    kernel.kptr_restrict = 1
1053e7
+    or:
1053e7
+    kernel.kptr_restrict = 2
1053e7
+    The output of the command should not indicate:
1053e7
+    kernel.kptr_restrict = 0
1053e7
+
1053e7
+    The preferable way how to assure the runtime compliance is to have
1053e7
+    correct persistent configuration, and rebooting the system.
1053e7
+
1053e7
+    The persistent kernel parameter configuration is performed by specifying the appropriate
1053e7
+    assignment in any file located in the 
/etc/sysctl.d
directory.
1053e7
+    Verify that there is not any existing incorrect configuration by executing the following command:
1053e7
+    
$ grep -r '^\s*kernel.kptr_restrict\s*=' /etc/sysctl.conf /etc/sysctl.d
1053e7
+    The command should not find any assignments other than:
1053e7
+    kernel.kptr_restrict = 1
1053e7
+    or:
1053e7
+    kernel.kptr_restrict = 2
1053e7
+
1053e7
+    Conflicting assignments are not allowed.
1053e7
+
1053e7
+ocil_clause: "the kernel.kptr_restrict is not set to 1 or 2 or is configured to be 0"
1053e7
+
1053e7
 srg_requirement: '{{{ full_name }}} must restrict exposed kernel pointer addresses access.'
1053e7
 
1053e7
 platform: machine
1053e7
@@ -52,4 +79,4 @@ template:
1053e7
 
1053e7
 fixtext: |-
1053e7
     Configure {{{ full_name }}} to restrict exposed kernel pointer addresses access.
1053e7
-    {{{ fixtext_sysctl("kernel.kptr_restrict", "1") | indent(4) }}}
1053e7
+    {{{ fixtext_sysctl("kernel.kptr_restrict", value=xccdf_value("sysctl_kernel_kptr_restrict_value")) | indent(4) }}}