📄 pageant.but
字号:
\versionid $Id: pageant.but,v 1.1.1.2.6.2 2004/12/29 11:32:20 pekangas Exp $\C{pageant} Using Pageant for authentication\cfg{winhelp-topic}{pageant.general}Pageant is an SSH authentication agent. It holds your private keysin memory, already decoded, so that you can use them often withoutneeding to type a passphrase.\H{pageant-start} Getting started with PageantBefore you run Pageant, you need to have a private key in \c{*.PPK}format. See \k{pubkey} to find out how to generate and use one.When you run Pageant, it will put an icon of a computer wearing ahat into the System tray. It will then sit and do nothing, until youload a private key into it.If you click the Pageant icon with the right mouse button, you willsee a menu. Select \q{View Keys} from this menu. The Pageant mainwindow will appear. (You can also bring this window up bydouble-clicking on the Pageant icon.)The Pageant window contains a list box. This shows the private keysPageant is holding. When you start Pageant, it has no keys, so thelist box will be empty. After you add one or more keys, they willshow up in the list box.To add a key to Pageant, press the \q{Add Key} button. Pageant willbring up a file dialog, labelled \q{Select Private Key File}. Findyour private key file in this dialog, and press \q{Open}.Pageant will now load the private key. If the key is protected by apassphrase, Pageant will ask you to type the passphrase. When thekey has been loaded, it will appear in the list in the Pageantwindow.Now start PuTTY and open an SSH session to a site that accepts yourkey. PuTTY will notice that Pageant is running, retrieve the keyautomatically from Pageant, and use it to authenticate. You can nowopen as many PuTTY sessions as you like without having to type yourpassphrase again.When you want to shut down Pageant, click the right button on thePageant icon in the System tray, and select \q{Exit} from the menu.Closing the Pageant main window does \e{not} shut down Pageant.\H{pageant-mainwin} The Pageant main windowThe Pageant main window appears when you left-click on the Pageantsystem tray icon, or alternatively right-click and select \q{ViewKeys} from the menu. You can use it to keep track of what keys arecurrently loaded into Pageant, and to add new ones or remove theexisting keys.\S{pageant-mainwin-keylist} The key list box\cfg{winhelp-topic}{pageant.keylist}The large list box in the Pageant main window lists the private keysthat are currently loaded into Pageant. The list might looksomething like this:\c ssh1 1024 22:c3:68:3b:09:41:36:c3:39:83:91:ae:71:b2:0f:04 k1\c ssh-rsa 1023 74:63:08:82:95:75:e1:7c:33:31:bb:cb:00:c0:89:8b k2For each key, the list box will tell you:\b The type of the key. Currently, this can be \c{ssh1} (an RSA keyfor use with the SSH v1 protocol), \c{ssh-rsa} (an RSA key for usewith the SSH v2 protocol), or \c{ssh-dss} (a DSA key for use withthe SSH v2 protocol).\b The size (in bits) of the key.\b The fingerprint for the public key. This should be the samefingerprint given by PuTTYgen, and (hopefully) also the samefingerprint shown by remote utilities such as \c{ssh-keygen} whenapplied to your \c{authorized_keys} file.\b The comment attached to the key.\S{pageant-mainwin-addkey} The \q{Add Key} button\cfg{winhelp-topic}{pageant.addkey}To add a key to Pageant by reading it out of a local disk file,press the \q{Add Key} button in the Pageant main window, oralternatively right-click on the Pageant icon in the system tray andselect \q{Add Key} from there.Pageant will bring up a file dialog, labelled \q{Select Private KeyFile}. Find your private key file in this dialog, and press\q{Open}. If you want to add more than one key at once, you canselect multiple files using Shift-click (to select several adjacentfiles) or Ctrl-click (to select non-adjacent files).Pageant will now load the private key(s). If a key is protected by apassphrase, Pageant will ask you to type the passphrase.(This is not the only way to add a private key to Pageant. You canalso add one from a remote system by using agent forwarding; see\k{pageant-forward} for details.)\S{pageant-mainwin-remkey} The \q{Remove Key} button\cfg{winhelp-topic}{pageant.remkey}If you need to remove a key from Pageant, select that key in thelist box, and press the \q{Remove Key} button. Pageant will removethe key from its memory.You can apply this to keys you added using the \q{Add Key} button,or to keys you added remotely using agent forwarding (see\k{pageant-forward}); it makes no difference.\H{pageant-cmdline} The Pageant command linePageant can be made to do things automatically when it starts up, byspecifying instructions on its command line. If you're startingPageant from the Windows GUI, you can arrange this by editing theproperties of the Windows shortcut that it was started from.\S{pageant-cmdline-loadkey} Making Pageant automatically load keyson startupPageant can automatically load one or more private keys when itstarts up, if you provide them on the Pageant command line. Yourcommand line might then look like:\c C:\PuTTY\pageant.exe d:\main.ppk d:\secondary.ppkIf the keys are stored encrypted, Pageant will request thepassphrases on startup.\S{pageant-cmdline-command} Making Pageant run another programYou can arrange for Pageant to start another program once it hasinitialised itself and loaded any keys specified on its commandline. This program (perhaps a PuTTY, or a WinCVS making use ofPlink, or whatever) will then be able to use the keys Pageant hasloaded.You do this by specifying the \c{-c} option followed by the command,like this:\c C:\PuTTY\pageant.exe d:\main.ppk -c C:\PuTTY\putty.exe\H{pageant-forward} Using agent forwardingAgent forwarding is a mechanism that allows applications on your SSHserver machine to talk to the agent on your client machine.Note that at present, agent forwarding in SSH2 is only availablewhen your SSH server is OpenSSH. The \cw{ssh.com} server uses adifferent agent protocol, which PuTTY does not yet support.To enable agent forwarding, first start Pageant. Then set up a PuTTYSSH session in which \q{Allow agent forwarding} is enabled (see\k{config-ssh-agentfwd}). Open the session as normal. (Alternatively,you can use the \c{-A} command line option; see\k{using-cmdline-agent} for details.)If this has worked, your applications on the server should now haveaccess to a Unix domain socket which the SSH server will forwardback to PuTTY, and PuTTY will forward on to the agent. To check thatthis has actually happened, you can try this command on Unix servermachines:\c unixbox:~$ echo $SSH_AUTH_SOCK\c /tmp/ssh-XXNP18Jz/agent.28794\c unixbox:~$If the result line comes up blank, agent forwarding has not beenenabled at all.Now if you run \c{ssh} on the server and use it to connect throughto another server that accepts one of the keys in Pageant, youshould be able to log in without a password:\c unixbox:~$ ssh -v otherunixbox\c [...]\c debug: next auth method to try is publickey\c debug: userauth_pubkey_agent: trying agent key my-putty-key\c debug: ssh-userauth2 successful: method publickey\c [...]If you enable agent forwarding on \e{that} SSH connection as well(see the manual for your server-side SSH client to find out how todo this), your authentication keys will still be available on thenext machine you connect to - two SSH connections away from wherethey're actually stored.In addition, if you have a private key on one of the SSH servers,you can send it all the way back to Pageant using the local\c{ssh-add} command:\c unixbox:~$ ssh-add ~/.ssh/id_rsa\c Need passphrase for /home/fred/.ssh/id_rsa\c Enter passphrase for /home/fred/.ssh/id_rsa:\c Identity added: /home/fred/.ssh/id_rsa (/home/simon/.ssh/id_rsa)\c unixbox:~$and then it's available to every machine that has agent forwardingavailable (not just the ones downstream of the place you added it).\H{pageant-security} Security considerationsUsing Pageant for public-key authentication gives you theconvenience of being able to open multiple SSH sessions withouthaving to type a passphrase every time, but also gives you thesecurity benefit of never storing a decrypted private key on disk.Many people feel this is a good compromise between security andconvenience.It \e{is} a compromise, however. Holding your decrypted private keysin Pageant is better than storing them in easy-to-find disk files,but still less secure than not storing them anywhere at all. This isfor two reasons:\b Windows unfortunately provides no way to protect pieces of memoryfrom being written to the system swap file. So if Pageant is holdingyour private keys for a long period of time, it's possible thatdecrypted private key data may be written to the system swap file,and an attacker who gained access to your hard disk later on mightbe able to recover that data. (However, if you stored an unencryptedkey in a disk file they would \e{certainly} be able to recover it.)\b Although, like most modern operating systems, Windows preventsprograms from accidentally accessing one another's memory space, itdoes allow programs to access one another's memory spacedeliberately, for special purposes such as debugging. This meansthat if you allow a virus, trojan, or other malicious program on toyour Windows system while Pageant is running, it could access thememory of the Pageant process, extract your decrypted authenticationkeys, and send them back to its master.Similarly, use of agent \e{forwarding} is a security improvement onother methods of one-touch authentication, but not perfect. Holdingyour keys in Pageant on your Windows box has a security advantageover holding them on the remote server machine itself (either in anagent or just unencrypted on disk), because if the server machineever sees your unencrypted private key then the sysadmin or anyonewho cracks the machine can steal the keys and pretend to be you foras long as they want.However, the sysadmin of the server machine can always pretend to beyou \e{on that machine}. So if you forward your agent to a servermachine, then the sysadmin of that machine can access the forwardedagent connection and request signatures from your public keys, andcan therefore log in to other machines as you. They can only do thisto a limited extent - when the agent forwarding disappears they losethe ability - but using Pageant doesn't actually \e{prevent} thesysadmin (or hackers) on the server from doing this.Therefore, if you don't trust the sysadmin of a server machine, youshould \e{never} use agent forwarding to that machine. (Of courseyou also shouldn't store private keys on that machine, typepassphrases into it, or log into other machines from it in any wayat all; Pageant is hardly unique in this respect.)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -