Date: Sat, 21 Sep 2013 21:14:05 GMT From: def@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r257575 - in soc2013/def/crashdump-head/etc: defaults rc.d Message-ID: <201309212114.r8LLE5K2083085@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: def Date: Sat Sep 21 21:14:05 2013 New Revision: 257575 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257575 Log: rc.d script to generate RSA keys if they don't exist and run dumpkey. Added: soc2013/def/crashdump-head/etc/rc.d/dumpkey (contents, props changed) Modified: soc2013/def/crashdump-head/etc/defaults/rc.conf Modified: soc2013/def/crashdump-head/etc/defaults/rc.conf ============================================================================== --- soc2013/def/crashdump-head/etc/defaults/rc.conf Sat Sep 21 20:45:53 2013 (r257574) +++ soc2013/def/crashdump-head/etc/defaults/rc.conf Sat Sep 21 21:14:05 2013 (r257575) @@ -606,6 +606,10 @@ chkprintcap_flags="-d" # Create missing directories by default. dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). dumpdir="/var/crash" # Directory where crash dumps are to be stored +dumpkey_enable="YES" +dumpkey_pub="/var/crash/.public.key" +dumpkey_priv="/var/crash/.private.key" +dumpkey_bits="2048" savecore_flags="-m 10" # Used if dumpdev is enabled above, and present. # By default, only the 10 most recent kernel dumps # are saved. Added: soc2013/def/crashdump-head/etc/rc.d/dumpkey ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2013/def/crashdump-head/etc/rc.d/dumpkey Sat Sep 21 21:14:05 2013 (r257575) @@ -0,0 +1,33 @@ +#!/bin/sh + +# PROVIDE: dumpkey +# REQUIRE: dumpon + +. /etc/rc.subr + +name="dumpkey" +rcvar="dumpkey_enable" +start_cmd="dumpkey_start" +start_precmd="dumpkey_prestart" +stop_cmd=":" + +dumpkey_prestart() +{ + if [ ! -r "${dumpkey_pub}" ] || [ ! -r "${dumpkey_priv}" ]; then + warn "At least one of keys doesn't exist. Generating new keys..." + + dumpkey_pub=${dumpdir}/.public.key + dumpkey_priv=${dumpdir}/.private.key + + /usr/bin/openssl genrsa -out ${dumpkey_priv} ${dumpkey_bits} + /usr/bin/openssl rsa -in ${dumpkey_priv} -out ${dumpkey_pub} -outform PEM -pubout + fi +} + +dumpkey_start() +{ + /sbin/dumpkey -p ${dumpkey_pub} +} + +load_rc_config $name +run_rc_command "$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309212114.r8LLE5K2083085>