bind/generate-rndc-key.sh
Petr Menšík 8ad1379019 Do not request use of urandom and report failure
Original script did not report failure as exit status. Report error if
rndc key generation failed also by exit status, not only by failed
message.

-r parameter is unsupported now, do not require it anymore.
2020-05-11 18:09:54 +02:00

22 lines
541 B
Bash
Executable File

#!/bin/bash
. /etc/rc.d/init.d/functions
# This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf
if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then
echo -n $"Generating /etc/rndc.key:"
if /usr/sbin/rndc-confgen -a -A hmac-sha256 > /dev/null 2>&1
then
chmod 640 /etc/rndc.key
chown root:named /etc/rndc.key
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/rndc.key
success $"/etc/rndc.key generation"
echo
else
failure $"/etc/rndc.key generation"
echo
exit 1
fi
fi