Agenda: dnssec-bind-inline-signing-howto.txt

File dnssec-bind-inline-signing-howto.txt, 7.9 KB (added by admin, 5 years ago)
Line 
1Automated zone INLINE signing with BIND
2---------------------------------------
3
4Remember that if you see '#' before a command, it means
5you need to run this command as root, either via:
6
7
8a) sudo -s
9
10b) sudo command
11
12We'll build on the previous labs and enable inline signing on BIND (9.9+)
13
14When doing inline signing, the original zone is never modified: this
15allows the operator to make, for example, a dump of a DB containing the
16zone, and BIND will just sign it.
17
18When the unsigned zone is updated, named detects the changes, and re-signs.
19
20*** ON YOUR MASTER (auth1) SERVER ***
21
221. We're going to add a couple of statements to the BIND named.conf
23   configuration file to enable inline dnssec signing.
24
25   First, edit named.conf under /etc/namedb/, and make the following changes:
26
27        zone "mytld" {
28        file "/etc/namedb/master/mytld";    // <--- remove ".signed", if there
29                                                   
30        type master;
31        allow-transfer { key mydomain-key; };   
32
33        key-directory "/etc/namedb/keys";   // <--- Add this if not done
34        auto-dnssec maintain;               // <--- Add this if not yet done
35        inline-signing yes;                 // <--- Add this
36
37        // update-policy local;             // <--- Remove if it's there
38        };
39
40    Save and exit.
41
422. Preparing the keys
43
44        If you've done the manual signing lab from before, you have already
45        generated keys, and we can reuse those. Otherwise, we'll generate
46        a new set of keys.
47
48    a) If you already have keys (otherwise go to step b)
49
50    We need to make sure the directory has the right permissions - since BIND
51    will be managing this, it needs access to the files and the directory:
52
53        $ sudo chown -R bind /etc/namedb/keys
54
55    Let's look at the keys, listed by time (oldest to newest)
56
57        $ cd /etc/namedb/keys/
58    $ ls -ltr Kmytld*
59    -rw-r--r--  1 bind  wheel   591 Feb 18 15:52 Kmytld.+008+52159.key
60    -rw-------  1 bind  wheel  1774 Feb 18 15:52 Kmytld.+008+52159.private
61    -rw-r--r--  1 bind  wheel   417 Feb 18 15:52 Kmytld.+008+51333.key
62    -rw-------  1 bind  wheel  1010 Feb 18 15:52 Kmytld.+008+51333.private
63
64    If you have extra ZSK and KSK from manual key rollover exercizes,
65    delete the oldest ZSK and KSK. Make sure to leave just one KSK and
66        one ZSK. If you delete the wrong ones, reconfig with the web
67        interface (or submit a new DS via scp!)
68
69        b) If you don't have keys yet:
70
71        $ sudo mkdir -p /etc/namedb/keys
72        $ sudo chown -R bind /etc/namedb/keys
73    $ cd /etc/namedb/keys
74
75        - Generate first key pair (Zone Signing Key)
76
77    $ sudo dnssec-keygen -a RSASHA256 mytld
78
79    ... will output something like:
80
81    Generating key pair......................+++++ + ....
82    Kmytld.+005+51333)
83
84        - Generate second key pair (Key Signing Key)
85
86    $ sudo dnssec-keygen -f KSK -a RSASHA256 mytld
87    Kmytld.+005+52159
88
89    (once again, some output will show)
90
91    Check that the keys are there:
92
93        $ ls -l Kmytld*
94
95        Notice that we don't specify any flags such as algorithm, key size,
96        etc... We're using the defaults for now.
97
98
993. Now let's take care of the zone file
100
101   If you have made a backup of your zone file, let's copy it back over
102   our zone, to start fresh:
103
104        $ cd /etc/namedb/master
105
106        Note the serial number in "mytld.signed"
107
108        $ sudo cp mytld.backup mytld
109
110    Increment the serial in "mytld" (which we just restored from the
111        backup) to be higher than what we noted above.
112
113    Remove the old .signed zone - BIND will create that automatically!
114
115    $ sudo rm mytld.signed
116
117    Again, remember to check in named.conf, that you are loading "mytld",
118    and *NOT* "mytld.signed".
119
120    We also need to make sure BIND can write in the master directory:
121
122    $ sudo chown bind /etc/namedb/master
123
1244. Now reconfig the nameserver
125
126    $ sudo rndc reconfig
127
128    At this point you should see some new files appear in the master/ dir:
129
130        $ cd /etc/namedb/master
131        $ ls -l
132
133...
134-rw-r--r--  1 root  wheel   497 Sep 13 14:56 mytld
135-rw-r--r--  1 root  wheel   497 Sep 12 09:49 mytld.backup
136-rw-r--r--  1 bind  wheel   512 Sep 13 15:04 mytld.jbk
137-rw-r--r--  1 bind  wheel  1331 Sep 13 15:04 mytld.signed
138-rw-r--r--  1 bind  wheel  3581 Sep 13 15:04 mytld.signed.jnl
139...
140
141        Check that signing did work:
142
143        $ sudo rndc signing -list mytld
144        Done signing with key 52159/RSASHA256
145        Done signing with key 51333/RSASHA256
146
147        Also look in the logs:
148
149        $ less /etc/namedb/log/general
150
15113-Sep-2012 15:04:27.444 reloading configuration succeeded
15213-Sep-2012 15:04:27.450 zone mytld/IN (unsigned): loaded serial 2012022301
15313-Sep-2012 15:04:27.451 any newly configured zones are now loaded
15413-Sep-2012 15:04:27.471 zone mytld/IN (signed): loaded serial 2012022301
15513-Sep-2012 15:04:27.493 zone mytld/IN (signed): receive_secure_serial: unchanged
15613-Sep-2012 15:04:27.501 zone mytld/IN (signed): reconfiguring zone keys
15713-Sep-2012 15:04:27.544 zone mytld/IN (signed): next key event: 13-Sep-2012 16:04:27.501
158
159
160        $ dig @localhost mytld NS +dnssec
161
162        Note that the signed zone is not stored in a human readable format.
163
164        To see the contents of the signed zone, one can either do a zone
165        transfer (axfr) or:
166
167        $ sudo named-checkzone -D -f raw -o - mytld mytld.signed | less
168
1695. Changes to the zone
170
171        So how do we update the zone and resign it ? Simple!
172
173        Let's modify the zone and add a "mail" record with the IP address
174        of the auth1 server:
175
176        mail            A               10.10.XX.1              ; X is your group
177
178        So edit the zone file "mytld" and add the line above.
179
180        Remember to update the serial!
181
182        Now, reload the zone. named will be automatically resign the zone:
183
184        $ sudo rndc reload mytld
185
186        Wait a few seconds, then:
187
188        $ tail /etc/namedb/log/general
189
190        What do you observe ?
191
192        $ dig @localhost mail.mytld a
193        $ dig @localhost mytld soa
194
195        - Do the above tests using your own resolver (10.10.X.3)
196        - Also try using the class resolver (10.10.0.230)
197
198        You should be able to resolve "mail.mytld" in all cases.
199
200        Notice the serial!
201
2026. If you haven't already uploaded the DS record in a previous lab, it's
203   time to communicate it to your parent (the root). Otherwise, you can
204   skip the rest of this lab!
205
206    (DS = digest fingerprint of the Key Signing Key).
207
208   Generate a "DS" from your key:
209
210    Find which key is the key signing key:
211
212    $ cd /etc/namedb/keys
213    $ more Kmytld*key
214   
215    Look at which one has "IN DNSKEY 257". Find the "keyid" and replace
216    the string "+008+52159" below with "+008+keyid" where "keyid" is the
217    number displayed.
218
219        $ sudo -s               # We need to be root here!
220    # dnssec-dsfromkey Kmytld.+008+52159 >dsset-mytld.
221        # exit
222        $
223
224    REMEMBER the dot!
225
2267. Upload the dsset for your zone (containing the hash of your zone) to the
227   ROOT server.
228
229   a) If using the RZM:
230
231        Log into the RZM classroom web site at https://rzm.dnssek.org/
232        using your username (your domain name) and password.
233
234    Check to see under Trust Anchor Details that your DS has automatically
235    appeared AND matches. It is NOT automatically activated - the only thing
236    the the RZM has done is "grab" the key from you and is waiting for your
237        confirmation to enable the DS in the parent zone.
238
239    If not, note that you can always add the DS record manually: cut-and-
240        paste the tag/digest data into the proper fields. Then click "Update"
241        to make the change.
242
243        The DS will automatically be included and signed shortly.
244
245        b) If not using the RZM:
246
247    $ scp dsset-mytld. adm@a.root-servers.net:
248
249    The password is the same as in class
250
251    Tell the instructor you have done so!
252
253    The instructor will include the DS-set in the root and re-sign the zone
254
2558. You should be able to verify this:
256
257                $ dig @a.root-servers.net DS mytld.
258
259        And, doing:
260
261                $ dig @10.10.X.3 +dnssec DNSKEY mytld.
262                or
263                $ dig @10.10.0.230 +dnssec DNSKEY mytld.
264
265        should show the "AD" flag bit set indicating the that the validating
266        resolvers were able to successfuly create a chain of trust to the
267        root.
268
269Optional:
270
271        If using the RZM, You may also view the MONITOR clasroom web site in
272        a few minutes to see if it has detected your newly signed TLD:
273       
274        http://monitor.dnssek.org/