]> git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/dnsdistdist/docs/reference/config.rst
dnsdist: Add 'ciphersTLS13' for DoT
[thirdparty/pdns.git] / pdns / dnsdistdist / docs / reference / config.rst
1 .. highlight:: lua
2
3 Configuration Reference
4 =======================
5
6 This page lists all configuration options for dnsdist.
7
8 .. note::
9
10 When an IPv6 IP:PORT combination is needed, the bracketed syntax from :rfc:`RFC 3986 <3986#section-3.2.2>` should be used.
11 e.g. "[2001:DB8:14::C0FF:FEE]:5300".
12
13 Functions and Types
14 -------------------
15
16 Within dnsdist several core object types exist:
17
18 * :class:`Server`: generated with :func:`newServer`, represents a downstream server
19 * :class:`ComboAddress`: represents an IP address and port
20 * :class:`DNSName`: represents a domain name
21 * :class:`NetmaskGroup`: represents a group of netmasks
22 * :class:`QPSLimiter`: implements a QPS-based filter
23 * :class:`SuffixMatchNode`: represents a group of domain suffixes for rapid testing of membership
24 * :class:`DNSHeader`: represents the header of a DNS packet, see :ref:`DNSHeader`
25 * :class:`ClientState`: sometimes also called Bind or Frontend, represents the addresses and ports dnsdist is listening on
26
27 The existence of most of these objects can mostly be ignored, unless you plan to write your own hooks and policies, but it helps to understand an expressions like:
28
29 .. code-block:: lua
30
31 getServer(0).order=12 -- set order of server 0 to 12
32 getServer(0):addPool("abuse") -- add this server to the abuse pool
33
34 The ``.`` means ``order`` is a data member, while the ``:`` means ``addPool`` is a member function.
35
36 Global configuration
37 --------------------
38
39 .. function:: includeDirectory(path)
40
41 Include configuration files from ``path``.
42
43 :param str path: The directory to load configuration files from. Each file must end in ``.conf``.
44
45 .. function:: reloadAllCertificates()
46
47 .. versionadded:: 1.4.0
48
49 Reload all DNSCrypt and TLS certificates, along with their associated keys.
50
51 .. function:: setSyslogFacility(facility)
52
53 .. versionadded:: 1.4.0
54
55 Set the syslog logging facility to ``facility``.
56
57 :param int facility: The new facility as a numeric value. Defaults to LOG_DAEMON.
58
59 Listen Sockets
60 ~~~~~~~~~~~~~~
61
62 .. function:: addLocal(address[, options])
63
64 .. versionadded:: 1.2.0
65
66 .. versionchanged:: 1.3.0
67 Added ``cpus`` to the options.
68
69 Add to the list of listen addresses.
70
71 :param str address: The IP Address with an optional port to listen on.
72 The default port is 53.
73 :param table options: A table with key: value pairs with listen options.
74
75 Options:
76
77 * ``doTCP=true``: bool - Also bind on TCP on ``address``.
78 * ``reusePort=false``: bool - Set the ``SO_REUSEPORT`` socket option.
79 * ``tcpFastOpenSize=0``: int - Set the TCP Fast Open queue size, enabling TCP Fast Open when available and the value is larger than 0.
80 * ``interface=""``: str - Set the network interface to use.
81 * ``cpus={}``: table - Set the CPU affinity for this listener thread, asking the scheduler to run it on a single CPU id, or a set of CPU ids. This parameter is only available if the OS provides the pthread_setaffinity_np() function.
82
83 .. code-block:: lua
84
85 addLocal('0.0.0.0:5300', { doTCP=true, reusePort=true })
86
87 This will bind to both UDP and TCP on port 5300 with SO_REUSEPORT enabled.
88
89 .. function:: addLocal(address[[[,do_tcp], so_reuseport], tcp_fast_open_qsize])
90
91 .. deprecated:: 1.2.0
92
93 Add to the list of addresses listened on.
94
95 :param str address: The IP Address with an optional port to listen on.
96 The default port is 53.
97 :param bool do_tcp: Also bind a TCP port on ``address``, defaults to true.
98 :param bool so_reuseport: Use ``SO_REUSEPORT`` if it is available, defaults to false
99 :param int tcp_fast_open_qsize: The size of the TCP Fast Open queue. Set to a number
100 higher than 0 to enable TCP Fast Open when available.
101 Default is 0.
102
103 .. function:: addDOHLocal(address, certFile(s), keyFile(s) [, url [, options]])
104
105 .. versionadded:: 1.4.0
106
107 Listen on the specified address and TCP port for incoming DNS over HTTPS connections, presenting the specified X.509 certificate.
108
109 :param str address: The IP Address with an optional port to listen on.
110 The default port is 443.
111 :param str certFile(s): The path to a X.509 certificate file in PEM format, or a list of paths to such files.
112 :param str keyFile(s): The path to the private key file corresponding to the certificate, or a list of paths to such files, whose order should match the certFile(s) ones.
113 :param list url: A list of URLs to accept queries on. The default is /.
114 :param table options: A table with key: value pairs with listen options.
115
116 Options:
117
118 * ``reusePort=false``: bool - Set the ``SO_REUSEPORT`` socket option.
119 * ``tcpFastOpenSize=0``: int - Set the TCP Fast Open queue size, enabling TCP Fast Open when available and the value is larger than 0.
120 * ``interface=""``: str - Set the network interface to use.
121 * ``cpus={}``: table - Set the CPU affinity for this listener thread, asking the scheduler to run it on a single CPU id, or a set of CPU ids. This parameter is only available if the OS provides the pthread_setaffinity_np() function.
122 * ``idleTimeout=30``: int - Set the idle timeout, in seconds.
123 * ``ciphers``: str - The TLS ciphers to use, in OpenSSL format. Ciphers for TLS 1.3 must be specified via ``ciphersTLS13``.
124 * ``ciphersTLS13``: str - The TLS ciphers to use for TLS 1.3, in OpenSSL format.
125
126 .. function:: addTLSLocal(address, certFile(s), keyFile(s) [, options])
127
128 .. versionadded:: 1.3.0
129 .. versionchanged:: 1.3.1
130 ``certFile(s)`` and ``keyFile(s)`` parameters accept a list of files.
131 ``sessionTickets`` option added.
132 .. versionchanged:: 1.3.3
133 ``numberOfStoredSessions`` option added.
134 .. versionchanged:: 1.4.0
135 ``ciphersTLS13`` option added.
136
137 Listen on the specified address and TCP port for incoming DNS over TLS connections, presenting the specified X.509 certificate.
138
139 :param str address: The IP Address with an optional port to listen on.
140 The default port is 853.
141 :param str certFile(s): The path to a X.509 certificate file in PEM format, or a list of paths to such files.
142 :param str keyFile(s): The path to the private key file corresponding to the certificate, or a list of paths to such files, whose order should match the certFile(s) ones.
143 :param table options: A table with key: value pairs with listen options.
144
145 Options:
146
147 * ``reusePort=false``: bool - Set the ``SO_REUSEPORT`` socket option.
148 * ``tcpFastOpenSize=0``: int - Set the TCP Fast Open queue size, enabling TCP Fast Open when available and the value is larger than 0.
149 * ``interface=""``: str - Set the network interface to use.
150 * ``cpus={}``: table - Set the CPU affinity for this listener thread, asking the scheduler to run it on a single CPU id, or a set of CPU ids. This parameter is only available if the OS provides the pthread_setaffinity_np() function.
151 * ``provider``: str - The TLS library to use between GnuTLS and OpenSSL, if they were available and enabled at compilation time.
152 * ``ciphers``: str - The TLS ciphers to use. The exact format depends on the provider used. When the OpenSSL provder is used, ciphers for TLS 1.3 must be specified via ``ciphersTLS13``.
153 * ``ciphersTLS13``: str - The ciphers to use for TLS 1.3, when the OpenSSL provider is used. When the GnuTLS provider is used, ``ciphers`` applies regardless of the TLS protocol and this setting is not used.
154 * ``numberOfTicketsKeys``: int - The maximum number of tickets keys to keep in memory at the same time, if the provider supports it (GnuTLS doesn't, OpenSSL does). Only one key is marked as active and used to encrypt new tickets while the remaining ones can still be used to decrypt existing tickets after a rotation. Default to 5.
155 * ``ticketKeyFile``: str - The path to a file from where TLS tickets keys should be loaded, to support RFC 5077. These keys should be rotated often and never written to persistent storage to preserve forward secrecy. The default is to generate a random key. The OpenSSL provider supports several tickets keys to be able to decrypt existing sessions after the rotation, while the GnuTLS provider only supports one key.
156 * ``ticketsKeysRotationDelay``: int - Set the delay before the TLS tickets key is rotated, in seconds. Default is 43200 (12h).
157 * ``sessionTickets``: bool - Whether session resumption via session tickets is enabled. Default is true, meaning tickets are enabled.
158 * ``numberOfStoredSessions``: int - The maximum number of sessions kept in memory at the same time. At this time this is only supported by the OpenSSL provider, as stored sessions are not supported with the GnuTLS one. Default is 20480. Setting this value to 0 disables stored session entirely.
159
160 .. function:: setLocal(address[, options])
161
162 .. versionadded:: 1.2.0
163
164 Remove the list of listen addresses and add a new one.
165
166 :param str address: The IP Address with an optional port to listen on.
167 The default port is 53.
168 :param table options: A table with key: value pairs with listen options.
169
170 The options that can be set are the same as :func:`addLocal`.
171
172 .. function:: setLocal(address[[[,do_tcp], so_reuseport], tcp_fast_open_qsize])
173
174 .. deprecated:: 1.2.0
175
176 Remove the list of listen addresses and add a new one.
177
178 :param str address: The IP Address with an optional port to listen on.
179 The default port is 53.
180 :param bool do_tcp: Also bind a TCP port on ``address``, defaults to true.
181 :param bool so_reuseport: Use ``SO_REUSEPORT`` if it is available, defaults to false
182 :param int tcp_fast_open_qsize: The size of the TCP Fast Open queue. Set to a number
183 higher than 0 to enable TCP Fast Open when available.
184 Default is 0.
185
186 Control Socket, Console and Webserver
187 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188
189 .. function:: addConsoleACL(netmask)
190
191 .. versionadded:: 1.3.0
192
193 Add a netmask to the existing console ACL, allowing remote clients to connect to the console. Please make sure that encryption
194 has been enabled with :func:`setKey` before doing so. The default is to only allow 127.0.0.1/8 and ::1/128.
195
196 :param str netmask: A CIDR netmask, e.g. ``"192.0.2.0/24"``. Without a subnetmask, only the specific address is allowed.
197
198 .. function:: controlSocket(address)
199
200 Bind to ``addr`` and listen for a connection for the console. Since 1.3.0 only connections from local users are allowed
201 by default, :func:`addConsoleACL` and :func:`setConsoleACL` can be used to enable remote connections. Please make sure
202 that encryption has been enabled with :func:`setKey` before doing so. Enabling encryption is also strongly advised for
203 local connections, since not enabling it allows any local user to connect to the console.
204
205 :param str address: An IP address with optional port. By default, the port is 5199.
206
207 .. function:: inClientStartup()
208
209 Returns true while the console client is parsing the configuration.
210
211 .. function:: makeKey()
212
213 Generate and print an encryption key.
214
215 .. function:: setConsoleConnectionsLogging(enabled)
216
217 .. versionadded:: 1.2.0
218
219 Whether to log the opening and closing of console connections.
220
221 :param bool enabled: Default to true.
222
223 .. function:: setKey(key)
224
225 Use ``key`` as shared secret between the client and the server
226
227 :param str key: An encoded key, as generated by :func:`makeKey`
228
229 .. function:: setConsoleACL(netmasks)
230
231 .. versionadded:: 1.3.0
232
233 Remove the existing console ACL and add the netmasks from the table, allowing remote clients to connect to the console. Please make sure that encryption
234 has been enabled with :func:`setKey` before doing so.
235
236 :param {str} netmasks: A table of CIDR netmask, e.g. ``{"192.0.2.0/24", "2001:DB8:14::/56"}``. Without a subnetmask, only the specific address is allowed.
237
238 .. function:: showConsoleACL()
239
240 Print a list of all netmasks allowed to connect to the console.
241
242 .. function:: testCrypto()
243
244 Test the crypto code, will report errors when something is not ok.
245
246 .. function:: setConsoleOutputMaxMsgSize(size)
247
248 .. versionadded:: 1.3.3
249
250 Set the maximum size in bytes of a single console message, default set to 10 MB.
251
252 :param int size: The new maximum size.
253
254 Webserver configuration
255 ~~~~~~~~~~~~~~~~~~~~~~~
256
257 .. function:: webserver(listen_address, password[, apikey[, custom_headers]])
258
259 Launch the :doc:`../guides/webserver` with statistics and the API.
260
261 :param str listen_address: The IP address and Port to listen on
262 :param str password: The password required to access the webserver
263 :param str apikey: The key required to access the API
264 :param {[str]=str,...} custom_headers: Allows setting custom headers and removing the defaults
265
266 .. function:: setAPIWritable(allow [,dir])
267
268 Allow modifications via the API.
269 Optionally saving these changes to disk.
270 Modifications done via the API will not be written to the configuration by default and will not persist after a reload
271
272 :param bool allow: Set to true to allow modification through the API
273 :param str dir: A valid directory where the configuration files will be written by the API.
274
275 .. function:: setWebserverConfig(options)
276
277 .. versionadded:: 1.3.3
278
279 Setup webserver configuration. See :func:`webserver`.
280
281 :param table options: A table with key: value pairs with webserver options.
282
283 Options:
284
285 * ``password=newPassword``: string - Changes the API password
286 * ``apikey=newKey``: string - Changes the API Key (set to an empty string do disable it)
287 * ``custom_headers={[str]=str,...}``: map of string - Allows setting custom headers and removing the defaults.
288
289 Access Control Lists
290 ~~~~~~~~~~~~~~~~~~~~
291
292 .. function:: addACL(netmask)
293
294 Add a netmask to the existing ACL controlling which clients can send UDP and TCP queries. See :ref:`ACL` for more information.
295
296 :param str netmask: A CIDR netmask, e.g. ``"192.0.2.0/24"``. Without a subnetmask, only the specific address is allowed.
297
298 .. function:: setACL(netmasks)
299
300 Remove the existing ACL and add the netmasks from the table of those allowed to send UDP and TCP queries. See :ref:`ACL` for more information.
301
302 :param {str} netmasks: A table of CIDR netmask, e.g. ``{"192.0.2.0/24", "2001:DB8:14::/56"}``. Without a subnetmask, only the specific address is allowed.
303
304 .. function:: showACL()
305
306 Print a list of all netmasks allowed to send queries over UDP and TCP. See :ref:`ACL` for more information.
307
308 EDNS Client Subnet
309 ~~~~~~~~~~~~~~~~~~
310
311 .. function:: setECSSourcePrefixV4(prefix)
312
313 When ``useClientSubnet`` in :func:`newServer` is set and dnsdist adds an EDNS Client Subnet Client option to the query, truncate the requestors IPv4 address to ``prefix`` bits
314
315 :param int prefix: The prefix length
316
317 .. function:: setECSSourcePrefixV6(prefix)
318
319 When ``useClientSubnet`` in :func:`newServer` is set and dnsdist adds an EDNS Client Subnet Client option to the query, truncate the requestor's IPv6 address to bits
320
321 :param int prefix: The prefix length
322
323 Ringbuffers
324 ~~~~~~~~~~~
325
326 .. function:: setRingBuffersLockRetries(num)
327
328 .. versionadded:: 1.3.0
329
330 Set the number of shards to attempt to lock without blocking before giving up and simply blocking while waiting for the next shard to be available
331
332 :param int num: The maximum number of attempts. Defaults to 5 if there is more than one shard, 0 otherwise.
333
334 .. function:: setRingBuffersSize(num [, numberOfShards])
335
336 .. versionchanged:: 1.3.0
337 ``numberOfShards`` optional parameter added.
338
339 Set the capacity of the ringbuffers used for live traffic inspection to ``num``, and the number of shards to ``numberOfShards`` if specified.
340
341 :param int num: The maximum amount of queries to keep in the ringbuffer. Defaults to 10000
342 :param int numberOfShards: the number of shards to use to limit lock contention. Defaults to 1
343
344 Servers
345 -------
346
347 .. function:: newServer(server_string)
348 newServer(server_table)
349
350 .. versionchanged:: 1.3.0
351 Added ``checkClass``, ``sockets`` and ``checkFunction`` to server_table.
352
353 .. versionchanged:: 1.4.0
354 Added ``checkTimeout`` and ``rise`` to server_table.
355
356 Add a new backend server. Call this function with either a string::
357
358 newServer(
359 "IP:PORT" -- IP and PORT of the backend server
360 )
361
362 or a table::
363
364 newServer({
365 address="IP:PORT", -- IP and PORT of the backend server (mandatory)
366 id=STRING, -- Use a pre-defined UUID instead of a random one
367 qps=NUM, -- Limit the number of queries per second to NUM, when using the `firstAvailable` policy
368 order=NUM, -- The order of this server, used by the `leastOustanding` and `firstAvailable` policies
369 weight=NUM, -- The weight of this server, used by the `wrandom`, `whashed` and `chashed` policies, default: 1
370 -- Supported values are a minimum of 1, and a maximum of 2147483647.
371 pool=STRING|{STRING}, -- The pools this server belongs to (unset or empty string means default pool) as a string or table of strings
372 retries=NUM, -- The number of TCP connection attempts to the backend, for a given query
373 tcpConnectTimeout=NUM, -- The timeout (in seconds) of a TCP connection attempt
374 tcpSendTimeout=NUM, -- The timeout (in seconds) of a TCP write attempt
375 tcpRecvTimeout=NUM, -- The timeout (in seconds) of a TCP read attempt
376 tcpFastOpen=BOOL, -- Whether to enable TCP Fast Open
377 ipBindAddrNoPort=BOOL, -- Whether to enable IP_BIND_ADDRESS_NO_PORT if available, default: true
378 name=STRING, -- The name associated to this backend, for display purpose
379 checkClass=NUM, -- Use NUM as QCLASS in the health-check query, default: DNSClass.IN
380 checkName=STRING, -- Use STRING as QNAME in the health-check query, default: "a.root-servers.net."
381 checkType=STRING, -- Use STRING as QTYPE in the health-check query, default: "A"
382 checkFunction=FUNCTION,-- Use this function to dynamically set the QNAME, QTYPE and QCLASS to use in the health-check query (see :ref:`Healthcheck`)
383 checkTimeout=NUM, -- The timeout (in milliseconds) of a health-check query, default: 1000 (1s)
384 setCD=BOOL, -- Set the CD (Checking Disabled) flag in the health-check query, default: false
385 maxCheckFailures=NUM, -- Allow NUM check failures before declaring the backend down, default: 1
386 checkInterval=NUM -- The time in seconds between health checks
387 mustResolve=BOOL, -- Set to true when the health check MUST return a NOERROR RCODE and an answer
388 useClientSubnet=BOOL, -- Add the client's IP address in the EDNS Client Subnet option when forwarding the query to this backend
389 source=STRING, -- The source address or interface to use for queries to this backend, by default this is left to the kernel's address selection
390 -- The following formats are supported:
391 -- "address", e.g. "192.0.2.2"
392 -- "interface name", e.g. "eth0"
393 -- "address@interface", e.g. "192.0.2.2@eth0"
394 addXPF=NUM, -- Add the client's IP address and port to the query, along with the original destination address and port,
395 -- using the experimental XPF record from `draft-bellis-dnsop-xpf <https://datatracker.ietf.org/doc/draft-bellis-dnsop-xpf/>`_ and the specified option code. Default is disabled (0)
396 sockets=NUM, -- Number of sockets (and thus source ports) used toward the backend server, defaults to a single one
397 disableZeroScope=BOOL, -- Disable the EDNS Client Subnet 'zero scope' feature, which does a cache lookup for an answer valid for all subnets (ECS scope of 0) before adding ECS information to the query and doing the regular lookup
398 rise=NUM -- Require NUM consecutive successful checks before declaring the backend up, default: 1
399 })
400
401 :param str server_string: A simple IP:PORT string.
402 :param table server_table: A table with at least a 'name' key
403
404 .. function:: getServer(index) -> Server
405
406 Get a :class:`Server`
407
408 :param int index: The number of the server (as seen in :func:`showServers`).
409 :returns: The :class:`Server` object or nil
410
411 .. function:: getServers()
412
413 Returns a table with all defined servers.
414
415 .. function:: rmServer(index)
416 rmServer(server)
417
418 Remove a backend server.
419
420 :param int index: The number of the server (as seen in :func:`showServers`).
421 :param Server server: A :class:`Server` object as returned by e.g. :func:`getServer`.
422
423 Server Functions
424 ~~~~~~~~~~~~~~~~
425 A server object returned by :func:`getServer` can be manipulated with these functions.
426
427 .. class:: Server
428
429 This object represents a backend server. It has several methods.
430
431 .. method:: Server:addPool(pool)
432
433 Add this server to a pool.
434
435 :param str pool: The pool to add the server to
436
437 .. method:: Server:getName() -> string
438
439 Get the name of this server.
440
441 :returns: The name of the server, or an empty string if it does not have one
442
443 .. method:: Server:getNameWithAddr() -> string
444
445 Get the name plus IP address and port of the server
446
447 :returns: A string containing the server name if any plus the server address and port
448
449 .. method:: Server:getOutstanding() -> int
450
451 Get the number of outstanding queries for this server.
452
453 :returns: The number of outstanding queries
454
455 .. method:: Server:isUp() -> bool
456
457 Returns the up status of the server
458
459 :returns: true when the server is up, false otherwise
460
461 .. method:: Server:rmPool(pool)
462
463 Removes the server from the named pool
464
465 :param str pool: The pool to remove the server from
466
467 .. method:: Server:setAuto([status])
468
469 .. versionchanged:: 1.3.0
470 ``status`` optional parameter added.
471
472 Set the server in the default auto state.
473 This will enable health check queries that will set the server ``up`` and ``down`` appropriately.
474
475 :param bool status: Set the initial status of the server to ``up`` (true) or ``down`` (false) instead of using the last known status
476
477 .. method:: Server:setQPS(limit)
478
479 Limit the queries per second for this server.
480
481 :param int limit: The maximum number of queries per second
482
483 .. method:: Server:setDown()
484
485 Set the server in an ``DOWN`` state.
486 The server will not receive queries and the health checks are disabled
487
488 .. method:: Server:setUp()
489
490 Set the server in an ``UP`` state.
491 This server will still receive queries and health checks are disabled
492
493 Apart from the functions, a :class:`Server` object has these attributes:
494
495 .. attribute:: Server.name
496
497 The name of the server
498
499 .. attribute:: Server.upStatus
500
501 Whether or not this server is up or down
502
503 .. attribute:: Server.order
504
505 The order of the server
506
507 .. attribute:: Server.weight
508
509 The weight of the server
510
511 Pools
512 -----
513
514 :class:`Server`\ s can be part of any number of pools.
515 Pools are automatically created when a server is added to a pool (with :func:`newServer`), or can be manually created with :func:`addPool`.
516
517 .. function:: addPool(name) -> ServerPool
518
519 Returns a :class:`ServerPool`.
520
521 :param string name: The name of the pool to create
522
523 .. function:: getPool(name) -> ServerPool
524
525 Returns a :class:`ServerPool` or nil.
526
527 :param string name: The name of the pool
528
529 .. function:: getPoolServers(name) -> [ Server ]
530
531 Returns a list of :class:`Server`\ s or nil.
532
533 :param string name: The name of the pool
534
535 .. function:: showPools()
536
537 Display the name, associated cache, server policy and associated servers for every pool.
538
539 .. class:: ServerPool
540
541 This represents the pool where zero or more servers are part of.
542
543 .. method:: ServerPool:getCache() -> PacketCache
544
545 Returns the :class:`PacketCache` for this pool or nil.
546
547 .. method:: ServerPool:getECS()
548
549 .. versionadded:: 1.3.0
550
551 Whether dnsdist will add EDNS Client Subnet information to the query before looking up into the cache,
552 when all servers from this pool are down. For more information see :meth:`ServerPool:setECS`.
553
554 .. method:: ServerPool:setCache(cache)
555
556 Adds ``cache`` as the pool's cache.
557
558 :param PacketCache cache: The new cache to add to the pool
559
560 .. method:: ServerPool:unsetCache()
561
562 Removes the cache from this pool.
563
564 .. method:: ServerPool:setECS()
565
566 .. versionadded:: 1.3.0
567
568 Set to true if dnsdist should add EDNS Client Subnet information to the query before looking up into the cache,
569 when all servers from this pool are down. If at least one server is up, the preference of the
570 selected server is used, this parameter is only useful if all the backends in this pool are down
571 and have EDNS Client Subnet enabled, since the queries in the cache will have been inserted with
572 ECS information. Default is false.
573
574 PacketCache
575 ~~~~~~~~~~~
576
577 A Pool can have a packet cache to answer queries directly in stead of going to the backend.
578 See :doc:`../guides/cache` for a how to.
579
580 .. function:: newPacketCache(maxEntries[, maxTTL=86400[, minTTL=0[, temporaryFailureTTL=60[, staleTTL=60[, dontAge=false[, numberOfShards=1[, deferrableInsertLock=true[, maxNegativeTTL=3600[, parseECS=false]]]]]]]) -> PacketCache
581
582 .. versionchanged:: 1.3.0
583 ``numberOfShards`` and ``deferrableInsertLock`` parameters added.
584
585 .. versionchanged:: 1.3.1
586 ``maxNegativeTTL`` and ``parseECS`` parameters added.
587
588 .. deprecated:: 1.4.0
589
590 Creates a new :class:`PacketCache` with the settings specified.
591
592 :param int maxEntries: The maximum number of entries in this cache
593 :param int maxTTL: Cap the TTL for records to his number
594 :param int minTTL: Don't cache entries with a TTL lower than this
595 :param int temporaryFailureTTL: On a SERVFAIL or REFUSED from the backend, cache for this amount of seconds
596 :param int staleTTL: When the backend servers are not reachable, and global configuration ``setStaleCacheEntriesTTL`` is set appropriately, TTL that will be used when a stale cache entry is returned
597 :param bool dontAge: Don't reduce TTLs when serving from the cache. Use this when :program:`dnsdist` fronts a cluster of authoritative servers
598 :param int numberOfShards: Number of shards to divide the cache into, to reduce lock contention
599 :param bool deferrableInsertLock: Whether the cache should give up insertion if the lock is held by another thread, or simply wait to get the lock
600 :param int maxNegativeTTL: Cache a NXDomain or NoData answer from the backend for at most this amount of seconds, even if the TTL of the SOA record is higher
601 :param bool parseECS: Whether any EDNS Client Subnet option present in the query should be extracted and stored to be able to detect hash collisions involving queries with the same qname, qtype and qclass but a different incoming ECS value. Enabling this option adds a parsing cost and only makes sense if at least one backend might send different responses based on the ECS value, so it's disabled by default
602
603 .. function:: newPacketCache(maxEntries, [options]) -> PacketCache
604
605 .. versionadded:: 1.4.0
606
607 Creates a new :class:`PacketCache` with the settings specified.
608
609 :param int maxEntries: The maximum number of entries in this cache
610
611 Options:
612
613 * ``deferrableInsertLock=true``: bool - Whether the cache should give up insertion if the lock is held by another thread, or simply wait to get the lock.
614 * ``dontAge=false``: bool - Don't reduce TTLs when serving from the cache. Use this when :program:`dnsdist` fronts a cluster of authoritative servers.
615 * ``keepStaleData=false``: bool - Whether to suspend the removal of expired entries from the cache when there is no backend available in at least one of the pools using this cache.
616 * ``maxEntries``: int - The maximum number of entries in this cache.
617 * ``maxNegativeTTL=3600``: int - Cache a NXDomain or NoData answer from the backend for at most this amount of seconds, even if the TTL of the SOA record is higher.
618 * ``maxTTL=86400``: int - Cap the TTL for records to his number.
619 * ``minTTL=0``: int - Don't cache entries with a TTL lower than this.
620 * ``numberOfShards=1``: int - Number of shards to divide the cache into, to reduce lock contention.
621 * ``parseECS=false``: bool - Whether any EDNS Client Subnet option present in the query should be extracted and stored to be able to detect hash collisions involving queries with the same qname, qtype and qclass but a different incoming ECS value. Enabling this option adds a parsing cost and only makes sense if at least one backend might send different responses based on the ECS value, so it's disabled by default.
622 * ``staleTTL=60``: int - When the backend servers are not reachable, and global configuration ``setStaleCacheEntriesTTL`` is set appropriately, TTL that will be used when a stale cache entry is returned.
623 * ``temporaryFailureTTL=60``: int - On a SERVFAIL or REFUSED from the backend, cache for this amount of seconds..
624
625 .. class:: PacketCache
626
627 Represents a cache that can be part of :class:`ServerPool`.
628
629 .. method:: PacketCache:dump(fname)
630
631 .. versionadded:: 1.3.1
632
633 Dump a summary of the cache entries to a file.
634
635 :param str fname: The path to a file where the cache summary should be dumped. Note that if the target file already exists, it will not be overwritten.
636
637 .. method:: PacketCache:expunge(n)
638
639 Remove entries from the cache, leaving at most ``n`` entries
640
641 :param int n: Number of entries to keep
642
643 .. method:: PacketCache:expungeByName(name [, qtype=DNSQType.ANY[, suffixMatch=false]])
644
645 .. versionchanged:: 1.2.0
646 ``suffixMatch`` parameter added.
647
648 Remove entries matching ``name`` and type from the cache.
649
650 :param DNSName name: The name to expunge
651 :param int qtype: The type to expunge, can be a pre-defined :ref:`DNSQType`
652 :param bool suffixMatch: When set to true, remove al entries under ``name``
653
654 .. method:: PacketCache:getStats()
655
656 .. versionadded:: 1.4.0
657
658 Return the cache stats (number of entries, hits, misses, deferred lookups, deferred inserts, lookup collisions, insert collisions and TTL too shorts) as a Lua table.
659
660 .. method:: PacketCache:isFull() -> bool
661
662 Return true if the cache has reached the maximum number of entries.
663
664 .. method:: PacketCache:printStats()
665
666 Print the cache stats (number of entries, hits, misses, deferred lookups, deferred inserts, lookup collisions, insert collisions and TTL too shorts).
667
668 .. method:: PacketCache:purgeExpired(n)
669
670 Remove expired entries from the cache until there is at most ``n`` entries remaining in the cache.
671
672 :param int n: Number of entries to keep
673
674 .. method:: PacketCache:toString() -> string
675
676 Return the number of entries in the Packet Cache, and the maximum number of entries
677
678 Client State
679 ------------
680
681 Also called frontend or bind, the Client State object returned by :func:`getBind` and listed with :func:`showBinds` represents an address and port dnsdist is listening on.
682
683 .. function:: getBind(index) -> ClientState
684
685 Return a :class:`ClientState` object.
686
687 :param int index: The object index
688
689 ClientState functions
690 ~~~~~~~~~~~~~~~~~~~~~
691
692 .. class:: ClientState
693
694 This object represents an address and port dnsdist is listening on. When ``reuseport`` is in use, several ClientState objects can be present for the same address and port.
695
696 .. method:: ClientState:attachFilter(filter)
697
698 Attach a BPF filter to this frontend.
699
700 :param BPFFilter filter: The filter to attach to this frontend
701
702 .. method:: ClientState:detachFilter()
703
704 Remove the BPF filter associated to this frontend, if any.
705
706 .. method:: ClientState:toString() -> string
707
708 Return the address and port this frontend is listening on.
709
710 :returns: The address and port this frontend is listening on
711
712 .. attribute:: ClientState.muted
713
714 If set to true, queries received on this frontend will be normally processed and sent to a backend if needed, but no response will be ever be sent to the client over UDP. TCP queries are processed normally and responses sent to the client.
715
716 Status, Statistics and More
717 ---------------------------
718
719 .. function:: dumpStats()
720
721 Print all statistics dnsdist gathers
722
723 .. function:: getDOHFrontend(idx)
724
725 .. versionadded:: 1.4.0
726
727 Return the DOHFrontend object for the DNS over HTTPS bind of index ``idx``.
728
729 .. function:: getTLSContext(idx)
730
731 .. versionadded:: 1.3.0
732
733 Return the TLSContext object for the context of index ``idx``.
734
735 .. function:: getTLSFrontend(idx)
736
737 .. versionadded:: 1.3.1
738
739 Return the TLSFrontend object for the TLS bind of index ``idx``.
740
741 .. function:: grepq(selector[, num])
742 grepq(selectors[, num])
743
744 Prints the last ``num`` queries matching ``selector`` or ``selectors``.
745
746 The selector can be:
747
748 * a netmask (e.g. '192.0.2.0/24')
749 * a DNS name (e.g. 'dnsdist.org')
750 * a response time (e.g. '100ms')
751
752 :param str selector: Select queries based on this property.
753 :param {str} selectors: A lua table of selectors. Only queries matching all selectors are shown
754 :param int num: Show a maximum of ``num`` recent queries, default is 10.
755
756 .. function:: setVerboseHealthChecks(verbose)
757
758 Set whether health check errors should be logged. This is turned off by default.
759
760 :param bool verbose: Set to true if you want to enable health check errors logging
761
762 .. function:: showBinds()
763
764 Print a list of all the current addresses and ports dnsdist is listening on, also called ``frontends``
765
766 .. function:: showDOHFrontends()
767
768 .. versionadded:: 1.4.0
769
770 Print the list of all availables DNS over HTTPS frontends.
771
772 .. function:: showResponseLatency()
773
774 Show a plot of the response time latency distribution
775
776 .. function:: showServers([options])
777
778 .. versionchanged:: 1.4.0
779 ``options`` optional parameter added
780
781 This function shows all backend servers currently configured and some statistics.
782 These statics have the following fields:
783
784 * ``#`` - The number of the server, can be used as the argument for :func:`getServer`
785 * ``UUID`` - The UUID of the backend. Can be set with the ``id`` option of :func:`newServer`
786 * ``Address`` - The IP address and port of the server
787 * ``State`` - The current state of the server
788 * ``Qps`` - Current number of queries per second
789 * ``Qlim`` - Configured maximum number of queries per second
790 * ``Ord`` - The order number of the server
791 * ``Wt`` - The weight of the server
792 * ``Queries`` - Total amount of queries sent to this server
793 * ``Drops`` - Number of queries that were dropped by this server
794 * ``Drate`` - Number of queries dropped per second by this server
795 * ``Lat`` - The latency of this server in milliseconds
796 * ``Pools`` - The pools this server belongs to
797
798 :param table options: A table with key: value pairs with display options.
799
800 Options:
801
802 * ``showUUIDs=false``: bool - Whether to display the UUIDs, defaults to false.
803
804 .. function:: showTCPStats()
805
806 Show some statistics regarding TCP
807
808 .. function:: showTLSContexts()
809
810 .. versionadded:: 1.3.0
811
812 Print the list of all availables DNS over TLS contexts.
813
814 .. function:: showVersion()
815
816 Print the version of dnsdist
817
818 .. function:: topBandwidth([num])
819
820 Print the top ``num`` clients that consume the most bandwidth.
821
822 :param int num: Number to show, defaults to 10.
823
824 .. function:: topClients([num])
825
826 Print the top ``num`` clients sending the most queries over length of ringbuffer
827
828 :param int num: Number to show, defaults to 10.
829
830 .. function:: topQueries([num[, labels]])
831
832 Print the ``num`` most popular QNAMEs from queries.
833 Optionally grouped by the rightmost ``labels`` DNS labels.
834
835 :param int num: Number to show, defaults to 10
836 :param int label: Number of labels to cut down to
837
838 .. function:: topResponses([num[, rcode[, labels]]])
839
840 Print the ``num`` most seen responses with an RCODE of ``rcode``.
841 Optionally grouped by the rightmost ``labels`` DNS labels.
842
843 :param int num: Number to show, defaults to 10
844 :param int rcode: :ref:`Response code <DNSRCode>`, defaults to 0 (No Error)
845 :param int label: Number of labels to cut down to
846
847 .. function:: topSlow([num[, limit[, labels]]])
848
849 Print the ``num`` slowest queries that are slower than ``limit`` milliseconds.
850 Optionally grouped by the rightmost ``labels`` DNS labels.
851
852 :param int num: Number to show, defaults to 10
853 :param int limit: Show queries slower than this amount of milliseconds, defaults to 2000
854 :param int label: Number of labels to cut down to
855
856 .. _dynblocksref:
857
858 Dynamic Blocks
859 --------------
860
861 .. function:: addDynBlocks(addresses, message[, seconds=10[, action]])
862
863 .. versionchanged:: 1.2.0
864 ``action`` parameter added.
865
866 Block a set of addresses with ``message`` for (optionally) a number of seconds.
867 The default number of seconds to block for is 10.
868
869 :param addresses: set of Addresses as returned by an exceed function
870 :param string message: The message to show next to the blocks
871 :param int seconds: The number of seconds this block to expire
872 :param int action: The action to take when the dynamic block matches, see :ref:`here <DNSAction>`. (default to DNSAction.None, meaning the one set with :func:`setDynBlocksAction` is used)
873
874 Please see the documentation for :func:`setDynBlocksAction` to confirm which actions are supported by the action paramater.
875
876 .. function:: clearDynBlocks()
877
878 Remove all current dynamic blocks.
879
880 .. function:: showDynBlocks()
881
882 List all dynamic blocks in effect.
883
884 .. function:: setDynBlocksAction(action)
885
886 .. versionchanged:: 1.3.3
887 ``DNSAction.NXDomain`` action added.
888
889 Set which action is performed when a query is blocked.
890 Only DNSAction.Drop (the default), DNSAction.NoOp, DNSAction.NXDomain, DNSAction.Refused, DNSAction.Truncate and DNSAction.NoRecurse are supported.
891
892 .. _exceedfuncs:
893
894 Getting addresses that exceeded parameters
895 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
896
897 .. function:: exceedServFails(rate, seconds)
898
899 Get set of addresses that exceed ``rate`` servfails/s over ``seconds`` seconds
900
901 :param int rate: Number of Servfails per second to exceed
902 :param int seconds: Number of seconds the rate has been exceeded
903
904 .. function:: exceedNXDOMAINs(rate, seconds)
905
906 get set of addresses that exceed ``rate`` NXDOMAIN/s over ``seconds`` seconds
907
908 :param int rate: Number of NXDOMAIN per second to exceed
909 :param int seconds: Number of seconds the rate has been exceeded
910
911 .. function:: exceedRespByterate(rate, seconds)
912
913 get set of addresses that exceeded ``rate`` bytes/s answers over ``seconds`` seconds
914
915 :param int rate: Number of bytes per second to exceed
916 :param int seconds: Number of seconds the rate has been exceeded
917
918 .. function:: exceedQRate(rate, seconds)
919
920 Get set of address that exceed ``rate`` queries/s over ``seconds`` seconds
921
922 :param int rate: Number of queries per second to exceed
923 :param int seconds: Number of seconds the rate has been exceeded
924
925 .. function:: exceedQTypeRate(type, rate, seconds)
926
927 Get set of address that exceed ``rate`` queries/s for queries of QType ``type`` over ``seconds`` seconds
928
929 :param int type: QType
930 :param int rate: Number of QType queries per second to exceed
931 :param int seconds: Number of seconds the rate has been exceeded
932
933 DynBlockRulesGroup
934 ~~~~~~~~~~~~~~~~~~
935
936 Instead of using several `exceed*()` lines, dnsdist 1.3.0 introduced a new `DynBlockRulesGroup` object
937 which can be used to group dynamic block rules.
938
939 See :doc:`../guides/dynblocks` for more information about the case where using a `DynBlockRulesGroup` might be
940 faster than the existing rules.
941
942 .. function:: dynBlockRulesGroup() -> DynBlockRulesGroup
943
944 .. versionadded:: 1.3.0
945
946 Creates a new :class:`DynBlockRulesGroup` object.
947
948 .. class:: DynBlockRulesGroup
949
950 Represents a group of dynamic block rules.
951
952 .. method:: DynBlockRulesGroup:setQueryRate(rate, seconds, reason, blockingTime [, action [, warningRate]])
953
954 .. versionchanged:: 1.3.3
955 ``warningRate`` parameter added.
956
957 Adds a query rate-limiting rule, equivalent to:
958 ```
959 addDynBlocks(exceedQRate(rate, seconds), reason, blockingTime, action)
960 ```
961
962 :param int rate: Number of queries per second to exceed
963 :param int seconds: Number of seconds the rate has been exceeded
964 :param string reason: The message to show next to the blocks
965 :param int blockingTime: The number of seconds this block to expire
966 :param int action: The action to take when the dynamic block matches, see :ref:`here <DNSAction>`. (default to the one set with :func:`setDynBlocksAction`)
967 :param int warningRate: If set to a non-zero value, the rate above which a warning message will be issued and a no-op block inserted
968
969 .. method:: DynBlockRulesGroup:setRCodeRate(rcode, rate, seconds, reason, blockingTime [, action [, warningRate]])
970
971 .. versionchanged:: 1.3.3
972 ``warningRate`` parameter added.
973
974 Adds a rate-limiting rule for responses of code ``rcode``, equivalent to:
975 ```
976 addDynBlocks(exceedServfails(rcode, rate, seconds), reason, blockingTime, action)
977 ```
978
979 :param int rcode: The response code
980 :param int rate: Number of responses per second to exceed
981 :param int seconds: Number of seconds the rate has been exceeded
982 :param string reason: The message to show next to the blocks
983 :param int blockingTime: The number of seconds this block to expire
984 :param int action: The action to take when the dynamic block matches, see :ref:`here <DNSAction>`. (default to the one set with :func:`setDynBlocksAction`)
985 :param int warningRate: If set to a non-zero value, the rate above which a warning message will be issued and a no-op block inserted
986
987 .. method:: DynBlockRulesGroup:setQTypeRate(qtype, rate, seconds, reason, blockingTime [, action [, warningRate]])
988
989 .. versionchanged:: 1.3.3
990 ``warningRate`` parameter added.
991
992 Adds a rate-limiting rule for queries of type ``qtype``, equivalent to:
993 ```
994 addDynBlocks(exceedQTypeRate(type, rate, seconds), reason, blockingTime, action)
995 ```
996
997 :param int qtype: The qtype
998 :param int rate: Number of queries per second to exceed
999 :param int seconds: Number of seconds the rate has been exceeded
1000 :param string reason: The message to show next to the blocks
1001 :param int blockingTime: The number of seconds this block to expire
1002 :param int action: The action to take when the dynamic block matches, see :ref:`here <DNSAction>`. (default to the one set with :func:`setDynBlocksAction`)
1003 :param int warningRate: If set to a non-zero value, the rate above which a warning message will be issued and a no-op block inserted
1004
1005 .. method:: DynBlockRulesGroup:setResponseByteRate(rate, seconds, reason, blockingTime [, action [, warningRate]])
1006
1007 .. versionchanged:: 1.3.3
1008 ``warningRate`` parameter added.
1009
1010 Adds a bandwidth rate-limiting rule for responses, equivalent to:
1011 ```
1012 addDynBlocks(exceedRespByterate(rate, seconds), reason, blockingTime, action)
1013 ```
1014
1015 :param int rate: Number of bytes per second to exceed
1016 :param int seconds: Number of seconds the rate has been exceeded
1017 :param string reason: The message to show next to the blocks
1018 :param int blockingTime: The number of seconds this block to expire
1019 :param int action: The action to take when the dynamic block matches, see :ref:`here <DNSAction>`. (default to the one set with :func:`setDynBlocksAction`)
1020 :param int warningRate: If set to a non-zero value, the rate above which a warning message will be issued and a no-op block inserted
1021
1022 .. method:: DynBlockRulesGroup:apply()
1023
1024 Walk the in-memory query and response ring buffers and apply the configured rate-limiting rules, adding dynamic blocks when the limits have been exceeded.
1025
1026 .. method:: DynBlockRulesGroup:excludeRange(netmasks)
1027
1028 .. versionadded:: 1.3.1
1029
1030 Exclude this range, or list of ranges, meaning that no dynamic block will ever be inserted for clients in that range. Default to empty, meaning rules are applied to all ranges. When used in combination with :meth:`DynBlockRulesGroup:includeRange`, the more specific entry wins.
1031
1032 :param int netmasks: A netmask, or list of netmasks, as strings, like for example "192.0.2.1/24"
1033
1034 .. method:: DynBlockRulesGroup:includeRange(netmasks)
1035
1036 .. versionadded:: 1.3.1
1037
1038 Include this range, or list of ranges, meaning that rules will be applied to this range. When used in combination with :meth:`DynBlockRulesGroup:excludeRange`, the more specific entry wins.
1039
1040 :param int netmasks: A netmask, or list of netmasks, as strings, like for example "192.0.2.1/24"
1041
1042 .. method:: DynBlockRulesGroup:toString()
1043
1044 .. versionadded:: 1.3.1
1045
1046 Return a string describing the rules and range exclusions of this DynBlockRulesGroup.
1047
1048 Other functions
1049 ---------------
1050
1051 .. function:: maintenance()
1052
1053 If this function exists, it is called every second to so regular tasks.
1054 This can be used for e.g. :doc:`Dynamic Blocks <../guides/dynblocks>`.
1055
1056 .. function: setAllowEmptyResponse()
1057
1058 .. versionadded:: 1.4.0
1059
1060 Set to true (defaults to false) to allow empty responses (qdcount=0) with a NoError or NXDomain rcode (default) from backends. dnsdist drops these responses by default because it can't match them against the initial query since they don't contain the qname, qtype and qclass, and therefore the risk of collision is much higher than with regular responses.
1061
1062 DOHFrontend
1063 ~~~~~~~~~~~
1064
1065 .. class:: DOHFrontend
1066
1067 .. versionadded:: 1.4.0
1068
1069 This object represents an address and port dnsdist is listening on for DNS over HTTPS queries.
1070
1071 .. method:: DOHFrontend:reloadCertificates()
1072
1073 Reload the current TLS certificate and key pairs.
1074
1075 TLSContext
1076 ~~~~~~~~~~
1077
1078 .. class:: TLSContext
1079
1080 .. versionadded:: 1.3.0
1081
1082 This object represents an address and port dnsdist is listening on for DNS over TLS queries.
1083
1084 .. method:: TLSContext:rotateTicketsKey()
1085
1086 Replace the current TLS tickets key by a new random one.
1087
1088 .. method:: TLSContext:loadTicketsKeys(ticketsKeysFile)
1089
1090 Load new tickets keys from the selected file, replacing the existing ones. These keys should be rotated often and never written to persistent storage to preserve forward secrecy. The default is to generate a random key. The OpenSSL provider supports several tickets keys to be able to decrypt existing sessions after the rotation, while the GnuTLS provider only supports one key.
1091
1092 :param str ticketsKeysFile: The path to a file from where TLS tickets keys should be loaded.
1093
1094 TLSFrontend
1095 ~~~~~~~~~~~
1096
1097 .. class:: TLSFrontend
1098
1099 .. versionadded:: 1.3.1
1100
1101 This object represents the configuration of a listening frontend for DNS over TLS queries. To each frontend is associated a TLSContext.
1102
1103 .. method:: TLSContext:loadNewCertificatesAndKeys(certFile(s), keyFile(s))
1104
1105 Create and switch to a new TLS context using the same options than were passed to the corresponding `addTLSLocal()` directive, but loading new certificates and keys from the selected files, replacing the existing ones.
1106
1107 :param str certFile(s): The path to a X.509 certificate file in PEM format, or a list of paths to such files.
1108 :param str keyFile(s): The path to the private key file corresponding to the certificate, or a list of paths to such files, whose order should match the certFile(s) ones.
1109
1110 EDNS on Self-generated answers
1111 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1112
1113 There are several mechanisms in dnsdist that turn an existing query into an answer right away,
1114 without reaching out to the backend, including :func:`SpoofAction`, :func:`RCodeAction`, :func:`TCAction`
1115 and returning a response from ``Lua``. Those responses should, according to :rfc:`6891`, contain an ``OPT``
1116 record if the received request had one, which is the case by default and can be disabled using
1117 :func:`setAddEDNSToSelfGeneratedResponses`.
1118
1119 We must, however, provide a responder's maximum payload size in this record, and we can't easily know the
1120 maximum payload size of the actual backend so we need to provide one. The default value is 1500 and can be
1121 overriden using :func:`setPayloadSizeOnSelfGeneratedAnswers`.
1122
1123 .. function:: setAddEDNSToSelfGeneratedResponses(add)
1124
1125 .. versionadded:: 1.3.3
1126
1127 Whether to add EDNS to self-generated responses, provided that the initial query had EDNS.
1128
1129 :param bool add: Whether to add EDNS, default is true.
1130
1131 .. function:: setPayloadSizeOnSelfGeneratedAnswers(payloadSize)
1132
1133 .. versionadded:: 1.3.3
1134
1135 Set the UDP payload size advertised via EDNS on self-generated responses. In accordance with
1136 :rfc:`RFC 6891 <6891#section-6.2.5>`, values lower than 512 will be treated as equal to 512.
1137
1138 :param int payloadSize: The responder's maximum UDP payload size, in bytes. Default is 1500.
1139
1140 Security Polling
1141 ~~~~~~~~~~~~~~~~
1142
1143 PowerDNS products can poll the security status of their respective versions. This polling, naturally,
1144 happens over DNS. If the result is that a given version has a security problem, the software will
1145 report this at level ‘Error’ during startup, and repeatedly during operations, every
1146 :func:`setSecurityPollInterval` seconds.
1147
1148 By default, security polling happens on the domain ‘secpoll.powerdns.com’, but this can be changed with
1149 the :func:`setSecurityPollSuffix` function. If this setting is made empty, no polling will take place.
1150 Organizations wanting to host their own security zones can do so by changing this setting to a domain name
1151 under their control.
1152
1153 To enable distributors of PowerDNS to signal that they have backported versions, the PACKAGEVERSION
1154 compilation-time macro can be used to set a distributor suffix.
1155
1156 .. function:: setSecurityPollInterval(interval)
1157
1158 .. versionadded:: 1.3.3
1159
1160 Set the interval, in seconds, between two security pollings.
1161
1162 :param int interval: The interval, in seconds, between two pollings. Default is 3600.
1163
1164 .. function:: setSecurityPollSuffix(suffix)
1165
1166 .. versionadded:: 1.3.3
1167
1168 Domain name from which to query security update notifications. Setting this to an empty string disables secpoll.
1169
1170 :param string suffix: The suffix to use, default is 'secpoll.powerdns.com.'.