https://github.com/magnetikonline/bind-zone-builder
Generates nicely formatted BIND DNS zone files from XML source definition documents.
https://github.com/magnetikonline/bind-zone-builder
bind dns
Last synced: 3 months ago
JSON representation
Generates nicely formatted BIND DNS zone files from XML source definition documents.
- Host: GitHub
- URL: https://github.com/magnetikonline/bind-zone-builder
- Owner: magnetikonline
- License: mit
- Created: 2013-03-29T04:13:33.000Z (about 13 years ago)
- Default Branch: main
- Last Pushed: 2022-02-03T00:21:24.000Z (about 4 years ago)
- Last Synced: 2025-02-01T02:29:12.104Z (about 1 year ago)
- Topics: bind, dns
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BIND zone builder
Generates nicely formatted [BIND](https://en.wikipedia.org/wiki/BIND) DNS zone files from simple XML source definition documents. A minor rewrite of a utility I put together a few years back to simplify the management of various BIND zone instances I have under my control.
Automatically handles zone serial number increments when rewriting existing zone file(s) with new DNS record information and performs some sanity checks of source XML data (a minimum of one NS record per zone, IPv4 format checks) to hopefully avoid some basic errors.
Provides support for the following record types:
- **ANAME** - only IPv4 for now (could be extended to IPv6 quite easily)
- **CNAME**
- **MX**
- **NS** - ensure at least one name server defined
- **SPF** - provides a (very) simple SPF record builder - for anything more advanced a TXT record can be used
- **TXT**
Time units where required/allowed can be given either in seconds or the standard BIND units of weeks, days, hours, minutes. TTL's can be set for individual records as well, see [Configuration XML format](#configuration-xml-format) below for an example.
- [Requires](#requires)
- [Usage](#usage)
- [Configuration XML format](#configuration-xml-format)
## Requires
- PHP 5.4
- [XML Parser extension](https://www.php.net/manual/en/book.xml.php) (James Clark's expat), should be installed by default.
## Usage
Also shown by running `bindzonebuilder.php` without command line option(s).
```
Usage: bindzonebuilder.php -c[file] -t[dir]
-c[file] XML domain configuration file
-t[dir] Target directory for generated bind zone files (must exist)
```
## Configuration XML format
An example XML config and output zone files, also refer to [example.xml](example.xml).
```xml
```
`/output/db.domain01.com`:
```
$TTL 1D
@ IN SOA ns1.domain01.com. dns.domainadmin.com. (
YYYYMMDDRR ; Serial
8H ; Refresh
2H ; Retry
1W ; Expire
60M ) ; Negative Cache TTL
@ NS ns1.domain01.com.
@ NS ns2.domain01.com.
@ 600 A 123.255.255.123
subdomain01 4H A 123.255.255.255
www CNAME domain01.com.
@ MX 10 mail1.server.com.
@ MX 20 mail2.server.com.
@ MX 30 mail3.server.com.
@ TXT "v=spf1 ip4:123.255.255.123 include:_spf.google.com ?all"
@ TXT "This is a text record"
```
`/output/db.domain02.com`
```
$TTL 1D
@ IN SOA ns1.domain02.com. dns.domainadmin.com. (
YYYYMMDDRR ; Serial
8H ; Refresh
2H ; Retry
1W ; Expire
60M ) ; Negative Cache TTL
@ NS ns1.domain02.com.
@ NS ns2.domain02.com.
@ MX 10 mail1.server.com.
@ TXT "v=spf1 ip4:123.255.255.123 include:_spf.google.com ~all"
```