bind/generate-rndc-key.sh
Tomas Hozza ed837c4f03 Use /dev/urandom for generation of rndc.key (#1079799
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2014-06-09 13:47:34 +02:00

20 lines
530 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 -r /dev/urandom > /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
fi
fi