|
|
7629ac |
diff --git a/shared/fixes/bash/grub2_audit_argument.sh
|
|
|
7629ac |
deleted file mode 100644
|
|
|
7629ac |
index 913ebd6788..0000000000
|
|
|
7629ac |
--- a/shared/fixes/bash/grub2_audit_argument.sh
|
|
|
7629ac |
+++ /dev/null
|
|
|
7629ac |
@@ -1,13 +0,0 @@
|
|
|
7629ac |
-# platform = Red Hat Enterprise Linux 7, multi_platform_fedora
|
|
|
7629ac |
-
|
|
|
7629ac |
-# Correct the form of default kernel command line in GRUB
|
|
|
7629ac |
-if grep -q '^GRUB_CMDLINE_LINUX=.*audit=.*"' '/etc/default/grub' ; then
|
|
|
7629ac |
- # modify the GRUB command-line if an audit= arg already exists
|
|
|
7629ac |
- sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\)audit=[^[:space:]]*\(.*"\)/\1 audit=1 \2/' '/etc/default/grub'
|
|
|
7629ac |
-else
|
|
|
7629ac |
- # no audit=arg is present, append it
|
|
|
7629ac |
- sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\)"/\1 audit=1"/' '/etc/default/grub'
|
|
|
7629ac |
-fi
|
|
|
7629ac |
-
|
|
|
7629ac |
-# Correct the form of kernel command line for each installed kernel in the bootloader
|
|
|
7629ac |
-grubby --update-kernel=ALL --args="audit=1"
|
|
|
7629ac |
diff --git a/shared/checks/oval/grub2_audit_argument.xml
|
|
|
7629ac |
deleted file mode 100644
|
|
|
7629ac |
index 0a943fd97a..0000000000
|
|
|
7629ac |
--- a/shared/checks/oval/grub2_audit_argument.xml
|
|
|
7629ac |
+++ /dev/null
|
|
|
7629ac |
@@ -1,55 +0,0 @@
|
|
|
7629ac |
-<def-group>
|
|
|
7629ac |
- <definition class="compliance" id="grub2_audit_argument" version="2">
|
|
|
7629ac |
- <metadata>
|
|
|
7629ac |
- <title>Enable Auditing for Processes Which Start Prior to the Audit Daemon</title>
|
|
|
7629ac |
- <affected family="unix">
|
|
|
7629ac |
- <platform>Red Hat Enterprise Linux 7</platform>
|
|
|
7629ac |
- <platform>multi_platform_fedora</platform>
|
|
|
7629ac |
- </affected>
|
|
|
7629ac |
- <description>Look for argument audit=1 in the kernel line in /etc/default/grub.</description>
|
|
|
7629ac |
- </metadata>
|
|
|
7629ac |
- <criteria operator="OR">
|
|
|
7629ac |
-
|
|
|
7629ac |
- comment="check for audit=1 in /etc/default/grub via GRUB_CMDLINE_LINUX" />
|
|
|
7629ac |
- <criteria operator="AND">
|
|
|
7629ac |
-
|
|
|
7629ac |
- comment="check for audit=1 in /etc/default/grub via GRUB_CMDLINE_LINUX_DEFAULT" />
|
|
|
7629ac |
-
|
|
|
7629ac |
- comment="Check GRUB_DISABLE_RECOVERY=true in /etc/default/grub" />
|
|
|
7629ac |
- </criteria>
|
|
|
7629ac |
- </criteria>
|
|
|
7629ac |
- </definition>
|
|
|
7629ac |
-
|
|
|
7629ac |
-
|
|
|
7629ac |
- comment="check for audit=1 in /etc/default/grub via GRUB_CMDLINE_LINUX"
|
|
|
7629ac |
- check="all" check_existence="all_exist" version="1">
|
|
|
7629ac |
- <ind:object object_ref="object_grub2_audit_argument" />
|
|
|
7629ac |
- <ind:state state_ref="state_grub2_audit_argument" />
|
|
|
7629ac |
- </ind:textfilecontent54_test>
|
|
|
7629ac |
-
|
|
|
7629ac |
- <ind:textfilecontent54_object id="object_grub2_audit_argument" version="1">
|
|
|
7629ac |
- <ind:filepath>/etc/default/grub</ind:filepath>
|
|
|
7629ac |
- <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX="(.*)"$</ind:pattern>
|
|
|
7629ac |
- <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
|
|
7629ac |
- </ind:textfilecontent54_object>
|
|
|
7629ac |
-
|
|
|
7629ac |
-
|
|
|
7629ac |
- comment="check for audit=1 in /etc/default/grub via GRUB_CMDLINE_LINUX_DEFAULT"
|
|
|
7629ac |
- check="all" check_existence="all_exist" version="1">
|
|
|
7629ac |
- <ind:object object_ref="object_grub2_audit_argument_default" />
|
|
|
7629ac |
- <ind:state state_ref="state_grub2_audit_argument" />
|
|
|
7629ac |
- </ind:textfilecontent54_test>
|
|
|
7629ac |
-
|
|
|
7629ac |
-
|
|
|
7629ac |
- version="1">
|
|
|
7629ac |
- <ind:filepath>/etc/default/grub</ind:filepath>
|
|
|
7629ac |
- <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$</ind:pattern>
|
|
|
7629ac |
- <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
|
|
7629ac |
- </ind:textfilecontent54_object>
|
|
|
7629ac |
-
|
|
|
7629ac |
-
|
|
|
7629ac |
- version="1">
|
|
|
7629ac |
- <ind:subexpression datatype="string" operation="pattern match">^.*audit=1.*$</ind:subexpression>
|
|
|
7629ac |
- </ind:textfilecontent54_state>
|
|
|
7629ac |
-
|
|
|
7629ac |
-</def-group>
|
|
|
7629ac |
diff --git a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument.rule b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument.rule
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..361a6b9853
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument.rule
|
|
|
7629ac |
@@ -0,0 +1,51 @@
|
|
|
7629ac |
+documentation_complete: true
|
|
|
7629ac |
+
|
|
|
7629ac |
+prodtype: rhel7,fedora
|
|
|
7629ac |
+
|
|
|
7629ac |
+title: 'Extend Audit Backlog Limit for the Audit Daemon'
|
|
|
7629ac |
+
|
|
|
7629ac |
+description: |-
|
|
|
7629ac |
+ To improve the kernel capacity to queue all log events, even those which occurred
|
|
|
7629ac |
+ prior to the audit daemon, add the argument <tt>audit_backlog_limit=8192</tt> to the default
|
|
|
7629ac |
+ GRUB 2 command line for the Linux operating system in
|
|
|
7629ac |
+ <tt>/etc/default/grub</tt>, in the manner below:
|
|
|
7629ac |
+ GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=VolGroup/LogVol06 rd.lvm.lv=VolGroup/lv_swap rhgb quiet rd.shell=0 audit=1 audit_backlog_limit=8192"
|
|
|
7629ac |
+
|
|
|
7629ac |
+rationale: |-
|
|
|
7629ac |
+ audit_backlog_limit sets the queue length for audit events awaiting transfer
|
|
|
7629ac |
+ to the audit daemon. Until the audit daemon is up and running, all log messages
|
|
|
7629ac |
+ are stored in this queue. If the queue is overrun during boot process, the action
|
|
|
7629ac |
+ defined by audit failure flag is taken.
|
|
|
7629ac |
+
|
|
|
7629ac |
+severity: unknown
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil_clause: 'audit backlog limit is not configured'
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil: |-
|
|
|
7629ac |
+ Inspect the form of default GRUB 2 command line for the Linux operating system
|
|
|
7629ac |
+ in <tt>/etc/default/grub</tt>. If they include <tt>audit_backlog_limit=1</tt>, then auditing
|
|
|
7629ac |
+ is enabled at boot time.
|
|
|
7629ac |
+
|
|
|
7629ac |
+ To ensure <tt>audit_backlog_limit=1</tt> is configured on all installed kernels, the
|
|
|
7629ac |
+ following command may be used:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ $ sudo /sbin/grubby --update-kernel=ALL --args="audit_backlog_limit=1"
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+warnings:
|
|
|
7629ac |
+ - management: |-
|
|
|
7629ac |
+ The GRUB 2 configuration file, <tt>grub.cfg</tt>,
|
|
|
7629ac |
+ is automatically updated each time a new kernel is installed. Note that any
|
|
|
7629ac |
+ changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
|
|
|
7629ac |
+ file. To update the GRUB 2 configuration file manually, use the
|
|
|
7629ac |
+ grub2-mkconfig -o command as follows:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ On BIOS-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
|
7629ac |
+ On UEFI-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+{{% if product == "rhel7" %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
|
|
|
7629ac |
+{{% else %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
|
|
7629ac |
+{{% endif %}}
|
|
|
7629ac |
+
|
|
|
7629ac |
diff --git a/linux_os/guide/system/permissions/restrictions/grub2_vsyscall_argument.rule b/linux_os/guide/system/permissions/restrictions/grub2_vsyscall_argument.rule
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..8773f2407f
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/linux_os/guide/system/permissions/restrictions/grub2_vsyscall_argument.rule
|
|
|
7629ac |
@@ -0,0 +1,49 @@
|
|
|
7629ac |
+documentation_complete: true
|
|
|
7629ac |
+
|
|
|
7629ac |
+prodtype: rhel7,fedora
|
|
|
7629ac |
+
|
|
|
7629ac |
+title: 'Disable vsyscalls'
|
|
|
7629ac |
+
|
|
|
7629ac |
+description: |-
|
|
|
7629ac |
+ To disable use of virtual syscalls,
|
|
|
7629ac |
+ add the argument <tt>vsyscall=none</tt> to the default
|
|
|
7629ac |
+ GRUB 2 command line for the Linux operating system in
|
|
|
7629ac |
+ <tt>/etc/default/grub</tt>, in the manner below:
|
|
|
7629ac |
+ GRUB_CMDLINE_LINUX="vsyscall=none"
|
|
|
7629ac |
+
|
|
|
7629ac |
+rationale: |-
|
|
|
7629ac |
+ Virtual Syscalls provide an opportunity of attack for a user who has control
|
|
|
7629ac |
+ of the return instruction pointer.
|
|
|
7629ac |
+
|
|
|
7629ac |
+severity: unknown
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil_clause: 'vsyscalls are enabled'
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil: |-
|
|
|
7629ac |
+ Inspect the form of default GRUB 2 command line for the Linux operating system
|
|
|
7629ac |
+ in <tt>/etc/default/grub</tt>. If they include <tt>vsyscall=none</tt>,
|
|
|
7629ac |
+ then virtyal syscalls are not enabled at boot time.
|
|
|
7629ac |
+
|
|
|
7629ac |
+ To ensure <tt>vsyscall=none</tt> is configured on all installed kernels, the
|
|
|
7629ac |
+ following command may be used:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ $ sudo /sbin/grubby --update-kernel=ALL --args="vsyscall=none
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+warnings:
|
|
|
7629ac |
+ - management: |-
|
|
|
7629ac |
+ The GRUB 2 configuration file, <tt>grub.cfg</tt>,
|
|
|
7629ac |
+ is automatically updated each time a new kernel is installed. Note that any
|
|
|
7629ac |
+ changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
|
|
|
7629ac |
+ file. To update the GRUB 2 configuration file manually, use the
|
|
|
7629ac |
+ grub2-mkconfig -o command as follows:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ On BIOS-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
|
7629ac |
+ On UEFI-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+{{% if product == "rhel7" %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
|
|
|
7629ac |
+{{% else %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
|
|
7629ac |
+{{% endif %}}
|
|
|
7629ac |
+
|
|
|
7629ac |
diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/group.yml b/linux_os/guide/system/permissions/restrictions/poisoning/group.yml
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..6a7a370f2b
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/linux_os/guide/system/permissions/restrictions/poisoning/group.yml
|
|
|
7629ac |
@@ -0,0 +1,8 @@
|
|
|
7629ac |
+documentation_complete: true
|
|
|
7629ac |
+
|
|
|
7629ac |
+title: 'Memory Poisoning'
|
|
|
7629ac |
+
|
|
|
7629ac |
+description: |-
|
|
|
7629ac |
+ Memory Poisoning consists of writing a special value to uninitialized or freed memory.
|
|
|
7629ac |
+ Poisoning can be used as a mechanism to prevent leak of information and detection of
|
|
|
7629ac |
+ corrupted memory.
|
|
|
7629ac |
diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument.rule b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument.rule
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..9056613b0d
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument.rule
|
|
|
7629ac |
@@ -0,0 +1,52 @@
|
|
|
7629ac |
+documentation_complete: true
|
|
|
7629ac |
+
|
|
|
7629ac |
+prodtype: rhel7,fedora
|
|
|
7629ac |
+
|
|
|
7629ac |
+title: 'Enable page allocator poisoning'
|
|
|
7629ac |
+
|
|
|
7629ac |
+description: |-
|
|
|
7629ac |
+ To enable poisoning of free pages,
|
|
|
7629ac |
+ add the argument <tt>page_poison=1</tt> to the default
|
|
|
7629ac |
+ GRUB 2 command line for the Linux operating system in
|
|
|
7629ac |
+ <tt>/etc/default/grub</tt>, in the manner below:
|
|
|
7629ac |
+ GRUB_CMDLINE_LINUX="page_poison=1"
|
|
|
7629ac |
+
|
|
|
7629ac |
+rationale: |-
|
|
|
7629ac |
+ Poisoning writes an arbitrary value to freed pages, so any modification or
|
|
|
7629ac |
+ reference to that page after being freed or before being initialized will be
|
|
|
7629ac |
+ detected and prevented.
|
|
|
7629ac |
+ This prevents many types of use-after-free vulnerabilities at little performance cost.
|
|
|
7629ac |
+ Also prevents leak of data and detection of corrupted memory.
|
|
|
7629ac |
+
|
|
|
7629ac |
+severity: unknown
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil_clause: 'page allocator poisoning is not enabled'
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil: |-
|
|
|
7629ac |
+ Inspect the form of default GRUB 2 command line for the Linux operating system
|
|
|
7629ac |
+ in <tt>/etc/default/grub</tt>. If they include <tt>page_poison=1</tt>,
|
|
|
7629ac |
+ then page poisoning is enabled at boot time.
|
|
|
7629ac |
+
|
|
|
7629ac |
+ To ensure <tt>page_poison=1</tt> is configured on all installed kernels, the
|
|
|
7629ac |
+ following command may be used:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ $ sudo /sbin/grubby --update-kernel=ALL --args="page_poison=1
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+warnings:
|
|
|
7629ac |
+ - management: |-
|
|
|
7629ac |
+ The GRUB 2 configuration file, <tt>grub.cfg</tt>,
|
|
|
7629ac |
+ is automatically updated each time a new kernel is installed. Note that any
|
|
|
7629ac |
+ changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
|
|
|
7629ac |
+ file. To update the GRUB 2 configuration file manually, use the
|
|
|
7629ac |
+ grub2-mkconfig -o command as follows:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ On BIOS-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
|
7629ac |
+ On UEFI-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+{{% if product == "rhel7" %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
|
|
|
7629ac |
+{{% else %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
|
|
7629ac |
+{{% endif %}}
|
|
|
7629ac |
+
|
|
|
7629ac |
diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument.rule b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument.rule
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..ea982ee216
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument.rule
|
|
|
7629ac |
@@ -0,0 +1,52 @@
|
|
|
7629ac |
+documentation_complete: true
|
|
|
7629ac |
+
|
|
|
7629ac |
+prodtype: rhel7,fedora
|
|
|
7629ac |
+
|
|
|
7629ac |
+title: 'Enable SLUB/SLAB allocator poisoning'
|
|
|
7629ac |
+
|
|
|
7629ac |
+description: |-
|
|
|
7629ac |
+ To enable poisoning of SLUB/SLAB objects,
|
|
|
7629ac |
+ add the argument <tt>slub_debug=P</tt> to the default
|
|
|
7629ac |
+ GRUB 2 command line for the Linux operating system in
|
|
|
7629ac |
+ <tt>/etc/default/grub</tt>, in the manner below:
|
|
|
7629ac |
+ GRUB_CMDLINE_LINUX="slub_debug=P"
|
|
|
7629ac |
+
|
|
|
7629ac |
+rationale: |-
|
|
|
7629ac |
+ Poisoning writes an arbitrary value to freed objects, so any modification or
|
|
|
7629ac |
+ reference to that object after being freed or before being initialized will be
|
|
|
7629ac |
+ detected and prevented.
|
|
|
7629ac |
+ This prevents many types of use-after-free vulnerabilities at little performance cost.
|
|
|
7629ac |
+ Also prevents leak of data and detection of corrupted memory.
|
|
|
7629ac |
+
|
|
|
7629ac |
+severity: unknown
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil_clause: 'SLUB/SLAB poisoning is not enabled'
|
|
|
7629ac |
+
|
|
|
7629ac |
+ocil: |-
|
|
|
7629ac |
+ Inspect the form of default GRUB 2 command line for the Linux operating system
|
|
|
7629ac |
+ in <tt>/etc/default/grub</tt>. If they include <tt>slub_debug=P</tt>,
|
|
|
7629ac |
+ then SLUB/SLAB poisoning is enabled at boot time.
|
|
|
7629ac |
+
|
|
|
7629ac |
+ To ensure <tt>slub_debug=P</tt> is configured on all installed kernels, the
|
|
|
7629ac |
+ following command may be used:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ $ sudo /sbin/grubby --update-kernel=ALL --args="slub_debug=P
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+warnings:
|
|
|
7629ac |
+ - management: |-
|
|
|
7629ac |
+ The GRUB 2 configuration file, <tt>grub.cfg</tt>,
|
|
|
7629ac |
+ is automatically updated each time a new kernel is installed. Note that any
|
|
|
7629ac |
+ changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
|
|
|
7629ac |
+ file. To update the GRUB 2 configuration file manually, use the
|
|
|
7629ac |
+ grub2-mkconfig -o command as follows:
|
|
|
7629ac |
+
|
|
|
7629ac |
+ On BIOS-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
|
7629ac |
+ On UEFI-based machines, issue the following command as <tt>root</tt>:
|
|
|
7629ac |
+{{% if product == "rhel7" %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
|
|
|
7629ac |
+{{% else %}}
|
|
|
7629ac |
+ ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
|
|
|
7629ac |
+{{% endif %}}
|
|
|
7629ac |
+
|
|
|
7629ac |
diff --git a/rhel7/profiles/ospp42.profile b/rhel7/profiles/ospp42.profile
|
|
|
7629ac |
index bfdc68de8b..dd157a6e5b 100644
|
|
|
7629ac |
--- a/rhel7/profiles/ospp42.profile
|
|
|
7629ac |
+++ b/rhel7/profiles/ospp42.profile
|
|
|
7629ac |
@@ -15,6 +15,7 @@ description: |-
|
|
|
7629ac |
selections:
|
|
|
7629ac |
- installed_OS_is_certified
|
|
|
7629ac |
- grub2_audit_argument
|
|
|
7629ac |
+ - grub2_audit_backlog_limit_argument
|
|
|
7629ac |
- service_auditd_enabled
|
|
|
7629ac |
- grub2_enable_fips_mode
|
|
|
7629ac |
- rpm_verify_hashes
|
|
|
7629ac |
@@ -53,6 +54,9 @@ selections:
|
|
|
7629ac |
- grub2_password
|
|
|
7629ac |
- grub2_uefi_password
|
|
|
7629ac |
- grub2_disable_interactive_boot
|
|
|
7629ac |
+ - grub2_slub_debug_argument
|
|
|
7629ac |
+ - grub2_page_poison_argument
|
|
|
7629ac |
+ - grub2_vsyscall_argument
|
|
|
7629ac |
- no_empty_passwords
|
|
|
7629ac |
- require_singleuser_auth
|
|
|
7629ac |
- service_debug-shell_disabled
|
|
|
7629ac |
diff --git a/shared/templates/create_grub2_bootloader_argument.py b/shared/templates/create_grub2_bootloader_argument.py
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..bbd6e46a82
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/shared/templates/create_grub2_bootloader_argument.py
|
|
|
7629ac |
@@ -0,0 +1,40 @@
|
|
|
7629ac |
+#!/usr/bin/python2
|
|
|
7629ac |
+
|
|
|
7629ac |
+#
|
|
|
7629ac |
+# create_grub2_bootloader_argument.py
|
|
|
7629ac |
+# generate template-based checks for unsuccessful file modifications detailed
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+from template_common import FilesGenerator, UnknownTargetError
|
|
|
7629ac |
+
|
|
|
7629ac |
+import re
|
|
|
7629ac |
+
|
|
|
7629ac |
+class GRUB2BootloaderArgumentGenerator(FilesGenerator):
|
|
|
7629ac |
+ def generate(self, target, args):
|
|
|
7629ac |
+ arg_name, arg_value = args[0:2]
|
|
|
7629ac |
+ arg_name_value = arg_name + '=' + arg_value
|
|
|
7629ac |
+
|
|
|
7629ac |
+ if target == "bash":
|
|
|
7629ac |
+ self.file_from_template(
|
|
|
7629ac |
+ "./template_BASH_grub2_bootloader_argument",
|
|
|
7629ac |
+ {
|
|
|
7629ac |
+ "ARG_NAME": arg_name,
|
|
|
7629ac |
+ "ARG_NAME_VALUE": arg_name_value
|
|
|
7629ac |
+ },
|
|
|
7629ac |
+ "./bash/grub2_{0}_argument.sh", arg_name
|
|
|
7629ac |
+ )
|
|
|
7629ac |
+ elif target == "oval":
|
|
|
7629ac |
+ self.file_from_template(
|
|
|
7629ac |
+ "./template_OVAL_grub2_bootloader_argument",
|
|
|
7629ac |
+ {
|
|
|
7629ac |
+ "ARG_NAME": arg_name,
|
|
|
7629ac |
+ "ARG_NAME_VALUE": arg_name_value
|
|
|
7629ac |
+ },
|
|
|
7629ac |
+ "./oval/grub2_{0}_argument.xml", arg_name
|
|
|
7629ac |
+ )
|
|
|
7629ac |
+ else:
|
|
|
7629ac |
+ raise UnknownTargetError(target)
|
|
|
7629ac |
+
|
|
|
7629ac |
+ def csv_format(self):
|
|
|
7629ac |
+ return("CSV should contains lines of the format: " +
|
|
|
7629ac |
+ "SYSCALL")
|
|
|
7629ac |
diff --git a/shared/templates/csv/grub2_bootloader_argument.csv b/shared/templates/csv/grub2_bootloader_argument.csv
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..8610111715
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/shared/templates/csv/grub2_bootloader_argument.csv
|
|
|
7629ac |
@@ -0,0 +1,10 @@
|
|
|
7629ac |
+# format:
|
|
|
7629ac |
+# <argument_name>,<value>
|
|
|
7629ac |
+# - argument_name is the name of argument for the bootloader
|
|
|
7629ac |
+# - value is the value for the argument
|
|
|
7629ac |
+
|
|
|
7629ac |
+audit,1
|
|
|
7629ac |
+audit_backlog_limit,8192
|
|
|
7629ac |
+slub_debug,P
|
|
|
7629ac |
+page_poison,1
|
|
|
7629ac |
+vsyscall,none
|
|
|
7629ac |
diff --git a/shared/templates/template_BASH_grub2_bootloader_argument b/shared/templates/template_BASH_grub2_bootloader_argument
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..9f48517415
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/shared/templates/template_BASH_grub2_bootloader_argument
|
|
|
7629ac |
@@ -0,0 +1,13 @@
|
|
|
7629ac |
+# platform = Red Hat Enterprise Linux 7, multi_platform_fedora
|
|
|
7629ac |
+
|
|
|
7629ac |
+# Correct the form of default kernel command line in GRUB
|
|
|
7629ac |
+if grep -q '^GRUB_CMDLINE_LINUX=.*{{{ ARG_NAME }}}=.*"' '/etc/default/grub' ; then
|
|
|
7629ac |
+ # modify the GRUB command-line if an {{{ ARG_NAME }}}= arg already exists
|
|
|
7629ac |
+ sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\){{{ ARG_NAME }}}=[^[:space:]]*\(.*"\)/\1 {{{ ARG_NAME_VALUE }}} \2/' '/etc/default/grub'
|
|
|
7629ac |
+else
|
|
|
7629ac |
+ # no {{{ ARG_NAME }}}=arg is present, append it
|
|
|
7629ac |
+ sed -i 's/\(^GRUB_CMDLINE_LINUX=".*\)"/\1 {{{ ARG_NAME_VALUE }}}"/' '/etc/default/grub'
|
|
|
7629ac |
+fi
|
|
|
7629ac |
+
|
|
|
7629ac |
+# Correct the form of kernel command line for each installed kernel in the bootloader
|
|
|
7629ac |
+grubby --update-kernel=ALL --args="{{{ ARG_NAME_VALUE }}}"
|
|
|
7629ac |
diff --git a/shared/templates/template_OVAL_grub2_bootloader_argument b/shared/templates/template_OVAL_grub2_bootloader_argument
|
|
|
7629ac |
new file mode 100644
|
|
|
7629ac |
index 0000000000..b6f4b1397a
|
|
|
7629ac |
--- /dev/null
|
|
|
7629ac |
+++ b/shared/templates/template_OVAL_grub2_bootloader_argument
|
|
|
7629ac |
@@ -0,0 +1,55 @@
|
|
|
7629ac |
+<def-group>
|
|
|
7629ac |
+ <definition class="compliance" id="grub2_{{{ ARG_NAME }}}_argument" version="2">
|
|
|
7629ac |
+ <metadata>
|
|
|
7629ac |
+ <title>Ensure GRUB 2 is configured to run Linux operating system with argument {{{ ARG_NAME_VALUE }}}</title>
|
|
|
7629ac |
+ <affected family="unix">
|
|
|
7629ac |
+ <platform>Red Hat Enterprise Linux 7</platform>
|
|
|
7629ac |
+ <platform>multi_platform_fedora</platform>
|
|
|
7629ac |
+ </affected>
|
|
|
7629ac |
+ <description>Look for argument {{{ ARG_NAME_VALUE }}} in the kernel line in /etc/default/grub.</description>
|
|
|
7629ac |
+ </metadata>
|
|
|
7629ac |
+ <criteria operator="OR">
|
|
|
7629ac |
+
|
|
|
7629ac |
+ comment="check for {{{ ARG_NAME_VALUE }}} in /etc/default/grub via GRUB_CMDLINE_LINUX" />
|
|
|
7629ac |
+ <criteria operator="AND">
|
|
|
7629ac |
+
|
|
|
7629ac |
+ comment="check for {{{ ARG_NAME_VALUE }}} in /etc/default/grub via GRUB_CMDLINE_LINUX_DEFAULT" />
|
|
|
7629ac |
+
|
|
|
7629ac |
+ comment="Check GRUB_DISABLE_RECOVERY=true in /etc/default/grub" />
|
|
|
7629ac |
+ </criteria>
|
|
|
7629ac |
+ </criteria>
|
|
|
7629ac |
+ </definition>
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+ comment="check for {{{ ARG_NAME_VALUE }}} in /etc/default/grub via GRUB_CMDLINE_LINUX"
|
|
|
7629ac |
+ check="all" check_existence="all_exist" version="1">
|
|
|
7629ac |
+ <ind:object object_ref="object_grub2_{{{ ARG_NAME }}}_argument" />
|
|
|
7629ac |
+ <ind:state state_ref="state_grub2_{{{ ARG_NAME }}}_argument" />
|
|
|
7629ac |
+ </ind:textfilecontent54_test>
|
|
|
7629ac |
+
|
|
|
7629ac |
+ <ind:textfilecontent54_object id="object_grub2_{{{ ARG_NAME }}}_argument" version="1">
|
|
|
7629ac |
+ <ind:filepath>/etc/default/grub</ind:filepath>
|
|
|
7629ac |
+ <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX="(.*)"$</ind:pattern>
|
|
|
7629ac |
+ <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
|
|
7629ac |
+ </ind:textfilecontent54_object>
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+ comment="check for {{{ ARG_NAME_VALUE }}} in /etc/default/grub via GRUB_CMDLINE_LINUX_DEFAULT"
|
|
|
7629ac |
+ check="all" check_existence="all_exist" version="1">
|
|
|
7629ac |
+ <ind:object object_ref="object_grub2_{{{ ARG_NAME }}}_argument_default" />
|
|
|
7629ac |
+ <ind:state state_ref="state_grub2_{{{ ARG_NAME }}}_argument" />
|
|
|
7629ac |
+ </ind:textfilecontent54_test>
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+ version="1">
|
|
|
7629ac |
+ <ind:filepath>/etc/default/grub</ind:filepath>
|
|
|
7629ac |
+ <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$</ind:pattern>
|
|
|
7629ac |
+ <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
|
|
|
7629ac |
+ </ind:textfilecontent54_object>
|
|
|
7629ac |
+
|
|
|
7629ac |
+
|
|
|
7629ac |
+ version="1">
|
|
|
7629ac |
+ <ind:subexpression datatype="string" operation="pattern match">^.*{{{ ARG_NAME_VALUE }}}.*$</ind:subexpression>
|
|
|
7629ac |
+ </ind:textfilecontent54_state>
|
|
|
7629ac |
+
|
|
|
7629ac |
+</def-group>
|
|
|
7629ac |
diff --git a/ssg/build_templates.py b/ssg/build_templates.py
|
|
|
7629ac |
index f4373553b2..c36bbbacc4 100644
|
|
|
7629ac |
--- a/ssg/build_templates.py
|
|
|
7629ac |
+++ b/ssg/build_templates.py
|
|
|
7629ac |
@@ -28,6 +28,7 @@
|
|
|
7629ac |
from create_audit_rules_usergroup_modification import AuditRulesUserGroupModificationGenerator
|
|
|
7629ac |
from create_audit_rules_execution import AuditRulesExecutionGenerator
|
|
|
7629ac |
from create_audit_rules_path_syscall import AuditRulesPathSyscallGenerator
|
|
|
7629ac |
+from create_grub2_bootloader_argument import GRUB2BootloaderArgumentGenerator
|
|
|
7629ac |
|
|
|
7629ac |
|
|
|
7629ac |
class Builder(object):
|
|
|
7629ac |
@@ -74,6 +75,7 @@ def __init__(self, env_yaml):
|
|
|
7629ac |
"audit_rules_usergroup_modification.csv": AuditRulesUserGroupModificationGenerator(),
|
|
|
7629ac |
"audit_rules_execution.csv": AuditRulesExecutionGenerator(),
|
|
|
7629ac |
"audit_rules_path_syscall.csv": AuditRulesPathSyscallGenerator(),
|
|
|
7629ac |
+ "grub2_bootloader_argument.csv": GRUB2BootloaderArgumentGenerator(),
|
|
|
7629ac |
}
|
|
|
7629ac |
self.langs = TEMPLATED_LANGUAGES
|
|
|
7629ac |
utils_dir = os.path.dirname(os.path.realpath(__file__))
|