Current time: 06-18-2024, 12:11 AM Hello There, Guest! (LoginRegister)


Thread Closed 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Howto] zweiter Nameserver
Author Message
Kilrathy Offline
Junior Member
*

Posts: 54
Joined: Jan 2008
Reputation: 0
Post: #4
RE: [Howto] zweiter Nameserver
Hi zusammen

Sorry für die Verspätung, also hier mal die genauen Details:

Code:
#!/bin/sh
NAMED="/etc/bind/loco-zones.conf"
TMPNAMED="/tmp/zns-441245.temp"
TMPZONEFILE="/tmp/zones.txt"
TMP="/tmp/zns-732.temp"
ZONELOCATION="/etc/bind/loco-zones"

echo -n "Checking for new named.conf... "
scp root@loco.zwirbel.net:/etc/bind/named.conf $TMPNAMED
#wget -q https://83.137.25.252:10801/named/named.conf -O $TMPNAMED

if [ -e $TMPNAMED ]
then
        echo "done."
else
        echo "no new data!"
        exit
fi
echo -n "Generating zone names... "
cat $TMPNAMED |grep zone |cut -d" " -f"2" |cut -d"\"" -f2 > $TMPZONEFILE
sed '1,8d' $TMPZONEFILE > $TMP
mv $TMP $TMPZONEFILE
echo "done. ("$TMPZONEFILE")"
echo "Generating zone info... "
cat $TMPZONEFILE |while read ZONE; do
if [ -e $ZONELOCATION/$ZONE.db ]
then
        echo "Zone $ZONE already available."
else
        echo -n "New zone available ($ZONE)... "
        echo "zone \"$ZONE\" { type slave; file \"$ZONELOCATION/$ZONE.db\"; masters { 83.137.25.252; }; allow-notify { 83.137.25.252; }; };" >> $NAMED
        echo "added."
fi
done
/etc/init.d/bind9 restart
rm $TMPZONEFILE
rm $TMPNAMED

Dazu noch folgende Anmerkungen:
Auf meinem zweiten DNS Server hatte ich bereits eine laufende Installation, daher habe ich auch die ZONELOCATION sowie auch die NAMED Variable angepasst - da dies nicht allgemein festgelegt werden kann, solltet ihr selber schauen wo ihr eure Zonen resp. die Zonen-Config ablegen wollt.

Die SCP Variante habe ich so gelöst:
Code:
scp root@loco.*****.net:/etc/bind/named.conf $TMPNAMED

Vorher habe ich eine public Key Authentication via SSH vorgenommen, damit ich vom NS2 mittels root auf der ISPCP Maschine einloggen kann, wie man sowas erledigt, könnt ihr u.a. hier nachlesen: ***link***

@ctct, ob du nur rndc verwenden kannst, bin ich mir nicht 100% sicher - aber ich glaube rndc kannst du ebenfalls verwenden. Bind muss einfach das Zonenfile *.conf neuladen, damit er weiss, für was er zuständig ist.

Desweiteren ist diese Kontrollstruktur:
Code:
if [ -e $ZONELOCATION/$ZONE.db ]
then
        echo "Zone $ZONE already available."
else
        echo -n "New zone available ($ZONE)... "
        echo "zone \"$ZONE\" { type slave; file \"$ZONELOCATION/$ZONE.db\"; masters { 83.137.25.252; }; allow-notify { 83.137.25.252; }; };" >> $NAMED
        echo "added."
fi

nicht optimal gelöst... denn ist das DB File nicht vorhanden (infolge eines TSIG Fehlers beim Transfers oder sowas) dann wird bei jedem Scriptdurchlauf eine neue Zeile im Zonenfiles erstellt... und das bis in die Unendlichkeit - besser wäre eine Kontrolle im File selber anstelle des Zonenfiles... aber das ist bei mir noch bei im ToDo Status.

Ach ja, ich würd noch empfehlen in der SSH Config PermitRootLogin auf "without-password" setzen... Smile

Gruss
(This post was last modified: 04-26-2010 10:42 PM by Kilrathy.)
04-26-2010 10:41 PM
Find all posts by this user
Thread Closed 


Messages In This Thread
[Howto] zweiter Nameserver - Kilrathy - 04-17-2010, 06:55 PM
RE: [Howto] zweiter Nameserver - ctct - 04-23-2010, 09:33 PM
RE: [Howto] zweiter Nameserver - Kilrathy - 04-26-2010 10:41 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)