]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - doc/pageant.but
Move kh2reg.py link from svn to git.
[PuTTY.git] / doc / pageant.but
1 \C{pageant} Using \i{Pageant} for authentication
2
3 \cfg{winhelp-topic}{pageant.general}
4
5 Pageant is an SSH \i{authentication agent}. It holds your \i{private key}s
6 in memory, already decoded, so that you can use them often
7 \I{passwordless login}without needing to type a \i{passphrase}.
8
9 \H{pageant-start} Getting started with Pageant
10
11 Before you run Pageant, you need to have a private key in \c{*.\i{PPK}}
12 format. See \k{pubkey} to find out how to generate and use one.
13
14 When you run Pageant, it will put an icon of a computer wearing a
15 hat into the \ii{System tray}. It will then sit and do nothing, until you
16 load a private key into it.
17
18 If you click the Pageant icon with the right mouse button, you will
19 see a menu. Select \q{View Keys} from this menu. The Pageant main
20 window will appear. (You can also bring this window up by
21 double-clicking on the Pageant icon.)
22
23 The Pageant window contains a list box. This shows the private keys
24 Pageant is holding. When you start Pageant, it has no keys, so the
25 list box will be empty. After you add one or more keys, they will
26 show up in the list box.
27
28 To add a key to Pageant, press the \q{Add Key} button. Pageant will
29 bring up a file dialog, labelled \q{Select Private Key File}. Find
30 your private key file in this dialog, and press \q{Open}.
31
32 Pageant will now load the private key. If the key is protected by a
33 passphrase, Pageant will ask you to type the passphrase. When the
34 key has been loaded, it will appear in the list in the Pageant
35 window.
36
37 Now start PuTTY and open an SSH session to a site that accepts your
38 key. PuTTY will notice that Pageant is running, retrieve the key
39 automatically from Pageant, and use it to authenticate. You can now
40 open as many PuTTY sessions as you like without having to type your
41 passphrase again.
42
43 (PuTTY can be configured not to try to use Pageant, but it will try
44 by default. See \k{config-ssh-tryagent} and
45 \k{using-cmdline-agentauth} for more information.)
46
47 When you want to shut down Pageant, click the right button on the
48 Pageant icon in the System tray, and select \q{Exit} from the menu.
49 Closing the Pageant main window does \e{not} shut down Pageant.
50
51 \H{pageant-mainwin} The Pageant main window
52
53 The Pageant main window appears when you left-click on the Pageant
54 system tray icon, or alternatively right-click and select \q{View
55 Keys} from the menu. You can use it to keep track of what keys are
56 currently loaded into Pageant, and to add new ones or remove the
57 existing keys.
58
59 \S{pageant-mainwin-keylist} The key list box
60
61 \cfg{winhelp-topic}{pageant.keylist}
62
63 The large list box in the Pageant main window lists the private keys
64 that are currently loaded into Pageant. The list might look
65 something like this:
66
67 \c ssh1    1024 22:c3:68:3b:09:41:36:c3:39:83:91:ae:71:b2:0f:04 k1
68 \c ssh-rsa 1023 74:63:08:82:95:75:e1:7c:33:31:bb:cb:00:c0:89:8b k2
69
70 For each key, the list box will tell you:
71
72 \b The type of the key. Currently, this can be \c{ssh1} (an RSA key
73 for use with the SSH-1 protocol), \c{ssh-rsa} (an RSA key for use
74 with the SSH-2 protocol), \c{ssh-dss} (a DSA key for use with
75 the SSH-2 protocol), or \c{ecdsa-sha2-*} (an ECDSA key for use with
76 the SSH-2 protocol).
77
78 \b The size (in bits) of the key.
79
80 \b The \I{key fingerprint}fingerprint for the public key. This should be
81 the same fingerprint given by PuTTYgen, and (hopefully) also the same
82 fingerprint shown by remote utilities such as \i\c{ssh-keygen} when
83 applied to your \c{authorized_keys} file.
84
85 \b The comment attached to the key.
86
87 \S{pageant-mainwin-addkey} The \q{Add Key} button
88
89 \cfg{winhelp-topic}{pageant.addkey}
90
91 To add a key to Pageant by reading it out of a local disk file,
92 press the \q{Add Key} button in the Pageant main window, or
93 alternatively right-click on the Pageant icon in the system tray and
94 select \q{Add Key} from there.
95
96 Pageant will bring up a file dialog, labelled \q{Select Private Key
97 File}. Find your private key file in this dialog, and press
98 \q{Open}. If you want to add more than one key at once, you can
99 select multiple files using Shift-click (to select several adjacent
100 files) or Ctrl-click (to select non-adjacent files).
101
102 Pageant will now load the private key(s). If a key is protected by a
103 passphrase, Pageant will ask you to type the passphrase.
104
105 (This is not the only way to add a private key to Pageant. You can
106 also add one from a remote system by using agent forwarding; see
107 \k{pageant-forward} for details.)
108
109 \S{pageant-mainwin-remkey} The \q{Remove Key} button
110
111 \cfg{winhelp-topic}{pageant.remkey}
112
113 If you need to remove a key from Pageant, select that key in the
114 list box, and press the \q{Remove Key} button. Pageant will remove
115 the key from its memory.
116
117 You can apply this to keys you added using the \q{Add Key} button,
118 or to keys you added remotely using agent forwarding (see
119 \k{pageant-forward}); it makes no difference.
120
121 \H{pageant-cmdline} The Pageant command line
122
123 Pageant can be made to do things automatically when it starts up, by
124 \I{command-line arguments}specifying instructions on its command line.
125 If you're starting Pageant from the Windows GUI, you can arrange this
126 by editing the properties of the \i{Windows shortcut} that it was
127 started from.
128
129 If Pageant is already running, invoking it again with the options
130 below causes actions to be performed with the existing instance, not a
131 new one.
132
133 \S{pageant-cmdline-loadkey} Making Pageant automatically load keys
134 on startup
135
136 Pageant can automatically load one or more private keys when it
137 starts up, if you provide them on the Pageant command line. Your
138 command line might then look like:
139
140 \c C:\PuTTY\pageant.exe d:\main.ppk d:\secondary.ppk
141
142 If the keys are stored encrypted, Pageant will request the
143 passphrases on startup.
144
145 If Pageant is already running, this syntax loads keys into the
146 existing Pageant.
147
148 \S{pageant-cmdline-command} Making Pageant run another program
149
150 You can arrange for Pageant to start another program once it has
151 initialised itself and loaded any keys specified on its command
152 line. This program (perhaps a PuTTY, or a WinCVS making use of
153 Plink, or whatever) will then be able to use the keys Pageant has
154 loaded.
155
156 You do this by specifying the \I{-c-pageant}\c{-c} option followed
157 by the command, like this:
158
159 \c C:\PuTTY\pageant.exe d:\main.ppk -c C:\PuTTY\putty.exe
160
161 \H{pageant-forward} Using \i{agent forwarding}
162
163 Agent forwarding is a mechanism that allows applications on your SSH
164 server machine to talk to the agent on your client machine.
165
166 Note that at present, agent forwarding in SSH-2 is only available
167 when your SSH server is \i{OpenSSH}. The \i\cw{ssh.com} server uses a
168 different agent protocol, which PuTTY does not yet support.
169
170 To enable agent forwarding, first start Pageant. Then set up a PuTTY
171 SSH session in which \q{Allow agent forwarding} is enabled (see
172 \k{config-ssh-agentfwd}). Open the session as normal. (Alternatively,
173 you can use the \c{-A} command line option; see
174 \k{using-cmdline-agent} for details.)
175
176 If this has worked, your applications on the server should now have
177 access to a Unix domain socket which the SSH server will forward
178 back to PuTTY, and PuTTY will forward on to the agent. To check that
179 this has actually happened, you can try this command on Unix server
180 machines:
181
182 \c unixbox:~$ echo $SSH_AUTH_SOCK
183 \c /tmp/ssh-XXNP18Jz/agent.28794
184 \c unixbox:~$
185
186 If the result line comes up blank, agent forwarding has not been
187 enabled at all.
188
189 Now if you run \c{ssh} on the server and use it to connect through
190 to another server that accepts one of the keys in Pageant, you
191 should be able to log in without a password:
192
193 \c unixbox:~$ ssh -v otherunixbox
194 \c [...]
195 \c debug: next auth method to try is publickey
196 \c debug: userauth_pubkey_agent: trying agent key my-putty-key
197 \c debug: ssh-userauth2 successful: method publickey
198 \c [...]
199
200 If you enable agent forwarding on \e{that} SSH connection as well
201 (see the manual for your server-side SSH client to find out how to
202 do this), your authentication keys will still be available on the
203 next machine you connect to - two SSH connections away from where
204 they're actually stored.
205
206 In addition, if you have a private key on one of the SSH servers,
207 you can send it all the way back to Pageant using the local
208 \i\c{ssh-add} command:
209
210 \c unixbox:~$ ssh-add ~/.ssh/id_rsa
211 \c Need passphrase for /home/fred/.ssh/id_rsa
212 \c Enter passphrase for /home/fred/.ssh/id_rsa:
213 \c Identity added: /home/fred/.ssh/id_rsa (/home/simon/.ssh/id_rsa)
214 \c unixbox:~$
215
216 and then it's available to every machine that has agent forwarding
217 available (not just the ones downstream of the place you added it).
218
219 \H{pageant-security} Security considerations
220
221 \I{security risk}Using Pageant for public-key authentication gives you the
222 convenience of being able to open multiple SSH sessions without
223 having to type a passphrase every time, but also gives you the
224 security benefit of never storing a decrypted private key on disk.
225 Many people feel this is a good compromise between security and
226 convenience.
227
228 It \e{is} a compromise, however. Holding your decrypted private keys
229 in Pageant is better than storing them in easy-to-find disk files,
230 but still less secure than not storing them anywhere at all. This is
231 for two reasons:
232
233 \b Windows unfortunately provides no way to protect pieces of memory
234 from being written to the system \i{swap file}. So if Pageant is holding
235 your private keys for a long period of time, it's possible that
236 decrypted private key data may be written to the system swap file,
237 and an attacker who gained access to your hard disk later on might
238 be able to recover that data. (However, if you stored an unencrypted
239 key in a disk file they would \e{certainly} be able to recover it.)
240
241 \b Although, like most modern operating systems, Windows prevents
242 programs from accidentally accessing one another's memory space, it
243 does allow programs to access one another's memory space
244 deliberately, for special purposes such as debugging. This means
245 that if you allow a virus, trojan, or other malicious program on to
246 your Windows system while Pageant is running, it could access the
247 memory of the Pageant process, extract your decrypted authentication
248 keys, and send them back to its master.
249
250 Similarly, use of agent \e{forwarding} is a security improvement on
251 other methods of one-touch authentication, but not perfect. Holding
252 your keys in Pageant on your Windows box has a security advantage
253 over holding them on the remote server machine itself (either in an
254 agent or just unencrypted on disk), because if the server machine
255 ever sees your unencrypted private key then the sysadmin or anyone
256 who cracks the machine can steal the keys and pretend to be you for
257 as long as they want.
258
259 However, the sysadmin of the server machine can always pretend to be
260 you \e{on that machine}. So if you forward your agent to a server
261 machine, then the sysadmin of that machine can access the forwarded
262 agent connection and request signatures from your private keys, and
263 can therefore log in to other machines as you. They can only do this
264 to a limited extent - when the agent forwarding disappears they lose
265 the ability - but using Pageant doesn't actually \e{prevent} the
266 sysadmin (or hackers) on the server from doing this.
267
268 Therefore, if you don't trust the sysadmin of a server machine, you
269 should \e{never} use agent forwarding to that machine. (Of course
270 you also shouldn't store private keys on that machine, type
271 passphrases into it, or log into other machines from it in any way
272 at all; Pageant is hardly unique in this respect.)