Skip to content

Commit

Permalink
Merge pull request ComplianceAsCode#10555 from rumch-se/fix_in_kernel…
Browse files Browse the repository at this point in the history
…_randomize_va_space

Fix into the rule sysctl_kernel_randomize_va_space
  • Loading branch information
yuumasato authored Jul 21, 2023
2 parents d99f979 + ae9eb19 commit 4bfaefb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion shared/templates/sysctl/ansible.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
{{% if product in ["sle12","sle15"] %}}
find:
paths:
- "/etc/sysctl.d/"
- "/run/sysctl.d/"
- "/etc/sysctl.d/"
- "/usr/local/lib/sysctl.d/"
- "/lib/sysctl.d/"
{{% else %}}
find:
paths:
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/sysctl/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Comment out any occurrences of {{{ SYSCTLVAR }}} from /etc/sysctl.d/*.conf files
{{% if product in [ "sle12", "sle15"] %}}
for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf; do
for f in /run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf; do
{{% elif product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf; do
{{% else %}}
Expand Down
21 changes: 17 additions & 4 deletions shared/templates/sysctl/oval.template
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,24 @@
</ind:textfilecontent54_test>
{{% endif %}}


<!-- Avoid directly referencing a possibly empty collection, one empty collection will cause the
variable to have no value even when there are valid objects. -->
<ind:textfilecontent54_object id="object_static_user_{{{ rule_id }}}" version="1">
<set>
<object_reference>object_static_etc_sysctls_{{{ rule_id }}}</object_reference>
<object_reference>object_static_etc_lib_sysctls_{{{ rule_id }}}</object_reference>
<object_reference>object_static_run_usr_local_sysctls_{{{ rule_id }}}</object_reference>
</set>
</ind:textfilecontent54_object>

<ind:textfilecontent54_object id="object_static_etc_lib_sysctls_{{{ rule_id }}}" version="1">
<set>
<object_reference>object_static_etc_sysctls_{{{ rule_id }}}</object_reference>
{{% if product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
<object_reference>object_static_lib_sysctld_{{{ rule_id }}}</object_reference>
{{% endif %}}
</set>
</ind:textfilecontent54_object>

<ind:textfilecontent54_object id="object_static_etc_sysctls_{{{ rule_id }}}" version="1">
<set>
<object_reference>object_static_sysctl_{{{ rule_id }}}</object_reference>
Expand All @@ -193,7 +201,6 @@
<object_reference>object_static_run_sysctld_{{{ rule_id }}}</object_reference>
</set>
</ind:textfilecontent54_object>

<ind:textfilecontent54_object id="object_static_sysctl_{{{ rule_id }}}" version="1">
<ind:filepath>/etc/sysctl.conf</ind:filepath>
{{{ sysctl_match() }}}
Expand Down Expand Up @@ -222,7 +229,13 @@
<ind:filename operation="pattern match">^.*\.conf$</ind:filename>
{{{ sysctl_match() }}}
</ind:textfilecontent54_object>

{{% if product not in [ "ol7", "ol8", "ol9", "rhcos4", "rhel7", "rhel8", "rhel9"] %}}
<ind:textfilecontent54_object id="object_static_lib_sysctld_{{{ rule_id }}}" version="1">
<ind:path>/lib/sysctl.d</ind:path>
<ind:filename operation="pattern match">^.*\.conf$</ind:filename>
{{{ sysctl_match() }}}
</ind:textfilecontent54_object>
{{% endif %}}
{{% if SYSCTLVAL is string %}}
{{% if SYSCTLVAL == "" %}}

Expand Down

0 comments on commit 4bfaefb

Please sign in to comment.