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