Verify /boot/grub/grub.cfg User Ownership
An XCCDF Rule
Description
The file /boot/grub/grub.cfg
should
be owned by the root
user to prevent destruction
or modification of the file.
To properly set the owner of /boot/grub/grub.cfg
, run the command:
$ sudo chown root /boot/grub/grub.cfg
Rationale
Only root should be able to modify important boot parameters.
- ID
- xccdf_org.ssgproject.content_rule_file_owner_grub2_cfg
- Severity
- Medium
- References
- Updated
Remediation - Ansible
- name: Gather the package facts
package_facts:
manager: auto
tags:
- CJIS-5.5.2.2
- NIST-800-171-3.4.5
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -d /sys/firmware/efi ] && dpkg-query --show --showformat='${db:Status-Status}\n' 'grub2-common' 2>/dev/null | grep -q installed && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
chown 0 /boot/grub/grub.cfg
else