summaryrefslogtreecommitdiff
path: root/markdown/OpenDNSSEC.md
blob: 49e28681d60ff171e6fc33939c82d048b2c3d4c2 (plain) (blame)
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
135
136
137
138

   

DNSSEC signing using OpenDNSSEC and a Cryptech alpha board rev03

Before you start, you'll need

  • A Cryptech Alpha board, preferrably revision "rev03"
  • APT on the host system configured to find packages in the Cryptech

repository, see BinaryPackages for instructions

apt-get install cryptech-alpha opendnssec opensc

Once you have the software package installed, you may need to [wiki:Upgrading upgrade your HSM's firmware].

Configure the HSM

For now, connect USB cables to both the DATA and MGMT ports of your HSM and plug them into the host where you will be running OpenDNSSEC. In production use it should not be necessary to leave the MGMT port connected, but it's easier to set up this way, and, as this is still a development platform, this is the configuration that's gotten the most testing.

# eval $(cryptech_probe)
# cryptech_muxd &
# cryptech_console

Username: wheel
Password: YouReallyNeedToChangeThisPINRightNowWeAreNotKidding

cryptech> keystore set pin wheel supersikritnewpw
cryptech> keystore set pin so 123456
cryptech> keystore set pin user 1234

cryptech> masterkey set EFBEADDE
^C

Leave cryptech_muxd running, so that the PKCS !#11 library can use it to talk to the HSM.

Configure OpenDNSSEC

mkdir /var/lib/opendnssec/cryptech

cat > /var/lib/opendnssec/unsigned/example.com << EOF
\$TTL 600
example.com.  IN SOA  hidden-master.example.com. hostmaster.example.com. (
                                2016041401 ; serial
                                720        ; 28800      ; refresh (8 hours)
                                720        ; 7200       ; retry (2 hours)
                                300        ; 604800     ; expire (1 week)
                                120        ; 3600       ; minimum (1 hour)
                                )

               NS      lab.cryptech.is.
test           A       127.0.0.1
EOF

chown -R opendnssec: /var/lib/opendnssec/*

OpenDNSSEC configuration changes

/etc/opendnssec/conf.xml:

<Repository name="Cryptech">
        <Module>/usr/lib/libcryptech-pkcs11.so</Module>
        <TokenLabel>Cryptech Token</TokenLabel>
        <PIN>1234</PIN>
        <SkipPublicKey/>
</Repository>

The PIN is whatever was chosen as PIN for 'user' above. The TokenLabel has to be "Cryptech Token", not something you choose.

/etc/opendnssec/kasp.xml:

s/SoftHSM/Cryptech/

/etc/opendnssec/zonelist.xml:

<Zone name="example.com">
        <Policy>lab</Policy>
        <SignerConfiguration>/var/lib/opendnssec/signconf/example.com.xml</SignerConfiguration>
        <Adapters>
                <Input>
                        <Adapter type="File">/var/lib/opendnssec/unsigned/example.com</Adapter>
                </Input>
                <Output>
                        <Adapter type="File">/var/lib/opendnssec/signed/example.com</Adapter>
                </Output>
        </Adapters>
</Zone>

Initialization and signing

Make the deamons reload their configuration:

    service opendnssec-enforcer restart
    service opendnssec-signer restart

Initialize opendnssec:

    ods-ksmutil setup

That should be it!

See /var/log/syslog for output from ods-kaspcheck, ods-enforcerd and ods-signerd. See /var/lib/opendnssec/signed/ for a signed example.com zone.

To list keys using ods-ksmutil, accessing the HSM using pkcs11 directly (rather than going through any of the opendnssec daemons), export the environment variables from /etc/default/opendnssec and run "ods-ksmutil keys list --verbose":

# ods-ksmutil keys list --verbose
SQLite database set to: /var/lib/opendnssec/kasp.db
Keys:
Zone:                           Keytype:      State:    Date of next transition (to):  Size:   Algorithm:  CKA_ID:                           Repository:                       Keytag:
example.com                     KSK           ready     waiting for ds-seen (active)   2048    8           7f9b9329480ebe5dc81054ccb293e261  Cryptech                          62642
example.com                     ZSK           active    2016-07-13 19:04:30 (retire)   1024    8           97e972633613bd605944a0531ff5399b  Cryptech                          56620

If the output for repository is "Cryptech NOT IN repository", ods-ksmutil has not been able to actually list the keys in the HSM.