Project

General

Profile

DNS » History » Version 23

Marc Dequènes, 2021-02-20 10:41

1 6 Marc Dequènes
{{toc}}
2
3 1 Marc Dequènes
h1. DNS
4
5
h2. Zone Management
6
7 9 Marc Dequènes
h3. Adding a Zone
8
9 1 Marc Dequènes
On each DNS server, master zone can be created/updated on _/etc/bind/masters/_. The ownership needs to be:
10
* _banya:_ if a user zone which should be updatable via the Banya service
11
* _root:bind_ in all other cases
12
13 23 Marc Dequènes
The zone is declared in _host_vars/<dnsserver>/dns.yml_ and the playbook _playbooks/tenants/duckcorp/dns.yml_ is in charge of updating all configurations (see the _bind9_ role documentation to understand the parameters). Only the zone content is not Ansible managed.
14 1 Marc Dequènes
15 9 Marc Dequènes
h3. Updating a Zone
16 1 Marc Dequènes
17 15 Marc Dequènes
Edit the file _/etc/bind/masters/<zone-name>.zone_ on the primary master (Orfeo for all zones except DuckLand zones using Elwing).
18
19
Do not forget to update the serial!
20
21
Better to check the file validity before publishing the zone:
22 2 Marc Dequènes
<pre>
23 1 Marc Dequènes
named-checkzone <zone-name> <zone-file>
24 2 Marc Dequènes
</pre>
25
26 15 Marc Dequènes
Then to publish the zone (DNSSEC-signed zones too):
27 2 Marc Dequènes
<pre>
28
rndc reload <zone-name>
29
</pre>
30
31 1 Marc Dequènes
In case the zone is DNSSEC-signed, the publishing of keys in the parent zone is to be done manually (not automated yet); more details below.
32
33 9 Marc Dequènes
h3. Reseting the Zone Serial
34 7 Marc Dequènes
35 15 Marc Dequènes
The serial needs to be increased by steps, as described "in this article":http://www.microhowto.info/howto/reset_the_serial_number_of_a_dns_zone.html.
36 7 Marc Dequènes
37 1 Marc Dequènes
h2. Secure Zone Transfers
38
39
To secure zone transfers, a TSIG key needs to be created and added on both sides. Beware the key name *must* be identical on both side. 
40
41
DNS server groups (servers allowed to request transfer) and keys can be defined in _host_vars/<dnsserver>/dns.yml_ and _host_vars/<dnsserver>/dns.vault.yml_ respectively. If they are to be used on all servers, then you can declare them in _group_vars/dns_servers/dns.yml_ and _group_vars/dns_servers/dns.vault.yml_ respectively.
42
43
You can a new key using:
44
<pre>
45 5 Marc Dequènes
dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST taiste
46
</pre>
47
Take the 'Key' part in 'Ktaiste.*.private' file, to put into the configuration.
48
49
The same playbook (_playbooks/tenants/duckcorp/dns.yml_) is used to update the configuration.
50
51 15 Marc Dequènes
h2. DNSSEC
52 5 Marc Dequènes
53 23 Marc Dequènes
Here are notes about using Bind KASP (version 9.16 required).
54 5 Marc Dequènes
55 23 Marc Dequènes
All general info above about DNSSEC does not change, especially the rollover steps are similar even if the tooling change, and testing the zone is identical.
56 5 Marc Dequènes
57 23 Marc Dequènes
The Ansible _bind_ role has been updated in a branch to be able to use Bind KASP for DNSSEC. Our Ansible repository now tracks this branch and add the necessary parameters to use it. Please look at the role's documentation to understand the inner technical details, this page is about administration of the solution.
58 5 Marc Dequènes
59
h3. Introduction
60
61
Better read some documentation before fiddling with the controls:
62 17 Marc Dequènes
* "Bind DNSSEC Guide":https://downloads.isc.org/isc/dnssec-guide/html/dnssec-guide.html
63 1 Marc Dequènes
* "KSK Rollover":https://blog.webernetz.net/dnssec-ksk-key-rollover/ (key is manually created instead of using `dnssec-keymgr` but it's a good example)
64
* "Future KSK Rollover Automation":https://www.dns.cam.ac.uk/news/2019-01-30-rollover.html
65
66 23 Marc Dequènes
Key materials are created on-demand by Bind using the policy parameters, so no need to do anything outside Ansible configuration of the zones and policy parameters. Cleanup of old keys when they become obsolete or when a zone is removed is not yet done though.
67 1 Marc Dequènes
68 23 Marc Dequènes
h3. Notes about migrating from a previous version (historical)
69
70
It is important to cleanup old keys first if switching from dnssec-keymgr to dnssec-policy or old keys would get in the way.
71
72
More generally look at "this ticket tracking the problems we encountered":https://projects.duckcorp.org/issues/720
73
74
As Bind is not using the usual date-based zone serial, it can be less misleading to reset the serial before migration (see dedicated chapter above).
75
76 5 Marc Dequènes
h3. Zone Status
77
78 1 Marc Dequènes
General zone info, including the real published serial (after signing, resigning if it happens, rollovers…) and planned signing events:
79 6 Marc Dequènes
<pre>
80 1 Marc Dequènes
rndc zonestatus <zone-name>
81
</pre>
82
83 21 Marc Dequènes
h4. Zone Keys
84 7 Marc Dequènes
85 21 Marc Dequènes
To know which keys (<key-id>) are currently signing a zone (may be inactive and not deleted yet):
86 22 Marc Dequènes
<pre>
87 23 Marc Dequènes
rndc dnssec -status <zone-name>
88
</pre>
89 6 Marc Dequènes
90 23 Marc Dequènes
Keys are stored in _/etc/bind/keys_ and you can use the key ID to locate the corresponding file this way:
91 1 Marc Dequènes
<pre>
92 7 Marc Dequènes
ls /etc/bind/keys/K<zone-name>.+*+*<key-id>.key
93
</pre>
94 15 Marc Dequènes
95 6 Marc Dequènes
Inside you can read the key type (KSK/ZSK) and the lifetime schedule (so important rollover dates).
96 1 Marc Dequènes
97 23 Marc Dequènes
The KASP is in charge of the key maintenance according to the policy. It is possible to alter the timing using the _dnssec-settime_ tool in case of bugs but that should not be needed.
98
In this case, after doing the modifications, Bind needs to be notified using:
99 10 Marc Dequènes
<pre>
100 18 Marc Dequènes
rndc loadkeys <zone-name>
101 6 Marc Dequènes
</pre>
102
103
h4. Parent Zone Publishing
104
105 1 Marc Dequènes
To see if the zone KSK keys are properly published in the parent zone:
106
<pre>
107
dnssec-checkds <zone-name>
108
</pre>
109
110
h3. Key Rollover
111
112 23 Marc Dequènes
To get a view of the schedule:
113 1 Marc Dequènes
<pre>
114 23 Marc Dequènes
rndc dnssec -status <zone-name>
115 1 Marc Dequènes
</pre>
116
117 6 Marc Dequènes
To have a list of KSK keys that needs publishing on the parent zone:
118
<pre>
119
dnssec-checkds <zone-name>
120 10 Marc Dequènes
</pre>
121
122 23 Marc Dequènes
The ZSK key rollover is handled automatically by Bind (KASP), so admins have nothing to do.
123
124
The KSK rollover implies contact with the parent zone:
125
* if we do not manage the parent zone:
126
** if the parent zone handles CDS/CDNSKEY (RFC 7344) then it will grab the new DS automagically (but most TLDs do not support it yet)
127
** else a manual step to get the DS entry in their zone is needed (manually in their UI, maybe via an API)
128
* if we manage the parent zone:
129
** if the zone publishes the CDS/CDNSKEY RRs (all our zones have them) then we simply need to define the list of _dnssec_children_ in the parent zone configuration (see bind9 role documentation) and a script will make the update
130
** else we need to organize with the tenant on a method to exchange the DS
131
132
WIPWIPWIP
133
134 10 Marc Dequènes
h3. KSK Rollover Workflow
135 17 Marc Dequènes
136
We use the Double-Signature method with some overlap of DS publishing.
137 10 Marc Dequènes
138 15 Marc Dequènes
Here are the states and what needs to be done:
139
* *created* state:
140
** new created key (new zone or key replacement), this key is not used yet
141
** action: wait
142
* *publish* state:
143
** the is added to the zone but not used to sign yet
144
** after the zone default TTL has passed, it is considered published
145
** action: wait for propagation
146 1 Marc Dequènes
* *active* state:
147
** the key is used for signing
148 18 Marc Dequènes
** action: export the key either (depending on the registrar):
149
*** DS: in digest format using the *dnssec-dsfromkey -2 <ksk-filename>* command (see previous chapter to get the absolute filename for the current KSK key, any of the _key_ or _private_ file would do)
150 15 Marc Dequènes
*** full key: in _<ksk-filename>_ the _<key>_ is on a line formated like _<zone-name> <ttl>  IN DNSKEY <flags> <protocol> <algorithm> <key>_ (<flags>, <protocol> and <algorithm> are three numbers, the rest is the <key>; you can copy it with the spaces)
151
** action: add the key to the parent zone
152
** after the DS TTL has passed, it is considered published and the zone is secured with the key
153
** action: wait for the next rollover
154
* *inactive* state:
155
** the key is no more used to sign but still published
156
** action: remove the DS key from the parent zone
157 11 Marc Dequènes
* *deleted* state:
158 12 Marc Dequènes
** the key is not published anymore
159
** action: when you're sure everything went fine, purge old keys (should be automated some day)
160
161
Currently we need to check manually when to do the KSK rollover. The coverage command above and _next key event_ in the zone info should help build a little script to warn us in time.
162
163 1 Marc Dequènes
The plan in the long run is to use CDS/CDNSKEY (RFC 7344). Some interesting reading about an implementation:
164 12 Marc Dequènes
  https://jpmens.net/2017/09/21/parents-children-cds-cdnskey-records-and-dnssec-cds/
165 13 Marc Dequènes
166 1 Marc Dequènes
h3. Checking a Zone
167
168
Test a Zone using a DNSSEC-enabled resolver:
169
<pre>
170
dig <zone-name> +dnssec
171
</pre>
172
173
You need to get the ad flag. If you get the aa flag, then you're interrogating one of the official NS for the zone, then try on another server to be sure your configuration is OK (remotely with *@<server>* as first command option).
174 12 Marc Dequènes
175
Test a Zone using an external web tool:
176
* http://dnssec-debugger.verisignlabs.com/
177
* http://dnsviz.net/
178
179
h3. Forcing a policy change to be applied at once
180 6 Marc Dequènes
181 23 Marc Dequènes
Via Ansible it is possible to change the policy directly and Bind should trigger the changes automagically. Currently we have not tested a change of policy with KASP.yet. We would like to test an algorithm rollover but we're waiting for some other bugs to be fixed first.
182 6 Marc Dequènes
183
h3. Unsecuring a Zone
184
185 23 Marc Dequènes
First the DS needs to be removed from the parent zone, then we need to wait for the DS TTL to expire (and it's probably better to wait a few days for Inetrnet caches to expire) before unsigning (which can be done by changing the zone's _dnssec_policy_ to _insecure_ in the Ansible configuration). It has not been tested yet since we never had the need.
186 6 Marc Dequènes
187 23 Marc Dequènes
Key materials need to be removed manually.
188 6 Marc Dequènes
189
h3. Forcing an Early Rollover
190 1 Marc Dequènes
191
It is possible to do so: https://blog.webernetz.net/dnssec-ksk-emergency-rollover/
192
193 23 Marc Dequènes
You can trigger an immediate change of KSK (with <key-id> the ID of the key you wish to replace):
194
<pre>
195
rndc dnssec -rollover -key <key-id> <zone-name>
196
</pre>
197
198
There is currently a bug so it may take up to a week to trigger.
199 9 Marc Dequènes
200
h2. Checking Servers
201
202
* "ISC EDNS Compliance Tester":https://ednscomp.isc.org/ednscomp/
203 14 Marc Dequènes
204 20 Marc Dequènes
h3. DNSSEC Checks
205
206
Should return a A record and have the *ad* flag set:
207
<pre>
208
dig sigok.verteiltesysteme.net @127.0.0.1
209
</pre>
210
211
212
Should return *SERVFAIL*:
213
<pre>
214
dig sigfail.verteiltesysteme.net @127.0.0.1
215
</pre>
216
217
218 14 Marc Dequènes
h2. Problems
219
220
h3. receive_secure_serial: not exact
221
222
This means the inline-signing journal is corrupted and changes to the zone cannot be applied to the signed zoned.
223
224
Workaround:
225
<pre>
226
rndc sync -clean <zone>
227
rndc stop
228
</pre>
229
then bump the zone's serial and restart Bind, it should have solved the problem.
230 19 Marc Dequènes
231
If this does not work:
232
<pre>
233
systemctl stop bind9
234
rm /var/cache/bind/masters/<zone>.zone.*
235
systemctl start bind9
236
</pre>