| 1 |
.\" Generated by Mmark Markdown Processor - mmark.miek.nl |
| 2 |
.TH "GLOBAL" 7 "August 2026" "atomdns handlers" "atomdns authors" |
| 3 |
|
| 4 |
.SH "NAME" |
| 5 |
.PP |
| 6 |
\fIglobal\fP \- hold server properties |
| 7 |
|
| 8 |
.SH "DESCRIPTION" |
| 9 |
.PP |
| 10 |
\fIglobal\fP holds the server properties, like the prometheus metrics port, root directory, profiling settings, |
| 11 |
and the server's configuration on how many and what type of servers to run. |
| 12 |
|
| 13 |
.PP |
| 14 |
It's not a proper handler and you can not use it as such: you can't use \fIglobal\fP in the configuration, other than in the |
| 15 |
global block, see the configuration examples below. |
| 16 |
|
| 17 |
.PP |
| 18 |
If no servers (also see below) are defined atomdns starts a (single, but one for TCP and one for UDP) DNS server on port 53. |
| 19 |
|
| 20 |
.SH "SYNTAX" |
| 21 |
.PP |
| 22 |
.RS |
| 23 |
|
| 24 |
.nf |
| 25 |
{ |
| 26 |
root DIRECTORY |
| 27 |
log { |
| 28 |
debug |
| 29 |
json |
| 30 |
quiet |
| 31 |
disable |
| 32 |
} |
| 33 |
metrics [/N] [ADDRRES] |
| 34 |
health [ADDRESS [LAMEDUCK]] |
| 35 |
pprof [FILE|ADDRESS] |
| 36 |
dns { |
| 37 |
addr ADDRESS |
| 38 |
limits { |
| 39 |
tcp EXPR |
| 40 |
run EXPR |
| 41 |
} |
| 42 |
} |
| 43 |
dot { |
| 44 |
addr ADDRESS |
| 45 |
limits { |
| 46 |
run EXPR |
| 47 |
} |
| 48 |
} |
| 49 |
doh { |
| 50 |
addr ADDRESS |
| 51 |
limits { |
| 52 |
run EXPR |
| 53 |
inflight EXPR |
| 54 |
} |
| 55 |
} |
| 56 |
dou { |
| 57 |
addr SOCKET |
| 58 |
} |
| 59 |
tls ISSUER { |
| 60 |
cert CERT KEY |
| 61 |
ca URL |
| 62 |
source IP|IFACE [IP|IFACE]... |
| 63 |
contact EMAIL |
| 64 |
directory DIRECTORY |
| 65 |
rootca CA |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
.fi |
| 70 |
.RE |
| 71 |
|
| 72 |
.IP \(bu 4 |
| 73 |
with \fB\fCroot\fR \fBDIRECTORY\fP that directory to use as the root directory for the server. Any relative path names will |
| 74 |
get this directory prefixed. If \fBDIRECTORY\fP itself is also relative, the current working directory (cwd) of the atomdns |
| 75 |
process will be prefixed. |
| 76 |
.IP \(bu 4 |
| 77 |
\fB\fClog\fR tells atomdns on how to, globally, log: |
| 78 |
|
| 79 |
.RS |
| 80 |
.IP \(en 4 |
| 81 |
\fB\fCdebug\fR sets the global log level to debug. |
| 82 |
.IP \(en 4 |
| 83 |
\fB\fCjson\fR enables JSON logging. |
| 84 |
.IP \(en 4 |
| 85 |
With \fB\fCquiet\fR the banner is not shown. Query logging is not affected. |
| 86 |
.IP \(en 4 |
| 87 |
And \fB\fCdisable\fR disables the logging so that it can be enabled with the SIGUSR1 signal, see atomdns\-log(7). |
| 88 |
To enable logging for specific zone you need to enable the \fIlog\fP handler in that handler block. |
| 89 |
|
| 90 |
.RE |
| 91 |
.IP \(bu 4 |
| 92 |
The \fB\fCmetrics\fR property allows setting the listening \fBADDRESS\fP for the prometheus metrics. This defaults to \fB\fClocalhost:9153\fR. |
| 93 |
Without \fB\fCmetrics\fR no metrics can be scraped as the prometheus server isn't running, i.e. to allow for |
| 94 |
metrics gathering \fB\fCmetrics\fR must be enabled in the global block. |
| 95 |
The optional \fB/N\fP tells the metric handler to monitor 1 in \fBN\fP queries. The default is 10. This needs to |
| 96 |
be a positive integer > 0. This is done to not impair performance too much. |
| 97 |
With the \fB\fCmetrics\fR handler you can enable/disable metrics on a per server basis. |
| 98 |
.IP \(bu 4 |
| 99 |
With \fB\fChealth\fR you start a local web server that exports a /health endpoint on \fBADDRESS\fP that returns 200 OK when |
| 100 |
everything is OK. When \fBLAMEDUCK\fP which should be a time.Duration in string form is given, the server' shutdown will be |
| 101 |
delayed for that duration. The default for \fBADDRESS\fP is \fB\fC:8080\fR. Every 2 seconds atomdns will query itself |
| 102 |
to get its health so it can export the latency metrics. |
| 103 |
.IP \(bu 4 |
| 104 |
With \fB\fCpprof\fR you can publish runtime profiling data at the endpoint on |
| 105 |
\fBADDRESS\fP under \fB\fC/debug/pprof\fR. Alternatively it can be a path where the profiling output is written to. |
| 106 |
The default is \fB\fClocalhost:6053\fR. |
| 107 |
|
| 108 |
|
| 109 |
.PP |
| 110 |
This is parsed in\-order and some settings depend on \fB\fCroot\fR and/or \fB\fCdebug\fR, so set those two early in the file. |
| 111 |
|
| 112 |
.SH ""\fB\fCdns\fR |
| 113 |
.PP |
| 114 |
With \fB\fCdns\fR you set DNS (port (usually) 53, TCP and UDP) server options, defined are. |
| 115 |
|
| 116 |
.IP \(bu 4 |
| 117 |
\fB\fCaddr\fR \fBADDRESS\fP: listen on this address, default is \fB\fC[::]:53\fR. |
| 118 |
.IP \(bu 4 |
| 119 |
\fB\fClimits\fR set further limits: |
| 120 |
|
| 121 |
.RS |
| 122 |
.IP \(en 4 |
| 123 |
\fB\fCtcp\fR \fBLIMIT\fP, break off TCP connections after this many queries, default is 1024, \-1 disables. |
| 124 |
.IP \(en 4 |
| 125 |
\fB\fCrun\fR \fBEXPR\fP, run this many servers the default is \fB\fCNumCPU()*3\fR, this can be a bare number, |
| 126 |
like 5, or an expression like \fB\fCNumCPU()*N\fR, where \fBN\fP is a whole number. \fB\fCNumCPU()\fR may be spelled in |
| 127 |
lowercase, i.e. \fB\fCnumcpu()*N\fR is OK. Note that adding more servers helps with lock contention when writing the DNS messages |
| 128 |
back to the client. This number is again multiplied by 2 for 50% UDP, and 50% TCP server. So \fB\fCrun 5\fR, will |
| 129 |
start 10 server instances. The maximum value is the number of CPUs * 1024. |
| 130 |
|
| 131 |
.RE |
| 132 |
|
| 133 |
|
| 134 |
.SH ""\fB\fCdot\fR |
| 135 |
.PP |
| 136 |
With \fB\fCdot\fR you control DNS TLS server options, defined are. |
| 137 |
|
| 138 |
.IP \(bu 4 |
| 139 |
\fB\fCaddr\fR \fBADDRESS\fP: listen on this address, default is \fB\fC[::]:853\fR. |
| 140 |
.IP \(bu 4 |
| 141 |
\fB\fClimits\fR set further limits: |
| 142 |
|
| 143 |
.RS |
| 144 |
.IP \(en 4 |
| 145 |
\fB\fCtcp\fR \fBLIMIT\fP, break off TCP connections after this many queries, default is 1024, \-1 disables. |
| 146 |
.IP \(en 4 |
| 147 |
\fB\fCrun\fR \fBEXPR\fP, run this many servers the default is \fB\fCNumCPU()*1\fR, this can be a bare number, |
| 148 |
like 5, or an expression like \fB\fCNumCPU()*N\fR, where \fBN\fP is a whole number. \fB\fCNumCPU()\fR may be spelled in lowercase. |
| 149 |
These are all TCP servers, so \fB\fCrun 5\fR will start 5 servers, not 10 as would the case with \fB\fCdns\fR. |
| 150 |
|
| 151 |
.RE |
| 152 |
|
| 153 |
|
| 154 |
.PP |
| 155 |
This requires a \fB\fCtls\fR setup too. |
| 156 |
|
| 157 |
.SH ""\fB\fCdoh\fR |
| 158 |
.PP |
| 159 |
With \fB\fCdoh\fR you set HTTP server options, defined are. |
| 160 |
|
| 161 |
.IP \(bu 4 |
| 162 |
\fB\fCaddr\fR \fBADDRESS\fP: listen on this address, default is \fB\fC[::]:443\fR. |
| 163 |
.IP \(bu 4 |
| 164 |
\fB\fClimits\fR set further limits: |
| 165 |
|
| 166 |
.RS |
| 167 |
.IP \(en 4 |
| 168 |
\fB\fCrun\fR \fBEXPR\fP, run this many servers the default is \fB\fCNumCPU()*1\fR, this can be a bare number, |
| 169 |
like 5, or an expression like \fB\fCNumCPU()*N\fR, where \fBN\fP is a whole number. \fB\fCNumCPU()*\fR may be spelled in lowercase. |
| 170 |
.IP \(en 4 |
| 171 |
\fB\fCinflight\fR \fBEXPR\fP, like \fB\fCrun\fR, how many inflight connection are we allowing, default is 1024, \-1 disables. |
| 172 |
|
| 173 |
.RE |
| 174 |
|
| 175 |
|
| 176 |
.PP |
| 177 |
To allow the certificate challenge, all DOH HTTP servers will also handle the TLS\-ALPN\-1 challenge, |
| 178 |
disregarding the port the run on. If the DOH servers are not running on port 443, one extra server will be |
| 179 |
started on that port, \fIjust\fP for the certificate challenge. N.B. This is only done if the port isn't "0", |
| 180 |
because that is usually used in testing scenarios. This requires the atomdns process to be able to bind to that |
| 181 |
port. |
| 182 |
|
| 183 |
.PP |
| 184 |
This requires a \fB\fCtls\fR setup too. |
| 185 |
|
| 186 |
.SH ""\fB\fCdou\fR |
| 187 |
.PP |
| 188 |
With \fB\fCdou\fR you configure an Unix domain socket to listen on, defined are. |
| 189 |
|
| 190 |
.IP \(bu 4 |
| 191 |
\fB\fCaddr\fR \fBSOCKET\fP: listen on this Unix domain socket. Note there are OS limits on the length of the socket's file name. |
| 192 |
If this is a relative name the path from \fB\fCroot\fR will be prepended. |
| 193 |
|
| 194 |
|
| 195 |
.PP |
| 196 |
Querying over a Unix domain socket needs to be done using the TCP packet format, for example: |
| 197 |
\fB\fCkdig +tcp www.example.org @/tmp/atomdns.sock\fR, if \fBSOCKET\fP is set to \fB\fC/tmp/atomdns.sock\fR. |
| 198 |
|
| 199 |
.SH ""\fB\fCtls\fR |
| 200 |
.PP |
| 201 |
With \fB\fCtls\fR you configure the TLS certificate setup. \fBISSUER\fP can be \fB\fCmanual\fR, or \fB\fClets-encrypt\fR. The later |
| 202 |
will set up the certificates automatically. If you use relative path in this configuration be sure that \fB\fCroot\fR |
| 203 |
is set \fIabove\fP this config, so that its value is set. |
| 204 |
|
| 205 |
.PP |
| 206 |
Depending on \fBISSUER\fP, you have the following further configuration: |
| 207 |
|
| 208 |
.PP |
| 209 |
If \fBISSUER\fP is \fB\fCmanual\fR: |
| 210 |
|
| 211 |
.IP \(bu 4 |
| 212 |
\fB\fCcert\fR, that lists in that order \fBCERT\fP the \fB\fCcert.pem\fR (as an example name) file, \fBKEY\fP the private key, |
| 213 |
\fB\fCkey.pem\fR |
| 214 |
.IP \(bu 4 |
| 215 |
\fB\fCrootca\fR, the root \fB\fCca.pem\fR file. This is optional, but can aid in testing. |
| 216 |
|
| 217 |
|
| 218 |
.PP |
| 219 |
If \fBISSUER\fP is \fB\fClets-encrypt\fR: |
| 220 |
|
| 221 |
.IP \(bu 4 |
| 222 |
\fB\fCsource\fR, a list of \fBIP\fPs or \fBIFACE\fP names for which the IP address should be retrieved, and for which |
| 223 |
the TLS certificates should be requested. |
| 224 |
.IP \(bu 4 |
| 225 |
\fB\fCcontact\fR, where \fBEMAIL\fP is the contact email use when retrieving certificates. This can be set to (one |
| 226 |
of) your SOA's Mbox (RNAME \- responsible person) mail address. |
| 227 |
.IP \(bu 4 |
| 228 |
\fB\fCdirectory\fR has the \fBDIRECTORY\fP where the certificates are stored. The global's \fB\fCroot\fR is prepended if this a |
| 229 |
relative path name. |
| 230 |
.IP \(bu 4 |
| 231 |
\fB\fCca\fR lets you select the production or staging ACME CA endpoint, by specifying the URL here. The default for |
| 232 |
the time being is Let's Encrypt staging endpoint: https://acme\-staging\-v02.api.letsencrypt.org/directory |
| 233 |
\[la]https://acme-staging-v02.api.letsencrypt.org/directory\[ra]. |
| 234 |
The production endpoint for Let's Encrypt is https://acme\-v02.api.letsencrypt.org/directory |
| 235 |
\[la]https://acme-v02.api.letsencrypt.org/directory\[ra]. |
| 236 |
If after the URL the literal text \fB\fCtest\fR is used, atomdns will not start a separate web server on port 443, |
| 237 |
this is to aid in local testing. |
| 238 |
.IP \(bu 4 |
| 239 |
\fB\fCrootca\fR, can also be used here. This is optional, but can aid in testing. |
| 240 |
|
| 241 |
|
| 242 |
.PP |
| 243 |
Both \fB\fCsource\fR and \fB\fCcontact\fR are mandatory. |
| 244 |
|
| 245 |
.PP |
| 246 |
To complete the challenge a web server needs to be running on port 443, if DOH is enabled (see \fB\fCdoh\fR), and is |
| 247 |
not already running on 443 another server will be started on that port just for the challenge. |
| 248 |
|
| 249 |
.SH "EXAMPLES" |
| 250 |
.PP |
| 251 |
A minimal example without any blocks, starts a DNS server on port 53, as said in the description. It is |
| 252 |
authoritative for \fB\fCexample.org.\fR and has two handlers, \fIlog\fP and \fIwhoami\fP. |
| 253 |
|
| 254 |
.PP |
| 255 |
.RS |
| 256 |
|
| 257 |
.nf |
| 258 |
example.org |
| 259 |
log |
| 260 |
whoami |
| 261 |
|
| 262 |
.fi |
| 263 |
.RE |
| 264 |
|
| 265 |
.PP |
| 266 |
This runs both a DNS and DOH server, the DOH server listens on port 8053. |
| 267 |
|
| 268 |
.PP |
| 269 |
.RS |
| 270 |
|
| 271 |
.nf |
| 272 |
{ |
| 273 |
root /var/lib/atomdns |
| 274 |
metrics localhost:9153 |
| 275 |
tls lets\-encrypt { |
| 276 |
contact [email protected] |
| 277 |
source eth0 |
| 278 |
path certs |
| 279 |
} |
| 280 |
dns { |
| 281 |
limits { |
| 282 |
tcp \-1 |
| 283 |
run NumCPU()*3 |
| 284 |
} |
| 285 |
} |
| 286 |
doh { |
| 287 |
addr [::]:8053 |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
example.org { |
| 292 |
log |
| 293 |
whoami |
| 294 |
} |
| 295 |
|
| 296 |
.fi |
| 297 |
.RE |
| 298 |
|
| 299 |
.PP |
| 300 |
Or run an health endpoint on http://localhost:8091, with a lame\-duck delay of 200 ms. |
| 301 |
|
| 302 |
.PP |
| 303 |
.RS |
| 304 |
|
| 305 |
.nf |
| 306 |
{ |
| 307 |
health localhost:8091 200ms |
| 308 |
} |
| 309 |
|
| 310 |
.fi |
| 311 |
.RE |
| 312 |
|
| 313 |
.PP |
| 314 |
Using the profiling tools. |
| 315 |
|
| 316 |
.PP |
| 317 |
.RS |
| 318 |
|
| 319 |
.nf |
| 320 |
{ |
| 321 |
pprof atomdns.prof |
| 322 |
} |
| 323 |
|
| 324 |
.fi |
| 325 |
.RE |
| 326 |
|
| 327 |
.PP |
| 328 |
Then run atomdns, and use the profiling data: \fB\fCgo tool pprof -http localhost:8080 atomdns atomdns.prof\fR and |
| 329 |
spot any bottlenecks. |
| 330 |
|
| 331 |
.SH "METRICS" |
| 332 |
.PP |
| 333 |
If monitoring is enabled (via \fB\fCmetrics\fR) and \fB\fChealth\fR is enabled the following metrics are exported: |
| 334 |
|
| 335 |
.IP \(bu 4 |
| 336 |
\fB\fCatomdns_health_request_duration_seconds{}\fR \- \fB\fChealth\fR performs a self health check |
| 337 |
once per second on the \fB\fC/health\fR endpoint. This metric is the duration to process that request. |
| 338 |
As this is a local operation it should be fast. A (large) increase in this |
| 339 |
duration indicates the atomdns process is having trouble keeping up with its query load. |
| 340 |
.IP \(bu 4 |
| 341 |
\fB\fCatomdns_health_request_failures_total{}\fR \- The number of times the self health check failed, this also |
| 342 |
points to imminent failure. |
| 343 |
|