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