From owner-svn-src-head@FreeBSD.ORG Sun Nov 2 09:24:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12B128B9; Sun, 2 Nov 2014 09:24:37 +0000 (UTC) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF7ABDF8; Sun, 2 Nov 2014 09:24:36 +0000 (UTC) Received: from [2001:470:9174:1:407c:4bb6:6af1:63e2] by gromit.grondar.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84 (FreeBSD)) (envelope-from ) id 1XkrOk-000GJ9-Qs; Sun, 02 Nov 2014 09:24:35 +0000 Subject: Re: svn commit: r273957 - in head: . etc/rc.d Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: text/plain; charset=utf-8 From: Mark R V Murray In-Reply-To: <201411020147.sA21lRW0082695@svn.freebsd.org> Date: Sun, 2 Nov 2014 09:24:33 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201411020147.sA21lRW0082695@svn.freebsd.org> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= X-Mailer: Apple Mail (2.1990.1) X-SA-Score: -1.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 09:24:37 -0000 Nice move, thanks! :-) M > On 2 Nov 2014, at 01:47, Dag-Erling Sm=C3=B8rgrav = wrote: >=20 > Author: des > Date: Sun Nov 2 01:47:27 2014 > New Revision: 273957 > URL: https://svnweb.freebsd.org/changeset/base/273957 >=20 > Log: > Get rid of the postrandom script. It was born in a time when the > random script ran before filesystems were mounted, which is no > longer the case. >=20 > In random_start(), immediately delete each file that is fed into > /dev/random, and recreate the default entropy file immediately > after reading and deleting it. The logic used in random_stop() > to determine which file to write to should probably be factored > out and used here as well. >=20 > Deleted: > head/etc/rc.d/postrandom > Modified: > head/ObsoleteFiles.inc > head/etc/rc.d/Makefile > head/etc/rc.d/adjkerntz > head/etc/rc.d/random >=20 > Modified: head/ObsoleteFiles.inc > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/ObsoleteFiles.inc Sun Nov 2 01:13:11 2014 = (r273956) > +++ head/ObsoleteFiles.inc Sun Nov 2 01:47:27 2014 = (r273957) > @@ -38,6 +38,8 @@ > # xargs -n1 | sort | uniq -d; > # done >=20 > +# 20141102: postrandom obsoleted by new /dev/random code > +OLD_FILES+=3Detc/rc.d/postrandom > # 20141031: initrandom obsoleted by new /dev/random code > OLD_FILES+=3Detc/rc.d/initrandom > # 20141028: debug files accidentally installed as directory name >=20 > Modified: head/etc/rc.d/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/etc/rc.d/Makefile Sun Nov 2 01:13:11 2014 = (r273956) > +++ head/etc/rc.d/Makefile Sun Nov 2 01:47:27 2014 = (r273957) > @@ -112,7 +112,6 @@ FILES=3D DAEMON \ > pf \ > pflog \ > pfsync \ > - postrandom \ > powerd \ > power_profile \ > ppp \ >=20 > Modified: head/etc/rc.d/adjkerntz > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/etc/rc.d/adjkerntz Sun Nov 2 01:13:11 2014 = (r273956) > +++ head/etc/rc.d/adjkerntz Sun Nov 2 01:47:27 2014 = (r273957) > @@ -4,7 +4,7 @@ > # >=20 > # PROVIDE: adjkerntz > -# REQUIRE: FILESYSTEMS postrandom > +# REQUIRE: FILESYSTEMS > # BEFORE: netif > # KEYWORD: nojail >=20 >=20 > Modified: head/etc/rc.d/random > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/etc/rc.d/random Sun Nov 2 01:13:11 2014 = (r273956) > +++ head/etc/rc.d/random Sun Nov 2 01:47:27 2014 = (r273957) > @@ -17,41 +17,58 @@ stop_cmd=3D"random_stop" > extra_commands=3D"saveseed" > saveseed_cmd=3D"${name}_stop" >=20 > +save_dev_random() > +{ > + for f ; do > + if :>>"$f" ; then > + debug "saving entropy to $f" > + dd if=3D/dev/random of=3D"$f" bs=3D4096 count=3D1 = 2>/dev/null > + fi > + done > +} > + > feed_dev_random() > { > - if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then > - cat "${1}" | dd of=3D/dev/random bs=3D8k 2>/dev/null > - fi > + for f ; do > + if [ -f "$f" -a -r "$f" -a -s "$f" ] ; then > + if dd if=3D"$f" of=3D/dev/random bs=3D4096 = 2>/dev/null ; then > + debug "entropy read from $f" > + rm -f "$f" > + fi > + fi > + done > } >=20 > random_start() > { > + echo -n 'Feeding entropy:' > + > + if [ ! -w /dev/random ] ; then > + warn "/dev/random is not writeable" > + return 1 > + fi > + > # Reseed /dev/random with previously stored entropy. > - case ${entropy_dir} in > + case ${entropy_dir:=3D/var/db/entropy} in > [Nn][Oo]) > ;; > *) > - entropy_dir=3D${entropy_dir:-/var/db/entropy} > - if [ -d "${entropy_dir}" ]; then > - if [ -w /dev/random ]; then > - for seedfile in ${entropy_dir}/*; do > - feed_dev_random "${seedfile}" > - done > - fi > + if [ -d "${entropy_dir}" ] ; then > + feed_dev_random "${entropy_dir}"/* > fi > ;; > esac >=20 > - case ${entropy_file} in > + case ${entropy_file:=3D/entropy} in > [Nn][Oo] | '') > ;; > *) > - if [ -w /dev/random ]; then > - feed_dev_random "${entropy_file}" > - feed_dev_random /var/db/entropy-file > - fi > + feed_dev_random "${entropy_file}" /var/db/entropy-file > + save_dev_random "${entropy_file}" > ;; > esac > + > + echo '.' > } >=20 > random_stop() > @@ -59,7 +76,7 @@ random_stop() > # Write some entropy so when the machine reboots /dev/random > # can be reseeded > # > - case ${entropy_file} in > + case ${entropy_file:=3D/entropy} in > [Nn][Oo] | '') > ;; > *) >=20 --=20 Mark R V Murray