| 1 |
.\" Generated by Mmark Markdown Processor - mmark.miek.nl |
| 2 |
.TH "ACL" 7 "August 2026" "atomdns handlers" "atomdns authors" |
| 3 |
|
| 4 |
.SH "NAME" |
| 5 |
.PP |
| 6 |
\fIacl\fP \- enforces access control policies |
| 7 |
|
| 8 |
.SH "DESCRIPTION" |
| 9 |
.PP |
| 10 |
With \fIacl\fP, users are able to block or filter suspicious DNS queries by configuring IP filter rule sets, i.e. |
| 11 |
allowing authorized queries or blocking unauthorized queries. |
| 12 |
|
| 13 |
.PP |
| 14 |
When evaluating the rule sets, \fIacl\fP uses the source IP adresss, unless the \fIecs\fP handler has added an address |
| 15 |
to the context. |
| 16 |
|
| 17 |
.SH "SYNTAX" |
| 18 |
.PP |
| 19 |
.RS |
| 20 |
|
| 21 |
.nf |
| 22 |
acl { |
| 23 |
ACTION [QTYPE|OPCODE]... [NET]... |
| 24 |
ACTION CTX VALUE... |
| 25 |
} |
| 26 |
|
| 27 |
.fi |
| 28 |
.RE |
| 29 |
|
| 30 |
.IP \(bu 4 |
| 31 |
\fBACTION\fP defines the way to deal with DNS queries matched by this rule. The default action is \fIallow\fP, |
| 32 |
DNS query not matched by any rules will be allowed to continue. The following actions are defined: |
| 33 |
|
| 34 |
.RS |
| 35 |
.IP \(en 4 |
| 36 |
\fIallow\fP forward the query to the next handler. |
| 37 |
.IP \(en 4 |
| 38 |
\fIblock\fP stop the query and return a \fIrefused\fP response with the extended error (EDE) 'blocked'. |
| 39 |
.IP \(en 4 |
| 40 |
\fIfilter\fP stop the query and returns \fInoerror\fP response with the extended error (EDE) 'filtered'. |
| 41 |
.IP \(en 4 |
| 42 |
\fIdrop\fP stop the query and don't send any reply. |
| 43 |
|
| 44 |
.RE |
| 45 |
.IP \(bu 4 |
| 46 |
\fBQTYPE|OPCODE\fP is the query type, or opcode to match for the requests to be allowed or blocked. If |
| 47 |
\fBQTYPE|OPCODE\fP is omitted it matches \fIall\fP types and opcodes. |
| 48 |
.IP \(bu 4 |
| 49 |
\fBNET\fP is the source IP address requests to be allowed or blocked. Typical CIDR notation and single IP |
| 50 |
addresses are supported. |
| 51 |
.IP \(bu 4 |
| 52 |
\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 |
| 53 |
instance writes data under (among other) the key \fB\fCgeoip/city\fR, that can be used here. If the key does not |
| 54 |
return any data it will considered a positive match and \fBACTION\fP is performed. |
| 55 |
.IP \(bu 4 |
| 56 |
\fBVALUE\fP is the value to match \fBCTX\fP to. Again with the \fIgeoip\fP handler and using \fB\fCCambridge\fR here you |
| 57 |
can have access control on a city level. |
| 58 |
|
| 59 |
|
| 60 |
.SH "EXAMPLES" |
| 61 |
.PP |
| 62 |
Block everything. |
| 63 |
|
| 64 |
.PP |
| 65 |
.RS |
| 66 |
|
| 67 |
.nf |
| 68 |
\&. { |
| 69 |
acl { |
| 70 |
block |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
.fi |
| 75 |
.RE |
| 76 |
|
| 77 |
.PP |
| 78 |
Filter all DNS queries with record type A from 192.168.0.0/16. |
| 79 |
|
| 80 |
.PP |
| 81 |
.RS |
| 82 |
|
| 83 |
.nf |
| 84 |
\&. { |
| 85 |
acl { |
| 86 |
filter A 192.168.0.0/16 |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
.fi |
| 91 |
.RE |
| 92 |
|
| 93 |
.PP |
| 94 |
Block all DNS queries from 192.168.0.0/16 except for 192.168.1.0/24. |
| 95 |
|
| 96 |
.PP |
| 97 |
.RS |
| 98 |
|
| 99 |
.nf |
| 100 |
\&. { |
| 101 |
acl { |
| 102 |
allow 192.168.1.0/24 |
| 103 |
block 192.168.0.0/16 |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
.fi |
| 108 |
.RE |
| 109 |
|
| 110 |
.PP |
| 111 |
Drop all queries from Cambridge, this requires the \fIgeoip\fP handler to have populated the context for this |
| 112 |
query. Allow all countries that are in the EU. |
| 113 |
|
| 114 |
.PP |
| 115 |
.RS |
| 116 |
|
| 117 |
.nf |
| 118 |
\&. { |
| 119 |
acl { |
| 120 |
block geoip/city Cambridge |
| 121 |
allow geoip/country/eu true |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
.fi |
| 126 |
.RE |
| 127 |
|
| 128 |
.PP |
| 129 |
Drop opcode UPDATE for all but a few IP ranges. |
| 130 |
|
| 131 |
.PP |
| 132 |
.RS |
| 133 |
|
| 134 |
.nf |
| 135 |
\&. { |
| 136 |
acl { |
| 137 |
allow UPDATE 192.168.1.0/24 |
| 138 |
block UPDATE |
| 139 |
} |
| 140 |
} |
| 141 |
|
| 142 |
.fi |
| 143 |
.RE |
| 144 |
|
| 145 |
.SH "METRICS" |
| 146 |
.PP |
| 147 |
If monitoring is enabled (via the \fImetrics\fP handler) then the following metrics are exported: |
| 148 |
|
| 149 |
.IP \(bu 4 |
| 150 |
\fB\fCatomdns_acl_blocked_requests_total{zone, network, family}\fR \- counter of DNS requests being blocked. |
| 151 |
.IP \(bu 4 |
| 152 |
\fB\fCatomdns_acl_filtered_requests_total{zone, network, family}\fR \- counter of DNS requests being filtered. |
| 153 |
.IP \(bu 4 |
| 154 |
\fB\fCatomdns_acl_allowed_requests_total{zone, network, family}\fR \- counter of DNS requests being allowed. |
| 155 |
.IP \(bu 4 |
| 156 |
\fB\fCatomdns_acl_dropped_requests_total{zone, network, family}\fR \- counter of DNS requests being dropped. |
| 157 |
|
| 158 |
|
| 159 |
.PP |
| 160 |
The \fB\fCzone\fR,\fB\fCnetwork\fR and \fB\fCfamily\fR labels are explained in the \fImetrics\fP handler documentation. These metrics |
| 161 |
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. |
| 162 |
|
| 163 |
.SH "ALSO SEE" |
| 164 |
.PP |
| 165 |
See atomdns\-ecs(7) that can add a better source address. |
| 166 |
|
| 167 |
.SH "BUGS" |
| 168 |
.PP |
| 169 |
\fIacl\fP should also check TSIG and other signed messages, see https://codeberg.org/miekg/dns/issues/426 for the |
| 170 |
remaining work. |