From owner-freebsd-rc@FreeBSD.ORG Thu Sep 13 19:05:09 2012 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CB551065670 for ; Thu, 13 Sep 2012 19:05:09 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) by mx1.freebsd.org (Postfix) with ESMTP id 0DA358FC1C for ; Thu, 13 Sep 2012 19:05:09 +0000 (UTC) Received: from uucp by gromit.grondar.org with local-rmail (Exim 4.77 (FreeBSD)) (envelope-from ) id 1TCEip-0002Ss-OF for freebsd-rc@freebsd.org; Thu, 13 Sep 2012 20:05:07 +0100 Received: from localhost ([127.0.0.1] helo=groundzero.grondar.org) by groundzero.grondar.org with esmtp (Exim 4.77 (FreeBSD)) (envelope-from ) id 1TCEeB-000InE-N6; Thu, 13 Sep 2012 20:00:19 +0100 To: RW , obrien@freebsd.org, freebsd-security@freebsd.org, Doug Barton , freebsd-rc@freebsd.org, Arthur Mesh , Xin Li , Ian Lepore In-reply-to: <20120912104547.1d0061c1@gumby.homeunix.com> References: <50453686.9090100@FreeBSD.org> <20120904220754.GA3643@server.rulingia.com> <20120906174247.GB13179@dragon.NUXI.org> <20120906230157.5307a21f@gumby.homeunix.com> <20120906224703.GD89120@x96.org> <20120907015157.GA29497@server.rulingia.com> <20120910135218.GA68128@dragon.NUXI.org> <504E343A.4020802@FreeBSD.org> <20120911064636.GB72584@dragon.NUXI.org> <504EE446.6060500@FreeBSD.org> <20120911082309.GD72584@dragon.NUXI.org> <20120912104547.1d0061c1@gumby.homeunix.com> From: Mark Murray Date: Thu, 13 Sep 2012 20:00:19 +0100 Message-Id: Cc: Subject: Re: svn commit: r239569 - head/etc/rc.d X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Sep 2012 19:05:09 -0000 I've been watching this thread, but not responding due to a need to not contribute to controversy and to be able to provide a measured response when I had the resources. I'm responding to this mail out of the thread not for any particular reason. > David O'Brien wrote: > > > > On 09/10/2012 23:46, David O'Brien wrote: > > > > > > > In what way did I suggest we don't need to seed the PRNG? I > > > > simply removed an outdated and incorrect statement. > > > > > > Yes, the comment as it stood was out of date. I'm not sure that > > > removing it (rather than rephrasing it) was the right call. > > > > Doug you're a FreeBSD committer, you know how to use an editor and > > 'svn diff'. Where is your patch suggesting a rephrase? David, please back down; I see more heat than light from you. > It doesn't make any difference. > > When root close the device a forced slow reseed is done (after the > yarrow thread completes feeding the data into yarrow). Since this is > unconditional and clears the entropy accounting, the entropy estimate > is irrelevant to rc.d/, which runs as root. Correct. The original intent, disabled during the whole Matt Dillon bust-up was to start the random device _blocked_. The unblocking mechanism was/is a write to /dev/random, the intent being start-up randomness cached from the previous shutdown, or manufactured by (eg) getting the pound the keyboard and/or wiggle the mouse. This would involve a possible "soft" hang at boot time while the device was unlocked, but was intended to allow the first ssh keys and friends to be securely created. There is a whole minefield of startup scenarios there, and satisfying everybody was a pretty thankless task. > The entropy estimated at zero bits is so that an *unpriveleged* user > can't feed in his own input, corrupt the entropy estimation and > perform a state-extension attack. Yarrow is pretty resistant to this. "cat /dev/zero > /dev/random" won't "dilute" the gathered entropy, but will swamp the harvest queue. > On Tue, 11 Sep 2012 00:12:06 -0700 Doug Barton wrote: > > > I'm also tired of repeating why writing out a new /entropy file at > > boot time makes the system weaker, not stronger. > > That's not really true. The entropy file contains up to 256 bits of > entropy, if yarrow is correctly seeded with that then that entropy > will be in the 256-bit key which will produce a new file that also > contains that entropy. Too many /entropy.* files would be overkill, but done properly, won't hurt. The harvest queue (as pointed out) is limited, and its possible to overwhelm it with excessive input. I'm in favour of doing something to "dribble" the startup suff in, while limiting its length to (say) 1-2 K. Compressing the gathered stuff is a good idea, and inserting that *first* with a delay following would be ideal; 1 second would be sufficient, 2 safer if the machine very busy. After that "chunking" the cached stuff and easing it in slowly would be a Good Thing(tm). Making the harvest queue block (and therefore take everything given to it) is possible, but the locking inside the kernel is not a nice thing to do, and something like "cat /dev/zero > /dev/random" would be a pretty good spanner-in-the-works without some extra cleverness (off the top of my head, /dev/random's harvester could limit its reads to (say) 2K before kicking off the writer with some soft error (EFBIG or EAGAIN?); this way multiple short writes would all work /in toto/). I also like the idea of XORing in excess data rather than dropping it. This could be messy, though. M -- Mark R V Murray Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open) Pi: 132511160