Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 2017 06:24:06 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318975 - head/etc/rc.d
Message-ID:  <201705270624.v4R6O6Lq044166@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sat May 27 06:24:06 2017
New Revision: 318975
URL: https://svnweb.freebsd.org/changeset/base/318975

Log:
  Tighten /entropy permissions.
  
  PR:		219527
  Reported by:	Lu Tung-Pin <lutungpin at openmailbox.org>
  Submitted by:	jilles
  MFC after:	3 days

Modified:
  head/etc/rc.d/random

Modified: head/etc/rc.d/random
==============================================================================
--- head/etc/rc.d/random	Sat May 27 02:07:22 2017	(r318974)
+++ head/etc/rc.d/random	Sat May 27 06:24:06 2017	(r318975)
@@ -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()



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