DNS » History » Version 12
Marc Dequènes, 2019-01-01 10:52
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 | 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. Only the zone content is not Ansible managed. |
||
14 | |||
15 | 9 | Marc Dequènes | h3. Updating a Zone |
16 | |||
17 | 2 | Marc Dequènes | Better to check the file validity before updating the zone: |
18 | <pre> |
||
19 | named-checkzone <zone-name> <zone-file> |
||
20 | </pre> |
||
21 | 1 | Marc Dequènes | |
22 | 7 | Marc Dequènes | Then to update the zone, if DNSSEC-signed (except on _Elwing_, use the usual reload command below, more info in the DNSSEC chapter): |
23 | 2 | Marc Dequènes | <pre> |
24 | ods-signer sign <zone-name> |
||
25 | </pre> |
||
26 | else: |
||
27 | <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 | See: http://www.microhowto.info/howto/reset_the_serial_number_of_a_dns_zone.html |
||
36 | |||
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 | 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 | 6 | Marc Dequènes | h2. DNSSEC (with OpenDNSSEC, all server except Elwing) |
52 | 1 | Marc Dequènes | |
53 | 3 | Marc Dequènes | h3. Introduction |
54 | |||
55 | Better read some documentation before fiddling with the controls: |
||
56 | * "Supported rollover methods with OpenDNSSEC":https://wiki.opendnssec.org/display/DOCS/Key+Rollovers |
||
57 | * "Explanation about the OpenDNSSEC key states":https://wiki.opendnssec.org/display/DOCS/Key+States |
||
58 | * "Deeper explanation about the OpenDNSSEC key states":https://wiki.opendnssec.org/display/DOCS20/Key+States+Explained |
||
59 | |||
60 | List of keys with states and IDs: |
||
61 | <pre> |
||
62 | ods-enforcer key list -v |
||
63 | </pre> |
||
64 | |||
65 | List of planned rollover dates: |
||
66 | <pre> |
||
67 | ods-enforcer rollover list |
||
68 | </pre> |
||
69 | |||
70 | h3. Key Rollover |
||
71 | |||
72 | The ZSK key rollover is handled automatically by OpenDNSSEC, so admins have nothing to do. |
||
73 | |||
74 | The KSK rollover implies contact with the parent zone and a manual step to get the DS entry in their zone is needed. |
||
75 | |||
76 | h3. KSK Rollover Workflow |
||
77 | |||
78 | Here are the states and what needs to be done: |
||
79 | * *publish* state: |
||
80 | ** when a new key is created, either for a new zone of to replace an old key, this key is added to the zone but not used to sign yet |
||
81 | ** action: wait |
||
82 | * *ready* state: |
||
83 | ** the new zone, containing the key, is considered propagated, but not used to sign yet |
||
84 | 4 | Marc Dequènes | ** action: export the key, either using the DNSKEY or DS format depending on the provider (*ods-enforcer key export -z <zone-name> --keytype KSK --keystate ready* for the DNSKEY, or add *--ds* for the DS) |
85 | ** action: add the key to the parent zone |
||
86 | 1 | Marc Dequènes | ** action: wait for the key to appear in the parent zone (*host -t DS -r <zone-name> $(host -t NS <tld> | grep "name server" | head -n 1 | cut -d" " -f4)*) |
87 | 4 | Marc Dequènes | ** action: notify OpenDNSSEC (*ods-enforcer key ds-seen -z <zone-name> --cka_id <key-id>*) |
88 | * *active* state: |
||
89 | ** the key is used for signing |
||
90 | ** action: wait for the next rollover |
||
91 | * *retire* state: |
||
92 | ** the key is no more used to sign but still advertized |
||
93 | ** action: remove the key from the parent zone |
||
94 | 5 | Marc Dequènes | ** action: wait for the key to disappear from the parent zone (*host -t DS -r <zone-name> $(host -t NS <zone-tld> | grep "name server" | head -n 1 | cut -d" " -f4)*) |
95 | 4 | Marc Dequènes | ** action: notify OpenDNSSEC (*ods-enforcer key ds-gone -z <zone-name> --cka_id <key-id>*) |
96 | 5 | Marc Dequènes | ** action: when you're sure everything went fine, purge old keys (*ods-enforcer key purge --policy default*) |
97 | 1 | Marc Dequènes | |
98 | 5 | Marc Dequènes | h3. Checking a Zone |
99 | |||
100 | Test a Zone using a DNSSEC-enabled resolver: |
||
101 | <pre> |
||
102 | dig <zone-name> +dnssec |
||
103 | </pre> |
||
104 | 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). |
||
105 | |||
106 | Test a Zone using an external web tool: |
||
107 | * http://dnssec-debugger.verisignlabs.com/ |
||
108 | * http://dnsviz.net/ |
||
109 | |||
110 | h3. Forcing a policy change to be applied at once |
||
111 | |||
112 | <pre> |
||
113 | ods-enforcer enforce |
||
114 | </pre> |
||
115 | |||
116 | h3. Unsecuring a Zone |
||
117 | |||
118 | If you plan to continue using the zone, better not remove DNSSEC support at once or until all DNSSEC information leaves the caches on the Internet problems are to be expected. |
||
119 | |||
120 | A special *unsigned* policy has been added to the _opendnssec_ Ansible role. It was created using the specifications in the OpenDNSSEC documentation but has never been tested. |
||
121 | |||
122 | In Ansible you need to affect this policy to your zone and deploy. Then follow the KSK rollover procedure until all keys have been retired. Then you can unconfigure DNSSEC for the zone. |
||
123 | |||
124 | To buy some time you might try to force an early rollover (see below). |
||
125 | |||
126 | h3. Forcing an Early Rollover |
||
127 | |||
128 | <pre> |
||
129 | 1 | Marc Dequènes | ods-enforcer key rollover --zone <zone-name> --keytype ksk |
130 | 6 | Marc Dequènes | </pre> |
131 | |||
132 | 1 | Marc Dequènes | h2. DNSSEC (with Bind, only Elwing) |
133 | 6 | Marc Dequènes | |
134 | 7 | Marc Dequènes | Here are notes about using Bind inline-signing and key management in place of OpenDNSSEC. Until this is deemed stable enough and well tested, this will only affect DNSSEC-enabled zones on Elwing. Important fixes for inline-signing are expected in version 9.13 (so 9.14 stable), and hopefully more DNSSEC tooling improvements. |
135 | 6 | Marc Dequènes | |
136 | All general info above about DNSSEC does not change, expecially the rollover steps are similar even if the tooling change, and testing the zone is identical. |
||
137 | |||
138 | The Ansible _bind_ role has been updated in a branch to be able to use Bind directly for DNSSEC. Our Ansible repository now tracks this branch (which still supports OpenDNSSEC) 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. |
||
139 | 1 | Marc Dequènes | |
140 | h3. Introduction |
||
141 | |||
142 | 7 | Marc Dequènes | Better read some documentation before fiddling with the controls: |
143 | * https://ftp.isc.org/isc/dnssec-guide/html/dnssec-guide.html |
||
144 | * https://kb.isc.org/docs/aa-00711 |
||
145 | * https://securityblog.switch.ch/2014/11/13/dnssec-signing-your-domain-with-bind-inline-signing/ |
||
146 | 6 | Marc Dequènes | |
147 | 7 | Marc Dequènes | Key materials are initially created by the role when a zone is declared in Ansible, so no need to do anything outside Ansible. Cleanup when a zone is removed is not yet done though. As Bind is not using the usual date-based zone serial, it can be less misleading to reset the serial (see dedicated chapter above). |
148 | |||
149 | 10 | Marc Dequènes | h3. Zone Status |
150 | |||
151 | 6 | Marc Dequènes | General zone info, including the real published serial (after signing, resigning if it happens, rollovers…) and planned signing events: |
152 | <pre> |
||
153 | rndc zonestatus <zone-name> |
||
154 | </pre> |
||
155 | |||
156 | 10 | Marc Dequènes | h4. Zone Keys |
157 | |||
158 | 6 | Marc Dequènes | To know which keys are currently signing a zone: |
159 | <pre> |
||
160 | rndc signing -list <zone-name> |
||
161 | </pre> |
||
162 | |||
163 | There is no way yet to know which is the KSK or ZSK without looking at the key materials. Keys are stored in _/etc/bind/keys_ and you can use the key ID to locate the corresponding file this way: |
||
164 | <pre> |
||
165 | 8 | Marc Dequènes | ls /etc/bind/keys/K<zone-name>.+*+*<key-id>.key |
166 | 6 | Marc Dequènes | </pre> |
167 | |||
168 | Inside you can read the key type (KSK/ZSK) and the lifetime schedule (so important rollover dates). |
||
169 | |||
170 | *DO NOT CHANGE KEY INFORMATION !!!* Do not even use the _dnssec-settime_ tool directly. _dnssec-keymgr_ is in charge of the key maintenance according to the policy. Read more about rollover below. |
||
171 | 10 | Marc Dequènes | |
172 | h4. Parent Zone Publishing |
||
173 | |||
174 | To see if the zone keys are properly published in the parent zone: |
||
175 | <pre> |
||
176 | dnssec-checkds <zone-name> |
||
177 | </pre> |
||
178 | |||
179 | (SHA-1 is obsolete, so not published) |
||
180 | |||
181 | |||
182 | 6 | Marc Dequènes | |
183 | h3. Key Rollover |
||
184 | |||
185 | The ZSK key rollover is handled automatically by Bind (_dnssec-keymgr_ in crontab), so admins have nothing to do. |
||
186 | |||
187 | The KSK rollover implies contact with the parent zone and a manual step to get the DS entry in their zone is needed. Creating the new keys and planning the change is also done automatically using the same tool. |
||
188 | |||
189 | To get a view of the schedule (past events for currently involved keys are displayed too) (beware it is using UTC): |
||
190 | <pre> |
||
191 | dnssec-coverage -K /etc/bind/keys -m 1w -d 1d -k |
||
192 | </pre> |
||
193 | |||
194 | h3. KSK Rollover Workflow |
||
195 | |||
196 | 1 | Marc Dequènes | The workflow is the same except there is no way to notify bind a change occurred, thus we *must* do the rollover in time or update the policy to allow more time (via Ansible parameters). |
197 | |||
198 | 11 | Marc Dequènes | 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. |
199 | |||
200 | To get the DS RR to set in the parent zone, first get the absolute filename for the current KSK key (see previous chapter, any of the _key_ or _private_ file would do), and use this command: |
||
201 | <pre> |
||
202 | dnssec-dsfromkey -2 <ksk-filename> |
||
203 | </pre> |
||
204 | 6 | Marc Dequènes | |
205 | 7 | Marc Dequènes | The plan in the long run is to use CDS/CDNSKEY (RFC 7344). Some interesting reading about an implementation: |
206 | https://jpmens.net/2017/09/21/parents-children-cds-cdnskey-records-and-dnssec-cds/ |
||
207 | 6 | Marc Dequènes | |
208 | 12 | Marc Dequènes | h3. Checking a Zone |
209 | |||
210 | Test a Zone using a DNSSEC-enabled resolver: |
||
211 | <pre> |
||
212 | dig <zone-name> +dnssec |
||
213 | </pre> |
||
214 | 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). |
||
215 | |||
216 | Test a Zone using an external web tool: |
||
217 | * http://dnssec-debugger.verisignlabs.com/ |
||
218 | * http://dnsviz.net/ |
||
219 | |||
220 | |||
221 | 6 | Marc Dequènes | h3. Forcing a policy change to be applied at once |
222 | |||
223 | Via Ansible it is possible to change the policy directly, then either wait a few hours or run _dnssec-keymgr_ manually (as _bind_ user). |
||
224 | |||
225 | h3. Unsecuring a Zone |
||
226 | |||
227 | First the DS needs to be removed from the parent zone, then we need to wait for the DS TTL to expire before unsigning. |
||
228 | |||
229 | The Ansible config can then be updated. Key materials need to be removed manually. |
||
230 | |||
231 | h3. Forcing an Early Rollover |
||
232 | |||
233 | Currently I'm not sure how it would interact with the _dnssec-keymgr_ operations so I need to test. |
||
234 | |||
235 | It is possible to do so: https://blog.webernetz.net/dnssec-ksk-emergency-rollover/ |
||
236 | |||
237 | 1 | Marc Dequènes | In our case we already do have pre-generated waiting keys scheduled to be injected, so changing the timing of the current key to reduce its lifetime and rerunning _dnssec-keymgr_ manually (as _bind_ user) should do the trick, but I need to test. |
238 | 9 | Marc Dequènes | |
239 | h2. Checking Servers |
||
240 | |||
241 | * "ISC EDNS Compliance Tester":https://ednscomp.isc.org/ednscomp/ |