Created
November 23, 2013 18:15
-
-
Save shivergard/7618077 to your computer and use it in GitHub Desktop.
PowerDNS add New Domains FAST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$1" ] | |
then | |
echo "No domain defined" | |
exit | |
fi | |
echo ' '>> /etc/powerdns/bindbackend.conf | |
echo 'zone "'$1'" {' >> /etc/powerdns/bindbackend.conf | |
echo ' type master;' >> /etc/powerdns/bindbackend.conf | |
echo ' file "/etc/powerdns/bind/'$1'.zone";' >> /etc/powerdns/bindbackend.conf | |
echo ' allow-update { none; };' >> /etc/powerdns/bindbackend.conf | |
echo '};' >> /etc/powerdns/bindbackend.conf | |
echo "Write IP address EndPoint [ENTER]:" | |
read ip | |
echo '$ORIGIN '$1' ; base for unqualified names' > /etc/powerdns/bind/$1.zone | |
echo '$TTL 1h ; default time-to-live' >> /etc/powerdns/bind/$1.zone | |
echo '@ IN SOA ns.'$1' hostmaster.'$1' (' >> /etc/powerdns/bind/$1.zone | |
echo ' 1; serial' >> /etc/powerdns/bind/$1.zone | |
echo ' 1d; refresh' >> /etc/powerdns/bind/$1.zone | |
echo ' 2h; retry' >> /etc/powerdns/bind/$1.zone | |
echo ' 4w; expire' >> /etc/powerdns/bind/$1.zone | |
echo ' 1h; minimum time-to-live' >> /etc/powerdns/bind/$1.zone | |
echo ' )' >> /etc/powerdns/bind/$1.zone | |
echo ' IN NS ns' >> /etc/powerdns/bind/$1.zone | |
echo ' IN A '$ip >> /etc/powerdns/bind/$1.zone | |
echo 'ns IN A '$ip >> /etc/powerdns/bind/$1.zone | |
echo 'webserver IN A '$ip >> /etc/powerdns/bind/$1.zone | |
echo 'www IN CNAME webserver' >> /etc/powerdns/bind/$1.zone | |
echo "Test and restart" | |
service pdns restart | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment