Contents of /xml/htdocs/proj/en/infrastructure/cvs-sshkeys.xml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.8 - (show annotations) (download) (as text)
Sun Mar 11 19:44:22 2012 UTC (6 years, 3 months ago) by robbat2
Branch: MAIN
Changes since 1.7: +6 -2 lines
File MIME type: application/xml
Add link to official SSH fingerprints, and clarify that the fingerprint on the page is from the output of ssh-keygen.

1 <?xml version='1.0' encoding="UTF-8"?>
2 <?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?>
3 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 <guide>
6 <title>SSH access to cvs.gentoo.org</title>
8 <author title="Author">
9 <mail link="swift"/>
10 </author>
11 <author title="Author">
12 <mail link="robbat2"/>
13 </author>
14 <author title="Author">
15 <mail link="antarus"/>
16 </author>
17 <author title="Editor">
18 <mail link="nightmorph"/>
19 </author>
21 <abstract>
22 This mini-guide explains on how to create and use ssh-keys, especially
23 for use on cvs.gentoo.org.
24 </abstract>
26 <version>1.3</version>
27 <date>2011-10-14</date>
29 <chapter>
30 <title>SSH keys</title>
31 <section>
32 <title>Key Handling</title>
33 <body>
34 <p>
35 Your SSH keypair authenticates you to Gentoo Infrastructure. Properly
36 handling these keys is vital to keeping our machines safe. Please try to
37 follow these guidelines.
38 </p>
40 <ul>
41 <li>Place your private keys <b>only</b> on machines you trust. This means only you have root
42 on these machines and they are not shared with other users.
43 </li>
44 <li>Do not trust Gentoo Infrastructure. Do not place copies of your keys
45 on Gentoo machines (like dev.gentoo.org.) You may forward your SSH agent
46 through Gentoo managed machines if they are configured to allow users to
47 agent forward (more on forwarding later.)
48 </li>
49 <li>Encrypt your keys with a strong passphrase. If you have trouble making
50 a passphrase try emerge pwgen; pwgen -sB 25
51 </li>
52 <li>Do not access Gentoo infrastructure from untrusted machines such as business
53 kiosks at hotels, internet cafes, or machines at computer conferences. Many of these machines
54 are infected with malware.</li>
55 <li>If you believe your keys were compromised, contact infrastructure immediately.
56 You can do this via #gentoo-infra on irc.freenode.net or by emailing incidents@gentoo.org.
57 </li>
58 <li>Official hostkey fingerprints for Gentoo Infrastructure servers are
59 available on the <uri link="/proj/en/infrastructure/server-specs"> server
60 specifications </uri> page.
61 </li>
62 </ul>
63 </body>
64 </section>
65 <section>
66 <title>Creating the SSH keys</title>
67 <body>
69 <p>
70 First of all, be physically logged on to your own computer. Make sure
71 that no-one will see you typing stuff in, since we are going to type in
72 passphrases and such. So get your pepperspray and fight all untrusted
73 entities until you are home alone.
74 </p>
76 <p>
77 Now we are going to create our ssh keys, DSA keys to be exact. Log onto
78 your computer as the user that you are going to be using when you want
79 to access cvs.gentoo.org. Then issue <c>ssh-keygen -t dsa</c>:
80 </p>
82 <pre caption="Creating SSH keys">
83 $ <i>ssh-keygen -t dsa</i>
84 Generating public/private dsa key pair.
85 Enter file in which to save the key (/home/temp/.ssh/id_dsa): <comment>(Press enter)</comment>
86 Created directory '/home/temp/.ssh'.
87 Enter passphrase (empty for no passphrase): <comment>(Enter your passphrase)</comment>
88 Enter same passphrase again: <comment>(Enter your passphrase again)</comment>
89 Your identification has been saved in /home/temp/.ssh/id_dsa.
90 Your public key has been saved in /home/temp/.ssh/id_dsa.pub.
91 The key fingerprint is:
92 85:35:81:a0:87:56:78:a2:da:53:6c:63:32:d1:34:48 user@examplehost <comment>This is the fingerprint of your new key</comment>
93 </pre>
95 <note>
96 Please be sure to set a strong passphrase on your private key. Ideally,
97 this passphrase should be at least eight characters and contain a mixture of
98 letters, numbers and symbols.
99 </note>
101 <warn>
102 Do not set an empty passphrase on your ssh key. If infra finds out this is the
103 case; your account will be suspended.
104 </warn>
106 <pre caption="Created files">
107 # <i>ls ~/.ssh</i>
108 id_dsa id_dsa.pub
109 </pre>
111 <p>
112 You may have more files than this, but the two files listed above
113 are the ones that are really important.
114 </p>
116 <p>
117 The first file, <path>id_dsa</path>, is your <e>private</e> key. Don't
118 give this to anyone; never decrypt it on an untrusted machine. Gentoo Staff
119 will never ask you for a copy of your private key.
120 </p>
122 <warn>
123 Be very careful which machines you put your private key on. If you have
124 several (<e>trusted!</e>) hosts from which you want to connect to
125 cvs.gentoo.org, you should copy <path>id_dsa</path> to the
126 <path>~/.ssh</path> directories on those hosts. Trusted machines are machines
127 that only you have root on; these machines are not shared with other users.
128 </warn>
130 <p>
131 The second file, <path>id_dsa.pub</path>, is your <e>public</e> key.
132 Distribute this file amongst all hosts that you want to be able to
133 access through SSH pubkey authentification. This file should be appended
134 to <path>~/.ssh/authorized_keys</path> on those remote hosts. Also add it
135 to your local host so you can connect to that one too if you have several
136 boxes.
137 </p>
139 <pre caption="Adding the SSH key to the box">
140 $ <i>cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys</i>
141 </pre>
143 </body>
144 </section>
145 <section>
146 <title>
147 Installing your public key on a machine using LDAP authentication for SSH
148 </title>
149 <body>
151 <note>
152 If you are a new developer, your recruiter will put your first SSH key into
153 LDAP, so that you can login. You can then add any additional SSH keys yourself
154 using the following procedure.
155 </note>
157 <note>
158 For most of the Gentoo infrastructure, we use LDAP to distribute user
159 information including SSH public keys. On these machines,
160 <path>~/.ssh/authorized_keys</path> should generally not contain your key.
161 </note>
163 <p>
164 You should place your public key into LDAP, using
165 <path>perl_ldap</path>, or <path>ldapmodify</path> directly.
166 The Infrastructure <uri link="/proj/en/infrastructure/ldap.xml">LDAP
167 guide</uri> describes this in more detail.
168 </p>
170 <pre caption="Adding the SSH key with perl_ldap on dev.gentoo.org">
171 $ <i>perl_ldap -b user -C sshPublicKey "$(cat ~/.ssh/id_dsa.pub)" &lt;username&gt;</i>
172 </pre>
174 <warn>
175 Each <path>sshPublicKey</path> attribute must contain exactly one public key. If you have multiple public keys, you must have multiple attributes!
176 </warn>
178 </body>
179 </section>
180 <section>
181 <title>Using keychain</title>
182 <body>
184 <p>
185 Every time you want to log on to a remote host using SSH public key
186 authentification, you will be asked to enter your passphrase. As much as
187 everybody likes typing, too much is sometimes too much. Luckily, there is
188 <c>keychain</c> to the rescue. There is an document on this one <uri
189 link="/doc/en/keychain-guide.xml">here</uri>, but I'll give you a quick
190 introduction.
191 </p>
193 <p>
194 First, install <c>keychain</c>:
195 </p>
197 <pre caption="Installing keychain">
198 # <i>emerge keychain</i>
199 </pre>
201 <p>
202 Now have keychain load up your private ssh key when you log on to your local
203 box. To do so, add the following to <path>~/.bash_profile</path>. Again, this
204 should be done on your <e>local</e> machine where you work at the Gentoo CVS.
205 </p>
207 <warn>
208 <b>NEVER</b> run keychain or decrypt your private key on an untrusted host.
209 </warn>
211 <pre caption="Add this to .bash_profile">
212 keychain ~/.ssh/id_dsa
213 . .keychain/<comment>hostname</comment>-sh
214 </pre>
216 <p>
217 Be sure to substitute <c>hostname</c> with your hostname.
218 </p>
220 </body>
221 </section>
222 </chapter>
223 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20