2012-12-20 13:34:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-05-22 09:25:14 +00:00
|
|
|
if [ -r /etc/rc.d/init.d/functions ]; then
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
else
|
|
|
|
success() {
|
|
|
|
echo $" OK "
|
|
|
|
}
|
|
|
|
|
|
|
|
failure() {
|
|
|
|
echo -n " "
|
|
|
|
echo $"FAILED"
|
|
|
|
}
|
|
|
|
fi
|
2012-12-20 13:34:39 +00:00
|
|
|
|
2013-08-16 11:08:20 +00:00
|
|
|
# This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf
|
2012-12-20 13:34:39 +00:00
|
|
|
|
2022-01-18 11:17:17 +00:00
|
|
|
if [ ! -s /etc/rndc.key ] && [ ! -s /etc/rndc.conf ]; then
|
2012-12-20 13:34:39 +00:00
|
|
|
echo -n $"Generating /etc/rndc.key:"
|
2020-05-11 16:09:54 +00:00
|
|
|
if /usr/sbin/rndc-confgen -a -A hmac-sha256 > /dev/null 2>&1
|
2017-10-31 16:37:27 +00:00
|
|
|
then
|
2012-12-20 13:34:39 +00:00
|
|
|
chmod 640 /etc/rndc.key
|
2017-10-31 16:37:27 +00:00
|
|
|
chown root:named /etc/rndc.key
|
2012-12-20 13:34:39 +00:00
|
|
|
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.key
|
|
|
|
success $"/etc/rndc.key generation"
|
|
|
|
echo
|
|
|
|
else
|
2020-05-22 09:25:14 +00:00
|
|
|
rc=$?
|
2012-12-20 13:34:39 +00:00
|
|
|
failure $"/etc/rndc.key generation"
|
|
|
|
echo
|
2020-05-22 09:25:14 +00:00
|
|
|
exit $rc
|
2012-12-20 13:34:39 +00:00
|
|
|
fi
|
|
|
|
fi
|