HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=19)
-   -   Automate DNS slave creation (http://www.howtoforge.com/forums/showthread.php?t=15589)

jorizzzz 17th September 2007 10:09

Automate DNS slave creation
 
i've got two servers here, each one has an installation of ISPConfig installed. Server1 is my webserver and is the master for the dns, Server2 is the slave.

Is it possible to automate the creation of the slave entries on the second ISPConfig server? At this point, whenever a reseller of mine adds a new domain, i've got to logon the second server and add the slave entry manually.

The updates are being pushed perfectly, all that is working. Only the creating of the slave entries is a problem at this time...

Could somebody help me?

mlz 17th September 2007 23:14

This is where MyDNS would be handy, you would just point both DNS servers to the same MySQL database (replicated of course) and let it run, both would have the same zones and records files(so to speak) available. Basically you need to figure out a way to pass from Server A to Server B, the names of the domains to replicate/create in named.conf and let it do it's thing. A simple set of php scripts could do the heavy lifting, but be sure to lock down the security such that only the two machines can talk to each other.

I would expect you would have to at least put a call into the ISPConfig code to run said script however... I'm not sure where, since I've about given up on hacks to ISPConfig 2.x hacks, everytime I do it, I upgrade and forget to back up my hacks.. :D

grant 21st September 2007 14:51

To have it run a script when you update something, add the script to the end of:

/root/ispconfig/scripts/writeconf.php

Add things write above the line that says:

Code:

echo "ende\n";
And, if you're hacking about in ISPConfig's files, remember to at least keep a list of every file you've changed (or better, copy the original file to a save location, as "filename.original" and when done, copy the new one there as "filename.new" so you can run diff on them to see what changes you need to make when you upgrade).

crayz1 1st October 2007 17:48

Quote:

Originally Posted by jorizzzz
i've got two servers here, each one has an installation of ISPConfig installed. Server1 is my webserver and is the master for the dns, Server2 is the slave.

Is it possible to automate the creation of the slave entries on the second ISPConfig server? At this point, whenever a reseller of mine adds a new domain, i've got to logon the second server and add the slave entry manually.

The updates are being pushed perfectly, all that is working. Only the creating of the slave entries is a problem at this time...

Could somebody help me?

I am interested in this as well.

I posted a topic in the Installation forum
http://www.howtoforge.com/forums/sho...79&postcount=7

Basically I have a web server with ISPConfig and Master/Slave DNS machines. I want the ISPConifg web server to manage the creation of DNS zones and send it to my DNS machines. I was thinking that my DNS machines both need to act as slaves to the ISPConfig web server, but when resolving name servers on the web the DNS machines would play their Master/Slave role.

mccharlet 1st October 2007 18:10

Hi,

I have not solution for autocreate au dns zone

lewis_saint 8th October 2007 06:20

I came up with a solution to this problem a number of months ago. I have ISPConfig running on one server, and bind on its own on another. My working setup is as follows:
1. A cronjob daily runs the following on my ISPConfig box:
Code:

grep "^zone" /etc/bind/named.conf | grep -v "arpa" | awk -F \" '{print $2}' | awk 'length > 1' > /etc/bind/slave-zones
scp /etc/bind/slave-zones slave-dns@bind9box:slave-zones > /dev/null

Using SSH keys, a file of all of my domains is created on the secondary box daily.

2. A cronjob daily runs the following on my secondary box:
Code:

echo > /etc/bind/slave-zones.conf
for i in `cat /home/slave-dns/slave-zones`; do
echo "zone \"$i\" {"                      >> /etc/bind/slave-zones.conf
echo "  type slave;"                >> /etc/bind/slave-zones.conf
echo "  file \"slave.$i\";"        >> /etc/bind/slave-zones.conf
echo "  masters { 123.123.123.123; };"      >> /etc/bind/slave-zones.conf
echo "  notify no;"  >> /etc/bind/slave-zones.conf
echo "};"                                >> /etc/bind/slave-zones.conf
echo                                      >> /etc/bind/slave-zones.conf
done

/etc/init.d/bind9 restart > /dev/null

I have bind9 including /etc/bind/slave-zones.conf in my configuration file.

Let me know how you get on!

jorizzzz 8th October 2007 09:48

This looks like a stable solution, i'll give it a go. Thanks a million times :)

Question tho... Won't this result in a very long list on the slave server with duplicate entries? It exports the entire master server every time...

zeeman 10th April 2008 23:27

I prefer keeping dead threads dead, but to complete the last question:
Quote:

Won't this result in a very long list on the slave server with duplicate entries? It exports the entire master server every time...
No. It doesn't:
Code:

echo > /etc/bind/slave-zones.conf
Before every run the slave-zones.conf is flushed.


All times are GMT +2. The time now is 01:32.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.