0

I've developed an application with Laravel (it's same as a site builder), clients can add their information to their profile, and finally, they can park a domain to the profile (by setting my DNS for the domains)

In the application controller, I will get the domain name (with request()->getHost()) and I will load the correct profile.

Everything is ok when I've tested my application on the local by adding a sample domain to /etc/hosts.

My problem is on the server because I need to add a DNS Zone for each domain (as far as I know), I'm wondered is there any solution to read the DNS records from a MySQL database, instead of the file? because BIND will load the DNS Zones from a text file and I don't want to generate that files.

The server is CentOS 8.

MajAfy
  • 107
  • 1
  • 6

2 Answers2

2

Is it possible for you to switch to PowerDNS instead of BIND? PowerDNS supports reading DNS records from a MySQL database, and has a JSON API to add/remove records which you can use from your app (which will handle things like properly incrementing the serial number) instead of manually manipulating its database.

Daniel Lo Nigro
  • 424
  • 6
  • 10
1

BIND has database support called Dynamically Loadable Zones (DLZ).

DLZ (Dynamically Loadable Zones) is an extension to BIND 9 that allows zone data to be retrieved directly from an external database. There is no required format or schema. DLZ drivers exist for several different database backends including PostgreSQL, MySQL, and LDAP and can be written for any other.

There's also an article on Using DLZ in BIND.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • PowerDNS seems easier to configure to use MySQL compared to BIND (I can't find up to date guides for BIND with MySQL), and my understanding is that BIND DLZ is not recommended for high load DNS servers, whereas PowerDNS has no trouble. – Daniel Lo Nigro Apr 25 '20 at 23:44
  • This is an excellent and free book online written by a knowledgeable man on DNS that explore various edge cases, that is everything that is not bind + text zonefiles: https://jpmens.net/2010/10/29/alternative-dns-servers-the-book-as-pdf/ It is a bit old now, but there are many useful things in it. Anyone serious about the DNS should take a look at it. – Patrick Mevzek Jun 05 '20 at 15:56
  • Also Bind DLZ "official" source is http://bind-dlz.sourceforge.net/ – Patrick Mevzek Jun 05 '20 at 15:57