[Midnightbsd-cvs] src [11684] trunk/etc/rc.d/postrandom: add postrandom

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jul 8 16:25:34 EDT 2018


Revision: 11684
          http://svnweb.midnightbsd.org/src/?rev=11684
Author:   laffer1
Date:     2018-07-08 16:25:34 -0400 (Sun, 08 Jul 2018)
Log Message:
-----------
add postrandom

Added Paths:
-----------
    trunk/etc/rc.d/postrandom

Added: trunk/etc/rc.d/postrandom
===================================================================
--- trunk/etc/rc.d/postrandom	                        (rev 0)
+++ trunk/etc/rc.d/postrandom	2018-07-08 20:25:34 UTC (rev 11684)
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# $MidnightBSD$
+
+# PROVIDE: postrandom
+# REQUIRE: initrandom random FILESYSTEMS
+# BEFORE: LOGIN
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="postrandom"
+start_cmd="${name}_start"
+stop_cmd=":"
+
+# This will remove old ${entropy_file} and generate a new one.
+# According to Bruce Schneier, this is strongly recommended in order
+# to avoid using same ${entropy_file} across reboots.
+# Reference: Chapter 10.6, Practical Cryptography, ISBN: 0-471-22357-3
+
+postrandom_start()
+{
+	/etc/rc.d/random fastsaveseed
+
+	case ${entropy_dir} in
+	[Nn][Oo])
+		;;
+	*)
+		entropy_dir=${entropy_dir:-/var/db/entropy}
+		if [ -d "${entropy_dir}" ]; then
+			if [ -w /dev/random ]; then
+				rm -f ${entropy_dir}/*
+			fi
+		fi
+		;;
+	esac
+}
+
+load_rc_config random
+run_rc_command "$1"


Property changes on: trunk/etc/rc.d/postrandom
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list