| 1 | Zone signing with OpenDNSSEC - part 1 |
|---|
| 2 | |
|---|
| 3 | 1. Initialize the Software "Hardware Security Module" |
|---|
| 4 | |
|---|
| 5 | # mkdir -p /usr/local/var/lib/softhsm |
|---|
| 6 | |
|---|
| 7 | # softhsm --init-token --slot 0 --label OpenDNSSEC |
|---|
| 8 | |
|---|
| 9 | (use '1234' for both questions below): |
|---|
| 10 | |
|---|
| 11 | The SO PIN must have a length between 4 and 255 characters. |
|---|
| 12 | Enter SO PIN: **** |
|---|
| 13 | The user PIN must have a length between 4 and 255 characters. |
|---|
| 14 | Enter user PIN: **** |
|---|
| 15 | The token has been initialized. |
|---|
| 16 | |
|---|
| 17 | # softhsm --show-slots |
|---|
| 18 | |
|---|
| 19 | Create configuration files for OpenDNSSEC by making a copy |
|---|
| 20 | of the samples distributed with the package: |
|---|
| 21 | |
|---|
| 22 | # cd /usr/local/etc/opendnssec |
|---|
| 23 | # cp kasp.xml.sample kasp.xml |
|---|
| 24 | # cp conf.xml.sample conf.xml |
|---|
| 25 | # cp zonefetch.xml.sample zonefetch.xml |
|---|
| 26 | # cp zonelist.xml.sample zonelist.xml |
|---|
| 27 | # chmod 644 *xml |
|---|
| 28 | |
|---|
| 29 | 2. Change the default Policy to use NSEC instead of NSEC3: |
|---|
| 30 | |
|---|
| 31 | Edit /usr/local/etc/opendnssec/kasp.xml |
|---|
| 32 | |
|---|
| 33 | Find this section, and remove all the lines from <NSEC3> ... </NSEC3> |
|---|
| 34 | |
|---|
| 35 | <NSEC3> |
|---|
| 36 | <!-- <OptOut/> --> |
|---|
| 37 | <Resalt>P100D</Resalt> |
|---|
| 38 | <Hash> |
|---|
| 39 | <Algorithm>1</Algorithm> |
|---|
| 40 | <Iterations>5</Iterations> |
|---|
| 41 | <Salt length="8"/> |
|---|
| 42 | </Hash> |
|---|
| 43 | </NSEC3> |
|---|
| 44 | |
|---|
| 45 | ... and replace them with this single line: |
|---|
| 46 | |
|---|
| 47 | <NSEC/> |
|---|
| 48 | |
|---|
| 49 | Save & exit. |
|---|
| 50 | |
|---|
| 51 | Also, set the correct path for the libsofthsm.so in the conf.xml: |
|---|
| 52 | |
|---|
| 53 | Change |
|---|
| 54 | |
|---|
| 55 | <Module>/usr/local/lib/libsofthsm.so</Module> |
|---|
| 56 | |
|---|
| 57 | to |
|---|
| 58 | |
|---|
| 59 | <Module>/usr/local/lib/softhsm/libsofthsm.so</Module> |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | 3. Initialize the KSM |
|---|
| 63 | |
|---|
| 64 | # ods-ksmutil setup |
|---|
| 65 | |
|---|
| 66 | *WARNING* This will erase all data in the database; are you sure? [y/N] y |
|---|
| 67 | SQLite database set to: /usr/local/var/opendnssec/kasp.db |
|---|
| 68 | fixing permissions on file /usr/local/var/opendnssec/kasp.db |
|---|
| 69 | zonelist filename set to /usr/local/etc/opendnssec/zonelist.xml. |
|---|
| 70 | kasp filename set to /usr/local/etc/opendnssec/kasp.xml. |
|---|
| 71 | Repository SoftHSM found |
|---|
| 72 | No Maximum Capacity set. |
|---|
| 73 | RequireBackup NOT set; please make sure that you know the potential |
|---|
| 74 | problems of using keys which are not recoverable |
|---|
| 75 | /usr/local/etc/opendnssec/conf.xml validates |
|---|
| 76 | /usr/local/etc/opendnssec/kasp.xml validates |
|---|
| 77 | Policy default found |
|---|
| 78 | Info: converting P1Y to seconds; M interpreted as 31 days, Y interpreted as 365 days |
|---|
| 79 | |
|---|
| 80 | 4. Install a copy of the unsigned zone for OpenDNSSEC to sign |
|---|
| 81 | |
|---|
| 82 | Earlier, we made a backup copy of our zone, before it was signed |
|---|
| 83 | by BIND9. We are going to use that backup copy now and make it |
|---|
| 84 | available to OpenDNSSEC. |
|---|
| 85 | |
|---|
| 86 | # cd /etc/namedb/master |
|---|
| 87 | # cp mytld.backup /usr/local/var/opendnssec/unsigned/mytld |
|---|
| 88 | |
|---|
| 89 | 5. Add the zone to OpenDNSSEC's database: |
|---|
| 90 | |
|---|
| 91 | # ods-ksmutil zone add --zone mytld |
|---|
| 92 | |
|---|
| 93 | zonelist filename set to /usr/local/etc/opendnssec/zonelist.xml. |
|---|
| 94 | Imported zone: mytld |
|---|
| 95 | |
|---|
| 96 | 6. Start OpenDNSSEC! |
|---|
| 97 | |
|---|
| 98 | # ods-control start |
|---|
| 99 | |
|---|
| 100 | Starting enforcer... |
|---|
| 101 | OpenDNSSEC ods-enforcerd started (version 1.3.10), pid 63495 |
|---|
| 102 | Starting signer engine... |
|---|
| 103 | Starting signer... |
|---|
| 104 | OpenDNSSEC signer engine version 1.3.10 |
|---|
| 105 | Engine running. |
|---|
| 106 | |
|---|
| 107 | # ps ax | grep ods |
|---|
| 108 | |
|---|
| 109 | 41588 ?? SsJ 0:00.11 /usr/local/sbin/ods-enforcerd |
|---|
| 110 | 41593 ?? SsJ 0:00.07 /usr/local/sbin/ods-signerd |
|---|
| 111 | |
|---|
| 112 | 7. Check that the zone is signed |
|---|
| 113 | |
|---|
| 114 | # ls -l /usr/local/var/opendnssec/signed |
|---|
| 115 | |
|---|
| 116 | -rw-r--r-- 1 root wheel 2621 Feb 19 09:10 mytld |
|---|
| 117 | |
|---|
| 118 | Take a look at the contents of the zone - note the key ids for |
|---|
| 119 | the KSK and ZSK. |
|---|
| 120 | |
|---|
| 121 | If for some reason, you don't see a file in this directory |
|---|
| 122 | (/usr/local/var/opendnssec/signed/), then force the signer to sign: |
|---|
| 123 | |
|---|
| 124 | # ods-signer sign mytld |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | 8. Moment of reflection |
|---|
| 128 | |
|---|
| 129 | Ok, so now the zone is signed with OpenDNSSEC - do notice that the |
|---|
| 130 | zone was signed, but you didn't issue any commands to generate keys. |
|---|
| 131 | |
|---|
| 132 | List the keys currently managed by OpenDNSSEC: |
|---|
| 133 | |
|---|
| 134 | # ods-ksmutil key list |
|---|
| 135 | Keys: |
|---|
| 136 | Zone: Keytype: State: Date of next transition: |
|---|
| 137 | mytld KSK publish 2012-09-14 09:15:09 |
|---|
| 138 | mytld ZSK active 2012-10-13 19:15:09 |
|---|
| 139 | |
|---|
| 140 | Notice that two keys have just been created by OpenDNSSEC, on the fly. |
|---|
| 141 | |
|---|
| 142 | But BIND is still loading the zone that was signed earlier (either |
|---|
| 143 | manually or using the inline signer) - can we just modify the named.conf |
|---|
| 144 | definition and point to the signed zone instead ? |
|---|
| 145 | |
|---|
| 146 | Which KSK is currently being used ? And which DS record is published |
|---|
| 147 | in the parent zone ? |
|---|
| 148 | |
|---|
| 149 | Would the resolvers be able to verify the signatures on the zone |
|---|
| 150 | signed with OpenDNSSEC ? Why not ? What would you have to do for |
|---|
| 151 | it to work (there are several possible answers) |
|---|
| 152 | |
|---|
| 153 | If you don't care about the validation problem, then you can proceed |
|---|
| 154 | with the rest of this lab. |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | 9. Tell BIND to load the new zone |
|---|
| 158 | |
|---|
| 159 | Modify /etc/namedb/named.conf, and change the zone definition for "mytld" |
|---|
| 160 | so it looks like this (REMOVE auto-dnssec, etc...) |
|---|
| 161 | |
|---|
| 162 | zone "mytld" { |
|---|
| 163 | file "/usr/local/var/opendnssec/signed/mytld"; // <--- Change path |
|---|
| 164 | type master; |
|---|
| 165 | key-directory "/etc/namedb/keys"; // <--- Remove if there |
|---|
| 166 | auto-dnssec maintain; // <--- Remove if there |
|---|
| 167 | inline-signing yes; // <--- Remove if there |
|---|
| 168 | }; |
|---|
| 169 | |
|---|
| 170 | Now, BIND is back to being a "passive" nameserver that doesn't sign |
|---|
| 171 | the zone - it just serves the zone signed by OpenDNSSEC. |
|---|
| 172 | |
|---|
| 173 | Restart named: |
|---|
| 174 | |
|---|
| 175 | # service named restart |
|---|
| 176 | |
|---|
| 177 | Check the logs in /etc/namedb/log/general to make sure that the zone |
|---|
| 178 | is loading correctly. |
|---|
| 179 | |
|---|
| 180 | Now, validation will probably fail for those trying to look up data |
|---|
| 181 | in your zone. Wait a few minutes, and try to lookup a record in your |
|---|
| 182 | zone: |
|---|
| 183 | |
|---|
| 184 | # dig www.mytld +dnssec |
|---|
| 185 | |
|---|
| 186 | What do you notice ? |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | 10. OpenDNSSEC reload BIND |
|---|
| 190 | |
|---|
| 191 | Even better, you can have OpenDNSSEC tell BIND to reload the zone when |
|---|
| 192 | it has been signed - like this, no need to manually reload. |
|---|
| 193 | |
|---|
| 194 | To do this, modify /usr/local/etc/opendnssec/conf.xml |
|---|
| 195 | |
|---|
| 196 | Find the lines: |
|---|
| 197 | |
|---|
| 198 | <!-- |
|---|
| 199 | <NotifyCommand>/usr/sbin/rndc reload %zone</NotifyCommand> |
|---|
| 200 | --> |
|---|
| 201 | |
|---|
| 202 | ... remove the comments (the lines '<!--' and '-->') before and after. |
|---|
| 203 | |
|---|
| 204 | Save the file, and restart OpenDNSSEC: |
|---|
| 205 | |
|---|
| 206 | # ods-control stop |
|---|
| 207 | ... |
|---|
| 208 | # ods-control start |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | 11. Export the DS, ready to upload: |
|---|
| 212 | |
|---|
| 213 | # ods-ksmutil key export --zone mytld --ds --keystate publish >/tmp/dsset-mytld. |
|---|
| 214 | |
|---|
| 215 | 12. Upload the DS to the server |
|---|
| 216 | |
|---|
| 217 | # scp /tmp/dsset-mytld. adm@a.root-servers.net: |
|---|
| 218 | |
|---|
| 219 | 13. Notify the administrator! |
|---|
| 220 | |
|---|
| 221 | Ask the root operator to add the new DS to the root zone, and see |
|---|
| 222 | how long it takes before validation starts working again for your zone. |
|---|
| 223 | |
|---|
| 224 | Next, we'll try and see if we can import our old keys so we can avoid |
|---|
| 225 | breaking validation. |
|---|