unbound.conf.j2 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. server:
  2. # verbosity number, 0 is least verbose. 1 is default.
  3. verbosity: 1
  4. # print statistics to the log (for every thread) every N seconds.
  5. # Set to "" or 0 to disable. Default is disabled.
  6. # Needs to be disabled for munin plugin
  7. statistics-interval: 0
  8. # enable shm for stats, default no. if you enable also enable
  9. # statistics-interval, every time it also writes stats to the
  10. # shared memory segment keyed with shm-key.
  11. # shm-enable: no
  12. # shm for stats uses this key, and key+1 for the shared mem segment.
  13. # shm-key: 11777
  14. # enable cumulative statistics, without clearing them after printing.
  15. # Needs to be disabled for munin plugin
  16. statistics-cumulative: no
  17. # enable extended statistics (query types, answer codes, status)
  18. # printed from unbound-control. default off, because of speed.
  19. # Needs to be enabled for munin plugin
  20. extended-statistics: yes
  21. # number of threads to create. 1 disables threading.
  22. num-threads: 4
  23. interface: 127.0.0.1
  24. interface: {{ ansible_all_ipv4_addresses|sort|first }}
  25. # for dns over tls and raw dns over port 80
  26. # interface: 0.0.0.0@443
  27. # interface: ::0@443
  28. # interface: 0.0.0.0@80
  29. # interface: ::0@80
  30. # enable this feature to copy the source address of queries to reply.
  31. # Socket options are not supported on all platforms. experimental.
  32. # interface-automatic: yes
  33. #
  34. # NOTE: Enable this option when specifying interface 0.0.0.0 or ::0
  35. # NOTE: Disabled per Fedora policy not to listen to * on default install
  36. # NOTE: If deploying on non-default port, eg 80/443, this needs to be disabled
  37. interface-automatic: no
  38. # port to answer queries from
  39. # port: 53
  40. # specify the interfaces to send outgoing queries to authoritative
  41. # server from by ip-address. If none, the default (all) interface
  42. # is used. Specify every interface on a 'outgoing-interface:' line.
  43. # outgoing-interface: 192.0.2.153
  44. # outgoing-interface: 2001:DB8::5
  45. # outgoing-interface: 2001:DB8::6
  46. outgoing-interface: {{ ansible_default_ipv4.address }}
  47. # Specify a netblock to use remainder 64 bits as random bits for
  48. # upstream queries. Uses freebind option (Linux).
  49. # outgoing-interface: 2001:DB8::/64
  50. # Also (Linux:) ip -6 addr add 2001:db8::/64 dev lo
  51. # And: ip -6 route add local 2001:db8::/64 dev lo
  52. # And set prefer-ip6: yes to use the ip6 randomness from a netblock.
  53. # Set this to yes to prefer ipv6 upstream servers over ipv4.
  54. # prefer-ip6: no
  55. # number of ports to allocate per thread, determines the size of the
  56. # port range that can be open simultaneously. About double the
  57. # num-queries-per-thread, or, use as many as the OS will allow you.
  58. # outgoing-range: 4096
  59. # permit unbound to use this port number or port range for
  60. # making outgoing queries, using an outgoing interface.
  61. # Only ephemeral ports are allowed by SElinux
  62. outgoing-port-permit: 32768-60999
  63. # deny unbound the use this of port number or port range for
  64. # making outgoing queries, using an outgoing interface.
  65. # Use this to make sure unbound does not grab a UDP port that some
  66. # other server on this computer needs. The default is to avoid
  67. # IANA-assigned port numbers.
  68. # If multiple outgoing-port-permit and outgoing-port-avoid options
  69. # are present, they are processed in order.
  70. # Our SElinux policy does not allow non-ephemeral ports to be used
  71. outgoing-port-avoid: 0-32767
  72. # number of outgoing simultaneous tcp buffers to hold per thread.
  73. # outgoing-num-tcp: 10
  74. # number of incoming simultaneous tcp buffers to hold per thread.
  75. # incoming-num-tcp: 10
  76. # buffer size for UDP port 53 incoming (SO_RCVBUF socket option).
  77. # 0 is system default. Use 4m to catch query spikes for busy servers.
  78. # so-rcvbuf: 0
  79. # buffer size for UDP port 53 outgoing (SO_SNDBUF socket option).
  80. # 0 is system default. Use 4m to handle spikes on very busy servers.
  81. # so-sndbuf: 0
  82. # use SO_REUSEPORT to distribute queries over threads.
  83. so-reuseport: yes
  84. # use IP_TRANSPARENT so the interface: addresses can be non-local
  85. # and you can config non-existing IPs that are going to work later on
  86. # (uses IP_BINDANY on FreeBSD).
  87. ip-transparent: yes
  88. # use IP_FREEBIND so the interface: addresses can be non-local
  89. # and you can bind to nonexisting IPs and interfaces that are down.
  90. # Linux only. On Linux you also have ip-transparent that is similar.
  91. # ip-freebind: no
  92. # EDNS reassembly buffer to advertise to UDP peers (the actual buffer
  93. # is set with msg-buffer-size). 1472 can solve fragmentation (timeouts).
  94. # edns-buffer-size: 4096
  95. # Maximum UDP response size (not applied to TCP response).
  96. # Suggested values are 512 to 4096. Default is 4096. 65536 disables it.
  97. # 3072 causes +dnssec any isc.org queries to need TC=1.
  98. # Helps mitigating DDOS
  99. max-udp-size: 3072
  100. # buffer size for handling DNS data. No messages larger than this
  101. # size can be sent or received, by UDP or TCP. In bytes.
  102. # msg-buffer-size: 65552
  103. # the amount of memory to use for the message cache.
  104. # plain value in bytes or you can append k, m or G. default is "4Mb".
  105. # msg-cache-size: 4m
  106. # the number of slabs to use for the message cache.
  107. # the number of slabs must be a power of 2.
  108. # more slabs reduce lock contention, but fragment memory usage.
  109. # msg-cache-slabs: 4
  110. # the number of queries that a thread gets to service.
  111. # num-queries-per-thread: 1024
  112. # if very busy, 50% queries run to completion, 50% get timeout in msec
  113. # jostle-timeout: 200
  114. # msec to wait before close of port on timeout UDP. 0 disables.
  115. # delay-close: 0
  116. # the amount of memory to use for the RRset cache.
  117. # plain value in bytes or you can append k, m or G. default is "4Mb".
  118. # rrset-cache-size: 4m
  119. # the number of slabs to use for the RRset cache.
  120. # the number of slabs must be a power of 2.
  121. # more slabs reduce lock contention, but fragment memory usage.
  122. # rrset-cache-slabs: 4
  123. # the time to live (TTL) value lower bound, in seconds. Default 0.
  124. # If more than an hour could easily give trouble due to stale data.
  125. # cache-min-ttl: 0
  126. # the time to live (TTL) value cap for RRsets and messages in the
  127. # cache. Items are not cached for longer. In seconds.
  128. # cache-max-ttl: 86400
  129. # the time to live (TTL) value cap for negative responses in the cache
  130. # cache-max-negative-ttl: 3600
  131. # the time to live (TTL) value for cached roundtrip times, lameness and
  132. # EDNS version information for hosts. In seconds.
  133. # infra-host-ttl: 900
  134. # minimum wait time for responses, increase if uplink is long. In msec.
  135. # infra-cache-min-rtt: 50
  136. # the number of slabs to use for the Infrastructure cache.
  137. # the number of slabs must be a power of 2.
  138. # more slabs reduce lock contention, but fragment memory usage.
  139. # infra-cache-slabs: 4
  140. # the maximum number of hosts that are cached (roundtrip, EDNS, lame).
  141. # infra-cache-numhosts: 10000
  142. # define a number of tags here, use with local-zone, access-control.
  143. # repeat the define-tag statement to add additional tags.
  144. # define-tag: "tag1 tag2 tag3"
  145. # Enable IPv4, "yes" or "no".
  146. # do-ip4: yes
  147. # Enable IPv6, "yes" or "no".
  148. # do-ip6: yes
  149. # Enable UDP, "yes" or "no".
  150. # NOTE: if setting up an unbound on tls443 for public use, you might want to
  151. # disable UDP to avoid being used in DNS amplification attacks.
  152. # do-udp: yes
  153. # Enable TCP, "yes" or "no".
  154. do-tcp: yes
  155. # upstream connections use TCP only (and no UDP), "yes" or "no"
  156. # useful for tunneling scenarios, default no.
  157. # tcp-upstream: no
  158. # upstream connections also use UDP (even if do-udp is no).
  159. # useful if if you want UDP upstream, but don't provide UDP downstream.
  160. # udp-upstream-without-downstream: no
  161. # Maximum segment size (MSS) of TCP socket on which the server
  162. # responds to queries. Default is 0, system default MSS.
  163. # tcp-mss: 0
  164. # Maximum segment size (MSS) of TCP socket for outgoing queries.
  165. # Default is 0, system default MSS.
  166. # outgoing-tcp-mss: 0
  167. # Fedora note: do not activate this - can cause a crash
  168. # Use systemd socket activation for UDP, TCP, and control sockets.
  169. # use-systemd: no
  170. # Detach from the terminal, run in background, "yes" or "no".
  171. # Set the value to "no" when unbound runs as systemd service.
  172. # do-daemonize: yes
  173. # control which clients are allowed to make (recursive) queries
  174. # to this server. Specify classless netblocks with /size and action.
  175. # By default everything is refused, except for localhost.
  176. # Choose deny (drop message), refuse (polite error reply),
  177. # allow (recursive ok), allow_setrd (recursive ok, rd bit is forced on),
  178. # allow_snoop (recursive and nonrecursive ok)
  179. # deny_non_local (drop queries unless can be answered from local-data)
  180. # refuse_non_local (like deny_non_local but polite error reply).
  181. # access-control: 0.0.0.0/0 refuse
  182. # access-control: 127.0.0.0/8 allow
  183. # access-control: ::0/0 refuse
  184. # access-control: ::1 allow
  185. # access-control: ::ffff:127.0.0.1 allow
  186. access-control: 127.0.0.0/8 allow
  187. {% for cidr in allowed_access_cidrs %}
  188. access-control: {{ cidr }} allow
  189. {% endfor %}
  190. # tag access-control with list of tags (in "" with spaces between)
  191. # Clients using this access control element use localzones that
  192. # are tagged with one of these tags.
  193. # access-control-tag: 192.0.2.0/24 "tag2 tag3"
  194. # set action for particular tag for given access control element
  195. # if you have multiple tag values, the tag used to lookup the action
  196. # is the first tag match between access-control-tag and local-zone-tag
  197. # where "first" comes from the order of the define-tag values.
  198. # access-control-tag-action: 192.0.2.0/24 tag3 refuse
  199. # set redirect data for particular tag for access control element
  200. # access-control-tag-data: 192.0.2.0/24 tag2 "A 127.0.0.1"
  201. # Set view for access control element
  202. # access-control-view: 192.0.2.0/24 viewname
  203. # if given, a chroot(2) is done to the given directory.
  204. # i.e. you can chroot to the working directory, for example,
  205. # for extra security, but make sure all files are in that directory.
  206. #
  207. # If chroot is enabled, you should pass the configfile (from the
  208. # commandline) as a full path from the original root. After the
  209. # chroot has been performed the now defunct portion of the config
  210. # file path is removed to be able to reread the config after a reload.
  211. #
  212. # All other file paths (working dir, logfile, roothints, and
  213. # key files) can be specified in several ways:
  214. # o as an absolute path relative to the new root.
  215. # o as a relative path to the working directory.
  216. # o as an absolute path relative to the original root.
  217. # In the last case the path is adjusted to remove the unused portion.
  218. #
  219. # The pid file can be absolute and outside of the chroot, it is
  220. # written just prior to performing the chroot and dropping permissions.
  221. #
  222. # Additionally, unbound may need to access /dev/random (for entropy).
  223. # How to do this is specific to your OS.
  224. #
  225. # If you give "" no chroot is performed. The path must not end in a /.
  226. # chroot: "/var/lib/unbound"
  227. chroot: ""
  228. # if given, user privileges are dropped (after binding port),
  229. # and the given username is assumed. Default is user "unbound".
  230. # If you give "" no privileges are dropped.
  231. username: "unbound"
  232. # the working directory. The relative files in this config are
  233. # relative to this directory. If you give "" the working directory
  234. # is not changed.
  235. # If you give a server: directory: dir before include: file statements
  236. # then those includes can be relative to the working directory.
  237. directory: "/etc/unbound"
  238. # the log file, "" means log to stderr.
  239. # Use of this option sets use-syslog to "no".
  240. # logfile: ""
  241. # Log to syslog(3) if yes. The log facility LOG_DAEMON is used to
  242. # log to. If yes, it overrides the logfile.
  243. # use-syslog: yes
  244. # Log identity to report. if empty, defaults to the name of argv[0]
  245. # (usually "unbound").
  246. # log-identity: ""
  247. # print UTC timestamp in ascii to logfile, default is epoch in seconds.
  248. log-time-ascii: yes
  249. # print one line with time, IP, name, type, class for every query.
  250. # log-queries: no
  251. # print one line per reply, with time, IP, name, type, class, rcode,
  252. # timetoresolve, fromcache and responsesize.
  253. # log-replies: no
  254. # the pid file. Can be an absolute path outside of chroot/work dir.
  255. pidfile: "/var/run/unbound/unbound.pid"
  256. # file to read root hints from.
  257. # get one from https://www.internic.net/domain/named.cache
  258. # root-hints: ""
  259. # enable to not answer id.server and hostname.bind queries.
  260. # hide-identity: no
  261. # enable to not answer version.server and version.bind queries.
  262. # hide-version: no
  263. # enable to not answer trustanchor.unbound queries.
  264. # hide-trustanchor: no
  265. # the identity to report. Leave "" or default to return hostname.
  266. # identity: ""
  267. # the version to report. Leave "" or default to return package version.
  268. # version: ""
  269. # the target fetch policy.
  270. # series of integers describing the policy per dependency depth.
  271. # The number of values in the list determines the maximum dependency
  272. # depth the recursor will pursue before giving up. Each integer means:
  273. # -1 : fetch all targets opportunistically,
  274. # 0: fetch on demand,
  275. # positive value: fetch that many targets opportunistically.
  276. # Enclose the list of numbers between quotes ("").
  277. # target-fetch-policy: "3 2 1 0 0"
  278. # Harden against very small EDNS buffer sizes.
  279. # harden-short-bufsize: no
  280. # Harden against unseemly large queries.
  281. # harden-large-queries: no
  282. # Harden against out of zone rrsets, to avoid spoofing attempts.
  283. harden-glue: yes
  284. # Harden against receiving dnssec-stripped data. If you turn it
  285. # off, failing to validate dnskey data for a trustanchor will
  286. # trigger insecure mode for that zone (like without a trustanchor).
  287. # Default on, which insists on dnssec data for trust-anchored zones.
  288. harden-dnssec-stripped: yes
  289. # Harden against queries that fall under dnssec-signed nxdomain names.
  290. harden-below-nxdomain: yes
  291. # Harden the referral path by performing additional queries for
  292. # infrastructure data. Validates the replies (if possible).
  293. # Default off, because the lookups burden the server. Experimental
  294. # implementation of draft-wijngaards-dnsext-resolver-side-mitigation.
  295. harden-referral-path: yes
  296. # Harden against algorithm downgrade when multiple algorithms are
  297. # advertised in the DS record. If no, allows the weakest algorithm
  298. # to validate the zone.
  299. # harden-algo-downgrade: no
  300. # Sent minimum amount of information to upstream servers to enhance
  301. # privacy. Only sent minimum required labels of the QNAME and set QTYPE
  302. # to NS when possible.
  303. qname-minimisation: yes
  304. # QNAME minimisation in strict mode. Do not fall-back to sending full
  305. # QNAME to potentially broken nameservers. A lot of domains will not be
  306. # resolvable when this option in enabled.
  307. # This option only has effect when qname-minimisation is enabled.
  308. # qname-minimisation-strict: no
  309. # Aggressive NSEC uses the DNSSEC NSEC chain to synthesize NXDOMAIN
  310. # and other denials, using information from previous NXDOMAINs answers.
  311. aggressive-nsec: yes
  312. # Use 0x20-encoded random bits in the query to foil spoof attempts.
  313. # This feature is an experimental implementation of draft dns-0x20.
  314. # use-caps-for-id: no
  315. # Domains (and domains in them) without support for dns-0x20 and
  316. # the fallback fails because they keep sending different answers.
  317. # caps-whitelist: "licdn.com"
  318. # caps-whitelist: "senderbase.org"
  319. # Enforce privacy of these addresses. Strips them away from answers.
  320. # It may cause DNSSEC validation to additionally mark it as bogus.
  321. # Protects against 'DNS Rebinding' (uses browser as network proxy).
  322. # Only 'private-domain' and 'local-data' names are allowed to have
  323. # these private addresses. No default.
  324. # private-address: 10.0.0.0/8
  325. # private-address: 172.16.0.0/12
  326. # private-address: 192.168.0.0/16
  327. # private-address: 169.254.0.0/16
  328. # private-address: fd00::/8
  329. # private-address: fe80::/10
  330. # private-address: ::ffff:0:0/96
  331. # Allow the domain (and its subdomains) to contain private addresses.
  332. # local-data statements are allowed to contain private addresses too.
  333. # private-domain: "example.com"
  334. # If nonzero, unwanted replies are not only reported in statistics,
  335. # but also a running total is kept per thread. If it reaches the
  336. # threshold, a warning is printed and a defensive action is taken,
  337. # the cache is cleared to flush potential poison out of it.
  338. # A suggested value is 10000000, the default is 0 (turned off).
  339. unwanted-reply-threshold: 10000000
  340. # Do not query the following addresses. No DNS queries are sent there.
  341. # List one address per entry. List classless netblocks with /size,
  342. # do-not-query-address: 127.0.0.1/8
  343. # do-not-query-address: ::1
  344. # if yes, the above default do-not-query-address entries are present.
  345. # if no, localhost can be queried (for testing and debugging).
  346. # do-not-query-localhost: yes
  347. # if yes, perform prefetching of almost expired message cache entries.
  348. prefetch: yes
  349. # if yes, perform key lookups adjacent to normal lookups.
  350. prefetch-key: yes
  351. # if yes, Unbound rotates RRSet order in response.
  352. rrset-roundrobin: yes
  353. # if yes, Unbound doesn't insert authority/additional sections
  354. # into response messages when those sections are not required.
  355. minimal-responses: yes
  356. # true to disable DNSSEC lameness check in iterator.
  357. # disable-dnssec-lame-check: no
  358. # module configuration of the server. A string with identifiers
  359. # separated by spaces. Syntax: "[dns64] [validator] iterator"
  360. module-config: "ipsecmod validator iterator"
  361. # File with trusted keys, kept uptodate using RFC5011 probes,
  362. # initial file like trust-anchor-file, then it stores metadata.
  363. # Use several entries, one per domain name, to track multiple zones.
  364. #
  365. # If you want to perform DNSSEC validation, run unbound-anchor before
  366. # you start unbound (i.e. in the system boot scripts). And enable:
  367. # Please note usage of unbound-anchor root anchor is at your own risk
  368. # and under the terms of our LICENSE (see that file in the source).
  369. # auto-trust-anchor-file: "/var/lib/unbound/root.key"
  370. # trust anchor signaling sends a RFC8145 key tag query after priming.
  371. trust-anchor-signaling: yes
  372. # Root key trust anchor sentinel (draft-ietf-dnsop-kskroll-sentinel)
  373. root-key-sentinel: yes
  374. # File with DLV trusted keys. Same format as trust-anchor-file.
  375. # There can be only one DLV configured, it is trusted from root down.
  376. # DLV is going to be decommissioned. Please do not use it any more.
  377. # dlv-anchor-file: "dlv.isc.org.key"
  378. # File with trusted keys for validation. Specify more than one file
  379. # with several entries, one file per entry.
  380. # Zone file format, with DS and DNSKEY entries.
  381. # Note this gets out of date, use auto-trust-anchor-file please.
  382. # trust-anchor-file: ""
  383. # Trusted key for validation. DS or DNSKEY. specify the RR on a
  384. # single line, surrounded by "". TTL is ignored. class is IN default.
  385. # Note this gets out of date, use auto-trust-anchor-file please.
  386. # (These examples are from August 2007 and may not be valid anymore).
  387. # trust-anchor: "nlnetlabs.nl. DNSKEY 257 3 5 AQPzzTWMz8qSWIQlfRnPckx2BiVmkVN6LPupO3mbz7FhLSnm26n6iG9N Lby97Ji453aWZY3M5/xJBSOS2vWtco2t8C0+xeO1bc/d6ZTy32DHchpW 6rDH1vp86Ll+ha0tmwyy9QP7y2bVw5zSbFCrefk8qCUBgfHm9bHzMG1U BYtEIQ=="
  388. # trust-anchor: "jelte.nlnetlabs.nl. DS 42860 5 1 14D739EB566D2B1A5E216A0BA4D17FA9B038BE4A"
  389. # File with trusted keys for validation. Specify more than one file
  390. # with several entries, one file per entry. Like trust-anchor-file
  391. # but has a different file format. Format is BIND-9 style format,
  392. # the trusted-keys { name flag proto algo "key"; }; clauses are read.
  393. # you need external update procedures to track changes in keys.
  394. # trusted-keys-file: ""
  395. #
  396. trusted-keys-file: /etc/unbound/keys.d/*.key
  397. auto-trust-anchor-file: "/var/lib/unbound/root.key"
  398. # Ignore chain of trust. Domain is treated as insecure.
  399. # domain-insecure: "example.com"
  400. # Override the date for validation with a specific fixed date.
  401. # Do not set this unless you are debugging signature inception
  402. # and expiration. "" or "0" turns the feature off. -1 ignores date.
  403. # val-override-date: ""
  404. # The time to live for bogus data, rrsets and messages. This avoids
  405. # some of the revalidation, until the time interval expires. in secs.
  406. # val-bogus-ttl: 60
  407. # The signature inception and expiration dates are allowed to be off
  408. # by 10% of the signature lifetime (expir-incep) from our local clock.
  409. # This leeway is capped with a minimum and a maximum. In seconds.
  410. # val-sig-skew-min: 3600
  411. # val-sig-skew-max: 86400
  412. # Should additional section of secure message also be kept clean of
  413. # unsecure data. Useful to shield the users of this validator from
  414. # potential bogus data in the additional section. All unsigned data
  415. # in the additional section is removed from secure messages.
  416. val-clean-additional: yes
  417. # Turn permissive mode on to permit bogus messages. Thus, messages
  418. # for which security checks failed will be returned to clients,
  419. # instead of SERVFAIL. It still performs the security checks, which
  420. # result in interesting log files and possibly the AD bit in
  421. # replies if the message is found secure. The default is off.
  422. # NOTE: TURNING THIS ON DISABLES ALL DNSSEC SECURITY
  423. val-permissive-mode: no
  424. # Ignore the CD flag in incoming queries and refuse them bogus data.
  425. # Enable it if the only clients of unbound are legacy servers (w2008)
  426. # that set CD but cannot validate themselves.
  427. # ignore-cd-flag: no
  428. # Serve expired responses from cache, with TTL 0 in the response,
  429. # and then attempt to fetch the data afresh.
  430. serve-expired: yes
  431. # Have the validator log failed validations for your diagnosis.
  432. # 0: off. 1: A line per failed user query. 2: With reason and bad IP.
  433. val-log-level: 1
  434. # It is possible to configure NSEC3 maximum iteration counts per
  435. # keysize. Keep this table very short, as linear search is done.
  436. # A message with an NSEC3 with larger count is marked insecure.
  437. # List in ascending order the keysize and count values.
  438. # val-nsec3-keysize-iterations: "1024 150 2048 500 4096 2500"
  439. # instruct the auto-trust-anchor-file probing to add anchors after ttl.
  440. # add-holddown: 2592000 # 30 days
  441. # instruct the auto-trust-anchor-file probing to del anchors after ttl.
  442. # del-holddown: 2592000 # 30 days
  443. # auto-trust-anchor-file probing removes missing anchors after ttl.
  444. # If the value 0 is given, missing anchors are not removed.
  445. # keep-missing: 31622400 # 366 days
  446. # debug option that allows very small holddown times for key rollover,
  447. # otherwise the RFC mandates probe intervals must be at least 1 hour.
  448. # permit-small-holddown: no
  449. # the amount of memory to use for the key cache.
  450. # plain value in bytes or you can append k, m or G. default is "4Mb".
  451. # key-cache-size: 4m
  452. # the number of slabs to use for the key cache.
  453. # the number of slabs must be a power of 2.
  454. # more slabs reduce lock contention, but fragment memory usage.
  455. # key-cache-slabs: 4
  456. # the amount of memory to use for the negative cache (used for DLV).
  457. # plain value in bytes or you can append k, m or G. default is "1Mb".
  458. # neg-cache-size: 1m
  459. # By default, for a number of zones a small default 'nothing here'
  460. # reply is built-in. Query traffic is thus blocked. If you
  461. # wish to serve such zone you can unblock them by uncommenting one
  462. # of the nodefault statements below.
  463. # You may also have to use domain-insecure: zone to make DNSSEC work,
  464. # unless you have your own trust anchors for this zone.
  465. # local-zone: "localhost." nodefault
  466. # local-zone: "127.in-addr.arpa." nodefault
  467. # local-zone: "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." nodefault
  468. # local-zone: "onion." nodefault
  469. # local-zone: "test." nodefault
  470. # local-zone: "invalid." nodefault
  471. # local-zone: "10.in-addr.arpa." nodefault
  472. # local-zone: "16.172.in-addr.arpa." nodefault
  473. # local-zone: "17.172.in-addr.arpa." nodefault
  474. # local-zone: "18.172.in-addr.arpa." nodefault
  475. # local-zone: "19.172.in-addr.arpa." nodefault
  476. # local-zone: "20.172.in-addr.arpa." nodefault
  477. # local-zone: "21.172.in-addr.arpa." nodefault
  478. # local-zone: "22.172.in-addr.arpa." nodefault
  479. # local-zone: "23.172.in-addr.arpa." nodefault
  480. # local-zone: "24.172.in-addr.arpa." nodefault
  481. # local-zone: "25.172.in-addr.arpa." nodefault
  482. # local-zone: "26.172.in-addr.arpa." nodefault
  483. # local-zone: "27.172.in-addr.arpa." nodefault
  484. # local-zone: "28.172.in-addr.arpa." nodefault
  485. # local-zone: "29.172.in-addr.arpa." nodefault
  486. # local-zone: "30.172.in-addr.arpa." nodefault
  487. # local-zone: "31.172.in-addr.arpa." nodefault
  488. # local-zone: "168.192.in-addr.arpa." nodefault
  489. # local-zone: "0.in-addr.arpa." nodefault
  490. # local-zone: "254.169.in-addr.arpa." nodefault
  491. # local-zone: "2.0.192.in-addr.arpa." nodefault
  492. # local-zone: "100.51.198.in-addr.arpa." nodefault
  493. # local-zone: "113.0.203.in-addr.arpa." nodefault
  494. # local-zone: "255.255.255.255.in-addr.arpa." nodefault
  495. # local-zone: "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." nodefault
  496. # local-zone: "d.f.ip6.arpa." nodefault
  497. # local-zone: "8.e.f.ip6.arpa." nodefault
  498. # local-zone: "9.e.f.ip6.arpa." nodefault
  499. # local-zone: "a.e.f.ip6.arpa." nodefault
  500. # local-zone: "b.e.f.ip6.arpa." nodefault
  501. # local-zone: "8.b.d.0.1.0.0.2.ip6.arpa." nodefault
  502. # And for 64.100.in-addr.arpa. to 127.100.in-addr.arpa.
  503. # If unbound is running service for the local host then it is useful
  504. # to perform lan-wide lookups to the upstream, and unblock the
  505. # long list of local-zones above. If this unbound is a dns server
  506. # for a network of computers, disabled is better and stops information
  507. # leakage of local lan information.
  508. # unblock-lan-zones: no
  509. # The insecure-lan-zones option disables validation for
  510. # these zones, as if they were all listed as domain-insecure.
  511. # insecure-lan-zones: no
  512. # a number of locally served zones can be configured.
  513. # local-zone: <zone> <type>
  514. # local-data: "<resource record string>"
  515. # o deny serves local data (if any), else, drops queries.
  516. # o refuse serves local data (if any), else, replies with error.
  517. # o static serves local data, else, nxdomain or nodata answer.
  518. # o transparent gives local data, but resolves normally for other names
  519. # o redirect serves the zone data for any subdomain in the zone.
  520. # o nodefault can be used to normally resolve AS112 zones.
  521. # o typetransparent resolves normally for other types and other names
  522. # o inform acts like transparent, but logs client IP address
  523. # o inform_deny drops queries and logs client IP address
  524. # o always_transparent, always_refuse, always_nxdomain, resolve in
  525. # that way but ignore local data for that name
  526. # o noview breaks out of that view towards global local-zones.
  527. #
  528. # defaults are localhost address, reverse for 127.0.0.1 and ::1
  529. # and nxdomain for AS112 zones. If you configure one of these zones
  530. # the default content is omitted, or you can omit it with 'nodefault'.
  531. #
  532. # If you configure local-data without specifying local-zone, by
  533. # default a transparent local-zone is created for the data.
  534. #
  535. # You can add locally served data with
  536. # local-zone: "local." static
  537. # local-data: "mycomputer.local. IN A 192.0.2.51"
  538. # local-data: 'mytext.local TXT "content of text record"'
  539. #
  540. # You can override certain queries with
  541. # local-data: "adserver.example.com A 127.0.0.1"
  542. #
  543. # You can redirect a domain to a fixed address with
  544. # (this makes example.com, www.example.com, etc, all go to 192.0.2.3)
  545. # local-zone: "example.com" redirect
  546. # local-data: "example.com A 192.0.2.3"
  547. #
  548. # Shorthand to make PTR records, "IPv4 name" or "IPv6 name".
  549. # You can also add PTR records using local-data directly, but then
  550. # you need to do the reverse notation yourself.
  551. # local-data-ptr: "192.0.2.3 www.example.com"
  552. include: /etc/unbound/local.d/*.conf
  553. # tag a localzone with a list of tag names (in "" with spaces between)
  554. # local-zone-tag: "example.com" "tag2 tag3"
  555. # add a netblock specific override to a localzone, with zone type
  556. # local-zone-override: "example.com" 192.0.2.0/24 refuse
  557. # service clients over SSL (on the TCP sockets), with plain DNS inside
  558. # the SSL stream. Give the certificate to use and private key.
  559. # default is "" (disabled). requires restart to take effect.
  560. # tls-service-key: "/etc/unbound/unbound_server.key"
  561. # tls-service-pem: "/etc/unbound/unbound_server.pem"
  562. # tls-port: 853
  563. #
  564. # request upstream over SSL (with plain DNS inside the SSL stream).
  565. # Default is no. Can be turned on and off with unbound-control.
  566. # tls-upstream: no
  567. # Certificates used to authenticate connections made upstream.
  568. # tls-cert-bundle: ""
  569. # Add system certs to the cert bundle, from the Windows Cert Store
  570. # tls-win-cert: no
  571. # Also serve tls on these port numbers (eg. 443, ...), by listing
  572. # tls-additional-ports: portno for each of the port numbers.
  573. # DNS64 prefix. Must be specified when DNS64 is use.
  574. # Enable dns64 in module-config. Used to synthesize IPv6 from IPv4.
  575. # dns64-prefix: 64:ff9b::0/96
  576. # ratelimit for uncached, new queries, this limits recursion effort.
  577. # ratelimiting is experimental, and may help against randomqueryflood.
  578. # if 0(default) it is disabled, otherwise state qps allowed per zone.
  579. # ratelimit: 0
  580. # ratelimits are tracked in a cache, size in bytes of cache (or k,m).
  581. # ratelimit-size: 4m
  582. # ratelimit cache slabs, reduces lock contention if equal to cpucount.
  583. # ratelimit-slabs: 4
  584. # 0 blocks when ratelimited, otherwise let 1/xth traffic through
  585. # ratelimit-factor: 10
  586. # what is considered a low rtt (ping time for upstream server), in msec
  587. # low-rtt: 45
  588. # select low rtt this many times out of 1000. 0 means the fast server
  589. # select is disabled. prefetches are not sped up.
  590. # low-rtt-permil: 0
  591. # override the ratelimit for a specific domain name.
  592. # give this setting multiple times to have multiple overrides.
  593. # ratelimit-for-domain: example.com 1000
  594. # override the ratelimits for all domains below a domain name
  595. # can give this multiple times, the name closest to the zone is used.
  596. # ratelimit-below-domain: com 1000
  597. # global query ratelimit for all ip addresses.
  598. # feature is experimental.
  599. # if 0(default) it is disabled, otherwise states qps allowed per ip address
  600. # ip-ratelimit: 0
  601. # ip ratelimits are tracked in a cache, size in bytes of cache (or k,m).
  602. # ip-ratelimit-size: 4m
  603. # ip ratelimit cache slabs, reduces lock contention if equal to cpucount.
  604. # ip-ratelimit-slabs: 4
  605. # 0 blocks when ip is ratelimited, otherwise let 1/xth traffic through
  606. # ip-ratelimit-factor: 10
  607. # Specific options for ipsecmod. unbound needs to be configured with
  608. # --enable-ipsecmod for these to take effect.
  609. #
  610. # Enable or disable ipsecmod (it still needs to be defined in
  611. # module-config above). Can be used when ipsecmod needs to be
  612. # enabled/disabled via remote-control(below).
  613. # Fedora: module will be enabled on-demand by libreswan
  614. ipsecmod-enabled: no
  615. # Path to executable external hook. It must be defined when ipsecmod is
  616. # listed in module-config (above).
  617. # ipsecmod-hook: "./my_executable"
  618. ipsecmod-hook:/usr/libexec/ipsec/_unbound-hook
  619. # When enabled unbound will reply with SERVFAIL if the return value of
  620. # the ipsecmod-hook is not 0.
  621. # ipsecmod-strict: no
  622. #
  623. # Maximum time to live (TTL) for cached A/AAAA records with IPSECKEY.
  624. # ipsecmod-max-ttl: 3600
  625. #
  626. # Reply with A/AAAA even if the relevant IPSECKEY is bogus. Mainly used for
  627. # testing.
  628. # ipsecmod-ignore-bogus: no
  629. #
  630. # Domains for which ipsecmod will be triggered. If not defined (default)
  631. # all domains are treated as being whitelisted.
  632. # ipsecmod-whitelist: "libreswan.org"
  633. # ipsecmod-whitelist: "nlnetlabs.nl"
  634. # Python config section. To enable:
  635. # o use --with-pythonmodule to configure before compiling.
  636. # o list python in the module-config string (above) to enable.
  637. # o and give a python-script to run.
  638. python:
  639. # Script file to load
  640. # python-script: "/etc/unbound/ubmodule-tst.py"
  641. # Remote control config section.
  642. remote-control:
  643. # Enable remote control with unbound-control(8) here.
  644. # set up the keys and certificates with unbound-control-setup.
  645. # Note: required for unbound-munin package
  646. control-enable: yes
  647. # Set to no and use an absolute path as control-interface to use
  648. # a unix local named pipe for unbound-control.
  649. # control-use-cert: yes
  650. # what interfaces are listened to for remote control.
  651. # give 0.0.0.0 and ::0 to listen to all interfaces.
  652. control-interface: 127.0.0.1
  653. # control-interface: ::1
  654. # port number for remote control operations.
  655. # control-port: 8953
  656. # unbound server key file.
  657. server-key-file: "/etc/unbound/unbound_server.key"
  658. # unbound server certificate file.
  659. server-cert-file: "/etc/unbound/unbound_server.pem"
  660. # unbound-control key file.
  661. control-key-file: "/etc/unbound/unbound_control.key"
  662. # unbound-control certificate file.
  663. control-cert-file: "/etc/unbound/unbound_control.pem"
  664. # Stub and Forward zones
  665. include: /etc/unbound/conf.d/*.conf
  666. # Stub zones.
  667. # Create entries like below, to make all queries for 'example.com' and
  668. # 'example.org' go to the given list of nameservers. list zero or more
  669. # nameservers by hostname or by ipaddress. If you set stub-prime to yes,
  670. # the list is treated as priming hints (default is no).
  671. # With stub-first yes, it attempts without the stub if it fails.
  672. # Consider adding domain-insecure: name and local-zone: name nodefault
  673. # to the server: section if the stub is a locally served zone.
  674. # stub-zone:
  675. # name: "example.com"
  676. # stub-addr: 192.0.2.68
  677. # stub-prime: no
  678. # stub-first: no
  679. # stub-tls-upstream: no
  680. # stub-zone:
  681. # name: "example.org"
  682. # stub-host: ns.example.com.
  683. # You can now also dynamically create and delete stub-zone's using
  684. # unbound-control stub_add domain.com 1.2.3.4 5.6.7.8
  685. # unbound-control stub_remove domain.com 1.2.3.4 5.6.7.8
  686. # Forward zones
  687. # Create entries like below, to make all queries for 'example.com' and
  688. # 'example.org' go to the given list of servers. These servers have to handle
  689. # recursion to other nameservers. List zero or more nameservers by hostname
  690. # or by ipaddress. Use an entry with name "." to forward all queries.
  691. # If you enable forward-first, it attempts without the forward if it fails.
  692. # forward-zone:
  693. # name: "example.com"
  694. # forward-addr: 192.0.2.68
  695. # forward-addr: 192.0.2.73@5355 # forward to port 5355.
  696. # forward-first: no
  697. # forward-tls-upstream: no
  698. # forward-zone:
  699. # name: "example.org"
  700. # forward-host: fwd.example.com
  701. #
  702. # You can now also dynamically create and delete forward-zone's using
  703. # unbound-control forward_add domain.com 1.2.3.4 5.6.7.8
  704. # unbound-control forward_remove domain.com 1.2.3.4 5.6.7.8
  705. # Authority zones
  706. # The data for these zones is kept locally, from a file or downloaded.
  707. # The data can be served to downstream clients, or used instead of the
  708. # upstream (which saves a lookup to the upstream). The first example
  709. # has a copy of the root for local usage. The second serves example.org
  710. # authoritatively. zonefile: reads from file (and writes to it if you also
  711. # download it), master: fetches with AXFR and IXFR, or url to zonefile.
  712. auth-zone:
  713. name: "."
  714. for-downstream: no
  715. for-upstream: yes
  716. fallback-enabled: yes
  717. master: b.root-servers.net
  718. master: c.root-servers.net
  719. master: e.root-servers.net
  720. master: f.root-servers.net
  721. master: g.root-servers.net
  722. master: k.root-servers.net
  723. # auth-zone:
  724. # name: "example.org"
  725. # for-downstream: yes
  726. # for-upstream: yes
  727. # zonefile: "example.org.zone"
  728. # Views
  729. # Create named views. Name must be unique. Map views to requests using
  730. # the access-control-view option. Views can contain zero or more local-zone
  731. # and local-data options. Options from matching views will override global
  732. # options. Global options will be used if no matching view is found.
  733. # With view-first yes, it will try to answer using the global local-zone and
  734. # local-data elements if there is no view specific match.
  735. # view:
  736. # name: "viewname"
  737. # local-zone: "example.com" redirect
  738. # local-data: "example.com A 192.0.2.3"
  739. # local-data-ptr: "192.0.2.3 www.example.com"
  740. # view-first: no
  741. # view:
  742. # name: "anotherview"
  743. # local-zone: "example.com" refuse
  744. # Fedora: DNSCrypt support not enabled since it requires linking to
  745. # another crypto library
  746. #
  747. # DNSCrypt
  748. # Caveats:
  749. # 1. the keys/certs cannot be produced by unbound. You can use dnscrypt-wrapper
  750. # for this: https://github.com/cofyc/dnscrypt-wrapper/blob/master/README.md#usage
  751. # 2. dnscrypt channel attaches to an interface. you MUST set interfaces to
  752. # listen on `dnscrypt-port` with the follo0wing snippet:
  753. # server:
  754. # interface: 0.0.0.0@443
  755. # interface: ::0@443
  756. #
  757. # Finally, `dnscrypt` config has its own section.
  758. # dnscrypt:
  759. # dnscrypt-enable: yes
  760. # dnscrypt-port: 443
  761. # dnscrypt-provider: 2.dnscrypt-cert.example.com.
  762. # dnscrypt-secret-key: /path/unbound-conf/keys1/1.key
  763. # dnscrypt-secret-key: /path/unbound-conf/keys2/1.key
  764. # dnscrypt-provider-cert: /path/unbound-conf/keys1/1.cert
  765. # dnscrypt-provider-cert: /path/unbound-conf/keys2/1.cert
  766. # CacheDB
  767. # Enable external backend DB as auxiliary cache. Specify the backend name
  768. # (default is "testframe", which has no use other than for debugging and
  769. # testing) and backend-specific options. The 'cachedb' module must be
  770. # included in module-config.
  771. # cachedb:
  772. # backend: "testframe"
  773. # # secret seed string to calculate hashed keys
  774. # secret-seed: "default"
  775. # # For "redis" backend:
  776. # # redis server's IP address or host name
  777. # redis-server-host: 127.0.0.1
  778. # # redis server's TCP port
  779. # redis-server-port: 6379
  780. # # timeout (in ms) for communication with the redis server
  781. # redis-timeout: 100
  782. # Adding DNS-Over-TLS Support
  783. #tls-cert-bundle: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
  784. forward-zone:
  785. name: "."
  786. {% if dns_over_https == true %}
  787. forward-ssl-upstream: yes
  788. forward-addr: {{ dns_primary }}@853
  789. forward-addr: {{ dns_secondary }}@853
  790. {% else %}
  791. forward-addr: {{ dns_primary}}@53
  792. forward-addr: {{ dns_secondary }}@53
  793. {% endif %}