initial commit of a *whole bunch* of old Egressive shell scripts, used to make many people redundant.

This commit is contained in:
Dave Lane 2016-03-16 13:43:31 +13:00
commit 43e0f5b59e
329 changed files with 31937 additions and 0 deletions

75
egdomainadd/egdomainadd Executable file
View file

@ -0,0 +1,75 @@
#!/bin/bash
# These variables can be overridden from env vars for testing, i.e
# export NAMED_CONF_FILES=/tmp/test.conf
ZONEFILE_LOCATION="${ZONEFILE_LOCATION-/var/lib/named/var/cache/bind}"
ZONEFILE_TEMPLATE="${ZONEFILE_TEMPLATE-/etc/egscripts/egdomainadd/zonetemplate}"
NAMED_CONF_FILE="${NAMED_CONF_FILE-/etc/bind/named.conf.egressive}"
SLAVES="${SLAVES-root@ns1.egressive.com root@ns2.egressive.com}"
usage() {
cat <<EOT
Usage: `basename $0` <domain name>
EOT
}
if [ $# -ne 1 ]
then
usage
exit 1
fi
# make sure there is at least one "." in the parameter so it might be a valid
# domain name
if ! [[ $1 =~ ".+\..+" ]]
then
usage
exit 1
fi
echo "Adding $1 to $NAMED_CONF_FILE . . ."
DATE=`date +%Y-%m-%d`
cat <<EOT >> $NAMED_CONF_FILE
//// Domain $1 added on $DATE
//zone "$1" {
// type master;
// allow-query { any; };
// allow-transfer { key TRANSFER; };
// file "$1";
//};
EOT
echo "Adding master zone file for $1 . . ."
DATE=`date +%Y%m%d01`
umask 002
sed "s/XXXXXX/$1/g;s/DDDDDD/$DATE/g" $ZONEFILE_TEMPLATE > $ZONEFILE_LOCATION/$1
echo "Adding slave records for $1 . . ."
for i in $SLAVES
do
echo "Adding slave record to $i . . ."
ssh $i /etc/egscripts/egupdatebind/egupdatebind $1
done
cat <<EOT
========================================================================="
Edit
$ZONEFILE_LOCATION/$1
and add any extra records that may be required.
When you are ready to be authoritative for this domain,
you will need to remove the comments from the end of
$NAMED_CONF_FILE
and reload bind with
sudo /etc/init.d/bind9 reload"
=========================================================================
EOT

21
egdomainadd/zonetemplate Normal file
View file

@ -0,0 +1,21 @@
;;;; MAKE MANUAL ENTRIES BELOW THIS LINE! ;;;;
$TTL 86400
@ IN SOA ns3.egressive.com. support.egressive.com. (
DDDDDD ; serial
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
NS ns1.egressive.com. ; Inet Address of name server 1
NS ns2.egressive.com. ; Inet Address of name server 2
NS ns3.egressive.com. ; Inet Address of name server 3
;
MX 5 mail3.egressive.com.
;
XXXXXX. IN A 202.6.116.2 ; smithers2
;mail IN A 202.6.116.2 ; smithers2
;smtp CNAME mail
;www CNAME XXXXXX.
;
*.XXXXXX. CNAME XXXXXX.