@@ -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 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
@@ -103,6 +106,7 @@ pub(crate) fn install(
103106 efidir
104107 . copy_file ( & Path :: new ( CONFIGDIR ) . join ( "grub-static-efi.cfg" ) , target)
105108 . context ( "Copying static EFI" ) ?;
109+ efidir. set_mode ( target, GRUBCONFIG_FILE_MODE ) ?;
106110 println ! ( "Installed: {target:?}" ) ;
107111 if let Some ( uuid_path) = uuid_path {
108112 let target = & vendor. join ( uuid_path) ;
0 commit comments