File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 8686 fi
8787 sudo ls /mnt/EFI/centos/{grub.cfg,${shim}}
8888 sudo umount /mnt
89+ # check /boot/grub2/grub.cfg permission
90+ root_part=$(sudo sfdisk -l -J "${device}" | jq -r '.partitiontable.partitions[] | select(.name == "root").node')
91+ sudo mount "${root_part}" /mnt/
92+ sudo ls /mnt/boot/grub2/grub.cfg
93+ [ $(sudo stat -c "%a" /mnt/boot/grub2/grub.cfg) == "600" ]
94+ sudo umount /mnt
8995 sudo losetup -D "${device}"
9096 sudo rm -f myimage.raw
9197
99105 --disable-selinux --replace=alongside /target
100106 # Verify we injected static configs
101107 jq -re '.["static-configs"].version' /boot/bootupd-state.json
108+ [ $(sudo stat -c "%a" /boot/grub2/grub.cfg) == "600" ]
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ const DROPINDIR: &str = "configs.d";
1717const GRUBENV : & str = "grubenv" ;
1818pub ( crate ) const GRUBCONFIG : & str = "grub.cfg" ;
1919pub ( crate ) const GRUBCONFIG_BACKUP : & str = "grub.cfg.backup" ;
20+ // File mode for /boot/grub2/grub.config
21+ // https://github.com/coreos/bootupd/issues/952
22+ const GRUBCONFIG_FILE_MODE : u32 = 0o600 ;
2023
2124/// Install the static GRUB config files.
2225#[ context( "Installing static GRUB configs" ) ]
@@ -67,7 +70,7 @@ pub(crate) fn install(
6770
6871 let grub2dir = bootdir. sub_dir ( GRUB2DIR ) ?;
6972 grub2dir
70- . write_file_contents ( "grub.cfg" , 0o644 , config. as_bytes ( ) )
73+ . write_file_contents ( "grub.cfg" , GRUBCONFIG_FILE_MODE , config. as_bytes ( ) )
7174 . context ( "Copying grub-static.cfg" ) ?;
7275 println ! ( "Installed: grub.cfg" ) ;
7376
You can’t perform that action at this time.
0 commit comments