forked from coredns/coredns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoredns-acl.7
135 lines (101 loc) · 2.98 KB
/
coredns-acl.7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.\" Generated by Mmark Markdown Processer - mmark.miek.nl
.TH "COREDNS-ACL" 7 "March 2021" "CoreDNS" "CoreDNS Plugins"
.SH "NAME"
.PP
\fIacl\fP - enforces access control policies on source ip and prevents unauthorized access to DNS servers.
.SH "DESCRIPTION"
.PP
With \fB\fCacl\fR enabled, users are able to block or filter suspicious DNS queries by configuring IP filter rule sets, i.e. allowing authorized queries to recurse or blocking unauthorized queries.
.PP
This plugin can be used multiple times per Server Block.
.SH "SYNTAX"
.PP
.RS
.nf
acl [ZONES...] {
ACTION [type QTYPE...] [net SOURCE...]
}
.fi
.RE
.IP \(bu 4
\fBZONES\fP zones it should be authoritative for. If empty, the zones from the configuration block are used.
.IP \(bu 4
\fBACTION\fP (\fIallow\fP, \fIblock\fP, or \fIfilter\fP) defines the way to deal with DNS queries matched by this rule. The default action is \fIallow\fP, which means a DNS query not matched by any rules will be allowed to recurse. The difference between \fIblock\fP and \fIfilter\fP is that block returns status code of \fIREFUSED\fP while filter returns an empty set \fINOERROR\fP
.IP \(bu 4
\fBQTYPE\fP is the query type to match for the requests to be allowed or blocked. Common resource record types are supported. \fB\fC*\fR stands for all record types. The default behavior for an omitted \fB\fCtype QTYPE...\fR is to match all kinds of DNS queries (same as \fB\fCtype *\fR).
.IP \(bu 4
\fBSOURCE\fP is the source IP address to match for the requests to be allowed or blocked. Typical CIDR notation and single IP address are supported. \fB\fC*\fR stands for all possible source IP addresses.
.SH "EXAMPLES"
.PP
To demonstrate the usage of plugin acl, here we provide some typical examples.
.PP
Block all DNS queries with record type A from 192.168.0.0/16:
.PP
.RS
.nf
\&. {
acl {
block type A net 192.168.0.0/16
}
}
.fi
.RE
.PP
Filter all DNS queries with record type A from 192.168.0.0/16:
.PP
.RS
.nf
\&. {
acl {
filter type A net 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 net 192.168.1.0/24
block net 192.168.0.0/16
}
}
.fi
.RE
.PP
Allow only DNS queries from 192.168.0.0/24 and 192.168.1.0/24:
.PP
.RS
.nf
\&. {
acl {
allow net 192.168.0.0/24 192.168.1.0/24
block
}
}
.fi
.RE
.PP
Block all DNS queries from 192.168.1.0/24 towards a.example.org:
.PP
.RS
.nf
example.org {
acl a.example.org {
block net 192.168.1.0/24
}
}
.fi
.RE
.SH "METRICS"
.PP
If monitoring is enabled (via the \fIprometheus\fP plugin) then the following metrics are exported:
.IP \(bu 4
\fB\fCcoredns_acl_blocked_requests_total{server, zone}\fR - counter of DNS requests being blocked.
.IP \(bu 4
\fB\fCcoredns_acl_allowed_requests_total{server}\fR - counter of DNS requests being allowed.
.PP
The \fB\fCserver\fR and \fB\fCzone\fR labels are explained in the \fImetrics\fP plugin documentation.