#!/usr/local/bin/bash # # UPDATE script for nameserver # # Zoidial, Inc. # Eric Thern 2002 - 2003 (sometime) # # # used to update the nameserver from a plesk system # soon to be modified to update remote servers (masters, not slaves) # # # update named server # cd /etc/namedb cp named.conf named.BACKUP cp /jail/webserver/usr/local/psa/named/run-root/etc/named.conf named.conf-temp # # clean up named.conf-temp (the main named.conf file we will use) # these cleaned up items get replaced with our named.LOCAL settings # sed -e "/options/d" named.conf-temp > named.conf-temp.rplzz cat named.conf-temp.rplzz > named.conf-temp && rm named.conf-temp.rplzz sleep 2 sed -e "/directory/d" named.conf-temp > named.conf-temp.rplzz cat named.conf-temp.rplzz > named.conf-temp && rm named.conf-temp.rplzz sleep 2 # # replace 'none;' with the allowed entries so that specific reverse # zones can be updated. # set up named.conf with our LOCAL file, then the full temp file # sed -e "s/none;/216.218.130.2; 216.218.131.2; 216.218.132.2;/" named.conf-temp > named.conf-temp.rplzz cat named.conf-temp.rplzz > named.conf-temp && rm named.conf-temp.rplzz cat named.LOCAL > named.conf cat named.conf-temp >> named.conf echo ' include "/dbinclude/named.conf.include"; ' >> named.conf # # recreate the entire database from the webserver # rm -Rf db cp -R /jail/webserver/usr/local/psa/named/run-root/var db # # make sure to add the include file(s) here - added to the end of the main zone # echo ' $INCLUDE 235.218.216.in-addr.arpa.include ' >> db/235.218.216.in-addr.arpa # # run the updater for the wierd reverse zones # /etc/namedb/dbinclude/UPDATE-REVERSE # # update the normal reverse zone with the included reverse info # cat /etc/namedb/dbinclude/REVERSE-INCLUDES >> /etc/namedb/db/191.71.64.in-addr.arpa # # set permissions and such, relink pid and ndc, restart named # chown -R bind:bind /etc/namedb chown -R bind:bind /etc/namedb/db chown bind:bind /etc/namedb/db chmod 750 /etc/namedb/db/* chmod 700 /etc/namedb ln -fs /etc/namedb/var/run/named.pid /var/run/named.pid ln -fs /etc/namedb/var/run/ndc /var/run/ndc chown bind:bind /etc/namedb kill -9 `cat /etc/namedb/var/run/named.pid` /usr/local/sbin/named -c named.conf -t /etc/namedb -u bind sleep 15 chown -R bind:bind /etc/namedb chown bind:bind /etc/namedb chown bind:bind /etc/namedb/db chown bind:bind usr/libexec/named-xfer