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