1eb61a0d384bdb7fe07aba258c8a400c60098e59
[monkeysphere.git] / website / signing-host-keys.mdwn
1 # Signing a host's SSH key using OpenPGP #
2
3 This page is meant to address the issue of signing OpenPGP-based SSH
4 host keys.  Machines are not people, so the circumstances under which
5 one should sign a host key are different from those under which one
6 should sign another person's key.
7
8 # Why are signatures on an SSH host key important? #
9
10 In order for users to validate a host (an SSH server) in a
11 monkeysphere-enabled network, the host key must have *full* calculated
12 validity from the perspective of the connecting user.  If the user has
13 not themselves signed the server's key, then the server's key can only
14 be valid if other people that the user trusts have signed the key.
15
16 If only one person has signed the server's key, then the user must
17 fully trust the single person who has signed the host key.  Full trust
18 should be granted sparingly and with consideration, though, so unless
19 the user knows the server admin very well, they will in general not
20 have full trust of this person.
21
22 However, full trust of the host key can also be achieved if the
23 server key has been signed by three or more people that the user has
24  *marginal* trust of.  In other words, three or more *marginally*
25 trusted signatures equals one *fully* trusted signature.  It is much
26 more common for users to have marginal trust of other users in the Web
27 of Trust.  For this reason, it is advisable to have as many people
28 sign the server key as possible.
29
30 ## What information should you have before signing a host key? ##
31
32 Before signing the key of a person, you want to do two things:
33
34 1. verify the identity of the person.
35 2. verify that the person is actually in control of the key that you
36 are signing.
37
38 For a server, you want to do basically the same thing:
39
40 1. verify the identity of the server.
41 2. verify that the server is actually in control of the key that you
42 are signing.
43
44 However, verifying these things for a server is less intuitive than it
45 is for a human.
46
47 Verifying that the host is in control of the key is, in principle,
48 straightforward.  If you are logged on to the machine in question,
49 then you can check directly that the key exists on the system.
50
51 What is not so straightforward is what exactly it means to "verify the
52 identity" of a remote server on the internet?  The identity in this
53 case is the fully qualified domain name (FQDN) of the host.  Verifying
54 this identity amounts to being sure that the host in question really
55 is located at that FQDN.
56
57 ## Signing the host key ##
58
59 If you are the person (or persons) that actually setup the server and
60 configured Monkeysphere and ssh on the server, then you should sign
61 the host key as part of that process.  When the server is first set
62 up, the administrators who set it up are the only ones who can
63 actually vouch for the server key, so their signatures are necessary
64 to get things going.  Their signatures are also necessary so that they
65 can validate the host key themselves and log into the server via
66 monkeysphere-enabled ssh in the future.
67
68 If you did not set up the server initially, you do not have an
69 accumulated full trust of the person(s) who did, and you do not
70 necessarily have console access to the server directly, it's hard to
71 confidently verify the server identity and key ownership.  You would
72 like to be able to walk up to the server, log in at the console, and
73 get the fingerprint of the ssh host key directly.  But this is usually
74 impossible.
75
76 However, it is still possible to verify the server identity *and*
77 server ownership of the key, even in this case.
78
79 ## Remotely verifying host identity and key possession ##
80
81 It is in fact possible to verify the identity and key ownership of a
82 server in one fell swoop with monkeysphere-enabled ssh.  Here is the
83 procedure:
84
85 > **Attempt to make a monkeysphere-enabled ssh connection to the host in
86 question.  Monkeysphere will check that the ssh host key offered by the
87 host matches the OpenPGP key with the correct host FQDN user ID.  If
88 the ssh host key and the OpenPGP key with the correct user ID match,
89 then you will have effectively:**
90
91 >**1. verified the host identity, because you actually connected to the
92 host in question, which you know because you:**
93
94 >**2. verified the host is in control of the key, because the ssh host
95 key offered by the host matches the OpenPGP key with correct host FQDN
96 user ID.**
97
98 Here is an example:
99
100         servo:~ 0$ ssh zimmermann.mayfirst.org
101         -------------------- Monkeysphere warning -------------------
102         Monkeysphere found OpenPGP keys for this hostname, but none had full validity.
103         An OpenPGP key matching the ssh key offered by the host was found:
104         
105         pub   2048R/860E8F9C 2008-10-29 [expires: 2009-02-26]
106         uid       [marginal] ssh://zimmermann.mayfirst.org
107         sig!         76CC057D 2008-11-15  Jamie McClelland <jamie@mayfirst.org>
108         sig!3        860E8F9C 2008-10-29  ssh://zimmermann.mayfirst.org
109         sig!         D21739E9 2008-10-29  Daniel Kahn Gillmor <dkg@fifthhorseman.net>
110         sig!         1CF2D62A 2008-11-16  Micah Anderson <micah@riseup.net>
111         
112         RSA key fingerprint is 81:96:13:3e:24:c9:3c:5b:3c:6d:55:ba:58:85:e9:9e.
113         -------------------- ssh continues below --------------------
114         The authenticity of host 'zimmermann.mayfirst.org (<no hostip for proxy command>)' can't be established.
115         RSA key fingerprint is 81:96:13:3e:24:c9:3c:5b:3c:6d:55:ba:58:85:e9:9e.
116         No matching host key fingerprint found in DNS.
117         Are you sure you want to continue connecting (yes/no)? no
118         Host key verification failed.
119         servo:~ 255$ 
120
121 I have attempted to connect to the host zimmermann.mayfirst.org.
122 zimmermann's host key has only *marginal* validity for the FQDN user
123 ID in question, so I am not able to connect.  However, the
124 Monkeysphere has checked that the ssh host key actually does match the
125 OpenPGP key with the correct user ID `ssh://zimmermann.mayfirst.org`.
126 I have therefore verified the identity of zimmermann, and verified
127 that zimmermann is in possession of the key in question.