How would you automatically create subdomains with DNS?

I would like to automatically update my DNS to a more multiple domain programmatically. I am running a BIND server (on FreeBSD), as well as host domains and DNS in GoDaddy. I could not find the Web Services API for GoDaddy to access and update my DNS, which they host, so I may have to use my BIND server to provide a dynamic solution.

Basically, I just want to query which subdomains already exist and add new ones.

Is BIND the best solution? Is there any other way to automatically add new domains without having to log in to GoDaddy or update my BIND configuration manually?

+4
source share
3 answers

The feature you need to add new subdomains is Dynamic Updates as specified in RFC 2136 and is well supported by BIND.

It is very convenient (for example, with Perl Net :: DNS module) to add and remove records from the zone file with the DNS UPDATE message.

To get what's there, you have two approaches:

  • Treat any other database as final and convert the changes to this database into ddns or updates.

  • Allow DNS "AXFR" messages so that you can download all zone content (although only to your zone management system, not the whole world!)

+3
source

One approach is to write a program that reads and / or updates the BIND configuration file (it is just a text file with a specific format) and reloads the BIND daemon if any changes were made. Thus, it would be as if you had updated your BIND configuration manually, except that you would have written a program for this.

+3
source

Just FYI: this is a system / network administration issue, not a programming issue. You could probably get better answers faster elsewhere.

That says ... it's pretty simple: you just need a DNS server that supports the database database for its data. Then you simply record the records in the database or query the database for what's there, and the DNS records will be automatically submitted. Ideally, use a database that supports triggers so that you can automatically update the serial numbers of DNS records when changes occur. Otherwise, you will need to read / write the serial number in each change of your code, having performed all the updates in the transaction.

Edit: just saw another comment above. Do not allow AXFR. This is considered a security risk these days.

You have TTL sites installed at the level, so updates spread to other servers quickly.

+2
source

All Articles