Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ jobs:
fi
sudo ls /mnt/EFI/centos/{grub.cfg,${shim}}
sudo umount /mnt
# check /boot/grub2/grub.cfg permission
root_part=$(sudo sfdisk -l -J "${device}" | jq -r '.partitiontable.partitions[] | select(.name == "root").node')
sudo mount "${root_part}" /mnt/
sudo ls /mnt/boot/grub2/grub.cfg
[ $(sudo stat -c "%a" /mnt/boot/grub2/grub.cfg) == "600" ]
sudo umount /mnt
sudo losetup -D "${device}"
sudo rm -f myimage.raw

Expand All @@ -99,3 +105,4 @@ jobs:
--disable-selinux --replace=alongside /target
# Verify we injected static configs
jq -re '.["static-configs"].version' /boot/bootupd-state.json
[ $(sudo stat -c "%a" /boot/grub2/grub.cfg) == "600" ]
5 changes: 4 additions & 1 deletion src/grubconfigs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const DROPINDIR: &str = "configs.d";
const GRUBENV: &str = "grubenv";
pub(crate) const GRUBCONFIG: &str = "grub.cfg";
pub(crate) const GRUBCONFIG_BACKUP: &str = "grub.cfg.backup";
// File mode for /boot/grub2/grub.config
// https://github.com/coreos/bootupd/issues/952
const GRUBCONFIG_FILE_MODE: u32 = 0o600;

/// Install the static GRUB config files.
#[context("Installing static GRUB configs")]
Expand Down Expand Up @@ -67,7 +70,7 @@ pub(crate) fn install(

let grub2dir = bootdir.sub_dir(GRUB2DIR)?;
grub2dir
.write_file_contents("grub.cfg", 0o644, config.as_bytes())
.write_file_contents("grub.cfg", GRUBCONFIG_FILE_MODE, config.as_bytes())
.context("Copying grub-static.cfg")?;
println!("Installed: grub.cfg");

Expand Down
Loading