Blame SOURCES/generate-rndc-key.sh

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