.\" Generated by Mmark Markdown Processor - mmark.miek.nl .TH "ACL" 7 "August 2026" "atomdns handlers" "atomdns authors" .SH "NAME" .PP \fIacl\fP \- enforces access control policies .SH "DESCRIPTION" .PP With \fIacl\fP, users are able to block or filter suspicious DNS queries by configuring IP filter rule sets, i.e. allowing authorized queries or blocking unauthorized queries. .PP When evaluating the rule sets, \fIacl\fP uses the source IP adresss, unless the \fIecs\fP handler has added an address to the context. .SH "SYNTAX" .PP .RS .nf acl { ACTION [QTYPE|OPCODE]... [NET]... ACTION CTX VALUE... } .fi .RE .IP \(bu 4 \fBACTION\fP defines the way to deal with DNS queries matched by this rule. The default action is \fIallow\fP, DNS query not matched by any rules will be allowed to continue. The following actions are defined: .RS .IP \(en 4 \fIallow\fP forward the query to the next handler. .IP \(en 4 \fIblock\fP stop the query and return a \fIrefused\fP response with the extended error (EDE) 'blocked'. .IP \(en 4 \fIfilter\fP stop the query and returns \fInoerror\fP response with the extended error (EDE) 'filtered'. .IP \(en 4 \fIdrop\fP stop the query and don't send any reply. .RE .IP \(bu 4 \fBQTYPE|OPCODE\fP is the query type, or opcode to match for the requests to be allowed or blocked. If \fBQTYPE|OPCODE\fP is omitted it matches \fIall\fP types and opcodes. .IP \(bu 4 \fBNET\fP is the source IP address requests to be allowed or blocked. Typical CIDR notation and single IP addresses are supported. .IP \(bu 4 \fBCTX\fP must be used in the format \fB\fCxxx/yyy\fR, i.e. two words seperated by a slash. The \fIgeoip\fP handler for instance writes data under (among other) the key \fB\fCgeoip/city\fR, that can be used here. If the key does not return any data it will considered a positive match and \fBACTION\fP is performed. .IP \(bu 4 \fBVALUE\fP is the value to match \fBCTX\fP to. Again with the \fIgeoip\fP handler and using \fB\fCCambridge\fR here you can have access control on a city level. .SH "EXAMPLES" .PP Block everything. .PP .RS .nf \&. { acl { block } } .fi .RE .PP Filter all DNS queries with record type A from 192.168.0.0/16. .PP .RS .nf \&. { acl { filter A 192.168.0.0/16 } } .fi .RE .PP Block all DNS queries from 192.168.0.0/16 except for 192.168.1.0/24. .PP .RS .nf \&. { acl { allow 192.168.1.0/24 block 192.168.0.0/16 } } .fi .RE .PP Drop all queries from Cambridge, this requires the \fIgeoip\fP handler to have populated the context for this query. Allow all countries that are in the EU. .PP .RS .nf \&. { acl { block geoip/city Cambridge allow geoip/country/eu true } } .fi .RE .PP Drop opcode UPDATE for all but a few IP ranges. .PP .RS .nf \&. { acl { allow UPDATE 192.168.1.0/24 block UPDATE } } .fi .RE .SH "METRICS" .PP If monitoring is enabled (via the \fImetrics\fP handler) then the following metrics are exported: .IP \(bu 4 \fB\fCatomdns_acl_blocked_requests_total{zone, network, family}\fR \- counter of DNS requests being blocked. .IP \(bu 4 \fB\fCatomdns_acl_filtered_requests_total{zone, network, family}\fR \- counter of DNS requests being filtered. .IP \(bu 4 \fB\fCatomdns_acl_allowed_requests_total{zone, network, family}\fR \- counter of DNS requests being allowed. .IP \(bu 4 \fB\fCatomdns_acl_dropped_requests_total{zone, network, family}\fR \- counter of DNS requests being dropped. .PP The \fB\fCzone\fR,\fB\fCnetwork\fR and \fB\fCfamily\fR labels are explained in the \fImetrics\fP handler documentation. These metrics follow the \fIglobal\fP's metric \fB\fC\N\fR setup, and as such should be multiplied by \fB\fCN\fR to get the actual value. .SH "ALSO SEE" .PP See atomdns\-ecs(7) that can add a better source address. .SH "BUGS" .PP \fIacl\fP should also check TSIG and other signed messages, see https://codeberg.org/miekg/dns/issues/426 for the remaining work.