Blame SOURCES/scap-security-guide-0.1.64-update_sysctl_template_with_multivalue_compliance-PR_9147.patch

f386a0
From 48a361a41eff571e8c0d6f8c759c56d41cec5c5a Mon Sep 17 00:00:00 2001
f386a0
From: vojtapolasek <vpolasek@redhat.com>
f386a0
Date: Tue, 2 Aug 2022 13:21:45 +0200
f386a0
Subject: [PATCH 3/8] Merge pull request #9147 from jan-cerny/rhbz2081728
f386a0
f386a0
Patch-name: scap-security-guide-0.1.64-update_sysctl_template_with_multivalue_compliance-PR_9147.patch
f386a0
Patch-status: Refresh BPF related rules in RHEL 9 OSPP profile
f386a0
---
f386a0
 docs/templates/template_reference.md          |  24 +-
f386a0
 .../rule.yml                                  |  82 +++++++
f386a0
 .../tests/system_default.pass.sh              |   5 +
f386a0
 .../tests/test_config.yml                     |   6 +
f386a0
 .../tests/value_0.fail.sh                     |  11 +
f386a0
 .../tests/value_1.pass.sh                     |  11 +
f386a0
 .../tests/value_2.pass.sh                     |  11 +
f386a0
 ...kernel_unprivileged_bpf_disabled_value.var |  18 ++
f386a0
 products/rhel9/profiles/ospp.profile          |   4 +-
f386a0
 .../oval/sysctl_kernel_ipv6_disable.xml       |   4 +-
f386a0
 shared/references/cce-redhat-avail.txt        |   1 -
f386a0
 shared/templates/sysctl/ansible.template      |   2 +-
f386a0
 shared/templates/sysctl/bash.template         |   2 +-
f386a0
 shared/templates/sysctl/oval.template         | 213 +++++++++++-------
f386a0
 shared/templates/sysctl/template.py           |  24 +-
f386a0
 15 files changed, 316 insertions(+), 102 deletions(-)
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/rule.yml
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/system_default.pass.sh
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/test_config.yml
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_0.fail.sh
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_1.pass.sh
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_2.pass.sh
f386a0
 create mode 100644 linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_value.var
f386a0
f386a0
diff --git a/docs/templates/template_reference.md b/docs/templates/template_reference.md
f386a0
index a439e3dca9..e73b95450f 100644
f386a0
--- a/docs/templates/template_reference.md
f386a0
+++ b/docs/templates/template_reference.md
f386a0
@@ -815,8 +815,28 @@ The selected value can be changed in the profile (consult the actual variable fo
f386a0
 
f386a0
     -   **datatype** - data type of the sysctl value, eg. `int`.
f386a0
 
f386a0
-    -   **sysctlval** - value of the sysctl value, eg. `'1'`. If this
f386a0
-        parameter is not specified, XCCDF Value is used instead.
f386a0
+    -   **sysctlval** - value of the sysctl value. This can be either not
f386a0
+        specified, or an atomic value, eg. `'1'`, or a list of values,
f386a0
+        eg. `['1','2']`.
f386a0
+        -   If this parameter is not specified, an XCCDF Value is used instead
f386a0
+            in OVAL check and remediations. The XCCDF Value should have a file
f386a0
+            name in the form `"sysctl_" + $escaped_sysctlvar + "_value.var"`,
f386a0
+            where the `escaped_sysctlvar` is a value of the **sysctlvar**
f386a0
+            parameter in which all characters that don't match the `\w` regular
f386a0
+            expression are replaced by an underscore (`_`).
f386a0
+        -   If this parameter is set to an atomic value, this atomic value
f386a0
+            will be used in OVAL check and remediations.
f386a0
+        -   If this parameter is set to a list of values, the list will be used
f386a0
+            in the OVAL check, but won't be used in the remediations.
f386a0
+            All remediations will use an XCCDF value instead.
f386a0
+
f386a0
+    -   **wrong_sysctlval_for_testing** - the value that is always wrong. This
f386a0
+        will be used in templated test scenarios when **sysctlval** is a list.
f386a0
+
f386a0
+    -   **missing_parameter_pass** - if set to `true` the check will pass if the
f386a0
+        setting for the given **sysctlvar** is not present in sysctl
f386a0
+        configuration files. In other words, the check will pass if the system
f386a0
+        default isn't overriden by configuration. Default value: `false`.
f386a0
 
f386a0
     -   **operation** - operation used for comparison of collected object
f386a0
         with **sysctlval**. Default value: `equals`.
f386a0
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/rule.yml b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/rule.yml
f386a0
new file mode 100644
f386a0
index 0000000000..259d1f901c
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/rule.yml
f386a0
@@ -0,0 +1,82 @@
f386a0
+documentation_complete: true
f386a0
+
f386a0
+prodtype: rhel9
f386a0
+
f386a0
+title: 'Disable Access to Network bpf() Syscall From Unprivileged Processes'
f386a0
+
f386a0
+description: |-
f386a0
+    To prevent unprivileged processes from using the bpf() syscall
f386a0
+    the kernel.unprivileged_bpf_disabled kernel parameter must
f386a0
+    be set to 1 or 2.
f386a0
+
f386a0
+    Writing 1 to this entry will disable unprivileged calls to bpf(); once
f386a0
+    disabled, calling bpf() without CAP_SYS_ADMIN or CAP_BPF will return -EPERM.
f386a0
+    Once set to 1, this can't be cleared from the running kernel anymore.
f386a0
+
f386a0
+    {{{ describe_sysctl_option_value(sysctl="kernel.unprivileged_bpf_disabled", value="1") }}}
f386a0
+
f386a0
+    Writing 2 to this entry will also disable unprivileged calls to bpf(),
f386a0
+    however, an admin can still change this setting later on, if needed, by
f386a0
+    writing 0 or 1 to this entry.
f386a0
+
f386a0
+    {{{ describe_sysctl_option_value(sysctl="kernel.unprivileged_bpf_disabled", value="2") }}}
f386a0
+
f386a0
+rationale: |-
f386a0
+    Loading and accessing the packet filters programs and maps using the bpf()
f386a0
+    syscall has the potential of revealing sensitive information about the kernel state.
f386a0
+
f386a0
+severity: medium
f386a0
+
f386a0
+identifiers:
f386a0
+    cce@rhel9: CCE-87712-6
f386a0
+
f386a0
+references:
f386a0
+    disa: CCI-000366
f386a0
+    nist: AC-6,SC-7(10)
f386a0
+    ospp: FMT_SMF_EXT.1
f386a0
+    srg: SRG-OS-000132-GPOS-00067,SRG-OS-000480-GPOS-00227
f386a0
+
f386a0
+ocil: |-
f386a0
+    The runtime status of the kernel.unprivileged_bpf_disabled
f386a0
+    kernel parameter can be queried by running the following command:
f386a0
+    
$ sysctl kernel.unprivileged_bpf_disabled
f386a0
+    The output of the command should indicate either:
f386a0
+    kernel.unprivileged_bpf_disabled = 1
f386a0
+    or:
f386a0
+    kernel.unprivileged_bpf_disabled = 2
f386a0
+    The output of the command should not indicate:
f386a0
+    kernel.unprivileged_bpf_disabled = 0
f386a0
+
f386a0
+    The preferable way how to assure the runtime compliance is to have
f386a0
+    correct persistent configuration, and rebooting the system.
f386a0
+
f386a0
+    The persistent kernel parameter configuration is performed by specifying the appropriate
f386a0
+    assignment in any file located in the 
/etc/sysctl.d
directory.
f386a0
+    Verify that there is not any existing incorrect configuration by executing the following command:
f386a0
+    
$ grep -r '^\s*{{{ sysctl }}}\s*=' /etc/sysctl.conf /etc/sysctl.d
f386a0
+    The command should not find any assignments other than:
f386a0
+    kernel.unprivileged_bpf_disabled = 1
f386a0
+    or:
f386a0
+    kernel.unprivileged_bpf_disabled = 2
f386a0
+
f386a0
+    Duplicate assignments are not allowed. Empty output is allowed, because the system default is 2.
f386a0
+
f386a0
+ocil_clause: "the kernel.unprivileged_bpf_disabled is not set to 1 or 2 or is configured to be 0"
f386a0
+
f386a0
+fixtext: |-
f386a0
+    Configure {{{ full_name }}} to prevent privilege escalation through the kernel by disabling access to the bpf syscall.
f386a0
+
f386a0
+srg_requirement: '{{{ full_name }}} must disable access to network bpf syscall from unprivileged processes.'
f386a0
+
f386a0
+platform: machine
f386a0
+
f386a0
+template:
f386a0
+    name: sysctl
f386a0
+    vars:
f386a0
+        sysctlvar: kernel.unprivileged_bpf_disabled
f386a0
+        sysctlval:
f386a0
+        - '1'
f386a0
+        - '2'
f386a0
+        wrong_sysctlval_for_testing: "0"
f386a0
+        missing_parameter_pass: "true"
f386a0
+        datatype: int
f386a0
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/system_default.pass.sh b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/system_default.pass.sh
f386a0
new file mode 100644
f386a0
index 0000000000..b9776227bd
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/system_default.pass.sh
f386a0
@@ -0,0 +1,5 @@
f386a0
+#!/bin/bash
f386a0
+# platform = Red Hat Enterprise Linux 9
f386a0
+
f386a0
+# Clean sysctl config directories
f386a0
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
f386a0
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/test_config.yml b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/test_config.yml
f386a0
new file mode 100644
f386a0
index 0000000000..5cf6807405
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/test_config.yml
f386a0
@@ -0,0 +1,6 @@
f386a0
+deny_templated_scenarios:
f386a0
+  # this rule uses missing_parameter_pass: true which means the check should pass
f386a0
+  # if the configuration is missing (or commented out) therefore we disable
f386a0
+  # line_not_there.fail.sh and comment.fail.sh test scenarios
f386a0
+  - line_not_there.fail.sh
f386a0
+  - comment.fail.sh
f386a0
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_0.fail.sh b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_0.fail.sh
f386a0
new file mode 100644
f386a0
index 0000000000..9f19e0140b
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_0.fail.sh
f386a0
@@ -0,0 +1,11 @@
f386a0
+#!/bin/bash
f386a0
+# platform = Red Hat Enterprise Linux 9
f386a0
+
f386a0
+# Clean sysctl config directories
f386a0
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
f386a0
+
f386a0
+sed -i "/kernel.unprivileged_bpf_disabled/d" /etc/sysctl.conf
f386a0
+echo "kernel.unprivileged_bpf_disabled = 0" >> /etc/sysctl.conf
f386a0
+
f386a0
+# set correct runtime value to check if the filesystem configuration is evaluated properly
f386a0
+sysctl -w kernel.unprivileged_bpf_disabled="0"
f386a0
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_1.pass.sh b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_1.pass.sh
f386a0
new file mode 100644
f386a0
index 0000000000..e976db594c
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_1.pass.sh
f386a0
@@ -0,0 +1,11 @@
f386a0
+#!/bin/bash
f386a0
+# platform = Red Hat Enterprise Linux 9
f386a0
+
f386a0
+# Clean sysctl config directories
f386a0
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
f386a0
+
f386a0
+sed -i "/kernel.unprivileged_bpf_disabled/d" /etc/sysctl.conf
f386a0
+echo "kernel.unprivileged_bpf_disabled = 1" >> /etc/sysctl.conf
f386a0
+
f386a0
+# set correct runtime value to check if the filesystem configuration is evaluated properly
f386a0
+sysctl -w kernel.unprivileged_bpf_disabled="1"
f386a0
diff --git a/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_2.pass.sh b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_2.pass.sh
f386a0
new file mode 100644
f386a0
index 0000000000..b1537175eb
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_accept_default/tests/value_2.pass.sh
f386a0
@@ -0,0 +1,11 @@
f386a0
+#!/bin/bash
f386a0
+# platform = Red Hat Enterprise Linux 9
f386a0
+
f386a0
+# Clean sysctl config directories
f386a0
+rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
f386a0
+
f386a0
+sed -i "/kernel.unprivileged_bpf_disabled/d" /etc/sysctl.conf
f386a0
+echo "kernel.unprivileged_bpf_disabled = 2" >> /etc/sysctl.conf
f386a0
+
f386a0
+# set correct runtime value to check if the filesystem configuration is evaluated properly
f386a0
+sysctl -w kernel.unprivileged_bpf_disabled="2"
f386a0
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
f386a0
new file mode 100644
f386a0
index 0000000000..b8bf965a25
f386a0
--- /dev/null
f386a0
+++ b/linux_os/guide/system/permissions/restrictions/sysctl_kernel_unprivileged_bpf_disabled_value.var
f386a0
@@ -0,0 +1,18 @@
f386a0
+documentation_complete: true
f386a0
+
f386a0
+title: kernel.unprivileged_bpf_disabled
f386a0
+
f386a0
+description: |-
f386a0
+    Prevent unprivileged processes from using the bpf() syscall.
f386a0
+
f386a0
+type: number
f386a0
+
f386a0
+operator: equals
f386a0
+
f386a0
+interactive: false
f386a0
+
f386a0
+options:
f386a0
+    default: 2
f386a0
+    0: "0"
f386a0
+    1: "1"
f386a0
+    2: "2"
f386a0
diff --git a/products/rhel9/profiles/ospp.profile b/products/rhel9/profiles/ospp.profile
f386a0
index feb96501a9..f27f961a7a 100644
f386a0
--- a/products/rhel9/profiles/ospp.profile
f386a0
+++ b/products/rhel9/profiles/ospp.profile
f386a0
@@ -74,8 +74,8 @@ selections:
f386a0
     - sysctl_kernel_yama_ptrace_scope
f386a0
     - sysctl_kernel_perf_event_paranoid
f386a0
     - sysctl_user_max_user_namespaces
f386a0
-    - sysctl_kernel_unprivileged_bpf_disabled
f386a0
-    - sysctl_net_core_bpf_jit_harden
f386a0
+    - sysctl_kernel_unprivileged_bpf_disabled_accept_default
f386a0
+    - sysctl_kernel_unprivileged_bpf_disabled_value=2
f386a0
     - service_kdump_disabled
f386a0
 
f386a0
     ### Audit
f386a0
diff --git a/shared/checks/oval/sysctl_kernel_ipv6_disable.xml b/shared/checks/oval/sysctl_kernel_ipv6_disable.xml
f386a0
index 1195cea518..f971d28a04 100644
f386a0
--- a/shared/checks/oval/sysctl_kernel_ipv6_disable.xml
f386a0
+++ b/shared/checks/oval/sysctl_kernel_ipv6_disable.xml
f386a0
@@ -19,8 +19,8 @@
f386a0
     </metadata>
f386a0
     <criteria comment="IPv6 disabled or net.ipv6.conf.all.disable_ipv6 set correctly" operator="OR">
f386a0
       <criteria operator="AND">
f386a0
-        <extend_definition comment="net.ipv6.conf.all.disable_ipv6 configuration setting check" definition_ref="sysctl_static_net_ipv6_conf_all_disable_ipv6" />
f386a0
-        <extend_definition comment="net.ipv6.conf.all.disable_ipv6 runtime setting check" definition_ref="sysctl_runtime_net_ipv6_conf_all_disable_ipv6" />
f386a0
+        <extend_definition comment="net.ipv6.conf.all.disable_ipv6 configuration setting check" definition_ref="sysctl_net_ipv6_conf_all_disable_ipv6_static" />
f386a0
+        <extend_definition comment="net.ipv6.conf.all.disable_ipv6 runtime setting check" definition_ref="sysctl_net_ipv6_conf_all_disable_ipv6_runtime" />
f386a0
       </criteria>
f386a0
     </criteria>
f386a0
   </definition>
f386a0
diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt
f386a0
index fb2f59fd09..a613a152ae 100644
f386a0
--- a/shared/references/cce-redhat-avail.txt
f386a0
+++ b/shared/references/cce-redhat-avail.txt
f386a0
@@ -1443,7 +1443,6 @@ CCE-87708-4
f386a0
 CCE-87709-2
f386a0
 CCE-87710-0
f386a0
 CCE-87711-8
f386a0
-CCE-87712-6
f386a0
 CCE-87713-4
f386a0
 CCE-87714-2
f386a0
 CCE-87715-9
f386a0
diff --git a/shared/templates/sysctl/ansible.template b/shared/templates/sysctl/ansible.template
f386a0
index c13bb6637f..edc4d3fb66 100644
f386a0
--- a/shared/templates/sysctl/ansible.template
f386a0
+++ b/shared/templates/sysctl/ansible.template
f386a0
@@ -21,7 +21,7 @@
f386a0
     replace: '#{{{ SYSCTLVAR }}}'
f386a0
   loop: "{{ find_sysctl_d.files }}"
f386a0
 
f386a0
-{{%- if SYSCTLVAL == "" %}}
f386a0
+{{%- if SYSCTLVAL == "" or SYSCTLVAL is not string  %}}
f386a0
 - (xccdf-var sysctl_{{{ SYSCTLID }}}_value)
f386a0
 
f386a0
 - name: Ensure sysctl {{{ SYSCTLVAR }}} is set
f386a0
diff --git a/shared/templates/sysctl/bash.template b/shared/templates/sysctl/bash.template
f386a0
index d67a59c388..cd3424b022 100644
f386a0
--- a/shared/templates/sysctl/bash.template
f386a0
+++ b/shared/templates/sysctl/bash.template
f386a0
@@ -20,7 +20,7 @@ for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf; do
f386a0
   fi
f386a0
 done
f386a0
 
f386a0
-{{%- if SYSCTLVAL == "" %}}
f386a0
+{{%- if SYSCTLVAL == "" or SYSCTLVAL is not string %}}
f386a0
 {{{ bash_instantiate_variables("sysctl_" + SYSCTLID + "_value") }}}
f386a0
 
f386a0
 #
f386a0
diff --git a/shared/templates/sysctl/oval.template b/shared/templates/sysctl/oval.template
f386a0
index 74583dbee1..1a7c4979bb 100644
f386a0
--- a/shared/templates/sysctl/oval.template
f386a0
+++ b/shared/templates/sysctl/oval.template
f386a0
@@ -1,12 +1,20 @@
f386a0
 {{%- if SYSCTLVAL == "" %}}
f386a0
 {{%- set COMMENT_VALUE="the appropriate value" %}}
f386a0
+{{%- elif SYSCTLVAL is sequence %}}
f386a0
+{{%- set COMMENT_VALUE = SYSCTLVAL | join(" or " ) %}}
f386a0
 {{%- else %}}
f386a0
 {{%- set COMMENT_VALUE=SYSCTLVAL %}}
f386a0
 {{%- endif %}}
f386a0
 
f386a0
 {{% macro state_static_sysctld(prefix) -%}}
f386a0
-    <ind:object object_ref="object_static_{{{ prefix }}}_{{{ SYSCTLID }}}"/>
f386a0
-    <ind:state state_ref="state_static_sysctld_{{{ SYSCTLID }}}"/>
f386a0
+    <ind:object object_ref="object_static_{{{ prefix }}}_{{{ rule_id }}}"/>
f386a0
+{{% if SYSCTLVAL is string %}}
f386a0
+    <ind:state state_ref="state_static_sysctld_{{{ rule_id }}}"/>
f386a0
+{{% elif SYSCTLVAL is sequence %}}
f386a0
+{{% for x in SYSCTLVAL %}}
f386a0
+    <ind:state state_ref="state_static_sysctld_{{{ rule_id }}}_{{{ x }}}" />
f386a0
+{{% endfor %}}
f386a0
+{{% endif %}}
f386a0
 {{%- endmacro -%}}
f386a0
 {{%- macro sysctl_match() -%}}
f386a0
 {{%- if SYSCTLVAL == "" -%}}
f386a0
@@ -20,13 +28,13 @@
f386a0
 {{%- if "P" in FLAGS -%}}
f386a0
 
f386a0
 <def-group>
f386a0
-  <definition class="compliance" id="sysctl_{{{ SYSCTLID }}}" version="3">
f386a0
+  <definition class="compliance" id="{{{ rule_id }}}" version="3">
f386a0
     {{{ oval_metadata("The '" + SYSCTLVAR + "' kernel parameter should be set to the appropriate value in both system configuration and system runtime.") }}}
f386a0
     <criteria operator="AND">
f386a0
       
f386a0
-                         definition_ref="sysctl_static_{{{ SYSCTLID }}}"/>
f386a0
+                         definition_ref="{{{ rule_id }}}_static"/>
f386a0
       
f386a0
-                         definition_ref="sysctl_runtime_{{{ SYSCTLID }}}"/>
f386a0
+                         definition_ref="{{{ rule_id }}}_runtime"/>
f386a0
     </criteria>
f386a0
   </definition>
f386a0
 </def-group>
f386a0
@@ -34,7 +42,7 @@
f386a0
 {{%- elif "I" in FLAGS -%}}
f386a0
 
f386a0
 <def-group>
f386a0
-  <definition class="compliance" id="sysctl_{{{ SYSCTLID }}}" version="4">
f386a0
+  <definition class="compliance" id="{{{ rule_id }}}" version="4">
f386a0
     {{{ oval_metadata("The kernel '" + SYSCTLVAR + "' parameter should be set to the appropriate value in both system configuration and system runtime.") }}}
f386a0
     <criteria comment="IPv6 disabled or {{{ SYSCTLVAR }}} set correctly" operator="OR">
f386a0
 {{% if product in ["ubuntu1604", "ubuntu1804"] %}}
f386a0
@@ -46,9 +54,9 @@
f386a0
 {{% endif %}}
f386a0
       <criteria operator="AND">
f386a0
         
f386a0
-                           definition_ref="sysctl_static_{{{ SYSCTLID }}}"/>
f386a0
+                           definition_ref="{{{ rule_id }}}_static"/>
f386a0
         
f386a0
-                           definition_ref="sysctl_runtime_{{{ SYSCTLID }}}"/>
f386a0
+                           definition_ref="{{{ rule_id }}}_runtime"/>
f386a0
       </criteria>
f386a0
     </criteria>
f386a0
   </definition>
f386a0
@@ -58,33 +66,41 @@
f386a0
 {{%- if "R" in FLAGS -%}}
f386a0
 
f386a0
 <def-group>
f386a0
-  <definition class="compliance" id="sysctl_runtime_{{{ SYSCTLID }}}" version="3">
f386a0
+  <definition class="compliance" id="{{{ rule_id }}}_runtime" version="3">
f386a0
     {{{ oval_metadata("The kernel '" + SYSCTLVAR + "' parameter should be set to " + COMMENT_VALUE + " in the system runtime.") }}}
f386a0
     <criteria operator="AND">
f386a0
       
f386a0
-                 test_ref="test_sysctl_runtime_{{{ SYSCTLID }}}"/>
f386a0
+                 test_ref="test_{{{ rule_id }}}_runtime"/>
f386a0
     </criteria>
f386a0
   </definition>
f386a0
-  
f386a0
+
f386a0
+  
f386a0
                     comment="kernel runtime parameter {{{ SYSCTLVAR }}} set to {{{ COMMENT_VALUE }}}"
f386a0
-                    check="all" check_existence="all_exist">
f386a0
-    <unix:object object_ref="object_sysctl_runtime_{{{ SYSCTLID }}}"/>
f386a0
-    <unix:state state_ref="state_sysctl_runtime_{{{ SYSCTLID }}}"/>
f386a0
+                    check="all" check_existence="all_exist" state_operator="OR">
f386a0
+    <unix:object object_ref="object_{{{ rule_id }}}_runtime"/>
f386a0
+{{% if SYSCTLVAL is string %}}
f386a0
+    <unix:state state_ref="state_{{{ rule_id }}}_runtime"/>
f386a0
+{{% elif SYSCTLVAL is sequence %}}
f386a0
+{{% for x in SYSCTLVAL %}}
f386a0
+    <unix:state state_ref="state_{{{ rule_id }}}_runtime_{{{ x }}}" />
f386a0
+{{% endfor %}}
f386a0
+{{% endif %}}
f386a0
   </unix:sysctl_test>
f386a0
 
f386a0
-  <unix:sysctl_object id="object_sysctl_runtime_{{{ SYSCTLID }}}" version="1">
f386a0
+  <unix:sysctl_object id="object_{{{ rule_id }}}_runtime" version="1">
f386a0
     <unix:name>{{{ SYSCTLVAR }}}</unix:name>
f386a0
   </unix:sysctl_object>
f386a0
+{{% if SYSCTLVAL is string %}}
f386a0
 {{% if SYSCTLVAL == "" %}}
f386a0
-  <unix:sysctl_state id="state_sysctl_runtime_{{{ SYSCTLID }}}" version="1">
f386a0
+  <unix:sysctl_state id="state_{{{ rule_id }}}_runtime" version="1">
f386a0
     
f386a0
-                var_ref="sysctl_{{{ SYSCTLID }}}_value"/>
f386a0
+                var_ref="{{{ rule_id }}}_value"/>
f386a0
   </unix:sysctl_state>
f386a0
 
f386a0
-  
f386a0
+  
f386a0
                      comment="External variable for {{{ SYSCTLVAR }}}" datatype="{{{ DATATYPE }}}"/>
f386a0
 {{%- else %}}
f386a0
-  <unix:sysctl_state id="state_sysctl_runtime_{{{ SYSCTLID }}}" version="1">
f386a0
+  <unix:sysctl_state id="state_{{{ rule_id }}}_runtime" version="1">
f386a0
 {{% if OPERATION == "pattern match" %}}
f386a0
     
f386a0
                 operation="{{{ OPERATION }}}">{{{ SYSCTLVAL_REGEX }}}</unix:value>
f386a0
@@ -94,133 +110,156 @@
f386a0
 {{% endif %}}
f386a0
   </unix:sysctl_state>
f386a0
 {{%- endif %}}
f386a0
+{{% elif SYSCTLVAL is sequence %}}
f386a0
+{{% for x in SYSCTLVAL %}}
f386a0
+  <unix:sysctl_state id="state_{{{ rule_id }}}_runtime_{{{ x }}}" version="1">
f386a0
+    
f386a0
+                operation="{{{ OPERATION }}}">{{{ x }}}</unix:value>
f386a0
+  </unix:sysctl_state>
f386a0
+{{% endfor %}}
f386a0
+{{% endif %}}
f386a0
 </def-group>
f386a0
 
f386a0
 {{%- endif -%}}
f386a0
 {{%- if "S" in FLAGS -%}}
f386a0
 
f386a0
 <def-group>
f386a0
-  <definition class="compliance" id="sysctl_static_{{{ SYSCTLID }}}" version="3">
f386a0
+  <definition class="compliance" id="{{{ rule_id }}}_static" version="3">
f386a0
     {{{ oval_metadata("The kernel '" + SYSCTLVAR + "' parameter should be set to " + COMMENT_VALUE + " in the system configuration.") }}}
f386a0
+{{% if MISSING_PARAMETER_PASS == "true" %}}
f386a0
+    <criteria operator="OR">
f386a0
+{{% endif %}}
f386a0
     <criteria operator="AND">
f386a0
       <criteria operator="OR">
f386a0
         
f386a0
-                   test_ref="test_static_sysctl_{{{ SYSCTLID }}}"/>
f386a0
+                   test_ref="test_{{{ rule_id }}}_static"/>
f386a0
         
f386a0
         
f386a0
-                   test_ref="test_static_etc_sysctld_{{{ SYSCTLID }}}"/>
f386a0
+                   test_ref="test_{{{ rule_id }}}_static_etc_sysctld"/>
f386a0
         
f386a0
-                   test_ref="test_static_run_sysctld_{{{ SYSCTLID }}}"/>
f386a0
+                   test_ref="test_{{{ rule_id }}}_static_run_sysctld"/>
f386a0
 {{% if product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
f386a0
         
f386a0
-                   test_ref="test_static_usr_lib_sysctld_{{{ SYSCTLID }}}"/>
f386a0
+                   test_ref="test_{{{ rule_id }}}_static_usr_lib_sysctld"/>
f386a0
 {{% endif %}}
f386a0
       </criteria>
f386a0
 {{% if target_oval_version >= [5, 11] %}}
f386a0
-      <criterion comment="Check that {{{ SYSCTLID }}} is defined in only one file" test_ref="test_sysctl_{{{ SYSCTLID }}}_defined_in_one_file" />
f386a0
+      <criterion comment="Check that {{{ SYSCTLID }}} is defined in only one file" test_ref="test_{{{ rule_id }}}_defined_in_one_file" />
f386a0
 {{% endif %}}
f386a0
     </criteria>
f386a0
+{{% if MISSING_PARAMETER_PASS == "true" %}}
f386a0
+      <criterion comment="Check that {{{ SYSCTLID }}} is not defined in any file" test_ref="test_{{{ rule_id }}}_not_defined" />
f386a0
+    </criteria>
f386a0
+{{% endif %}}
f386a0
   </definition>
f386a0
 
f386a0
-  
f386a0
-                              check="all" check_existence="all_exist"
f386a0
+{{% if MISSING_PARAMETER_PASS == "true" %}}
f386a0
+  
f386a0
+                              check="all" check_existence="none_exist"
f386a0
                               comment="{{{ SYSCTLVAR }}} static configuration">
f386a0
+    <ind:object object_ref="object_{{{ rule_id }}}_static_set_sysctls" />
f386a0
+  </ind:textfilecontent54_test>
f386a0
+{{% endif %}}
f386a0
+
f386a0
+  
f386a0
+                              check="all" check_existence="all_exist"
f386a0
+                              comment="{{{ SYSCTLVAR }}} static configuration" state_operator="OR">
f386a0
     {{{ state_static_sysctld("sysctl") }}}
f386a0
   </ind:textfilecontent54_test>
f386a0
 
f386a0
-  
f386a0
-                          comment="{{{ SYSCTLVAR }}} static configuration in /etc/sysctl.d/*.conf">
f386a0
+  
f386a0
+                          comment="{{{ SYSCTLVAR }}} static configuration in /etc/sysctl.d/*.conf" state_operator="OR">
f386a0
     {{{ state_static_sysctld("etc_sysctld") }}}
f386a0
   </ind:textfilecontent54_test>
f386a0
 
f386a0
-  
f386a0
-                          comment="{{{ SYSCTLVAR }}} static configuration in /run/sysctl.d/*.conf">
f386a0
+  
f386a0
+                          comment="{{{ SYSCTLVAR }}} static configuration in /run/sysctl.d/*.conf" state_operator="OR">
f386a0
     {{{ state_static_sysctld("run_sysctld") }}}
f386a0
   </ind:textfilecontent54_test>
f386a0
 
f386a0
 {{% if product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
f386a0
-  
f386a0
+  
f386a0
                           check="all"
f386a0
-                          comment="{{{ SYSCTLVAR }}} static configuration in /usr/lib/sysctl.d/*.conf">
f386a0
+                          comment="{{{ SYSCTLVAR }}} static configuration in /usr/lib/sysctl.d/*.conf" state_operator="OR">
f386a0
     {{{ state_static_sysctld("usr_lib_sysctld") }}}
f386a0
   </ind:textfilecontent54_test>
f386a0
 {{% endif %}}
f386a0
 
f386a0
 {{% if target_oval_version >= [5, 11] %}}
f386a0
   
f386a0
-  id="test_sysctl_{{{ SYSCTLID }}}_defined_in_one_file" version="1">
f386a0
-    <ind:object object_ref="oject_sysctl_{{{ SYSCTLID }}}_defined_in_one_file" />
f386a0
-    <ind:state state_ref="state_sysctl_{{{ SYSCTLID }}}_defined_in_one_file" />
f386a0
+  id="test_{{{ rule_id }}}_defined_in_one_file" version="1">
f386a0
+    <ind:object object_ref="object_{{{ rule_id }}}_defined_in_one_file" />
f386a0
+    <ind:state state_ref="state_{{{ rule_id }}}_defined_in_one_file" />
f386a0
   </ind:variable_test>
f386a0
 
f386a0
-  <ind:variable_object id="oject_sysctl_{{{ SYSCTLID }}}_defined_in_one_file" version="1">
f386a0
-    <ind:var_ref>local_var_unique_sysctl_{{{ SYSCTLID }}}_counter</ind:var_ref>
f386a0
+  <ind:variable_object id="object_{{{ rule_id }}}_defined_in_one_file" version="1">
f386a0
+    <ind:var_ref>local_var_{{{ rule_id }}}_counter</ind:var_ref>
f386a0
   </ind:variable_object>
f386a0
 
f386a0
-  <ind:variable_state id="state_sysctl_{{{ SYSCTLID }}}_defined_in_one_file" version="1">
f386a0
+  <ind:variable_state id="state_{{{ rule_id }}}_defined_in_one_file" version="1">
f386a0
     <ind:value operation="equals" datatype="int">1</ind:value>
f386a0
   </ind:variable_state>
f386a0
 
f386a0
-  <local_variable comment="Count unique sysctls" datatype="int" id="local_var_unique_sysctl_{{{ SYSCTLID }}}_counter" version="1">
f386a0
+  <local_variable comment="Count unique sysctls" datatype="int" id="local_var_{{{ rule_id }}}_counter" version="1">
f386a0
     <count>
f386a0
       <unique>
f386a0
-        <object_component object_ref="object_static_set_sysctls_{{{ SYSCTLID }}}" item_field="filepath" />
f386a0
+        <object_component object_ref="object_{{{ rule_id }}}_static_set_sysctls" item_field="filepath" />
f386a0
       </unique>
f386a0
     </count>
f386a0
   </local_variable>
f386a0
 
f386a0
-  <ind:textfilecontent54_object id="object_static_set_sysctls_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_{{{ rule_id }}}_static_set_sysctls" version="1">
f386a0
     <set>
f386a0
-      <object_reference>object_static_set_unfiltered_sysctls_{{{ SYSCTLID }}}</object_reference>
f386a0
-      <filter action="exclude">state_{{{ SYSCTLID }}}_filepath_is_symlink</filter>
f386a0
+      <object_reference>object_{{{ rule_id }}}_static_set_sysctls_unfiltered</object_reference>
f386a0
+      <filter action="exclude">state_{{{ rule_id }}}_filepath_is_symlink</filter>
f386a0
     </set>
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
-  <ind:textfilecontent54_state id="state_{{{ SYSCTLID }}}_filepath_is_symlink" version="1">
f386a0
-    <ind:filepath operation="equals" var_check="at least one" var_ref="local_var_safe_symlinks_{{{ SYSCTLID }}}" datatype="string" />
f386a0
+  <ind:textfilecontent54_state id="state_{{{ rule_id }}}_filepath_is_symlink" version="1">
f386a0
+    <ind:filepath operation="equals" var_check="at least one" var_ref="local_var_{{{ rule_id }}}_safe_symlinks" datatype="string" />
f386a0
   </ind:textfilecontent54_state>
f386a0
 
f386a0
-  
f386a0
+  
f386a0
   
f386a0
        This ultimately avoids referencing a variable with "no values",
f386a0
        we reference a variable with a blank string -->
f386a0
-  <local_variable comment="Unique list of symlink conf files" datatype="string" id="local_var_safe_symlinks_{{{ SYSCTLID }}}" version="1">
f386a0
+  <local_variable comment="Unique list of symlink conf files" datatype="string" id="local_var_{{{ rule_id }}}_safe_symlinks" version="1">
f386a0
     <unique>
f386a0
-      <object_component object_ref="var_object_symlink_{{{ SYSCTLID }}}" item_field="value" />
f386a0
+      <object_component object_ref="var_object_symlink_{{{ rule_id }}}" item_field="value" />
f386a0
     </unique>
f386a0
   </local_variable>
f386a0
 
f386a0
-  <ind:variable_object id="var_object_symlink_{{{ SYSCTLID }}}" comment="combine the blank string with symlink paths found" version="1">
f386a0
+  <ind:variable_object id="var_object_symlink_{{{ rule_id }}}" comment="combine the blank string with symlink paths found" version="1">
f386a0
     <set>
f386a0
-      <object_reference>var_obj_symlink_{{{ SYSCTLID }}}</object_reference>
f386a0
-      <object_reference>var_obj_blank_{{{ SYSCTLID }}}</object_reference>
f386a0
+      <object_reference>var_obj_symlink_{{{ rule_id }}}</object_reference>
f386a0
+      <object_reference>var_obj_blank_{{{ rule_id }}}</object_reference>
f386a0
     </set>
f386a0
   </ind:variable_object>
f386a0
 
f386a0
-  <ind:variable_object id="var_obj_blank_{{{ SYSCTLID }}}" comment="variable object of the blank string" version="1">
f386a0
-    <ind:var_ref>local_var_blank_path_{{{ SYSCTLID }}}</ind:var_ref>
f386a0
+  <ind:variable_object id="var_obj_blank_{{{ rule_id }}}" comment="variable object of the blank string" version="1">
f386a0
+    <ind:var_ref>local_var_blank_path_{{{ rule_id }}}</ind:var_ref>
f386a0
   </ind:variable_object>
f386a0
 
f386a0
-  <local_variable comment="Blank string" datatype="string" id="local_var_blank_path_{{{ SYSCTLID }}}" version="1">
f386a0
+  <local_variable comment="Blank string" datatype="string" id="local_var_blank_path_{{{ rule_id }}}" version="1">
f386a0
     <literal_component datatype="string"></literal_component>
f386a0
   </local_variable>
f386a0
 
f386a0
-  <ind:variable_object id="var_obj_symlink_{{{ SYSCTLID }}}" comment="variable object of the symlinks found" version="1">
f386a0
-    <ind:var_ref>local_var_symlinks_{{{ SYSCTLID }}}</ind:var_ref>
f386a0
+  <ind:variable_object id="var_obj_symlink_{{{ rule_id }}}" comment="variable object of the symlinks found" version="1">
f386a0
+    <ind:var_ref>local_var_symlinks_{{{ rule_id }}}</ind:var_ref>
f386a0
   </ind:variable_object>
f386a0
-  
f386a0
+  
f386a0
 
f386a0
-  <local_variable comment="Unique list of symlink conf files" datatype="string" id="local_var_symlinks_{{{ SYSCTLID }}}" version="1">
f386a0
+  <local_variable comment="Unique list of symlink conf files" datatype="string" id="local_var_symlinks_{{{ rule_id }}}" version="1">
f386a0
     <unique>
f386a0
-      <object_component object_ref="object_{{{ SYSCTLID }}}_symlinks" item_field="filepath" />
f386a0
+      <object_component object_ref="object_{{{ rule_id }}}_symlinks" item_field="filepath" />
f386a0
     </unique>
f386a0
   </local_variable>
f386a0
 
f386a0
   
f386a0
        Workaround by querying for all conf files found -->
f386a0
-  <unix:symlink_object comment="Symlinks referencing files in default dirs" id="object_{{{ SYSCTLID }}}_symlinks" version="1">
f386a0
-    <unix:filepath operation="equals" var_ref="local_var_conf_files_{{{ SYSCTLID }}}" />
f386a0
-    <filter action="exclude">state_symlink_points_outside_usual_dirs_{{{ SYSCTLID }}}</filter>
f386a0
+  <unix:symlink_object comment="Symlinks referencing files in default dirs" id="object_{{{ rule_id }}}_symlinks" version="1">
f386a0
+    <unix:filepath operation="equals" var_ref="local_var_conf_files_{{{ rule_id }}}" />
f386a0
+    <filter action="exclude">state_symlink_points_outside_usual_dirs_{{{ rule_id }}}</filter>
f386a0
   </unix:symlink_object>
f386a0
 
f386a0
   
f386a0
@@ -228,75 +267,76 @@
f386a0
        ^/etc/sysctl.d/.*$
f386a0
        ^/run/sysctl.d/.*$
f386a0
        ^/usr/lib/sysctl.d/.*$ -->
f386a0
-  <unix:symlink_state comment="State that matches symlinks referencing files not in the default dirs" id="state_symlink_points_outside_usual_dirs_{{{ SYSCTLID }}}" version="1">
f386a0
+  <unix:symlink_state comment="State that matches symlinks referencing files not in the default dirs" id="state_symlink_points_outside_usual_dirs_{{{ rule_id }}}" version="1">
f386a0
     <unix:canonical_path operation="pattern match">^(?!(\/etc\/sysctl\.conf$|(\/etc|\/run|\/usr\/lib)\/sysctl\.d\/)).*$</unix:canonical_path>
f386a0
   </unix:symlink_state>
f386a0
 {{% endif %}}
f386a0
 
f386a0
-  <local_variable comment="List of conf files" datatype="string" id="local_var_conf_files_{{{ SYSCTLID }}}" version="1">
f386a0
-    <object_component object_ref="object_static_set_unfiltered_sysctls_{{{ SYSCTLID }}}" item_field="filepath" />
f386a0
+  <local_variable comment="List of conf files" datatype="string" id="local_var_conf_files_{{{ rule_id }}}" version="1">
f386a0
+    <object_component object_ref="object_{{{ rule_id }}}_static_set_sysctls_unfiltered" item_field="filepath" />
f386a0
   </local_variable>
f386a0
 
f386a0
   
f386a0
        variable to have no value even when there are valid objects. -->
f386a0
-  <ind:textfilecontent54_object id="object_static_set_unfiltered_sysctls_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_{{{ rule_id }}}_static_set_sysctls_unfiltered" version="1">
f386a0
     <set>
f386a0
-      <object_reference>object_static_etc_sysctls_{{{ SYSCTLID }}}</object_reference>
f386a0
-      <object_reference>object_static_run_usr_sysctls_{{{ SYSCTLID }}}</object_reference>
f386a0
+      <object_reference>object_static_etc_sysctls_{{{ rule_id }}}</object_reference>
f386a0
+      <object_reference>object_static_run_usr_sysctls_{{{ rule_id }}}</object_reference>
f386a0
     </set>
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
-  <ind:textfilecontent54_object id="object_static_etc_sysctls_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_static_etc_sysctls_{{{ rule_id }}}" version="1">
f386a0
     <set>
f386a0
-      <object_reference>object_static_sysctl_{{{ SYSCTLID }}}</object_reference>
f386a0
-      <object_reference>object_static_etc_sysctld_{{{ SYSCTLID }}}</object_reference>
f386a0
+      <object_reference>object_static_sysctl_{{{ rule_id }}}</object_reference>
f386a0
+      <object_reference>object_static_etc_sysctld_{{{ rule_id }}}</object_reference>
f386a0
     </set>
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
-  <ind:textfilecontent54_object id="object_static_run_usr_sysctls_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_static_run_usr_sysctls_{{{ rule_id }}}" version="1">
f386a0
     <set>
f386a0
-      <object_reference>object_static_run_sysctld_{{{ SYSCTLID }}}</object_reference>
f386a0
+      <object_reference>object_static_run_sysctld_{{{ rule_id }}}</object_reference>
f386a0
 {{% if product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
f386a0
-      <object_reference>object_static_usr_lib_sysctld_{{{ SYSCTLID }}}</object_reference>
f386a0
+      <object_reference>object_static_usr_lib_sysctld_{{{ rule_id }}}</object_reference>
f386a0
 {{% endif %}}
f386a0
     </set>
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
-  <ind:textfilecontent54_object id="object_static_sysctl_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_static_sysctl_{{{ rule_id }}}" version="1">
f386a0
     <ind:filepath>/etc/sysctl.conf</ind:filepath>
f386a0
     {{{ sysctl_match() }}}
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
-  <ind:textfilecontent54_object id="object_static_etc_sysctld_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_static_etc_sysctld_{{{ rule_id }}}" version="1">
f386a0
     <ind:path>/etc/sysctl.d</ind:path>
f386a0
     <ind:filename operation="pattern match">^.*\.conf$</ind:filename>
f386a0
     {{{ sysctl_match() }}}
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
-  <ind:textfilecontent54_object id="object_static_run_sysctld_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_static_run_sysctld_{{{ rule_id }}}" version="1">
f386a0
     <ind:path>/run/sysctl.d</ind:path>
f386a0
     <ind:filename operation="pattern match">^.*\.conf$</ind:filename>
f386a0
     {{{ sysctl_match() }}}
f386a0
   </ind:textfilecontent54_object>
f386a0
 
f386a0
 {{% if product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
f386a0
-  <ind:textfilecontent54_object id="object_static_usr_lib_sysctld_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_object id="object_static_usr_lib_sysctld_{{{ rule_id }}}" version="1">
f386a0
     <ind:path>/usr/lib/sysctl.d</ind:path>
f386a0
     <ind:filename operation="pattern match">^.*\.conf$</ind:filename>
f386a0
     {{{ sysctl_match() }}}
f386a0
   </ind:textfilecontent54_object>
f386a0
 {{% endif %}}
f386a0
+{{% if SYSCTLVAL is string %}}
f386a0
 {{% if SYSCTLVAL == "" %}}
f386a0
 
f386a0
-  <ind:textfilecontent54_state id="state_static_sysctld_{{{ SYSCTLID }}}" version="1">
f386a0
-    
f386a0
+  <ind:textfilecontent54_state id="state_static_sysctld_{{{ rule_id }}}" version="1">
f386a0
+    
f386a0
                        datatype="{{{ DATATYPE }}}" />
f386a0
   </ind:textfilecontent54_state>
f386a0
 
f386a0
-  
f386a0
+  
f386a0
                      comment="External variable for {{{ SYSCTLVAR }}}" datatype="{{{ DATATYPE }}}"/>
f386a0
 {{% else %}}
f386a0
-  <ind:textfilecontent54_state id="state_static_sysctld_{{{ SYSCTLID }}}" version="1">
f386a0
+  <ind:textfilecontent54_state id="state_static_sysctld_{{{ rule_id }}}" version="1">
f386a0
 {{% if OPERATION == "pattern match" %}}
f386a0
     <ind:subexpression operation="{{{ OPERATION }}}" datatype="{{{ DATATYPE }}}">{{{ SYSCTLVAL_REGEX }}}</ind:subexpression>
f386a0
 {{% else %}}
f386a0
@@ -304,5 +344,12 @@
f386a0
 {{% endif %}}
f386a0
   </ind:textfilecontent54_state>
f386a0
 {{% endif %}}
f386a0
+{{% elif SYSCTLVAL is sequence %}}
f386a0
+{{% for x in SYSCTLVAL %}}
f386a0
+  <ind:textfilecontent54_state id="state_static_sysctld_{{{ rule_id }}}_{{{ x }}}" version="1">
f386a0
+    <ind:subexpression operation="{{{ OPERATION }}}" datatype="{{{ DATATYPE }}}">{{{ x }}}</ind:subexpression>
f386a0
+  </ind:textfilecontent54_state>
f386a0
+{{% endfor %}}
f386a0
+{{% endif %}}
f386a0
 </def-group>
f386a0
 {{%- endif -%}}
f386a0
diff --git a/shared/templates/sysctl/template.py b/shared/templates/sysctl/template.py
f386a0
index fa981a9dce..9083a6a418 100644
f386a0
--- a/shared/templates/sysctl/template.py
f386a0
+++ b/shared/templates/sysctl/template.py
f386a0
@@ -11,8 +11,19 @@ def preprocess(data, lang):
f386a0
     data["flags"] = "SR" + ipv6_flag
f386a0
     if "operation" not in data:
f386a0
         data["operation"] = "equals"
f386a0
+    if isinstance(data["sysctlval"], list) and len(data["sysctlval"]) == 0:
f386a0
+        raise ValueError(
f386a0
+            "The sysctlval parameter of {0} is an empty list".format(
f386a0
+                data["_rule_id"]))
f386a0
 
f386a0
     # Configure data for test scenarios
f386a0
+    if data["datatype"] not in ["string", "int"]:
f386a0
+        raise ValueError(
f386a0
+            "Test scenarios for data type '{0}' are not implemented yet.\n"
f386a0
+            "Please check if rule '{1}' has correct data type and edit "
f386a0
+            "{2} to add tests for it.".format(
f386a0
+                data["datatype"], data["_rule_id"], __file__))
f386a0
+
f386a0
     if data["sysctlval"] == "":
f386a0
         if data["datatype"] == "int":
f386a0
             data["sysctl_correct_value"] = "0"
f386a0
@@ -20,20 +31,13 @@ def preprocess(data, lang):
f386a0
         elif data["datatype"] == "string":
f386a0
             data["sysctl_correct_value"] = "correct_value"
f386a0
             data["sysctl_wrong_value"] = "wrong_value"
f386a0
-        else:
f386a0
-            raise ValueError(
f386a0
-                "Test scenarios for data type '{0}' are not implemented yet.\n"
f386a0
-                "Please check if rule '{1}' has correct data type and edit "
f386a0
-                "{2} to add tests for it.".format(data["datatype"], data["_rule_id"], __file__))
f386a0
+    elif isinstance(data["sysctlval"], list):
f386a0
+        data["sysctl_correct_value"] = data["sysctlval"][0]
f386a0
+        data["sysctl_wrong_value"] = data["wrong_sysctlval_for_testing"]
f386a0
     else:
f386a0
         data["sysctl_correct_value"] = data["sysctlval"]
f386a0
         if data["datatype"] == "int":
f386a0
             data["sysctl_wrong_value"] = "1" + data["sysctlval"]
f386a0
         elif data["datatype"] == "string":
f386a0
             data["sysctl_wrong_value"] = "wrong_value"
f386a0
-        else:
f386a0
-            raise ValueError(
f386a0
-                "Test scenarios for data type '{0}' are not implemented yet.\n"
f386a0
-                "Please check if rule '{1}' has correct data type and edit "
f386a0
-                "{2} to add tests for it.".format(data["datatype"], data["_rule_id"], __file__))
f386a0
     return data
f386a0
-- 
f386a0
2.37.1
f386a0