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