| 1 |
# Name |
| 2 |
|
| 3 |
_dbfile_ - serve zone data from an RFC 1035-style file |
| 4 |
|
| 5 |
# Description |
| 6 |
|
| 7 |
The _dbfile_ handler is used for DNS servers that serve from a file that loaded from disk, |
| 8 |
containing RFC 1035 styled data. If the zone file contains signatures (i.e., is signed using DNSSEC), correct |
| 9 |
DNSSEC answers are returned. Only NSEC is supported. See the _sign_ handler if you want to sign and resign your |
| 10 |
zone automatically. |
| 11 |
|
| 12 |
The server will reply with minimal responses by default. The _dbfile_ handler will watch the zone file and when |
| 13 |
it receives a (kernel) notify it will reload the zone after 2 seconds. Regardless of any change it will send out |
| 14 |
notifies if configured to do so, the actual SOA serial isn't relevant. |
| 15 |
|
| 16 |
# Syntax |
| 17 |
|
| 18 |
In it simplests form _dbfile_ you can use: |
| 19 |
|
| 20 |
``` |
| 21 |
dbfile FILE |
| 22 |
``` |
| 23 |
|
| 24 |
- **FILE** the zone file to load. If the path is relative, the path from the global root config will be |
| 25 |
prepended to it. |
| 26 |
|
| 27 |
If the handler block contains multiple zones, they all will use the _same_ **FILE**. And you must make |
| 28 |
sure that zone **FILE** is generic enough, i.e. use `@` for origins instead of domain names. Note that this break |
| 29 |
incoming transfers and thus will lead to an error when attempted. |
| 30 |
|
| 31 |
For extra control you can open the block and define multipe extra properties that deal with zone transfers. |
| 32 |
|
| 33 |
``` |
| 34 |
dbfile FILE { |
| 35 |
transfer { |
| 36 |
from IP[:PORT] [IP[:PORT]]... { |
| 37 |
key NAME ALGORITHM SECRET |
| 38 |
} |
| 39 |
to [IP[:PORT]]... { |
| 40 |
notify IP[:PORT] [IP[:PORT]]... |
| 41 |
source IP|IFACE [IP|IFACE] |
| 42 |
key NAME ALGORITHM SECRET |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
``` |
| 47 |
|
| 48 |
- `transfer` details how zone transfers are handled, `from` deals with incoming AXFR from **IP**, and `to` |
| 49 |
deals with outgoing ones. Without `transfer` all transfers are prohibited. When transfer from a secondary |
| 50 |
_all_ SOA timers are ignored, every 10 time minutes the upstream(s) is(/are) check for SOA updates. |
| 51 |
- `from` allows for multiple upstream **IP**s to be specified, they will be tried in that order. Notifies |
| 52 |
from those servers will be matched against **IP**s. |
| 53 |
If `from` is used _multipe_ zones are disallowed, and will cause an error because the transferred zone |
| 54 |
cant be shared. To save the zone file the directory of **FILE** must be writeable. |
| 55 |
- The `key` specification is for TSIG signed transfers. The **SECRET** must be base64 encoded. |
| 56 |
- `to` allows for multipe downstream **IP**s to be specified, those are all allowed to initiate a transfer. |
| 57 |
If there are no **IP**s specfied the AXFR is open to the entire internet. |
| 58 |
- If there is no `notify` the **IP**s as specified in `to` are used for sending notifies. If you |
| 59 |
want to override this add a `notify` and put an (new) set of **IP**s there. There can be at the most two |
| 60 |
IPs here, one for IPv4 and one for IPv6. With `source` you can set the source(s) address when sending the |
| 61 |
notifies. You can use an interface name as **IFACE** and the routable IP address from the interface are also |
| 62 |
used. The TSIG key specification is identical to that of `from`. For **IP** you can use IPv6 or IPv4 |
| 63 |
addresses, these are automatically matched up, i.e. a notify with a IPv4 address will use a IPv4 source and |
| 64 |
vice versa. |
| 65 |
|
| 66 |
Note that a bare `transfer` is enough to allow for outgoing transfers. |
| 67 |
|
| 68 |
# Examples |
| 69 |
|
| 70 |
Load the `example.org` zone from `db.example.org` and allow transfers to the internet, but send |
| 71 |
notifies to 10.240.1.1 |
| 72 |
|
| 73 |
```conffile |
| 74 |
example.org { |
| 75 |
dbfile db.example.org { |
| 76 |
transfer { |
| 77 |
to { |
| 78 |
notify 10.240.1.1 |
| 79 |
} |
| 80 |
} |
| 81 |
} |
| 82 |
} |
| 83 |
``` |
| 84 |
|
| 85 |
Where `db.example.org` would contain RRs in the (text) presentation format from RFC 1035: |
| 86 |
|
| 87 |
``` |
| 88 |
$ORIGIN example.org. |
| 89 |
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. 2017042745 7200 3600 1209600 3600 |
| 90 |
3600 IN NS a.iana-servers.net. |
| 91 |
3600 IN NS b.iana-servers.net. |
| 92 |
|
| 93 |
www IN A 127.0.0.1 |
| 94 |
IN AAAA ::1 |
| 95 |
``` |
| 96 |
|
| 97 |
Or use a single zone file for multiple zones: |
| 98 |
|
| 99 |
```conffile |
| 100 |
example.org example.net { |
| 101 |
dbfile example.org.signed { |
| 102 |
transfer { |
| 103 |
to 10.240.1.1 { |
| 104 |
source eth0 |
| 105 |
} |
| 106 |
} |
| 107 |
} |
| 108 |
} |
| 109 |
``` |
| 110 |
|
| 111 |
# See Also |
| 112 |
|
| 113 |
See the _sign_ handler for signing your zones and see RFC 1035 for more info on how to structure zone files. |