freebsd-dev/etc/rc.d
Konrad Witaszczyk 480f31c214 Add support for encrypted kernel crash dumps.
Changes include modifications in kernel crash dump routines, dumpon(8) and
savecore(8). A new tool called decryptcore(8) was added.

A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump
configuration in the diocskerneldump_arg structure to the kernel.
The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 for
backward ABI compatibility.

dumpon(8) generates an one-time random symmetric key and encrypts it using
an RSA public key in capability mode. Currently only AES-256-CBC is supported
but EKCD was designed to implement support for other algorithms in the future.
The public key is chosen using the -k flag. The dumpon rc(8) script can do this
automatically during startup using the dumppubkey rc.conf(5) variable.  Once the
keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O
control.

When the kernel receives the DIOCSKERNELDUMP I/O control it generates a random
IV and sets up the key schedule for the specified algorithm. Each time the
kernel tries to write a crash dump to the dump device, the IV is replaced by
a SHA-256 hash of the previous value. This is intended to make a possible
differential cryptanalysis harder since it is possible to write multiple crash
dumps without reboot by repeating the following commands:
# sysctl debug.kdb.enter=1
db> call doadump(0)
db> continue
# savecore

A kernel dump key consists of an algorithm identifier, an IV and an encrypted
symmetric key. The kernel dump key size is included in a kernel dump header.
The size is an unsigned 32-bit integer and it is aligned to a block size.
The header structure has 512 bytes to match the block size so it was required to
make a panic string 4 bytes shorter to add a new field to the header structure.
If the kernel dump key size in the header is nonzero it is assumed that the
kernel dump key is placed after the first header on the dump device and the core
dump is encrypted.

Separate functions were implemented to write the kernel dump header and the
kernel dump key as they need to be unencrypted. The dump_write function encrypts
data if the kernel was compiled with the EKCD option. Encrypted kernel textdumps
are not supported due to the way they are constructed which makes it impossible
to use the CBC mode for encryption. It should be also noted that textdumps don't
contain sensitive data by design as a user decides what information should be
dumped.

savecore(8) writes the kernel dump key to a key.# file if its size in the header
is nonzero. # is the number of the current core dump.

decryptcore(8) decrypts the core dump using a private RSA key and the kernel
dump key. This is performed by a child process in capability mode.
If the decryption was not successful the parent process removes a partially
decrypted core dump.

Description on how to encrypt crash dumps was added to the decryptcore(8),
dumpon(8), rc.conf(5) and savecore(8) manual pages.

EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using QEMU.
The feature still has to be tested on arm and arm64 as it wasn't possible to run
FreeBSD due to the problems with QEMU emulation and lack of hardware.

Designed by:	def, pjd
Reviewed by:	cem, oshogbo, pjd
Partial review:	delphij, emaste, jhb, kib
Approved by:	pjd (mentor)
Differential Revision:	https://reviews.freebsd.org/D4712
2016-12-10 16:20:39 +00:00
..
abi - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
accounting - Don't log messages saying that accounting is being disabled and enabled 2012-05-02 14:25:39 +00:00
addswap - Add vnode-backed swap space specification support. This is enabled when 2013-06-27 18:28:45 +00:00
adjkerntz Get rid of the postrandom script. It was born in a time when the 2014-11-02 01:47:27 +00:00
amd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
apm - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
apmd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
archdep
atm1
atm2
atm3
auditd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
auditdistd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
automount The "automount" rc script should depend on "automountd", not the other 2015-09-18 06:54:52 +00:00
automountd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
autounmountd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
bgfsck - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
blacklistd Add basic blacklist build support 2016-06-02 19:06:04 +00:00
bluetooth - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
bootparams - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
bridge - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
bsnmpd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
bthidd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ccd Fix typo (forgotten "=" after desc). 2016-04-24 12:07:44 +00:00
cleanvar - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
cleartmp - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
cron - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ctld - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
DAEMON
ddb - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
defaultroute - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
devd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
devfs - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
dhclient Fix indentation in dhclient rc.d script 2016-05-31 18:40:47 +00:00
dmesg - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
dumpon Add support for encrypted kernel crash dumps. 2016-12-10 16:20:39 +00:00
FILESYSTEMS Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol 2016-05-15 04:38:50 +00:00
fsck Refactor the root mount hold code and add the wait to etc/rc.d/fsck. 2016-05-10 08:44:44 +00:00
ftp-proxy - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ftpd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
gbde - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
geli - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
geli2 Fix duplicate "name" variable that sneaked in with the rc description commit. 2016-04-24 19:25:11 +00:00
gptboot Prepare for the removal of set_rcvar() by changing the rcvar= 2012-01-14 02:18:41 +00:00
growfs - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
gssd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
hastd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
hcsecd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
hostapd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
hostid - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
hostid_save Make hostid_save depend on hostid 2016-05-15 06:00:13 +00:00
hostname - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
inetd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
iovctl Use correct flag in iovctl_start(). 2015-06-27 18:01:50 +00:00
ip6addrctl - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ipfilter - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ipfs - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ipfw - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ipmon - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ipnat - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ipropd_master Restructure rc.d scripts for kerberos5 daemons: 2014-08-29 07:51:47 +00:00
ipropd_slave Fix a typo; master server for iprop service should be singular. 2014-09-16 05:45:38 +00:00
ipsec - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
iscsictl - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
iscsid - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
jail Many shops still prefer rc.conf(5) based jail configuration(s). In-part 2016-10-12 20:50:17 +00:00
kadmind - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
kdc Make SERVERS REQUIRE clean when MK_KERBEROS==no 2016-04-30 09:50:08 +00:00
keyserv - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
kfd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
kld - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
kldxref - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
kpasswdd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ldconfig Fix circular dependency created after r287197 between ldconfig and mountcritremote 2016-05-30 19:59:51 +00:00
local - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
local_unbound - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
localpkg - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
lockd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
LOGIN Unbreak rcorder when MK_UTX == no by moving utx from REQUIRE: in LOGIN to 2015-02-13 20:52:23 +00:00
lpd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
Makefile Do not install NIS program rc script if WITHOUT_NIS is set 2016-10-22 19:51:32 +00:00
mdconfig - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
mdconfig2 - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
mixer - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
motd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
mountcritlocal Refactor the root mount hold code and add the wait to etc/rc.d/fsck. 2016-05-10 08:44:44 +00:00
mountcritremote Fix circular dependency created after r287197 between ldconfig and mountcritremote 2016-05-30 19:59:51 +00:00
mountd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
mountlate - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
moused - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
msgs - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
natd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
netif Make netif REQUIRE hostid 2016-05-29 02:59:03 +00:00
netoptions - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
netwait - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
NETWORKING Fix broken dependency with routed when MK_ROUTED != no 2016-05-15 05:45:54 +00:00
newsyslog - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nfscbd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nfsclient - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nfsd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nfsuserd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nisdomain - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nscd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
nsswitch - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ntpd Remove the gratuitous check for $FreeBSD$ and rename the function 2016-08-25 13:24:11 +00:00
ntpdate - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
opensm Add svn:executable property 2011-04-25 05:57:01 +00:00
othermta Since r275359, there is no need to provide a bogus service name. 2015-10-26 15:16:27 +00:00
pf - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
pflog - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
pfsync - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
power_profile - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
powerd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ppp - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
pppoed - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
pwcheck - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
quota - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
random Cosmetics: add missing space after the ':' in etc/rc.d/random. 2016-05-31 08:31:34 +00:00
rarpd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
rctl - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
resolv - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
rfcomm_pppd_server - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
root - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
route6d - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
routed Fix broken dependency with routed when MK_ROUTED != no 2016-05-15 05:45:54 +00:00
routing Fix exit status of "service routing start <af> <iface>" 2016-06-02 15:31:24 +00:00
rpcbind - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
rtadvd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
rtsold - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
rwho - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
savecore Add a savecore_enable variable support for the savecore rc script 2016-04-29 12:23:56 +00:00
sdpd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
securelevel - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
sendmail etc: minor spelling fixes. 2016-05-01 16:43:22 +00:00
serial
SERVERS Make SERVERS REQUIRE clean when MK_KERBEROS==no 2016-04-30 09:50:08 +00:00
sppp - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
sshd Disable DSA again. 2016-08-03 16:34:20 +00:00
statd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
static_arp - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
static_ndp Fill in MK_ACPI, (MK_ACPI && MK_APM), MK_INET6, MK_PPP, and MK_ROUTED 2014-11-30 06:08:22 +00:00
stf - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
swap - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
swaplate swapoff: Remove only late devices with -aL. 2016-10-21 21:55:50 +00:00
syscons - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
sysctl - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
syslogd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
timed - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
tmp - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ubthidhci Prepare for the removal of set_rcvar() by changing the rcvar= 2012-01-14 02:18:41 +00:00
ugidfw - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
utx - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
var Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol 2016-05-15 04:38:50 +00:00
virecover - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
watchdogd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
wpa_supplicant - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ypbind - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ypldap Add rc.d script for ypldap(8). 2016-06-06 03:55:00 +00:00
yppasswdd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ypserv - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ypset - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
ypupdated Fix various issues with the NFS and RPC related scripts: 2012-02-14 10:51:24 +00:00
ypxfrd - Add descriptions to most of the rc scripts. Those are mostly taken from their 2016-04-23 16:10:54 +00:00
zfs rc.d/zfsbe: a new script designed for boot environment support 2016-10-13 06:19:54 +00:00
zfsbe rc.d/zfsbe: a new script designed for boot environment support 2016-10-13 06:19:54 +00:00
zfsd zfsd(8), the ZFS fault management daemon 2016-05-28 17:43:40 +00:00
zvol Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol 2016-05-15 04:38:50 +00:00