Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / 2008_07.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6    <meta name="generator" content="Movable Type 5.2.3" />
7
8    <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9    <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml"$>" />
11
12    <title>Status for Andrew DeFaria: July 2008 Archives</title>
13
14    <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15    <link rel="prev" href="http://defaria.com/blogs/Status/archives/2008_05.html" title="May 2008" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/2009_04.html" title="April 2009" />
17 </head>
18 <body class="layout-one-column">
19    <div id="container">
20       <div id="container-inner" class="pkg">
21
22          <div id="banner">
23             <div id="banner-inner" class="pkg">
24                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
25                <h2 id="banner-description">Searchable status reports and work log</h2>
26             </div>
27          </div>
28
29          <div id="pagebody">
30             <div id="pagebody-inner" class="pkg">
31                <div id="alpha">
32                   <div id="alpha-inner" class="pkg">
33                      
34                      <p class="content-nav">
35                         <a href="http://defaria.com/blogs/Status/archives/2008_05.html">&laquo; May 2008</a> |
36                         <a href="http://defaria.com/blogs/Status/">Main</a>
37                         | <a href="http://defaria.com/blogs/Status/archives/2009_04.html">April 2009 &raquo;</a>
38                      </p>
39                      
40                      
41                      <!--
42 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
43          xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
44          xmlns:dc="http://purl.org/dc/elements/1.1/">
45 <rdf:Description
46     rdf:about="http://defaria.com/blogs/Status/archives/2008_07.html#entry-000705"
47     trackback:ping="http://defaria.com/mt/mt-tb.cgi/92"
48     dc:title="Pre-shared ssh keys"
49     dc:identifier="http://defaria.com/blogs/Status/archives/2008_07.html#entry-000705"
50     dc:subject="General Dynamics"
51     dc:description="Issue Gantry mentioned that we are still having issues with pre-shared key access to various systems using pswit as the log in. This email will serve to document how pre-share key access works, how we are using it here and..."
52     dc:creator=""
53     dc:date="2008-07-30T17:25:01-06:00" />
54 </rdf:RDF>
55 -->
56
57
58                      <h2 class="date-header">July 30, 2008</h2>
59                      <a id="a000705"></a>
60                      <div class="entry" id="entry-705">
61                         <h3 class="entry-header">Pre-shared ssh keys</h3>
62                         <div class="entry-content">
63                            <div class="entry-body">
64                               <h3>Issue</h3>
65
66 <p>Gantry mentioned that we are still having issues with pre-shared key access to various systems using pswit as the log in. This email will serve to document how pre-share key access works, how we are using it here and how the process is breaking down. We could attempt to script it but there are challenges and issues with that, specifically the
67 gathering of ssh keys requires root access. Or we could simply learn how it works and follow a process, which I'll suggest.</p>
68
69 <h3>How pre-shared ssh access works</h3>
70
71 <p>In order to ssh to another machine as another user (or any user including yourself) using a pre-shared key you eed have a key to share. Therefore you need to generate an ssh key. We tend to use DSA keys as they are stronger. The process of generating an ssh key will not be discussed here but if you have one then in your home directory you'll have a file name id_dsa.pub under your .ssh directory.</p>
72
73 <p>The contents of this file needs to be placed into the "receiving" user's ~/.ssh/authorized_keys file. The act of doing this specifically states "I know &lt;x&gt; and I will allow him to ssh into this machine as me". So if I (p6258c) want to ssh to seast1 as pswit I need to get my DSA key (~p6258c/.ssh/id_dsa.pub) into pswit's authorized_keys file (~pswit/.ssh/authorized_keys).</p>
74
75 <h3>NIS domain/Windows considerations</h3>
76
77 <p>An additional complication here is that pswit in the RAN NIS domain != pswit in the RANTEST NIS domain. So If I wanted to be able to ssh as pswit to ranray I'd need to <b>also</b> get my DSA key (generated on the RAN NIS domain) into ~pswit/.ssh/authorized_keys. remember pswit's home directory on ranray != pswit's home directory on seast1. Both entities (the pswit user ID in RAN and the pswit user ID in RANTEST) are distinct and different users.</p>
78
79 <p>A further complication is that pswit on the 11 Windows machines are all local users to those Windows machines. The Windows machines are in the set (rantm50[1..7], sim[1..4]).</p>
80
81 <h3>Gathering ssh keys and building a combined authorzied_keys file</h3>
82
83 <p>So we need to collect ssh keys from multiple users, in multiple Unix NIS domains to multiple machines. In the past what I did was to gather all of the ssh keys for the users on the RAN side into an authorized_keys file named ran and then gathered all of the ssh keys for the users on the RANTEST side in an authorized_keys file named east. Normally an ssh key would say "&lt;user&gt;@&lt;machine&gt;" where &lt;machine&gt; is the machine which ssh-keygen was run. To avoid confusion I changed the comment at the end of each key to say "&lt;user&gt;@ran" or "&lt;user&gt;@east" in the respective files. Then I would concatenate the two files, ran and east, to one authorized keys file. This file was then checked into Clearcase under rantest_auto/config.</p>
84
85 <h3>Dissemination</h3>
86
87 <p>Since the home directory for pswit is always the same home directory for all machines in the RAN domain, and since the same is true in the RANTEST domain, we need only set authorized_keys twice, once in RAN and once in RANTEST, for the Unix side. However we need to also disseminate keys to 11 Windows boxes. Here's, effectively, how I do that.</p>
88
89 <div class="code">
90 <pre>$ machines="\
91 &gt;  ranray\
92 &gt;  seast1\
93 &gt;  rantm501\
94 &gt;  rantm502\
95 &gt;  rantm503\
96 &gt;  rantm504\
97 &gt;  rantm505\
98 &gt;  rantm506\
99 &gt;  rantm507\
100 &gt;  sim1\
101 &gt;  sim2\
102 &gt;  sim3\
103 &gt;  sim4\
104 &gt; "
105
106 $for machine in $machines; do
107   scp -q authorized_keys <a class="moz-txt-link-abbreviated" href="mailto:pswit@$machine:.ssh">pswit@$machine:.ssh</a>
108 done
109 </pre>
110 </div>
111
112 <p>This disseminates the authorized_keys file to all the appropriate machines.</p>
113
114 <h3>Current state</h3>
115
116 <p>Currently, gathering up all authorized_keys files in a reverse fashion to the above, we have:</p>
117
118 <table align="center" border="1" cellpadding="2" cellspacing="0"
119  width="75%">
120   <tbody>
121     <tr>
122       <th bgcolor="teal" valign="top"><font color="#ffffff">Region/Machine<br>
123       </font></th>
124       <th bgcolor="teal" valign="top"><font color="#ffffff"># of Entries<br>
125       </font></th>
126       <th bgcolor="teal" valign="top"><font color="#ffffff">Comments<br>
127       </font></th>
128     </tr>
129     <tr>
130       <td align="center" valign="top">master<br>
131       </td>
132       <td align="center" valign="top">92<br>
133       </td>
134       <td valign="top">Master authorized_keys file from Clearcase<br>
135       </td>
136     </tr>
137     <tr>
138       <td align="center" valign="top">ran<br>
139       </td>
140       <td align="center" valign="top">95<br>
141       </td>
142       <td valign="top">authorized_keys file from RAN<br>
143       </td>
144     </tr>
145     <tr>
146       <td align="center" valign="top">rantm501<br>
147       </td>
148       <td align="center" valign="top">92<br>
149       </td>
150       <td valign="top"><br>
151       </td>
152     </tr>
153     <tr>
154       <td align="center" valign="top">rantm502</td>
155       <td align="center" valign="top">92</td>
156       <td valign="top"><br>
157       </td>
158     </tr>
159     <tr>
160       <td align="center" valign="top">rantm503</td>
161       <td align="center" valign="top">92</td>
162       <td valign="top"><br>
163       </td>
164     </tr>
165     <tr>
166       <td align="center" valign="top">rantm504</td>
167       <td align="center" valign="top">92</td>
168       <td valign="top"><br>
169       </td>
170     </tr>
171     <tr>
172       <td align="center" valign="top">rantm505</td>
173       <td align="center" valign="top">92</td>
174       <td valign="top"><br>
175       </td>
176     </tr>
177     <tr>
178       <td align="center" valign="top">rantm506</td>
179       <td align="center" valign="top">92</td>
180       <td valign="top"><br>
181       </td>
182     </tr>
183     <tr>
184       <td align="center" valign="top">rantm507</td>
185       <td align="center" valign="top">92</td>
186       <td valign="top"><br>
187       </td>
188     </tr>
189     <tr>
190       <td align="center" valign="top">seast1<br>
191       </td>
192       <td align="center" valign="top">97</td>
193       <td valign="top">authorized_keys file from RANTEST<br>
194       </td>
195     </tr>
196     <tr>
197       <td align="center" valign="top">sim1<br>
198       </td>
199       <td align="center" valign="top">93<br>
200       </td>
201       <td valign="top"><br>
202       </td>
203     </tr>
204     <tr>
205       <td align="center" valign="top">sim2<br>
206       </td>
207       <td align="center" valign="top">92<br>
208       </td>
209       <td valign="top"><br>
210       </td>
211     </tr>
212     <tr>
213       <td align="center" valign="top">sim3<br>
214       </td>
215       <td align="center" valign="top">92<br>
216       </td>
217       <td valign="top"><br>
218       </td>
219     </tr>
220     <tr>
221       <td align="center" valign="top">sim4<br>
222       </td>
223       <td align="center" valign="top">92<br>
224       </td>
225       <td valign="top"><br>
226       </td>
227     </tr>
228   </tbody>
229 </table>
230
231 <p>The way to have pre-shared ssh key access working the best is for each Region/Machine to have the same amount of entries (actually the exact same authorized_keys file). But we can see that people are indiscriminately changing the authorized_keys file only in certain places causing confusion and causing the process to break down.</p>
232
233 <h3>Suggested process</h3>
234
235 <p>When somebody reports that they are having a problem with ssh access using a pre-shared key to become pswit on another machine they should submit a help desk ticket. The way to resolve the help desk ticket is to:</p>
236
237 <ol>
238   <li>Generate this user's DSA ssh key (if required) on both the RAN
239 and the RANTEST NIS domains</li>
240   <li>Change the host name associated with the key to "ran" or "east"
241 as appropriate</li>
242   <li>Open a WOR in the RANTEST_Auto project and create a view</li>
243   <li>Checkout the rantest_tools/config/authorized_keys file and edit
244 it appending the two DSA ssh keys</li>
245   <li>Checkin and deliver the WOR</li>
246   <li>Either execute the above code to disseminate the new
247 authorized_keys file or perhaps we could write a simple script to do it.<br>
248   </li>
249 </ol>
250
251 <p>Comments?</p>
252                               
253                               <p class="entry-footer">
254                                  <span class="post-footers">Posted by  at  5:25 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000705.html">Permalink</a>
255                                  
256                                  | <a href="http://defaria.com/blogs/Status/archives/000705.html#trackback">TrackBacks (0)</a>
257                               </p>
258                            </div>
259                         </div>
260                      </div>
261                      
262                   </div>
263                </div>
264             </div>
265          </div>
266       </div>
267    </div>
268 </body>
269 </html>