Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jan 2017 01:21:42 +0000
From:      Lu Tung-Pin <lutungpin@openmailbox.org>
To:        freebsd-current@freebsd.org
Subject:   Fix /etc/rc.d/random umask handling (/entropy permissions)
Message-ID:  <14f5a2fdf191c33e4ed1dc882b288e81@openmailbox.org>

next in thread | raw e-mail | index | archive | help
--=_4c8ece43f9a5623fa0f12896a365b95d
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII;
 format=flowed

A 2014 change broke the umask handling in /etc/rc.d/random,
leaving /entropy with ug+r permissions. Quick fix attached,
mirroring random_stop() behavior.

(Incidentally, /usr/libexec/save-entropy is still fine for
/var/db/entropy/*, as is /etc/rc.d/random for the new
/boot/entropy.)



--- /etc/rc.d/random.old        2017-01-21 11:48:30.975009000 +1100
+++ /etc/rc.d/random    2017-01-19 18:04:34.224632000 +1100
@@ -20,12 +20,15 @@

  save_dev_random()
  {
+       oumask=`umask`
+       umask 077
         for f ; do
                 if :>>"$f" ; then
                         debug "saving entropy to $f"
                         dd if=/dev/random of="$f" bs=4096 count=1 
2>/dev/null
                 fi
         done
+       umask ${oumask}
  }

  feed_dev_random()

--=_4c8ece43f9a5623fa0f12896a365b95d
Content-Transfer-Encoding: base64
Content-Type: text/x-diff;
 name=random.diff
Content-Disposition: attachment;
 filename=random.diff;
 size=371

LS0tIC9ldGMvcmMuZC9yYW5kb20ub2xkCTIwMTctMDEtMjEgMTE6NDg6MzAuOTc1MDA5MDAwICsx
MTAwCisrKyAvZXRjL3JjLmQvcmFuZG9tCTIwMTctMDEtMTkgMTg6MDQ6MzQuMjI0NjMyMDAwICsx
MTAwCkBAIC0yMCwxMiArMjAsMTUgQEAKIAogc2F2ZV9kZXZfcmFuZG9tKCkKIHsKKwlvdW1hc2s9
YHVtYXNrYAorCXVtYXNrIDA3NwogCWZvciBmIDsgZG8KIAkJaWYgOj4+IiRmIiA7IHRoZW4KIAkJ
CWRlYnVnICJzYXZpbmcgZW50cm9weSB0byAkZiIKIAkJCWRkIGlmPS9kZXYvcmFuZG9tIG9mPSIk
ZiIgYnM9NDA5NiBjb3VudD0xIDI+L2Rldi9udWxsCiAJCWZpCiAJZG9uZQorCXVtYXNrICR7b3Vt
YXNrfQogfQogCiBmZWVkX2Rldl9yYW5kb20oKQo=
--=_4c8ece43f9a5623fa0f12896a365b95d--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14f5a2fdf191c33e4ed1dc882b288e81>