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