Skip to content

Commit

Permalink
Merge pull request #9450 from Mab879/fix_9192_2
Browse files Browse the repository at this point in the history
Move kernel_module_disabled use more genric RHEL in conditionals
  • Loading branch information
jan-cerny committed Sep 20, 2022
2 parents b430ddb + 2bd830e commit d38fdbd
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# platform multi_platform_rhel,multi_platform_ol

rm -f /etc/modprobe.d/dccp-blacklist.conf
echo "install {{{ KERNMODULE }}} /bin/true" > /etc/modprobe.d/{{{ KERNMODULE }}}.conf
2 changes: 1 addition & 1 deletion shared/templates/kernel_module_disabled/ansible.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
dest: "/etc/modprobe.d/{{{ KERNMODULE }}}.conf"
regexp: '{{{ KERNMODULE }}}'
line: "install {{{ KERNMODULE }}} /bin/true"
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
- name: Ensure kernel module '{{{ KERNMODULE }}}' is blacklisted
lineinfile:
create: yes
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/kernel_module_disabled/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else
echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/{{{ KERNMODULE }}}.conf
echo "install {{{ KERNMODULE }}} /bin/true" >> /etc/modprobe.d/{{{ KERNMODULE }}}.conf
fi
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
if ! LC_ALL=C grep -q -m 1 "^blacklist {{{ KERNMODULE }}}$" /etc/modprobe.d/{{{ KERNMODULE }}}.conf ; then
echo "blacklist {{{ KERNMODULE }}}" >> /etc/modprobe.d/{{{ KERNMODULE }}}.conf
fi
Expand Down
4 changes: 2 additions & 2 deletions shared/templates/kernel_module_disabled/oval.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{% if product in ["sle12", "sle15"] %}}
<criterion test_ref="test_kernmod_{{{ KERNMODULE }}}_blacklisted"
comment="kernel module {{{ KERNMODULE }}} blacklisted in modprobe.d" />
{{% elif product in ["ol7", "ol8", "rhcos4", "rhel7", "rhel8"] %}}
{{% elif product in ["ol7", "ol8", "rhcos4"] or 'rhel' in product %}}
<criteria operator="AND">
<criterion test_ref="test_kernmod_{{{ KERNMODULE }}}_blacklisted"
comment="kernel module {{{ KERNMODULE }}} blacklisted in modprobe.d" />
Expand Down Expand Up @@ -49,7 +49,7 @@
</constant_variable>
{{% endif %}}

{{% if product in ["ol7", "ol8", "rhcos4", "rhel7", "rhel8", "sle12", "sle15"] %}}
{{% if product in ["ol7", "ol8", "rhcos4", "sle12", "sle15"] or 'rhel' in product %}}
<ind:textfilecontent54_test id="test_kernmod_{{{ KERNMODULE }}}_blacklisted" version="1" check="all"
comment="kernel module {{{ KERNMODULE }}} blacklisted">
<ind:object object_ref="obj_kernmod_{{{ KERNMODULE }}}_blacklisted" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "install {{{ KERNMODULE }}} /bin/true" > /etc/modprobe.d/{{{ KERNMODULE }}}.conf
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "blacklist {{{ KERNMODULE }}}" >> /etc/modprobe.d/{{{ KERNMODULE }}}.conf
{{% endif %}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "install {{{ KERNMODULE }}} /bin/true" > /etc/modules-load.d/{{{ KERNMODULE }}}.conf
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "blacklist {{{ KERNMODULE }}}" >> /etc/modules-load.d/{{{ KERNMODULE }}}.conf
{{% endif %}}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ if [[ ! -d /run/modprobe.d ]]; then
mkdir -p /run/modprobe.d
fi
echo "install {{{ KERNMODULE }}} /bin/true" > /run/modprobe.d/{{{ KERNMODULE }}}.conf
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "blacklist {{{ KERNMODULE }}}" >> /run/modprobe.d/{{{ KERNMODULE }}}.conf
{{% endif %}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ if [[ ! -d /run/modules-load.d ]]; then
fi

echo "install {{{ KERNMODULE }}} /bin/true" > /run/modules-load.d/{{{ KERNMODULE }}}.conf
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "blacklist {{{ KERNMODULE }}}" >> /run/modules-load.d/{{{ KERNMODULE }}}.conf
{{% endif %}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "install {{{ KERNMODULE }}} /bin/true" > /usr/lib/modprobe.d/{{{ KERNMODULE }}}.conf
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "blacklist {{{ KERNMODULE }}}" >> /usr/lib/modprobe.d/{{{ KERNMODULE }}}.conf
{{% endif %}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "install {{{ KERNMODULE }}} /bin/true" > /usr/lib/modules-load.d/{{{ KERNMODULE }}}.conf
{{% if product in ["ol7", "ol8", "rhel7", "rhel8"] %}}
{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "blacklist {{{ KERNMODULE }}}" >> /usr/lib/modules-load.d/{{{ KERNMODULE }}}.conf
{{% endif %}}

0 comments on commit d38fdbd

Please sign in to comment.