# # /usr/local/etc/nsd/nsd.conf # See nsd.conf(5) # # References # ---------- # * NSD DNS Server Tutorial # https://calomel.org/nsd_dns.html # * Host Your own DNS, without Sacrificing Reliability # https://blog.tom-fitzhenry.me.uk/2012/12/host-your-own-dns-without-sacrificing-reliability.html # * Stealth (a.k.a. DMZ or Hidden Master) Name Server # http://www.zytrax.com/books/dns/ch4/#stealth # * Free Secondary/slave DNS services # http://www.frankb.us/dns/ # * Free Secondary (slave) DNS # https://bornoe.org/blog/2015/10/free-secondary-slave-dns/ # # # Aaron LI # # NOTE: # Authoritative master server in *stealth* mode, i.e., hidden master. # # Due to the importance of the DNS, many registrars require that at least 2 # name servers are provided from different machines or even from different # countries. Maybe you could create another glue record with the same IP # address to fool the registrar, but some registrars may further check the # IP addresses. Nevertheless, it is highly unrecommended to host your own # DNS on single machine, and secondary/slave DNS services should be used. # One can even configure a hidden master DNS with several slaves, which # can greatly reduce the traffic to the (small) master DNS, since only the # configured slaves have access to it, and the better security (avoid DDoS). server: # Specify the interfaces to bind. # Default are the wildcard interfaces 0.0.0.0 and ::0). ip-address: {{ network.ipv4.address }} ip-address: {{ network.ipv6.address }} # Use the reuseport socket option for performance. # Default: no. reuseport: yes # Listen on IPv4 connections do-ip4: yes # Listen on IPv6 connections do-ip6: yes # The file used to store the compiled zone information. # If set to "" then no disk-database is used, less memory used # but zone updates are not (immediately) spooled to disk. #database: "/var/db/nsd/nsd.db" database: "" # Don't answer VERSION.BIND and VERSION.SERVER CHAOS class queries hide-version: yes # Identify the server (CH TXT ID.SERVER entry) identity: "" # Statistics are produced every number of seconds. # NOTE: requires BIND 8 statistics, which is disabled in the package #statistics: 7200 # Verbosity level (0, 1, 2). # Level 0 will print warnings and errors, and other events that are # important to keep NSD running. verbosity: 1 # Log messages to file. Default to stderr and syslog (with # facility LOG_DAEMON). stderr disappears when daemon goes to bg. #logfile: "/var/log/nsd.log" # Remote control config section. # remote-control: # Enable remote control with nsd-control(8) here. control-enable: yes # Interfaces listened to for control. Default is on localhost. control-interface: 127.0.0.1 control-interface: ::1 # Server and nsd-control key and certificate files for remote control. # Set up the keys and certificates with nsd-control-setup. server-key-file: "/usr/local/etc/nsd/nsd_server.key" server-cert-file: "/usr/local/etc/nsd/nsd_server.pem" control-key-file: "/usr/local/etc/nsd/nsd_control.key" control-cert-file: "/usr/local/etc/nsd/nsd_control.pem" # Patterns have zone configuration that are shared by one or more zones. # pattern: # Name by which the pattern is referred to name: "stealth_zones" # The zonefile for the zones that use this pattern. # If relative then from the zonesdir (inside the chroot). # the name is processed: %s - zone name (as appears in zone:name). zonefile: "zones/%s.zone" # Use "%s" to use the name of the zone to track its statistics from # nsd-control stats and stats_noreset. zonestats: "%s" # Notify these slaves when the master zone changes, and allow them # to transfer zones. {% for server in nameservers %} notify: {{ server.xfr_ip }} NOKEY # {{ server.name }} provide-xfr: {{ server.xfr_ip }} NOKEY # {{ server.name }} {% endfor %} # Fixed zone entries. Here you can config zones that cannot be deleted. # Zones that are dynamically added and deleted are put in the zonelist file. # {% for zf in zonefiles %} zone: name: "{{ zf | basename | regex_replace('\.zone\.j2', '') }}" include-pattern: "stealth_zones" {% endfor %}