|
NAMEnsnotifyd —
handle DNS NOTIFY messages by running a command
SYNOPSIS
DESCRIPTIONThensnotifyd daemon monitors a set of DNS
zones and runs a command when any
of them change. It listens for DNS NOTIFY messages so it can respond to
changes promptly. It also uses each zone's SOA refresh and retry parameters to
poll for updates if nsnotifyd does not receive NOTIFY
messages more frequently.
You should specify zone names without the trailing dot. The root
zone can be specified as ‘ Note: OPTIONS
Interval syntaxTime parameters for the-T , -R
and -r options are in seconds, or you can use a
combination of the following time units, as in DNS master files. For example,
1h1m1s is 3661 seconds.
The usage message printed by
DETAILSStartupBefore daemonizing,nsnotifyd makes SOA queries for each
zone to initialize its refresh and retry timers.
Daemonizing is configured using the When daemonizing, ServerThensnotifyd daemon acts as a very simple UDP-only or
TCP-only DNS server. (BIND sends NOTIFY messages over UDP, whereas Knot DNS
uses TCP.) If you need to support both UDP and TCP, you can run two copies of
nsnotifyd with and without the
-t option.
The only DNS queries handled by In UDP-only mode (the default), Normally Messages are logged via syslog(3). Zone refreshWhennsnotifyd receives a NOTIFY, or when a refresh or
retry timer expires, it makes a SOA query to see if the zone has changed. The
SOA query is sent to the source of the NOTIFY or, if a timer expired, to the
server given in the -s option.
If the NOTIFY message was accepted for an unknown zone because you
used the Some jitter is applied to SOA refresh and retry timers, so polling can occur up to 10% earlier than specified. Command invocationWhen the SOA reply indicates the zone's serial number has increased,nsnotifyd runs the command with
two or three arguments:
When the command exits successfully,
If the SOA query or command fails,
Unknown zones that were not mentioned on the command line are not polled. Performance considerationsThe speed of your command determines how fastnsnotifyd can process NOTIFY messages.
When NOTIFYs arrive faster than they can be processed,
For example, if you rapidly update 100 zones, and your
command takes about 1 second to run,
You should aim to keep this maximum latency (your command running time times your NOTIFY batch size) less than your DNS server's NOTIFY timeout. If your command is too slow, you can alter it to fork and do the bulk of its work in the background, but then you are responsible for avoiding a forkbomb. You might limit how many NOTIFY messages your DNS server sends at once, or alter your command to limit its own concurrency. EXAMPLE - metazonesMetazones allow you to use standard DNS mechanisms - AXFR, IXFR, NOTIFY, UPDATE - to control the configuration of multiple name servers, instead of using a separate out-of-band distribution system.For details, see the metazone(1) manual. EXAMPLE - zone revision historySay you have a zone, example.org, which is updated dynamically, and you want to automatically record its history in a git(1) repository.Setup gitOn a server that is authoritative for example.org, run the following commands:$ mkdir zone-history $ cd zone-history $ git init $ touch example.org $ git add example.org $ git commit -m 'add example.org (empty)' Monitor the zoneThensnotify2git script is designed to work with
nsnotifyd to record the history of a set of zones.
Continuing the transcript,
$ nsnotifyd -P nsnotifyd.pid -p 5309 nsnotify2git example.org Send notifiesTo configure BIND to send notifies tonsnotifyd , so it
detects changes more efficiently, look in your
named.conf(5)
file for
zone example.org { ... }; Inside the zone clause, add or modify the
‘ also-notify { 127.0.0.1 port 5309; }; Update the zoneNow, when the zone changes,nsnotifyd will quickly
record the change in your git repository.
$ nsupdate -l > add example.com 3600 IN TXT "foo" > send > quit $ git log --format=%s example.org IN SOA 1234 add example.org (empty) EXAMPLE - stealth secondary synchronizationA stealth secondary is a server which transfers authoritative copies of a zone, but which is not listed in the zone's NS records. It will not normally get NOTIFY messages to tell it when to update the zone, so must rely on the zone's SOA timers instead.We would like stealth secondaries to get updates promptly, but
without extra manual configuration of
‘ To do this, Create working directoryThe working directory contains the client lists, one per zone, and a symlink to the log file used by BIND. You only need to run this command once when creating the directory.$ mkdir notify-stealth $ cd notify-stealth $ ln -s /var/log/messages .log This directory will also contain a .pid
file for Pre-populate the directoryThis gets us a file per zone, each containing a list of clients for that zone. Thensnotify2stealth script will automatically update
the client lists once per day.
$ nsnotify-liststealth .log Monitor the zonesBecause we have a file per zone, we can invokensnotifyd
with a glob instead of listing the zones explicitly. The special files
(.log .once .pid) are dotted so that the glob works as
expected.
$ nsnotifyd -P .pid -p 5307 nsnotify2stealth * Send notifiesYou will also need to reconfigure BIND to send notifies tonsnotifyd , as described in the previous example.
Tune BINDIf you have a lot of stealth secondaries,nsnotify2stealth can cause a large flood of zone
transfers. You may need to change BIND's capacity settings as described in the
ISC Knowledge Base article cited in the SEE
ALSO section below.
EXAMPLE - bump-in-the-wire DNSSECThe nsdiff(1) utility creates an nsupdate(1) script from the differences between two versions of a zone. It can be used as an alternative to BIND'sinline-signing option,
amongst other things.
You can use Configure your hidden master server to send notifies and allow zone transfers to your signing server: also-notify { signer port 5305; }; allow-transfer { signer; }; Configure the signer with dynamic signed master zones, and generate keys for them: zone example.org { type master; update-policy local; auto-dnssec maintain; }; $ dnssec-keygen -fk example.org $ dnssec-keygen example.org Run $ nsnotifyd -P nsnotifyd.pid -p 5305 nsnotify2update example.org Configure your public name servers to transfer your zones from the signer instead of from the hidden master. BUGSThensnotifyd daemon is not very secure.
It accepts any well-formed NOTIFY message, regardless of the
source. It does not support TSIG authentication (RFC 2845) for access
control. You should configure The The A spoofed NOTIFY will make It does not support EDNS (RFC 6891). However, NOTIFY messages and responses are very small, so following these specifications should not be necessary in practice. SEE ALSOgit(1), metazone(1), named(8), named.conf(5), nsdiff(1), nsnotify(1), nspatch(1), nsupdate(1), syslog(3)Cathy Almond, Tuning BIND for zone transfers, Internet Systems Consortium, ISC Knowledge Base, AA-00726, https://kb.isc.org/article/AA-00726. STANDARDSPaul Mockapetris, Domain names - concepts and facilities, RFC 1034, November 1987.Paul Mockapetris, Domain names - implementation and specification, RFC 1035, November 1987. Robert Elz and Randy Bush, Serial number arithmetic, RFC 1982, August 1996. Paul Vixie, A mechanism for prompt notification of zone changes (DNS NOTIFY), RFC 1996, August 1996. AUTHORTony Finch ⟨dot@dotat.at ⟩
at Cambridge University Information Services
Visit the GSP FreeBSD Man Page Interface. |