aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2017-05-27 06:24:06 +0000
committerXin LI <delphij@FreeBSD.org>2017-05-27 06:24:06 +0000
commit335917f071f6eeea1bd993ded4ad3a79e74e1601 (patch)
treeda98d20c67a2105e252e43f8e0ec7cae9d0ab46b /etc/rc.d
parentef7161e77498cf94c4d8aa8b45b845c58ec3b93b (diff)
downloadsrc-335917f071f6eeea1bd993ded4ad3a79e74e1601.tar.gz
src-335917f071f6eeea1bd993ded4ad3a79e74e1601.zip
Tighten /entropy permissions.
PR: 219527 Reported by: Lu Tung-Pin <lutungpin at openmailbox.org> Submitted by: jilles MFC after: 3 days
Notes
Notes: svn path=/head/; revision=318975
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/random10
1 files changed, 6 insertions, 4 deletions
diff --git a/etc/rc.d/random b/etc/rc.d/random
index 1e4e5b2fc729..9762c9d3bfdd 100755
--- a/etc/rc.d/random
+++ b/etc/rc.d/random
@@ -20,12 +20,14 @@ saveseed_cmd="${name}_stop"
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
+ debug "saving entropy to $f"
+ dd if=/dev/random of="$f" bs=4096 count=1 status=none &&
+ chmod 600 "$f"
done
+ umask ${oumask}
}
feed_dev_random()