Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would you create sub-domains with DNS automatically?

Tags:

dns

I would like to automatically update my DNS more multiple domains programmatically. I run a BIND server (on FreeBSD) as well as host domains and DNS at GoDaddy. I could not find a web service API for GoDaddy to access and update my DNS that they are hosting so I may have to use my BIND server to provide a dynamic solution.

Basically I just want to query which sub-domains already exist and add new ones.

Is BIND the best solution? Is there another way to automatically add new domains without me having to log into GoDaddy or update my BIND configuration manually?

like image 443
Brennan Avatar asked Mar 01 '23 23:03

Brennan


1 Answers

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

It's reasonably easy (for example with Perl's Net::DNS module) to add and remove records from a zone file with the DNS "UPDATE" message.

To actually retrieve what's there, you've got two approaches:

  1. Treat some other database as definitive, and convert changes in that database into ddns updates, or.

  2. Permit DNS "AXFR" messages to allow you to download the entire zone content (albeit only to your zone management system, not to the whole world!)

like image 104
Alnitak Avatar answered Mar 08 '23 11:03

Alnitak