]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub-mkconfig.in: Use umask rather than chmod to create
authorMark Wooding <mdw@distorted.org.uk>
Fri, 3 Feb 2012 11:15:53 +0000 (12:15 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 3 Feb 2012 11:15:53 +0000 (12:15 +0100)
grub.cfg.new to avoid insecure grub.cfg.

ChangeLog
util/grub-mkconfig.in

index f63e3b7535885408ee562c5b232e0be5c2140153..21ccd02235056977bb88f3e78122194bec3ce924 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-03  Mark Wooding <mdw@distorted.org.uk>
+
+       * util/grub-mkconfig.in: Use umask rather than chmod to create
+       grub.cfg.new to avoid insecure grub.cfg.
+
 2012-02-03  Vladimir Serbinenko  <phcoder@gmail.com>
 
         * grub-core/commands/ls.c: Gettextize.
index c876a4e4c49b45cf47e749717d9c5c04c1e28f19..859c2e8c387535e74d2028e1708767d63b6df197 100644 (file)
@@ -248,13 +248,10 @@ export GRUB_DEFAULT \
   GRUB_BADRAM
 
 if test "x${grub_cfg}" != "x"; then
-  rm -f ${grub_cfg}.new
-  exec > ${grub_cfg}.new
-
-  # Allow this to fail, since /boot/grub/ might need to be fatfs to support some
-  # firmware implementations (e.g. OFW or EFI).
-  chmod 400 ${grub_cfg}.new || grub_warn "$(gettext_printf "Could not make %s \
-readable by only root. This means that if the generated config contains a password it is readable by everyone" "${grub_cfg}.new")"
+  rm -f "${grub_cfg}.new"
+  oldumask=$(umask); umask 077
+  exec > "${grub_cfg}.new"
+  umask $oldumask
 fi
 gettext "Generating grub.cfg ..." >&2
 echo >&2