svn commit: r239569 - head/etc/rc.d

Dag-Erling Smørgrav des at des.no
Tue Sep 4 23:37:16 UTC 2012


(shameless thread hijacking)

Speaking of rc.d and entropy, is the following code in /etc/rc.d/sshd
really necessary?

	seeded=`sysctl -n kern.random.sys.seeded 2>/dev/null`
	if [ "x${seeded}" != "x" ] && [ ${seeded} -eq 0 ] ; then
		warn "Setting entropy source to blocking mode."
		echo "===================================================="
		echo "Type a full screenful of random junk to unblock"
		echo "it and remember to finish with <enter>. This will"
		echo "timeout in ${timeout} seconds, but waiting for"
		echo "the timeout without typing junk may make the"
		echo "entropy source deliver predictable output."
		echo ""
		echo "Just hit <enter> for fast+insecure startup."
		echo "===================================================="
		sysctl kern.random.sys.seeded=0 2>/dev/null
		read -t ${timeout} junk
		echo "${junk}" `sysctl -a` `date` > /dev/random
	fi

Considering, among other factors, how late in the boot sshd actually
starts, and how much disk and / or network activity has occurred by that
point.

I don't believe this was how it was initially supposed to work, by the
way.  The original code *intentionally* always blocked, but it was
slightly obfuscated.  Two years after it was written, someone who
misunderstood it submitted a PR, and several other someones who didn't
understand it either came up with an incorrect fix and committed it.
Neither Mark, who wrote the original code, nor I, who was (and still am)
the OpenSSH maintainer, were consulted.

BTW, it might be a good idea to run "/etc/rc.d/sshd keygen" from the
installer if sshd is enabled during installation.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-rc mailing list