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