[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] redundancy how too....



> Hmmmm, when you setup the SOA for a domain in the DNS, you have
> the option of adding secondary nameserver(s).  I believe that's the
> solution...while it isn't server wide, if you're plugging a
> secondary name server anyway, it's no more work to plug in the one
> of your "partner".
>
> thom

Trick is on the secondary's side, Thom. We each always setup our own
domains anyway, but then you have to email your secondary and have them
set it up too.

Even I of bash-ignominy can write the following script. Of course, I'll
need a couple of hours to make sure it actually works (like checking the
use of double " symbols down at the end) but it eventually will work.
Note extensive disclaimers so I don't make an ass of myself with the
error I'm sure you'll find.

Anyway, if we make this work then it's just one quick command... and
then we can work on determining *IF* properly-authenticated access from
outside is possible, then on doing so.

Although I'd still be curious on how to do whole-server secondary. Seems
like someone would have written it already, no?

#!/bin/sh
# domain.secondary.add
#
# Script to add a secondary domain to the named.conf file.
# Pass two parameters: name of domain and the name of the
# master server holder.
#
# WARNING: STUPID SCRIPT!!! NO ERROR CHECKING AT ALL!!!
#          (Because I just don't know how, dammit...)
#
# Usage: domain.secondary.add <domainname> <ownername>

# Select the right master server to use.

case "$2" in
  Carrie)
	MASTER=111.222.333.444
	;;
  Thom)
	MASTER=222.333.444.555
	;;
  Brent)
	MASTER=333.444.555.666
	;;
esac

# Back up the named.conf file to named.conf.save.mmdd
# where mmdd is the month and date in two-digit format.

NEWFILE=/etc/named.conf".save."$(date +%m%d)
cp /etc/named.conf $NEWFILE
echo "Backup file created at $NEWFILE."

# Is there any way to automatically have this file check
# that the domain:
#    o exists?
#    o has ns1 pointing to the right machine?
#    o has ns2 pointing to us?
# If this check fails, the script should go no further.

# If there is any way on God's green Earth for this
# file to break DNS services, it should go no further.

# Add the domain to the /etc/named.conf file.
# And for God's sake triple-check the quoting to make
# sure the right text goes into that file.
# Also note I've written <tab> where I don't know how
# to make it include a tab so far. Things to check...

echo "zone \"$1\" IN {" >> /etc/named.conf
echo "<tab>type slave;" >> /etc/named.conf
echo "<tab>masters { $MASTER; };" >> /etc/named.conf
echo "<tab>allow-update { none; };" >> /etc/named.conf
echo "};" >> /etc/named.conf
echo

# Restart the nameserver.

/etc/rc.d/init.d/named restart

# End script domain.secondary.add

Please nobody try this before it's debugged, OK?

--
Rodolfo J. Paiz
rpaiz@xxxxxxxxxxxxxx <mailto:rpaiz@xxxxxxxxxxxxxx>