1 | .\" -*- nroff -*- |
---|
2 | .\" |
---|
3 | .\" $Id: RFC.nroff,v 1.1.1.3 1999-03-08 17:42:55 danw Exp $ |
---|
4 | .\" $Log: not supported by cvs2svn $ |
---|
5 | # Revision 1.11 1998/04/30 01:49:48 kivinen |
---|
6 | # Fixed phone numbers. |
---|
7 | # |
---|
8 | .\" Revision 1.10 1998/03/27 17:25:27 kivinen |
---|
9 | .\" Removed TSS. |
---|
10 | .\" |
---|
11 | .\" Revision 1.9 1997/08/21 22:35:33 ylo |
---|
12 | .\" Clarified session id computation, as reported by Ian Goldberg. |
---|
13 | .\" |
---|
14 | .\" Revision 1.8 1997/03/27 03:39:12 kivinen |
---|
15 | .\" Fixed typo. |
---|
16 | .\" |
---|
17 | .\" Revision 1.7 1997/03/27 03:08:04 kivinen |
---|
18 | .\" Added kerberos authentication documentation. |
---|
19 | .\" |
---|
20 | .\" Revision 1.6 1997/03/19 22:06:13 kivinen |
---|
21 | .\" Fixed typo. |
---|
22 | .\" |
---|
23 | .\" Revision 1.5 1997/03/19 19:24:18 kivinen |
---|
24 | .\" Documented TIS Authentication. |
---|
25 | .\" |
---|
26 | .\" Revision 1.4 1997/03/19 17:34:30 kivinen |
---|
27 | .\" Removed des from mandatory ciphers. |
---|
28 | .\" |
---|
29 | .\" Revision 1.3 1996/10/29 22:33:30 kivinen |
---|
30 | .\" Updated protocol version to 1.5. |
---|
31 | .\" |
---|
32 | .\" Revision 1.2 1996/06/20 23:50:13 ylo |
---|
33 | .\" Fixed a typo. |
---|
34 | .\" |
---|
35 | .\" Revision 1.1.1.1 1996/02/18 21:38:10 ylo |
---|
36 | .\" Imported ssh-1.2.13. |
---|
37 | .\" |
---|
38 | .\" Revision 1.7 1995/09/24 23:57:48 ylo |
---|
39 | .\" Added passing of screen number to server. |
---|
40 | .\" |
---|
41 | .\" Revision 1.6 1995/09/06 19:52:11 ylo |
---|
42 | .\" Added a note that X11 forwarding with spoofing is optional. |
---|
43 | .\" |
---|
44 | .\" Revision 1.5 1995/07/27 02:15:33 ylo |
---|
45 | .\" Changes to RC4 keying. |
---|
46 | .\" |
---|
47 | .\" Revision 1.4 1995/07/26 23:31:57 ylo |
---|
48 | .\" Changes for protocol version 1.1 to deter replay and rsa |
---|
49 | .\" response forwarding. |
---|
50 | .\" |
---|
51 | .\" Revision 1.3 1995/07/15 22:27:39 ylo |
---|
52 | .\" Added pointer to the www page. |
---|
53 | .\" |
---|
54 | .\" Revision 1.2 1995/07/13 01:05:52 ylo |
---|
55 | .\" Added cvs log. |
---|
56 | .\" |
---|
57 | .\" $Endlog$ |
---|
58 | .pl 10.0i |
---|
59 | .po 0 |
---|
60 | .ll 7.2i |
---|
61 | .lt 7.2i |
---|
62 | .nr LL 7.2i |
---|
63 | .nr LT 7.2i |
---|
64 | .ds LF Ylonen |
---|
65 | .ds RF FORMFEED[Page %] |
---|
66 | .ds CF |
---|
67 | .ds LH Internet-Draft |
---|
68 | .ds RH 15 November 1995 |
---|
69 | .ds CH SSH (Secure Shell) Remote Login Protocol |
---|
70 | .na |
---|
71 | .hy 0 |
---|
72 | .in 0 |
---|
73 | Network Working Group T. Ylonen |
---|
74 | Internet-Draft Helsinki University of Technology |
---|
75 | draft-ylonen-ssh-protocol-00.txt 15 November 1995 |
---|
76 | Expires: 15 May 1996 |
---|
77 | |
---|
78 | .in 3 |
---|
79 | |
---|
80 | .ce |
---|
81 | The SSH (Secure Shell) Remote Login Protocol |
---|
82 | |
---|
83 | .ti 0 |
---|
84 | Status of This Memo |
---|
85 | |
---|
86 | This document is an Internet-Draft. Internet-Drafts are working |
---|
87 | documents of the Internet Engineering Task Force (IETF), its areas, |
---|
88 | and its working groups. Note that other groups may also distribute |
---|
89 | working documents as Internet-Drafts. |
---|
90 | |
---|
91 | Internet-Drafts are draft documents valid for a maximum of six |
---|
92 | months and may be updated, replaced, or obsoleted by other docu- |
---|
93 | ments at any time. It is inappropriate to use Internet-Drafts as |
---|
94 | reference material or to cite them other than as ``work in pro- |
---|
95 | gress.'' |
---|
96 | |
---|
97 | To learn the current status of any Internet-Draft, please check the |
---|
98 | ``1id-abstracts.txt'' listing contained in the Internet- Drafts Shadow |
---|
99 | Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), |
---|
100 | munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or |
---|
101 | ftp.isi.edu (US West Coast). |
---|
102 | |
---|
103 | The distribution of this memo is unlimited. |
---|
104 | |
---|
105 | .ti 0 |
---|
106 | Introduction |
---|
107 | |
---|
108 | SSH (Secure Shell) is a program to log into another computer over a |
---|
109 | network, to execute commands in a remote machine, and to move files |
---|
110 | from one machine to another. It provides strong authentication and |
---|
111 | secure communications over insecure networks. Its features include |
---|
112 | the following: |
---|
113 | .IP o |
---|
114 | Closes several security holes (e.g., IP, routing, and DNS spoofing). |
---|
115 | New authentication methods: .rhosts together with RSA [RSA] based host |
---|
116 | authentication, and pure RSA authentication. |
---|
117 | .IP o |
---|
118 | All communications are automatically and transparently encrypted. |
---|
119 | Encryption is also used to protect integrity. |
---|
120 | .IP o |
---|
121 | X11 connection forwarding provides secure X11 sessions. |
---|
122 | .IP o |
---|
123 | Arbitrary TCP/IP ports can be redirected over the encrypted channel |
---|
124 | in both directions. |
---|
125 | .IP o |
---|
126 | Client RSA-authenticates the server machine in the beginning of every |
---|
127 | connection to prevent trojan horses (by routing or DNS spoofing) and |
---|
128 | man-in-the-middle attacks, and the server RSA-authenticates the client |
---|
129 | machine before accepting .rhosts or /etc/hosts.equiv authentication |
---|
130 | (to prevent DNS, routing, or IP spoofing). |
---|
131 | .IP o |
---|
132 | An authentication agent, running in the user's local workstation or |
---|
133 | laptop, can be used to hold the user's RSA authentication keys. |
---|
134 | .RT |
---|
135 | |
---|
136 | The goal has been to make the software as easy to use as possible for |
---|
137 | ordinary users. The protocol has been designed to be as secure as |
---|
138 | possible while making it possible to create implementations that |
---|
139 | are easy to use and install. The sample implementation has a number |
---|
140 | of convenient features that are not described in this document as they |
---|
141 | are not relevant for the protocol. |
---|
142 | |
---|
143 | |
---|
144 | .ti 0 |
---|
145 | Overview of the Protocol |
---|
146 | |
---|
147 | The software consists of a server program running on a server machine, |
---|
148 | and a client program running on a client machine (plus a few auxiliary |
---|
149 | programs). The machines are connected by an insecure IP [RFC0791] |
---|
150 | network (that can be monitored, tampered with, and spoofed by hostile |
---|
151 | parties). |
---|
152 | |
---|
153 | A connection is always initiated by the client side. The server |
---|
154 | listens on a specific port waiting for connections. Many clients may |
---|
155 | connect to the same server machine. |
---|
156 | |
---|
157 | The client and the server are connected via a TCP/IP [RFC0793] socket |
---|
158 | that is used for bidirectional communication. Other types of |
---|
159 | transport can be used but are currently not defined. |
---|
160 | |
---|
161 | When the client connects the server, the server accepts the connection |
---|
162 | and responds by sending back its version identification string. The |
---|
163 | client parses the server's identification, and sends its own |
---|
164 | identification. The purpose of the identification strings is to |
---|
165 | validate that the connection was to the correct port, declare the |
---|
166 | protocol version number used, and to declare the software version used |
---|
167 | on each side (for debugging purposes). The identification strings are |
---|
168 | human-readable. If either side fails to understand or support the |
---|
169 | other side's version, it closes the connection. |
---|
170 | |
---|
171 | After the protocol identification phase, both sides switch to a packet |
---|
172 | based binary protocol. The server starts by sending its host key |
---|
173 | (every host has an RSA key used to authenticate the host), server key |
---|
174 | (an RSA key regenerated every hour), and other information to the |
---|
175 | client. The client then generates a 256 bit session key, encrypts it |
---|
176 | using both RSA keys (see below for details), and sends the encrypted |
---|
177 | session key and selected cipher type to the server. Both sides then |
---|
178 | turn on encryption using the selected algorithm and key. The server |
---|
179 | sends an encrypted confirmation message to the client. |
---|
180 | |
---|
181 | The client then authenticates itself using any of a number of |
---|
182 | authentication methods. The currently supported authentication |
---|
183 | methods are .rhosts or /etc/hosts.equiv authentication (disabled by |
---|
184 | default), the same with RSA-based host authentication, RSA |
---|
185 | authentication, and password authentication. |
---|
186 | |
---|
187 | After successful authentication, the client makes a number of requests |
---|
188 | to prepare for the session. Typical requests include allocating a |
---|
189 | pseudo tty, starting X11 [X11] or TCP/IP port forwarding, starting |
---|
190 | authentication agent forwarding, and executing the shell or a command. |
---|
191 | |
---|
192 | When a shell or command is executed, the connection enters interactive |
---|
193 | session mode. In this mode, data is passed in both directions, |
---|
194 | new forwarded connections may be opened, etc. The interactive session |
---|
195 | normally terminates when the server sends the exit status of the |
---|
196 | program to the client. |
---|
197 | |
---|
198 | |
---|
199 | The protocol makes several reservations for future extensibility. |
---|
200 | First of all, the initial protocol identification messages include the |
---|
201 | protocol version number. Second, the first packet by both sides |
---|
202 | includes a protocol flags field, which can be used to agree on |
---|
203 | extensions in a compatible manner. Third, the authentication and |
---|
204 | session preparation phases work so that the client sends requests to |
---|
205 | the server, and the server responds with success or failure. If the |
---|
206 | client sends a request that the server does not support, the server |
---|
207 | simply returns failure for it. This permits compatible addition of |
---|
208 | new authentication methods and preparation operations. The |
---|
209 | interactive session phase, on the other hand, works asynchronously and |
---|
210 | does not permit the use of any extensions (because there is no easy |
---|
211 | and reliable way to signal rejection to the other side and problems |
---|
212 | would be hard to debug). Any compatible extensions to this phase must |
---|
213 | be agreed upon during any of the earlier phases. |
---|
214 | |
---|
215 | .ti 0 |
---|
216 | The Binary Packet Protocol |
---|
217 | |
---|
218 | After the protocol identification strings, both sides only send |
---|
219 | specially formatted packets. The packet layout is as follows: |
---|
220 | .IP o |
---|
221 | Packet length: 32 bit unsigned integer, coded as four 8-bit bytes, msb |
---|
222 | first. Gives the length of the packet, not including the length field |
---|
223 | and padding. The maximum length of a packet (not including the length |
---|
224 | field and padding) is 262144 bytes. |
---|
225 | .IP o |
---|
226 | Padding: 1-8 bytes of random data (or zeroes if not encrypting). The |
---|
227 | amount of padding is (8 - (length % 8)) bytes (where % stands for the |
---|
228 | modulo operator). The rationale for always having some random padding |
---|
229 | at the beginning of each packet is to make known plaintext attacks |
---|
230 | more difficult. |
---|
231 | .IP o |
---|
232 | Packet type: 8-bit unsigned byte. The value 255 is reserved for |
---|
233 | future extension. |
---|
234 | .IP o |
---|
235 | Data: binary data bytes, depending on the packet type. The number of |
---|
236 | data bytes is the "length" field minus 5. |
---|
237 | .IP o |
---|
238 | Check bytes: 32-bit crc, four 8-bit bytes, msb first. The crc is the |
---|
239 | Cyclic Redundancy Check, with the polynomial 0xedb88320, of the |
---|
240 | Padding, Packet type, and Data fields. The crc is computed before |
---|
241 | any encryption. |
---|
242 | .RT |
---|
243 | |
---|
244 | The packet, except for the length field, may be encrypted using any of |
---|
245 | a number of algorithms. The length of the encrypted part (Padding + |
---|
246 | Type + Data + Check) is always a multiple of 8 bytes. Typically the |
---|
247 | cipher is used in a chained mode, with all packets chained together as |
---|
248 | if it was a single data stream (the length field is never included in |
---|
249 | the encryption process). Details of encryption are described below. |
---|
250 | |
---|
251 | When the session starts, encryption is turned off. Encryption is |
---|
252 | enabled after the client has sent the session key. The encryption |
---|
253 | algorithm to use is selected by the client. |
---|
254 | |
---|
255 | |
---|
256 | .ti 0 |
---|
257 | Packet Compression |
---|
258 | |
---|
259 | If compression is supported (it is an optional feature, see |
---|
260 | SSH_CMSG_REQUEST_COMPRESSION below), the packet type and data fields |
---|
261 | of the packet are compressed using the gzip deflate algorithm [GZIP]. |
---|
262 | If compression is in effect, the packet length field indicates the |
---|
263 | length of the compressed data, plus 4 for the crc. The amount of |
---|
264 | padding is computed from the compressed data, so that the amount of |
---|
265 | data to be encrypted becomes a multiple of 8 bytes. |
---|
266 | |
---|
267 | When compressing, the packets (type + data portions) in each direction |
---|
268 | are compressed as if they formed a continuous data stream, with only the |
---|
269 | current compression block flushed between packets. This corresponds |
---|
270 | to the GNU ZLIB library Z_PARTIAL_FLUSH option. The compression |
---|
271 | dictionary is not flushed between packets. The two directions are |
---|
272 | compressed independently of each other. |
---|
273 | |
---|
274 | |
---|
275 | .ti 0 |
---|
276 | Packet Encryption |
---|
277 | |
---|
278 | The protocol supports several encryption methods. During session |
---|
279 | initialization, the server sends a bitmask of all encryption methods |
---|
280 | that it supports, and the client selects one of these methods. The |
---|
281 | client also generates a 256-bit random session key (32 8-bit bytes) and |
---|
282 | sends it to the server. |
---|
283 | |
---|
284 | The encryption methods supported by the current implementation, and |
---|
285 | their codes are: |
---|
286 | .TS |
---|
287 | center; |
---|
288 | l r l. |
---|
289 | SSH_CIPHER_NONE 0 No encryption |
---|
290 | SSH_CIPHER_IDEA 1 IDEA in CFB mode |
---|
291 | SSH_CIPHER_DES 2 DES in CBC mode |
---|
292 | SSH_CIPHER_3DES 3 Triple-DES in CBC mode |
---|
293 | SSH_CIPHER_RC4 5 RC4 |
---|
294 | .TE |
---|
295 | |
---|
296 | All implementations are required to support SSH_CIPHER_3DES. |
---|
297 | Supporting SSH_CIPHER_IDEA, SSH_CIPHER_RC4, and |
---|
298 | SSH_CIPHER_NONE is recommended. Other ciphers |
---|
299 | may be added at a later time; support for them is optional. |
---|
300 | |
---|
301 | For encryption, the encrypted portion of the packet is considered a |
---|
302 | linear byte stream. The length of the stream is always a multiple of |
---|
303 | 8. The encrypted portions of consecutive packets (in the same |
---|
304 | direction) are encrypted as if they were a continuous buffer (that is, |
---|
305 | any initialization vectors are passed from the previous packet to the |
---|
306 | next packet). Data in each direction is encrypted independently. |
---|
307 | .IP SSH_CIPHER_DES |
---|
308 | The key is taken from the first 8 bytes of the session key. The least |
---|
309 | significant bit of each byte is ignored. This results in 56 bits of |
---|
310 | key data. DES [DES] is used in CBC mode. The iv (initialization vector) is |
---|
311 | initialized to all zeroes. |
---|
312 | .IP SSH_CIPHER_3DES |
---|
313 | The variant of triple-DES used here works as follows: there are three |
---|
314 | independent DES-CBC ciphers, with independent initialization vectors. |
---|
315 | The data (the whole encrypted data stream) is first encrypted with the |
---|
316 | first cipher, then decrypted with the second cipher, and finally |
---|
317 | encrypted with the third cipher. All these operations are performed |
---|
318 | in CBC mode. |
---|
319 | |
---|
320 | The key for the first cipher is taken from the first 8 bytes of the |
---|
321 | session key; the key for the next cipher from the next 8 bytes, and |
---|
322 | the key for the third cipher from the following 8 bytes. All three |
---|
323 | initialization vectors are initialized to zero. |
---|
324 | |
---|
325 | (Note: the variant of 3DES used here differs from some other |
---|
326 | descriptions.) |
---|
327 | .IP SSH_CIPHER_IDEA |
---|
328 | The key is taken from the first 16 bytes of the session key. IDEA |
---|
329 | [IDEA] is used in CFB mode. The initialization vector is initialized |
---|
330 | to all zeroes. |
---|
331 | .IP SSH_CIPHER_RC4 |
---|
332 | The first 16 bytes of the session key are used as the key for the |
---|
333 | server to client direction. The remaining 16 bytes are used as the |
---|
334 | key for the client to server direction. This gives independent |
---|
335 | 128-bit keys for each direction. |
---|
336 | |
---|
337 | This algorithm is the alleged RC4 cipher posted to the Usenet in 1995. |
---|
338 | It is widely believed to be equivalent with the original RSADSI RC4 |
---|
339 | cipher. This is a very fast algorithm. |
---|
340 | .RT |
---|
341 | |
---|
342 | |
---|
343 | .ti 0 |
---|
344 | Data Type Encodings |
---|
345 | |
---|
346 | The Data field of each packet contains data encoded as described in |
---|
347 | this section. There may be several data items; each item is coded as |
---|
348 | described here, and their representations are concatenated together |
---|
349 | (without any alignment or padding). |
---|
350 | |
---|
351 | Each data type is stored as follows: |
---|
352 | .IP "8-bit byte" |
---|
353 | The byte is stored directly as a single byte. |
---|
354 | .IP "32-bit unsigned integer" |
---|
355 | Stored in 4 bytes, msb first. |
---|
356 | .IP "Arbitrary length binary string" |
---|
357 | First 4 bytes are the length of the string, msb first (not including |
---|
358 | the length itself). The following "length" bytes are the string |
---|
359 | value. There are no terminating null characters. |
---|
360 | .IP "Multiple-precision integer" |
---|
361 | First 2 bytes are the number of bits in the integer, msb first (for |
---|
362 | example, the value 0x00012345 would have 17 bits). The value zero has |
---|
363 | zero bits. It is permissible that the number of bits be larger than the |
---|
364 | real number of bits. |
---|
365 | |
---|
366 | The number of bits is followed by (bits + 7) / 8 bytes of binary data, |
---|
367 | msb first, giving the value of the integer. |
---|
368 | .RT |
---|
369 | |
---|
370 | |
---|
371 | .ti 0 |
---|
372 | TCP/IP Port Number and Other Options |
---|
373 | |
---|
374 | The server listens for connections on TCP/IP port 22. |
---|
375 | |
---|
376 | The client may connect the server from any port. However, if the |
---|
377 | client wishes to use any form of .rhosts or /etc/hosts.equiv |
---|
378 | authentication, it must connect from a privileged port (less than |
---|
379 | 1024). |
---|
380 | |
---|
381 | For the IP Type of Service field [RFC0791], it is recommended that |
---|
382 | interactive sessions (those having a user terminal or forwarding X11 |
---|
383 | connections) use the IPTOS_LOWDELAY, and non-interactive connections |
---|
384 | use IPTOS_THROUGHPUT. |
---|
385 | |
---|
386 | It is recommended that keepalives are used, because otherwise programs |
---|
387 | on the server may never notice if the other end of the connection is |
---|
388 | rebooted. |
---|
389 | |
---|
390 | |
---|
391 | .ti 0 |
---|
392 | Protocol Version Identification |
---|
393 | |
---|
394 | After the socket is opened, the server sends an identification string, |
---|
395 | which is of the form |
---|
396 | "SSH-<protocolmajor>.<protocolminor>-<version>\\n", where |
---|
397 | <protocolmajor> and <protocolminor> are integers and specify the |
---|
398 | protocol version number (not software distribution version). |
---|
399 | <version> is server side software version string (max 40 characters); |
---|
400 | it is not interpreted by the remote side but may be useful for |
---|
401 | debugging. |
---|
402 | |
---|
403 | The client parses the server's string, and sends a corresponding |
---|
404 | string with its own information in response. If the server has lower |
---|
405 | version number, and the client contains special code to emulate it, |
---|
406 | the client responds with the lower number; otherwise it responds with |
---|
407 | its own number. The server then compares the version number the |
---|
408 | client sent with its own, and determines whether they can work |
---|
409 | together. The server either disconnects, or sends the first packet |
---|
410 | using the binary packet protocol and both sides start working |
---|
411 | according to the lower of the protocol versions. |
---|
412 | |
---|
413 | By convention, changes which keep the protocol compatible with |
---|
414 | previous versions keep the same major protocol version; changes that |
---|
415 | are not compatible increment the major version (which will hopefully |
---|
416 | never happen). The version described in this document is 1.5. |
---|
417 | |
---|
418 | .ti 0 |
---|
419 | Key Exchange and Server Host Authentication |
---|
420 | |
---|
421 | The first message sent by the server using the packet protocol is |
---|
422 | SSH_SMSG_PUBLIC_KEY. It declares the server's host key, server public |
---|
423 | key, supported ciphers, supported authentication methods, and flags |
---|
424 | for protocol extensions. It also contains a 64-bit random number |
---|
425 | (cookie) that must be returned in the client's reply (to make IP |
---|
426 | spoofing more difficult). No encryption is used for this message. |
---|
427 | |
---|
428 | Both sides compute a session id as follows. The modulus of the host |
---|
429 | key is interpreted as a byte string (without explicit length field, |
---|
430 | with minimum length able to hold the whole value), most significant |
---|
431 | byte first. This string is concatenated with the server key |
---|
432 | interpreted the same way. Additionally, the cookie is concatenated |
---|
433 | with this. Both sides compute MD5 of the resulting string. The |
---|
434 | resulting 16 bytes (128 bits) are stored by both parties and are |
---|
435 | called the session id. |
---|
436 | |
---|
437 | In other words, |
---|
438 | session_id = MD5(hostkey->n || servkey->n || cookie) |
---|
439 | |
---|
440 | The client responds with a SSH_CMSG_SESSION_KEY message, which |
---|
441 | contains the selected cipher type, a copy of the 64-bit cookie sent by |
---|
442 | the server, client's protocol flags, and a session key encrypted |
---|
443 | with both the server's host key and server key. No encryption is used |
---|
444 | for this message. |
---|
445 | |
---|
446 | The session key is 32 8-bit bytes (a total of 256 random bits |
---|
447 | generated by the client). The client first xors the 16 bytes of the |
---|
448 | session id with the first 16 bytes of the session key. The resulting |
---|
449 | string is then encrypted using the smaller key (one with smaller |
---|
450 | modulus), and the result is then encrypted using the other key. The |
---|
451 | number of bits in the public modulus of the two keys must differ by at |
---|
452 | least 128 bits. |
---|
453 | |
---|
454 | At each encryption step, a multiple-precision integer is constructed |
---|
455 | from the data to be encrypted as follows (the integer is here |
---|
456 | interpreted as a sequence of bytes, msb first; the number of bytes is |
---|
457 | the number of bytes needed to represent the modulus). |
---|
458 | |
---|
459 | The most significant byte (which is only partial as the value must be |
---|
460 | less than the public modulus, which is never a power of two) is zero. |
---|
461 | |
---|
462 | The next byte contains the value 2 (which stands for public-key |
---|
463 | encrypted data in the PKCS standard [PKCS#1]). Then, there are |
---|
464 | non-zero random bytes to fill any unused space, a zero byte, and the |
---|
465 | data to be encrypted in the least significant bytes, the last byte of |
---|
466 | the data in the least significant byte. |
---|
467 | |
---|
468 | This algorithm is used twice. First, it is used to encrypt the 32 |
---|
469 | random bytes generated by the client to be used as the session key |
---|
470 | (xored by the session id). This value is converted to an integer as |
---|
471 | described above, and encrypted with RSA using the key with the smaller |
---|
472 | modulus. The resulting integer is converted to a byte stream, msb |
---|
473 | first. This byte stream is padded and encrypted identically using the |
---|
474 | key with the larger modulus. |
---|
475 | |
---|
476 | After the client has sent the session key, it starts to use the |
---|
477 | selected algorithm and key for decrypting any received packets, and |
---|
478 | for encrypting any sent packets. Separate ciphers are used for |
---|
479 | different directions (that is, both directions have separate |
---|
480 | initialization vectors or other state for the ciphers). |
---|
481 | |
---|
482 | When the server has received the session key message, and has turned |
---|
483 | on encryption, it sends a SSH_SMSG_SUCCESS message to the client. |
---|
484 | |
---|
485 | The recommended size of the host key is 1024 bits, and 768 bits for |
---|
486 | the server key. The minimum size is 512 bits for the smaller key. |
---|
487 | |
---|
488 | |
---|
489 | .ti 0 |
---|
490 | Declaring the User Name |
---|
491 | |
---|
492 | The client then sends a SSH_CMSG_USER message to the server. This |
---|
493 | message specifies the user name to log in as. |
---|
494 | |
---|
495 | The server validates that such a user exists, checks whether |
---|
496 | authentication is needed, and responds with either SSH_SMSG_SUCCESS or |
---|
497 | SSH_SMSG_FAILURE. SSH_SMSG_SUCCESS indicates that no authentication |
---|
498 | is needed for this user (no password), and authentication phase has |
---|
499 | now been completed. SSH_SMSG_FAILURE indicates that authentication is |
---|
500 | needed (or the user does not exist). |
---|
501 | |
---|
502 | If the user does not exist, it is recommended that this returns |
---|
503 | failure, but the server keeps reading messages from the client, and |
---|
504 | responds to any messages (except SSH_MSG_DISCONNECT, SSH_MSG_IGNORE, |
---|
505 | and SSH_MSG_DEBUG) with SSH_SMSG_FAILURE. This way the client cannot |
---|
506 | be certain whether the user exists. |
---|
507 | |
---|
508 | |
---|
509 | .ti 0 |
---|
510 | Authentication Phase |
---|
511 | |
---|
512 | Provided the server didn't immediately accept the login, an |
---|
513 | authentication exchange begins. The client sends messages to the |
---|
514 | server requesting different types of authentication in arbitrary order as |
---|
515 | many times as desired (however, the server may close the connection |
---|
516 | after a timeout). The server always responds with SSH_SMSG_SUCCESS if |
---|
517 | it has accepted the authentication, and with SSH_SMSG_FAILURE if it has |
---|
518 | denied authentication with the requested method or it does not |
---|
519 | recognize the message. Some authentication methods cause an exchange |
---|
520 | of further messages before the final result is sent. The |
---|
521 | authentication phase ends when the server responds with success. |
---|
522 | |
---|
523 | The recommended value for the authentication timeout (timeout before |
---|
524 | disconnecting if no successful authentication has been made) is 5 |
---|
525 | minutes. |
---|
526 | |
---|
527 | The following authentication methods are currently supported: |
---|
528 | .TS |
---|
529 | center; |
---|
530 | l r l. |
---|
531 | SSH_AUTH_RHOSTS 1 .rhosts or /etc/hosts.equiv |
---|
532 | SSH_AUTH_RSA 2 pure RSA authentication |
---|
533 | SSH_AUTH_PASSWORD 3 password authentication |
---|
534 | SSH_AUTH_RHOSTS_RSA 4 .rhosts with RSA host authentication |
---|
535 | .TE |
---|
536 | .IP SSH_AUTH_RHOSTS |
---|
537 | |
---|
538 | This is the authentication method used by rlogin and rsh [RFC1282]. |
---|
539 | |
---|
540 | The client sends SSH_CMSG_AUTH_RHOSTS with the client-side user name |
---|
541 | as an argument. |
---|
542 | |
---|
543 | The server checks whether to permit authentication. On UNIX systems, |
---|
544 | this is usually done by checking /etc/hosts.equiv, and .rhosts in the |
---|
545 | user's home directory. The connection must come from a privileged |
---|
546 | port. |
---|
547 | |
---|
548 | It is recommended that the server checks that there are no IP options |
---|
549 | (such as source routing) specified for the socket before accepting |
---|
550 | this type of authentication. The client host name should be |
---|
551 | reverse-mapped and then forward mapped to ensure that it has the |
---|
552 | proper IP-address. |
---|
553 | |
---|
554 | This authentication method trusts the remote host (root on the remote |
---|
555 | host can pretend to be any other user on that host), the name |
---|
556 | services, and partially the network: anyone who can see packets coming |
---|
557 | out from the server machine can do IP-spoofing and pretend to be any |
---|
558 | machine; however, the protocol prevents blind IP-spoofing (which used |
---|
559 | to be possible with rlogin). |
---|
560 | |
---|
561 | Many sites probably want to disable this authentication method because |
---|
562 | of the fundamental insecurity of conventional .rhosts or |
---|
563 | /etc/hosts.equiv authentication when faced with spoofing. It is |
---|
564 | recommended that this method not be supported by the server by |
---|
565 | default. |
---|
566 | .IP SSH_AUTH_RHOSTS_RSA |
---|
567 | |
---|
568 | In addition to conventional .rhosts and hosts.equiv authentication, |
---|
569 | this method additionally requires that the client host be |
---|
570 | authenticated using RSA. |
---|
571 | |
---|
572 | The client sends SSH_CMSG_AUTH_RHOSTS_RSA specifying the client-side |
---|
573 | user name, and the public host key of the client host. |
---|
574 | |
---|
575 | The server first checks if normal .rhosts or /etc/hosts.equiv |
---|
576 | authentication would be accepted, and if not, responds with |
---|
577 | SSH_SMSG_FAILURE. Otherwise, it checks whether it knows the host key |
---|
578 | for the client machine (using the same name for the host that was used |
---|
579 | for checking the .rhosts and /etc/hosts.equiv files). If it does not |
---|
580 | know the RSA key for the client, access is denied and SSH_SMSG_FAILURE |
---|
581 | is sent. |
---|
582 | |
---|
583 | If the server knows the host key of the client machine, it verifies |
---|
584 | that the given host key matches that known for the client. If not, |
---|
585 | access is denied and SSH_SMSG_FAILURE is sent. |
---|
586 | |
---|
587 | The server then sends a SSH_SMSG_AUTH_RSA_CHALLENGE message containing |
---|
588 | an encrypted challenge for the client. The challenge is 32 8-bit |
---|
589 | random bytes (256 bits). When encrypted, the highest (partial) byte |
---|
590 | is left as zero, the next byte contains the value 2, the following are |
---|
591 | non-zero random bytes, followed by a zero byte, and the challenge put |
---|
592 | in the remaining bytes. This is then encrypted using RSA with the |
---|
593 | client host's public key. (The padding and encryption algorithm is |
---|
594 | the same as that used for the session key.) |
---|
595 | |
---|
596 | The client decrypts the challenge using its private host key, |
---|
597 | concatenates this with the session id, and computes an MD5 checksum |
---|
598 | of the resulting 48 bytes. The MD5 output is returned as 16 bytes in |
---|
599 | a SSH_CMSG_AUTH_RSA_RESPONSE message. (MD5 is used to deter chosen |
---|
600 | plaintext attacks against RSA; the session id binds it to a specific |
---|
601 | session). |
---|
602 | |
---|
603 | The server verifies that the MD5 of the decrypted challenge returned by |
---|
604 | the client matches that of the original value, and sends SSH_SMSG_SUCCESS if |
---|
605 | so. Otherwise it sends SSH_SMSG_FAILURE and refuses the |
---|
606 | authentication attempt. |
---|
607 | |
---|
608 | This authentication method trusts the client side machine in that root |
---|
609 | on that machine can pretend to be any user on that machine. |
---|
610 | Additionally, it trusts the client host key. The name and/or IP |
---|
611 | address of the client host is only used to select the public host key. |
---|
612 | The same host name is used when scanning .rhosts or /etc/hosts.equiv |
---|
613 | and when selecting the host key. It would in principle be possible to |
---|
614 | eliminate the host name entirely and substitute it directly by the |
---|
615 | host key. IP and/or DNS [RFC1034] spoofing can only be used |
---|
616 | to pretend to be a host for which the attacker has the private host |
---|
617 | key. |
---|
618 | .IP SSH_AUTH_RSA |
---|
619 | |
---|
620 | The idea behind RSA authentication is that the server recognizes the |
---|
621 | public key offered by the client, generates a random challenge, and |
---|
622 | encrypts the challenge with the public key. The client must then |
---|
623 | prove that it has the corresponding private key by decrypting the |
---|
624 | challenge. |
---|
625 | |
---|
626 | The client sends SSH_CMSG_AUTH_RSA with public key modulus (n) as an |
---|
627 | argument. |
---|
628 | |
---|
629 | The server may respond immediately with SSH_SMSG_FAILURE if it does |
---|
630 | not permit authentication with this key. Otherwise it generates a |
---|
631 | challenge, encrypts it using the user's public key (stored on the |
---|
632 | server and identified using the modulus), and sends |
---|
633 | SSH_SMSG_AUTH_RSA_CHALLENGE with the challenge (mp-int) as an |
---|
634 | argument. |
---|
635 | |
---|
636 | The challenge is 32 8-bit random bytes (256 bits). When encrypted, |
---|
637 | the highest (partial) byte is left as zero, the next byte contains the |
---|
638 | value 2, the following are non-zero random bytes, followed by a zero |
---|
639 | byte, and the challenge put in the remaining bytes. This is then |
---|
640 | encrypted with the public key. (The padding and encryption algorithm |
---|
641 | is the same as that used for the session key.) |
---|
642 | |
---|
643 | The client decrypts the challenge using its private key, concatenates |
---|
644 | it with the session id, and computes an MD5 checksum of the resulting |
---|
645 | 48 bytes. The MD5 output is returned as 16 bytes in a |
---|
646 | SSH_CMSG_AUTH_RSA_RESPONSE message. (Note that the MD5 is necessary |
---|
647 | to avoid chosen plaintext attacks against RSA; the session id binds it |
---|
648 | to a specific session.) |
---|
649 | |
---|
650 | The server verifies that the MD5 of the decrypted challenge returned |
---|
651 | by the client matches that of the original value, and sends |
---|
652 | SSH_SMSG_SUCCESS if so. Otherwise it sends SSH_SMSG_FAILURE and |
---|
653 | refuses the authentication attempt. |
---|
654 | |
---|
655 | This authentication method does not trust the remote host, the |
---|
656 | network, name services, or anything else. Authentication is based |
---|
657 | solely on the possession of the private identification keys. Anyone |
---|
658 | in possession of the private keys can log in, but nobody else. |
---|
659 | |
---|
660 | The server may have additional requirements for a successful |
---|
661 | authentiation. For example, to limit damage due to a compromised RSA |
---|
662 | key, a server might restrict access to a limited set of hosts. |
---|
663 | .IP SSH_AUTH_PASSWORD |
---|
664 | |
---|
665 | The client sends a SSH_CMSG_AUTH_PASSWORD message with the plain text |
---|
666 | password. (Note that even though the password is plain text inside |
---|
667 | the message, it is normally encrypted by the packet mechanism.) |
---|
668 | |
---|
669 | The server verifies the password, and sends SSH_SMSG_SUCCESS if |
---|
670 | authentication was accepted and SSH_SMSG_FAILURE otherwise. |
---|
671 | |
---|
672 | Note that the password is read from the user by the client; the user |
---|
673 | never interacts with a login program. |
---|
674 | |
---|
675 | This authentication method does not trust the remote host, the |
---|
676 | network, name services or anything else. Authentication is based |
---|
677 | solely on the possession of the password. Anyone in possession of the |
---|
678 | password can log in, but nobody else. |
---|
679 | .RT |
---|
680 | |
---|
681 | .ti 0 |
---|
682 | Preparatory Operations |
---|
683 | |
---|
684 | After successful authentication, the server waits for a request from |
---|
685 | the client, processes the request, and responds with SSH_SMSG_SUCCESS |
---|
686 | whenever a request has been successfully processed. If it receives a |
---|
687 | message that it does not recognize or it fails to honor a request, it |
---|
688 | returns SSH_SMSG_FAILURE. It is expected that new message types might |
---|
689 | be added to this phase in future. |
---|
690 | |
---|
691 | The following messages are currently defined for this phase. |
---|
692 | .IP SSH_CMSG_REQUEST_COMPRESSION |
---|
693 | Requests that compression be enabled for this session. A |
---|
694 | gzip-compatible compression level (1-9) is passed as an argument. |
---|
695 | .IP SSH_CMSG_REQUEST_PTY |
---|
696 | Requests that a pseudo terminal device be allocated for this session. |
---|
697 | The user terminal type and terminal modes are supplied as arguments. |
---|
698 | .IP SSH_CMSG_X11_REQUEST_FORWARDING |
---|
699 | Requests forwarding of X11 connections from the remote machine to the |
---|
700 | local machine over the secure channel. Causes an internet-domain |
---|
701 | socket to be allocated and the DISPLAY variable to be set on the server. |
---|
702 | X11 authentication data is automatically passed to the server, and the |
---|
703 | client may implement spoofing of authentication data for added |
---|
704 | security. The authentication data is passed as arguments. |
---|
705 | .IP SSH_CMSG_PORT_FORWARD_REQUEST |
---|
706 | Requests forwarding of a TCP/IP port on the server host over the |
---|
707 | secure channel. What happens is that whenever a connection is made to |
---|
708 | the port on the server, a connection will be made from the client end |
---|
709 | to the specified host/port. Any user can forward unprivileged ports; |
---|
710 | only the root can forward privileged ports (as determined by |
---|
711 | authentication done earlier). |
---|
712 | .IP SSH_CMSG_AGENT_REQUEST_FORWARDING |
---|
713 | Requests forwarding of the connection to the authentication agent. |
---|
714 | .IP SSH_CMSG_EXEC_SHELL |
---|
715 | Starts a shell (command interpreter) for the user, and moves into |
---|
716 | interactive session mode. |
---|
717 | .IP SSH_CMSG_EXEC_CMD |
---|
718 | Executes the given command (actually "<shell> -c <command>" or |
---|
719 | equivalent) for the user, and moves into interactive session mode. |
---|
720 | .RT |
---|
721 | |
---|
722 | |
---|
723 | .ti 0 |
---|
724 | Interactive Session and Exchange of Data |
---|
725 | |
---|
726 | During the interactive session, any data written by the shell or |
---|
727 | command running on the server machine is forwarded to stdin or |
---|
728 | stderr on the client machine, and any input available from stdin on |
---|
729 | the client machine is forwarded to the program on the server machine. |
---|
730 | |
---|
731 | All exchange is asynchronous; either side can send at any time, and |
---|
732 | there are no acknowledgements (TCP/IP already provides reliable |
---|
733 | transport, and the packet protocol protects against tampering or IP |
---|
734 | spoofing). |
---|
735 | |
---|
736 | When the client receives EOF from its standard input, it will send |
---|
737 | SSH_CMSG_EOF; however, this in no way terminates the exchange. The |
---|
738 | exchange terminates and interactive mode is left when the server sends |
---|
739 | SSH_SMSG_EXITSTATUS to indicate that the client program has |
---|
740 | terminated. Alternatively, either side may disconnect at any time by |
---|
741 | sending SSH_MSG_DISCONNECT or closing the connection. |
---|
742 | |
---|
743 | The server may send any of the following messages: |
---|
744 | .IP SSH_SMSG_STDOUT_DATA |
---|
745 | Data written to stdout by the program running on the server. The data |
---|
746 | is passed as a string argument. The client writes this data to |
---|
747 | stdout. |
---|
748 | .IP SSH_SMSG_STDERR_DATA |
---|
749 | Data written to stderr by the program running on the server. The data |
---|
750 | is passed as a string argument. The client writes this data to |
---|
751 | stderr. (Note that if the program is running on a tty, it is not |
---|
752 | possible to separate stdout and stderr data, and all data will be sent |
---|
753 | as stdout data.) |
---|
754 | .IP SSH_SMSG_EXITSTATUS |
---|
755 | Indicates that the shell or command has exited. Exit status is passed |
---|
756 | as an integer argument. This message causes termination of the |
---|
757 | interactive session. |
---|
758 | .IP SSH_SMSG_AGENT_OPEN |
---|
759 | Indicates that someone on the server side is requesting a connection |
---|
760 | to the authentication agent. The server-side channel number is passed |
---|
761 | as an argument. The client must respond with either |
---|
762 | SSH_CHANNEL_OPEN_CONFIRMATION or SSH_CHANNEL_OPEN_FAILURE. |
---|
763 | .IP SSH_SMSG_X11_OPEN |
---|
764 | Indicates that a connection has been made to the X11 socket on the |
---|
765 | server side and should be forwarded to the real X server. An integer |
---|
766 | argument indicates the channel number allocated for this connection on |
---|
767 | the server side. The client should send back either |
---|
768 | SSH_MSG_CHANNEL_OPEN_CONFIRMATION or SSH_MSG_CHANNEL_OPEN_FAILURE with |
---|
769 | the same server side channel number. |
---|
770 | .IP SSH_MSG_PORT_OPEN |
---|
771 | Indicates that a connection has been made to a port on the server side |
---|
772 | for which forwarding has been requested. Arguments are server side |
---|
773 | channel number, host name to connect to, and port to connect to. The |
---|
774 | client should send back either |
---|
775 | SSH_MSG_CHANNEL_OPEN_CONFIRMATION or SSH_MSG_CHANNEL_OPEN_FAILURE with |
---|
776 | the same server side channel number. |
---|
777 | .IP SSH_MSG_CHANNEL_OPEN_CONFIRMATION |
---|
778 | This is sent by the server to indicate that it has opened a connection |
---|
779 | as requested in a previous message. The first argument indicates the |
---|
780 | client side channel number, and the second argument is the channel number |
---|
781 | that the server has allocated for this connection. |
---|
782 | .IP SSH_MSG_CHANNEL_OPEN_FAILURE |
---|
783 | This is sent by the server to indicate that it failed to open a |
---|
784 | connection as requested in a previous message. The client-side |
---|
785 | channel number is passed as an argument. The client will close the |
---|
786 | descriptor associated with the channel and free the channel. |
---|
787 | .IP SSH_MSG_CHANNEL_DATA |
---|
788 | This packet contains data for a channel from the server. The first |
---|
789 | argument is the client-side channel number, and the second argument (a |
---|
790 | string) is the data. |
---|
791 | .IP SSH_MSG_CHANNEL_CLOSE |
---|
792 | This is sent by the server to indicate that whoever was in the other |
---|
793 | end of the channel has closed it. The argument is the client side channel |
---|
794 | number. The client will let all buffered data in the channel to |
---|
795 | drain, and when ready, will close the socket, free the channel, and |
---|
796 | send the server a SSH_MSG_CHANNEL_CLOSE_CONFIRMATION message for the |
---|
797 | channel. |
---|
798 | .IP SSH_MSG_CHANNEL_CLOSE_CONFIRMATION |
---|
799 | This is send by the server to indicate that a channel previously |
---|
800 | closed by the client has now been closed on the server side as well. |
---|
801 | The argument indicates the client channel number. The client frees |
---|
802 | the channel. |
---|
803 | .RT |
---|
804 | |
---|
805 | The client may send any of the following messages: |
---|
806 | .IP SSH_CMSG_STDIN_DATA |
---|
807 | This is data to be sent as input to the program running on the server. |
---|
808 | The data is passed as a string. |
---|
809 | .IP SSH_CMSG_EOF |
---|
810 | Indicates that the client has encountered EOF while reading standard |
---|
811 | input. The server will allow any buffered input data to drain, and |
---|
812 | will then close the input to the program. |
---|
813 | .IP SSH_CMSG_WINDOW_SIZE |
---|
814 | Indicates that window size on the client has been changed. The server |
---|
815 | updates the window size of the tty and causes SIGWINCH to be sent to |
---|
816 | the program. The new window size is passed as four integer arguments: |
---|
817 | row, col, xpixel, ypixel. |
---|
818 | .IP SSH_MSG_PORT_OPEN |
---|
819 | Indicates that a connection has been made to a port on the client side |
---|
820 | for which forwarding has been requested. Arguments are client side |
---|
821 | channel number, host name to connect to, and port to connect to. The |
---|
822 | server should send back either SSH_MSG_CHANNEL_OPEN_CONFIRMATION or |
---|
823 | SSH_MSG_CHANNEL_OPEN_FAILURE with the same client side channel number. |
---|
824 | .IP SSH_MSG_CHANNEL_OPEN_CONFIRMATION |
---|
825 | This is sent by the client to indicate that it has opened a connection |
---|
826 | as requested in a previous message. The first argument indicates the |
---|
827 | server side channel number, and the second argument is the channel |
---|
828 | number that the client has allocated for this connection. |
---|
829 | .IP SSH_MSG_CHANNEL_OPEN_FAILURE |
---|
830 | This is sent by the client to indicate that it failed to open a |
---|
831 | connection as requested in a previous message. The server side |
---|
832 | channel number is passed as an argument. The server will close the |
---|
833 | descriptor associated with the channel and free the channel. |
---|
834 | .IP SSH_MSG_CHANNEL_DATA |
---|
835 | This packet contains data for a channel from the client. The first |
---|
836 | argument is the server side channel number, and the second argument (a |
---|
837 | string) is the data. |
---|
838 | .IP SSH_MSG_CHANNEL_CLOSE |
---|
839 | This is sent by the client to indicate that whoever was in the other |
---|
840 | end of the channel has closed it. The argument is the server channel |
---|
841 | number. The server will allow buffered data to drain, and when ready, |
---|
842 | will close the socket, free the channel, and send the client a |
---|
843 | SSH_MSG_CHANNEL_CLOSE_CONFIRMATION message for the channel. |
---|
844 | .IP SSH_MSG_CHANNEL_CLOSE_CONFIRMATION |
---|
845 | This is send by the client to indicate that a channel previously |
---|
846 | closed by the server has now been closed on the client side as well. |
---|
847 | The argument indicates the server channel number. The server frees |
---|
848 | the channel. |
---|
849 | .RT |
---|
850 | |
---|
851 | Any unsupported messages during interactive mode cause the connection |
---|
852 | to be terminated with SSH_MSG_DISCONNECT and an error message. |
---|
853 | Compatible protocol upgrades should agree about any extensions during |
---|
854 | the preparation phase or earlier. |
---|
855 | |
---|
856 | |
---|
857 | .ti 0 |
---|
858 | Termination of the Connection |
---|
859 | |
---|
860 | Normal termination of the connection is always initiated by the server |
---|
861 | by sending SSH_SMSG_EXITSTATUS after the program has exited. The |
---|
862 | client responds to this message by sending SSH_CMSG_EXIT_CONFIRMATION |
---|
863 | and closes the socket; the server then closes the socket. There are |
---|
864 | two purposes for the confirmation: some systems may lose previously |
---|
865 | sent data when the socket is closed, and closing the client side first |
---|
866 | causes any TCP/IP TIME_WAIT [RFC0793] waits to occur on the client side, not |
---|
867 | consuming server resources. |
---|
868 | |
---|
869 | If the program terminates due to a signal, the server will send |
---|
870 | SSH_MSG_DISCONNECT with an appropriate message. If the connection is |
---|
871 | closed, all file descriptors to the program will be closed and the |
---|
872 | server will exit. If the program runs on a tty, the kernel sends it |
---|
873 | the SIGHUP signal when the pty master side is closed. |
---|
874 | |
---|
875 | .ti 0 |
---|
876 | Protocol Flags |
---|
877 | |
---|
878 | Both the server and the client pass 32 bits of protocol flags to the |
---|
879 | other side. The flags are intended for compatible protocol extension; |
---|
880 | the server first announces which added capabilities it supports, and |
---|
881 | the client then sends the capabilities that it supports. |
---|
882 | |
---|
883 | The following flags are currently defined (the values are bit masks): |
---|
884 | .IP "1 SSH_PROTOFLAG_SCREEN_NUMBER" |
---|
885 | This flag can only be sent by the client. It indicates that the X11 |
---|
886 | forwarding requests it sends will include the screen number. |
---|
887 | .IP "2 SSH_PROTOFLAG_HOST_IN_FWD_OPEN" |
---|
888 | If both sides specify this flag, SSH_SMSG_X11_OPEN and |
---|
889 | SSH_MSG_PORT_OPEN messages will contain an additional field containing |
---|
890 | a description of the host at the other end of the connection. |
---|
891 | .RT |
---|
892 | |
---|
893 | .ti 0 |
---|
894 | Detailed Description of Packet Types and Formats |
---|
895 | |
---|
896 | The supported packet types and the corresponding message numbers are |
---|
897 | given in the following table. Messages with _MSG_ in their name may |
---|
898 | be sent by either side. Messages with _CMSG_ are only sent by the |
---|
899 | client, and messages with _SMSG_ only by the server. |
---|
900 | |
---|
901 | A packet may contain additional data after the arguments specified |
---|
902 | below. Any such data should be ignored by the receiver. However, it |
---|
903 | is recommended that no such data be stored without good reason. (This |
---|
904 | helps build compatible extensions.) |
---|
905 | .IP "0 SSH_MSG_NONE" |
---|
906 | This code is reserved. This message type is never sent. |
---|
907 | .IP "1 SSH_MSG_DISCONNECT" |
---|
908 | .TS |
---|
909 | ; |
---|
910 | l l. |
---|
911 | string Cause of disconnection |
---|
912 | .TE |
---|
913 | This message may be sent by either party at any time. It causes the |
---|
914 | immediate disconnection of the connection. The message is intended to |
---|
915 | be displayed to a human, and describes the reason for disconnection. |
---|
916 | .IP "2 SSH_SMSG_PUBLIC_KEY" |
---|
917 | .TS |
---|
918 | ; |
---|
919 | l l. |
---|
920 | 8 bytes anti_spoofing_cookie |
---|
921 | 32-bit int server_key_bits |
---|
922 | mp-int server_key_public_exponent |
---|
923 | mp-int server_key_public_modulus |
---|
924 | 32-bit int host_key_bits |
---|
925 | mp-int host_key_public_exponent |
---|
926 | mp-int host_key_public_modulus |
---|
927 | 32-bit int protocol_flags |
---|
928 | 32-bit int supported_ciphers_mask |
---|
929 | 32-bit int supported_authentications_mask |
---|
930 | .TE |
---|
931 | Sent as the first message by the server. This message gives the |
---|
932 | server's host key, server key, protocol flags (intended for compatible |
---|
933 | protocol extension), supported_ciphers_mask (which is the |
---|
934 | bitwise or of (1 << cipher_number), where << is the left shift |
---|
935 | operator, for all supported ciphers), and |
---|
936 | supported_authentications_mask (which is the bitwise or of (1 << |
---|
937 | authentication_type) for all supported authentication types). The |
---|
938 | anti_spoofing_cookie is 64 random bits, and must be sent back |
---|
939 | verbatim by the client in its reply. It is used to make IP-spoofing |
---|
940 | more difficult (encryption and host keys are the real defense against |
---|
941 | spoofing). |
---|
942 | .IP "3 SSH_CMSG_SESSION_KEY" |
---|
943 | .TS |
---|
944 | ; |
---|
945 | l l. |
---|
946 | 1 byte cipher_type (must be one of the supported values) |
---|
947 | 8 bytes anti_spoofing_cookie (must match data sent by the server) |
---|
948 | mp-int double-encrypted session key |
---|
949 | 32-bit int protocol_flags |
---|
950 | .TE |
---|
951 | Sent by the client as the first message in the session. Selects the |
---|
952 | cipher to use, and sends the encrypted session key to the server. The |
---|
953 | anti_spoofing_cookie must be the same bytes that were sent by the |
---|
954 | server. Protocol_flags is intended for negotiating compatible |
---|
955 | protocol extensions. |
---|
956 | .IP "4 SSH_CMSG_USER" |
---|
957 | .TS |
---|
958 | ; |
---|
959 | l l. |
---|
960 | string user login name on server |
---|
961 | .TE |
---|
962 | Sent by the client to begin authentication. Specifies the user name |
---|
963 | on the server to log in as. The server responds with SSH_SMSG_SUCCESS |
---|
964 | if no authentication is needed for this user, or SSH_SMSG_FAILURE if |
---|
965 | authentication is needed (or the user does not exist). [Note to the |
---|
966 | implementator: the user name is of arbitrary size. The implementation |
---|
967 | must be careful not to overflow internal buffers.] |
---|
968 | .IP "5 SSH_CMSG_AUTH_RHOSTS" |
---|
969 | .TS |
---|
970 | ; |
---|
971 | l l. |
---|
972 | string client-side user name |
---|
973 | .TE |
---|
974 | Requests authentication using /etc/hosts.equiv and .rhosts (or |
---|
975 | equivalent mechanisms). This authentication method is normally |
---|
976 | disabled in the server because it is not secure (but this is the |
---|
977 | method used by rsh and rlogin). The server responds with |
---|
978 | SSH_SMSG_SUCCESS if authentication was successful, and |
---|
979 | SSH_SMSG_FAILURE if access was not granted. The server should check |
---|
980 | that the client side port number is less than 1024 (a privileged |
---|
981 | port), and immediately reject authentication if it is not. Supporting |
---|
982 | this authentication method is optional. This method should normally |
---|
983 | not be enabled in the server because it is not safe. (However, not |
---|
984 | enabling this only helps if rlogind and rshd are disabled.) |
---|
985 | .IP "6 SSH_CMSG_AUTH_RSA" |
---|
986 | .TS |
---|
987 | ; |
---|
988 | l l. |
---|
989 | mp-int identity_public_modulus |
---|
990 | .TE |
---|
991 | Requests authentication using pure RSA authentication. The server |
---|
992 | checks if the given key is permitted to log in, and if so, responds |
---|
993 | with SSH_SMSG_AUTH_RSA_CHALLENGE. Otherwise, it responds with |
---|
994 | SSH_SMSG_FAILURE. The client often tries several different keys in |
---|
995 | sequence until one supported by the server is found. Authentication |
---|
996 | is accepted if the client gives the correct response to the challenge. |
---|
997 | The server is free to add other criteria for authentication, such as a |
---|
998 | requirement that the connection must come from a certain host. Such |
---|
999 | additions are not visible at the protocol level. Supporting this |
---|
1000 | authentication method is optional but recommended. |
---|
1001 | .IP "7 SSH_SMSG_AUTH_RSA_CHALLENGE" |
---|
1002 | .TS |
---|
1003 | ; |
---|
1004 | l l. |
---|
1005 | mp-int encrypted challenge |
---|
1006 | .TE |
---|
1007 | Presents an RSA authentication challenge to the client. The challenge |
---|
1008 | is a 256-bit random value encrypted as described elsewhere in this |
---|
1009 | document. The client must decrypt the challenge using the RSA private |
---|
1010 | key, compute MD5 of the challenge plus session id, and send back the |
---|
1011 | resulting 16 bytes using SSH_CMSG_AUTH_RSA_RESPONSE. |
---|
1012 | .IP "8 SSH_CMSG_AUTH_RSA_RESPONSE" |
---|
1013 | .TS |
---|
1014 | ; |
---|
1015 | l l. |
---|
1016 | 16 bytes MD5 of decrypted challenge |
---|
1017 | .TE |
---|
1018 | This message is sent by the client in response to an RSA challenge. |
---|
1019 | The MD5 checksum is returned instead of the decrypted challenge to |
---|
1020 | deter known-plaintext attacks against the RSA key. The server |
---|
1021 | responds to this message with either SSH_SMSG_SUCCESS or |
---|
1022 | SSH_SMSG_FAILURE. |
---|
1023 | .IP "9 SSH_CMSG_AUTH_PASSWORD" |
---|
1024 | .TS |
---|
1025 | ; |
---|
1026 | l l. |
---|
1027 | string plain text password |
---|
1028 | .TE |
---|
1029 | Requests password authentication using the given password. Note that |
---|
1030 | even though the password is plain text inside the packet, the whole |
---|
1031 | packet is normally encrypted by the packet layer. It would not be |
---|
1032 | possible for the client to perform password encryption/hashing, |
---|
1033 | because it cannot know which kind of encryption/hashing, if any, the |
---|
1034 | server uses. The server responds to this message with |
---|
1035 | SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE. |
---|
1036 | .IP "10 SSH_CMSG_REQUEST_PTY" |
---|
1037 | .TS |
---|
1038 | ; |
---|
1039 | l l. |
---|
1040 | string TERM environment variable value (e.g. vt100) |
---|
1041 | 32-bit int terminal height, rows (e.g., 24) |
---|
1042 | 32-bit int terminal width, columns (e.g., 80) |
---|
1043 | 32-bit int terminal width, pixels (0 if no graphics) (e.g., 480) |
---|
1044 | 32-bit int terminal height, pixels (0 if no graphics) (e.g., 640) |
---|
1045 | n bytes tty modes encoded in binary |
---|
1046 | .TE |
---|
1047 | Requests a pseudo-terminal to be allocated for this command. This |
---|
1048 | message can be used regardless of whether the session will later |
---|
1049 | execute the shell or a command. If a pty has been requested with this |
---|
1050 | message, the shell or command will run on a pty. Otherwise it will |
---|
1051 | communicate with the server using pipes, sockets or some other similar |
---|
1052 | mechanism. |
---|
1053 | |
---|
1054 | The terminal type gives the type of the user's terminal. In the UNIX |
---|
1055 | environment it is passed to the shell or command in the TERM |
---|
1056 | environment variable. |
---|
1057 | |
---|
1058 | The width and height values give the initial size of the user's |
---|
1059 | terminal or window. All values can be zero if not supported by the |
---|
1060 | operating system. The server will pass these values to the kernel if |
---|
1061 | supported. |
---|
1062 | |
---|
1063 | Terminal modes are encoded into a byte stream in a portable format. |
---|
1064 | The exact format is described later in this document. |
---|
1065 | |
---|
1066 | The server responds to the request with either SSH_SMSG_SUCCESS or |
---|
1067 | SSH_SMSG_FAILURE. If the server does not have the concept of pseudo |
---|
1068 | terminals, it should return success if it is possible to execute a |
---|
1069 | shell or a command so that it looks to the client as if it was running |
---|
1070 | on a pseudo terminal. |
---|
1071 | .IP "11 SSH_CMSG_WINDOW_SIZE" |
---|
1072 | .TS |
---|
1073 | ; |
---|
1074 | l l. |
---|
1075 | 32-bit int terminal height, rows |
---|
1076 | 32-bit int terminal width, columns |
---|
1077 | 32-bit int terminal width, pixels |
---|
1078 | 32-bit int terminal height, pixels |
---|
1079 | .TE |
---|
1080 | This message can only be sent by the client during the interactive |
---|
1081 | session. This indicates that the size of the user's window has |
---|
1082 | changed, and provides the new size. The server will update the |
---|
1083 | kernel's notion of the window size, and a SIGWINCH signal or |
---|
1084 | equivalent will be sent to the shell or command (if supported by the |
---|
1085 | operating system). |
---|
1086 | .IP "12 SSH_CMSG_EXEC_SHELL" |
---|
1087 | |
---|
1088 | (no arguments) |
---|
1089 | |
---|
1090 | Starts a shell (command interpreter), and enters interactive session |
---|
1091 | mode. |
---|
1092 | .IP "13 SSH_CMSG_EXEC_CMD" |
---|
1093 | .TS |
---|
1094 | ; |
---|
1095 | l l. |
---|
1096 | string command to execute |
---|
1097 | .TE |
---|
1098 | Starts executing the given command, and enters interactive session |
---|
1099 | mode. On UNIX, the command is run as "<shell> -c <command>", where |
---|
1100 | <shell> is the user's login shell. |
---|
1101 | .IP "14 SSH_SMSG_SUCCESS" |
---|
1102 | |
---|
1103 | (no arguments) |
---|
1104 | |
---|
1105 | This message is sent by the server in response to the session key, a |
---|
1106 | successful authentication request, and a successfully completed |
---|
1107 | preparatory operation. |
---|
1108 | .IP "15 SSH_SMSG_FAILURE" |
---|
1109 | |
---|
1110 | (no arguments) |
---|
1111 | |
---|
1112 | This message is sent by the server in response to a failed |
---|
1113 | authentication operation to indicate that the user has not yet been |
---|
1114 | successfully authenticated, and in response to a failed preparatory |
---|
1115 | operation. This is also sent in response to an authentication or |
---|
1116 | preparatory operation request that is not recognized or supported. |
---|
1117 | .IP "16 SSH_CMSG_STDIN_DATA" |
---|
1118 | .TS |
---|
1119 | ; |
---|
1120 | l l. |
---|
1121 | string data |
---|
1122 | .TE |
---|
1123 | Delivers data from the client to be supplied as input to the shell or |
---|
1124 | program running on the server side. This message can only be used in |
---|
1125 | the interactive session mode. No acknowledgement is sent for this |
---|
1126 | message. |
---|
1127 | .IP "17 SSH_SMSG_STDOUT_DATA" |
---|
1128 | .TS |
---|
1129 | ; |
---|
1130 | l l. |
---|
1131 | string data |
---|
1132 | .TE |
---|
1133 | Delivers data from the server that was read from the standard output of |
---|
1134 | the shell or program running on the server side. This message can |
---|
1135 | only be used in the interactive session mode. No acknowledgement is |
---|
1136 | sent for this message. |
---|
1137 | .IP "18 SSH_SMSG_STDERR_DATA" |
---|
1138 | .TS |
---|
1139 | ; |
---|
1140 | l l. |
---|
1141 | string data |
---|
1142 | .TE |
---|
1143 | Delivers data from the server that was read from the standard error of |
---|
1144 | the shell or program running on the server side. This message can |
---|
1145 | only be used in the interactive session mode. No acknowledgement is |
---|
1146 | sent for this message. |
---|
1147 | .IP "19 SSH_CMSG_EOF" |
---|
1148 | |
---|
1149 | (no arguments) |
---|
1150 | |
---|
1151 | This message is sent by the client to indicate that EOF has been |
---|
1152 | reached on the input. Upon receiving this message, and after all |
---|
1153 | buffered input data has been sent to the shell or program, the server |
---|
1154 | will close the input file descriptor to the program. This message can |
---|
1155 | only be used in the interactive session mode. No acknowledgement is |
---|
1156 | sent for this message. |
---|
1157 | .IP "20 SSH_SMSG_EXITSTATUS" |
---|
1158 | .TS |
---|
1159 | ; |
---|
1160 | l l. |
---|
1161 | 32-bit int exit status of the command |
---|
1162 | .TE |
---|
1163 | Returns the exit status of the shell or program after it has exited. |
---|
1164 | The client should respond with SSH_CMSG_EXIT_CONFIRMATION when it has |
---|
1165 | received this message. This will be the last message sent by the |
---|
1166 | server. If the program being executed dies with a signal instead of |
---|
1167 | exiting normally, the server should terminate the session with |
---|
1168 | SSH_MSG_DISCONNECT (which can be used to pass a human-readable string |
---|
1169 | indicating that the program died due to a signal) instead of using |
---|
1170 | this message. |
---|
1171 | .IP "21 SSH_MSG_CHANNEL_OPEN_CONFIRMATION" |
---|
1172 | .TS |
---|
1173 | ; |
---|
1174 | l l. |
---|
1175 | 32-bit int remote_channel |
---|
1176 | 32-bit int local_channel |
---|
1177 | .TE |
---|
1178 | This is sent in response to any channel open request if the channel |
---|
1179 | has been successfully opened. Remote_channel is the channel number |
---|
1180 | received in the initial open request; local_channel is the channel |
---|
1181 | number the side sending this message has allocated for the channel. |
---|
1182 | Data can be transmitted on the channel after this message. |
---|
1183 | .IP "22 SSH_MSG_CHANNEL_OPEN_FAILURE" |
---|
1184 | .TS |
---|
1185 | ; |
---|
1186 | l l. |
---|
1187 | 32-bit int remote_channel |
---|
1188 | .TE |
---|
1189 | This message indicates that an earlier channel open request by the |
---|
1190 | other side has failed or has been denied. Remote_channel is the |
---|
1191 | channel number given in the original request. |
---|
1192 | .IP "23 SSH_MSG_CHANNEL_DATA" |
---|
1193 | .TS |
---|
1194 | ; |
---|
1195 | l l. |
---|
1196 | 32-bit int remote_channel |
---|
1197 | string data |
---|
1198 | .TE |
---|
1199 | Data is transmitted in a channel in these messages. A channel is |
---|
1200 | bidirectional, and both sides can send these messages. There is no |
---|
1201 | acknowledgement for these messages. It is possible that either side |
---|
1202 | receives these messages after it has sent SSH_MSG_CHANNEL_CLOSE for |
---|
1203 | the channel. These messages cannot be received after the party has |
---|
1204 | sent or received SSH_MSG_CHANNEL_CLOSE_CONFIRMATION. |
---|
1205 | .IP "24 SSH_MSG_CHANNEL_CLOSE" |
---|
1206 | .TS |
---|
1207 | ; |
---|
1208 | l l. |
---|
1209 | 32-bit int remote_channel |
---|
1210 | .TE |
---|
1211 | When a channel is closed at one end of the connection, that side sends |
---|
1212 | this message. Upon receiving this message, the channel should be |
---|
1213 | closed. When this message is received, if the channel is already |
---|
1214 | closed (the receiving side has sent this message for the same channel |
---|
1215 | earlier), the channel is freed and no further action is taken; |
---|
1216 | otherwise the channel is freed and SSH_MSG_CHANNEL_CLOSE_CONFIRMATION |
---|
1217 | is sent in response. (It is possible that the channel is closed |
---|
1218 | simultaneously at both ends.) |
---|
1219 | .IP "25 SSH_MSG_CHANNEL_CLOSE_CONFIRMATION" |
---|
1220 | .TS |
---|
1221 | ; |
---|
1222 | l l. |
---|
1223 | 32-bit int remote_channel |
---|
1224 | .TE |
---|
1225 | This message is sent in response to SSH_MSG_CHANNEL_CLOSE unless the |
---|
1226 | channel was already closed. When this message is sent or received, |
---|
1227 | the channel is freed. |
---|
1228 | .IP "26 (OBSOLETED; was unix-domain X11 forwarding) |
---|
1229 | .IP "27 SSH_SMSG_X11_OPEN" |
---|
1230 | .TS |
---|
1231 | ; |
---|
1232 | l l. |
---|
1233 | 32-bit int local_channel |
---|
1234 | string originator_string (see below) |
---|
1235 | .TE |
---|
1236 | This message can be sent by the server during the interactive session |
---|
1237 | mode to indicate that a client has connected the fake X server. |
---|
1238 | Local_channel is the channel number that the server has allocated for |
---|
1239 | the connection. The client should try to open a connection to the |
---|
1240 | real X server, and respond with SSH_MSG_CHANNEL_OPEN_CONFIRMATION or |
---|
1241 | SSH_MSG_CHANNEL_OPEN_FAILURE. |
---|
1242 | |
---|
1243 | The field originator_string is present if both sides |
---|
1244 | specified SSH_PROTOFLAG_HOST_IN_FWD_OPEN in the protocol flags. It |
---|
1245 | contains a description of the host originating the connection. |
---|
1246 | .IP "28 SSH_CMSG_PORT_FORWARD_REQUEST" |
---|
1247 | .TS |
---|
1248 | ; |
---|
1249 | l l. |
---|
1250 | 32-bit int server_port |
---|
1251 | string host_to_connect |
---|
1252 | 32-bit int port_to_connect |
---|
1253 | .TE |
---|
1254 | Sent by the client in the preparatory phase, this message requests |
---|
1255 | that server_port on the server machine be forwarded over the secure |
---|
1256 | channel to the client machine, and from there to the specified host |
---|
1257 | and port. The server should start listening on the port, and send |
---|
1258 | SSH_MSG_PORT_OPEN whenever a connection is made to it. Supporting |
---|
1259 | this message is optional, and the server is free to reject any forward |
---|
1260 | request. For example, it is highly recommended that unless the user |
---|
1261 | has been authenticated as root, forwarding any privileged port numbers |
---|
1262 | (below 1024) is denied. |
---|
1263 | .IP "29 SSH_MSG_PORT_OPEN" |
---|
1264 | .TS |
---|
1265 | ; |
---|
1266 | l l. |
---|
1267 | 32-bit int local_channel |
---|
1268 | string host_name |
---|
1269 | 32-bit int port |
---|
1270 | string originator_string (see below) |
---|
1271 | .TE |
---|
1272 | Sent by either party in interactive session mode, this message |
---|
1273 | indicates that a connection has been opened to a forwarded TCP/IP |
---|
1274 | port. Local_channel is the channel number that the sending party has |
---|
1275 | allocated for the connection. Host_name is the host the connection |
---|
1276 | should be be forwarded to, and the port is the port on that host to |
---|
1277 | connect. The receiving party should open the connection, and respond |
---|
1278 | with SSH_MSG_CHANNEL_OPEN_CONFIRMATION or |
---|
1279 | SSH_MSG_CHANNEL_OPEN_FAILURE. It is recommended that the receiving |
---|
1280 | side check the host_name and port for validity to avoid compromising |
---|
1281 | local security by compromised remote side software. Particularly, it |
---|
1282 | is recommended that the client permit connections only to those ports |
---|
1283 | for which it has requested forwarding with SSH_CMSG_PORT_FORWARD_REQUEST. |
---|
1284 | |
---|
1285 | The field originator_string is present if both sides |
---|
1286 | specified SSH_PROTOFLAG_HOST_IN_FWD_OPEN in the protocol flags. It |
---|
1287 | contains a description of the host originating the connection. |
---|
1288 | .IP "30 SSH_CMSG_AGENT_REQUEST_FORWARDING" |
---|
1289 | |
---|
1290 | (no arguments) |
---|
1291 | |
---|
1292 | Requests that the connection to the authentication agent be forwarded |
---|
1293 | over the secure channel. The method used by clients to contact the |
---|
1294 | authentication agent within each machine is implementation and machine |
---|
1295 | dependent. If the server accepts this request, it should arrange that |
---|
1296 | any clients run from this session will actually contact the server |
---|
1297 | program when they try to contact the authentication agent. The server |
---|
1298 | should then send a SSH_SMSG_AGENT_OPEN to open a channel to the agent, |
---|
1299 | and the client should forward the connection to the real |
---|
1300 | authentication agent. Supporting this message is optional. |
---|
1301 | .IP "31 SSH_SMSG_AGENT_OPEN" |
---|
1302 | .TS |
---|
1303 | ; |
---|
1304 | l l. |
---|
1305 | 32-bit int local_channel |
---|
1306 | .TE |
---|
1307 | Sent by the server in interactive session mode, this message requests |
---|
1308 | opening a channel to the authentication agent. The client should open |
---|
1309 | a channel, and respond with either SSH_MSG_CHANNEL_OPEN_CONFIRMATION |
---|
1310 | or SSH_MSG_CHANNEL_OPEN_FAILURE. |
---|
1311 | .IP "32 SSH_MSG_IGNORE" |
---|
1312 | .TS |
---|
1313 | ; |
---|
1314 | l l. |
---|
1315 | string data |
---|
1316 | .TE |
---|
1317 | Either party may send this message at any time. This message, and the |
---|
1318 | argument string, is silently ignored. This message might be used in |
---|
1319 | some implementations to make traffic analysis more difficult. This |
---|
1320 | message is not currently sent by the implementation, but all |
---|
1321 | implementations are required to recognize and ignore it. |
---|
1322 | .IP "33 SSH_CMSG_EXIT_CONFIRMATION" |
---|
1323 | |
---|
1324 | (no arguments) |
---|
1325 | |
---|
1326 | Sent by the client in response to SSH_SMSG_EXITSTATUS. This is the |
---|
1327 | last message sent by the client. |
---|
1328 | .IP "34 SSH_CMSG_X11_REQUEST_FORWARDING" |
---|
1329 | .TS |
---|
1330 | ; |
---|
1331 | l l. |
---|
1332 | string x11_authentication_protocol |
---|
1333 | string x11_authentication_data |
---|
1334 | 32-bit int screen number (if SSH_PROTOFLAG_SCREEN_NUMBER) |
---|
1335 | .TE |
---|
1336 | Sent by the client during the preparatory phase, this message requests |
---|
1337 | that the server create a fake X11 display and set the DISPLAY |
---|
1338 | environment variable accordingly. An internet-domain display is |
---|
1339 | preferable. The given authentication protocol and the associated data |
---|
1340 | should be recorded by the server so that it is used as authentication |
---|
1341 | on connections (e.g., in .Xauthority). The authentication protocol |
---|
1342 | must be one of the supported X11 authentication protocols, e.g., |
---|
1343 | "MIT-MAGIC-COOKIE-1". Authentication data must be a lowercase hex |
---|
1344 | string of even length. Its interpretation is protocol dependent. |
---|
1345 | The data is in a format that can be used with e.g. the xauth program. |
---|
1346 | Supporting this message is optional. |
---|
1347 | |
---|
1348 | The client is permitted (and recommended) to generate fake |
---|
1349 | authentication information and send fake information to the server. |
---|
1350 | This way, a corrupt server will not have access to the user's terminal |
---|
1351 | after the connection has terminated. The correct authorization codes |
---|
1352 | will also not be left hanging around in files on the server (many |
---|
1353 | users keep the same X session for months, thus protecting the |
---|
1354 | authorization data becomes important). |
---|
1355 | |
---|
1356 | X11 authentication spoofing works by initially sending fake (random) |
---|
1357 | authentication data to the server, and interpreting the first packet |
---|
1358 | sent by the X11 client after the connection has been opened. The |
---|
1359 | first packet contains the client's authentication. If the packet |
---|
1360 | contains the correct fake data, it is replaced by the client by the |
---|
1361 | correct authentication data, and then sent to the X server. |
---|
1362 | .IP "35 SSH_CMSG_AUTH_RHOSTS_RSA" |
---|
1363 | .TS |
---|
1364 | ; |
---|
1365 | l l. |
---|
1366 | string clint-side user name |
---|
1367 | 32-bit int client_host_key_bits |
---|
1368 | mp-int client_host_key_public_exponent |
---|
1369 | mp-int client_host_key_public_modulus |
---|
1370 | .TE |
---|
1371 | Requests authentication using /etc/hosts.equiv and .rhosts (or |
---|
1372 | equivalent) together with RSA host authentication. The server should |
---|
1373 | check that the client side port number is less than 1024 (a privileged |
---|
1374 | port), and immediately reject authentication if it is not. The server |
---|
1375 | responds with SSH_SMSG_FAILURE or SSH_SMSG_AUTH_RSA_CHALLENGE. The |
---|
1376 | client must respond to the challenge with the proper |
---|
1377 | SSH_CMSG_AUTH_RSA_RESPONSE. The server then responds with success if |
---|
1378 | access was granted, or failure if the client gave a wrong response. |
---|
1379 | Supporting this authentication method is optional but recommended in |
---|
1380 | most environments. |
---|
1381 | .IP "36 SSH_MSG_DEBUG" |
---|
1382 | .TS |
---|
1383 | ; |
---|
1384 | l l. |
---|
1385 | string debugging message sent to the other side |
---|
1386 | .TE |
---|
1387 | This message may be sent by either party at any time. It is used to |
---|
1388 | send debugging messages that may be informative to the user in |
---|
1389 | solving various problems. For example, if authentication fails |
---|
1390 | because of some configuration error (e.g., incorrect permissions for |
---|
1391 | some file), it can be very helpful for the user to make the cause of |
---|
1392 | failure available. On the other hand, one should not make too much |
---|
1393 | information available for security reasons. It is recommended that |
---|
1394 | the client provides an option to display the debugging information |
---|
1395 | sent by the sender (the user probably does not want to see it by default). |
---|
1396 | The server can log debugging data sent by the client (if any). Either |
---|
1397 | party is free to ignore any received debugging data. Every |
---|
1398 | implementation must be able to receive this message, but no |
---|
1399 | implementation is required to send these. |
---|
1400 | .IP "37 SSH_CMSG_REQUEST_COMPRESSION" |
---|
1401 | .TS |
---|
1402 | ; |
---|
1403 | l l. |
---|
1404 | 32-bit int gzip compression level (1-9) |
---|
1405 | .TE |
---|
1406 | This message can be sent by the client in the preparatory operations |
---|
1407 | phase. The server responds with SSH_SMSG_FAILURE if it does not |
---|
1408 | support compression or does not want to compress; it responds with |
---|
1409 | SSH_SMSG_SUCCESS if it accepted the compression request. In the |
---|
1410 | latter case the response to this packet will still be uncompressed, |
---|
1411 | but all further packets in either direction will be compressed by gzip. |
---|
1412 | .IP "38 SSH_CMSG_MAX_PACKET_SIZE" |
---|
1413 | .TS |
---|
1414 | ; |
---|
1415 | l l. |
---|
1416 | 32-bit int maximum packet size, bytes (4096-1024k) |
---|
1417 | .TE |
---|
1418 | This message can be sent by the client in the preparatory operations |
---|
1419 | phase. The server responds with SSH_SMSG_FAILURE if it does not |
---|
1420 | support limiting packet size, or with SSH_SMSG_SUCCESS if it has |
---|
1421 | limited the maximum packet size (as determined by the value in the |
---|
1422 | size field) to the specified value. |
---|
1423 | .IP "39 SSH_CMSG_AUTH_TIS" |
---|
1424 | |
---|
1425 | (no arguments) |
---|
1426 | |
---|
1427 | This message starts TIS authentication. The server |
---|
1428 | responds with SSH_SMSG_FAILURE or SSH_SMSG_AUTH_TIS_CHALLENGE. |
---|
1429 | .IP "40 SSH_SMSG_AUTH_TIS_CHALLENGE" |
---|
1430 | .TS |
---|
1431 | ; |
---|
1432 | l l. |
---|
1433 | string tis challenge |
---|
1434 | .TE |
---|
1435 | Server sends TIS challenge to user and client should show it to user |
---|
1436 | and ask for response, which is sent back using |
---|
1437 | SSH_CMSG_AUTH_TIS_RESPONSE message. |
---|
1438 | .IP "41 SSH_CMSG_AUTH_TIS_RESPONSE" |
---|
1439 | .TS |
---|
1440 | ; |
---|
1441 | l l. |
---|
1442 | string user response to tis challenge |
---|
1443 | .TE |
---|
1444 | When client receives SSH_SMSG_AUTH_TIS_CHALLENGE and ask users |
---|
1445 | response to challenge it sends it back this message. The server |
---|
1446 | answers with SSH_SMSG_FAILURE or SSH_SMSG_SUCCESS. |
---|
1447 | .IP "42 SSH_CMSG_AUTH_KERBEROS" |
---|
1448 | .TS |
---|
1449 | ; |
---|
1450 | l l. |
---|
1451 | string authentication info |
---|
1452 | .TE |
---|
1453 | Client sends authentication info to server, which replies with |
---|
1454 | SSH_SMSG_AUTH_KERBEROS_RESPONSE message having correct response data |
---|
1455 | encrypted with the session key. |
---|
1456 | .IP "43 SSH_SMSG_AUTH_KERBEROS_RESPONSE" |
---|
1457 | .TS |
---|
1458 | ; |
---|
1459 | l l. |
---|
1460 | string response data |
---|
1461 | .TE |
---|
1462 | Server replies to SSH_CMSG_AUTH_KERBEROS message with this message so |
---|
1463 | that the response data is encrypted with session key. |
---|
1464 | .IP "44 SSH_CMSG_HAVE_KERBEROS_TGT" |
---|
1465 | .TS |
---|
1466 | ; |
---|
1467 | l l. |
---|
1468 | string kerberos credentials |
---|
1469 | .TE |
---|
1470 | Client sends kerberos credentials to server and the server replies with |
---|
1471 | SSH_SMSG_SUCCESS or SSH_SMSG_FAILURE. |
---|
1472 | .RT |
---|
1473 | |
---|
1474 | |
---|
1475 | .ti 0 |
---|
1476 | Encoding of Terminal Modes |
---|
1477 | |
---|
1478 | Terminal modes (as passed in SSH_CMSG_REQUEST_PTY) are encoded into a |
---|
1479 | byte stream. It is intended that the coding be portable across |
---|
1480 | different environments. |
---|
1481 | |
---|
1482 | The tty mode description is a stream of bytes. The stream consists of |
---|
1483 | opcode-argument pairs. It is terminated by opcode TTY_OP_END (0). |
---|
1484 | Opcodes 1-127 have one-byte arguments. Opcodes 128-159 have 32-bit |
---|
1485 | integer arguments (stored msb first). Opcodes 160-255 are not yet |
---|
1486 | defined, and cause parsing to stop (they should only be used after any |
---|
1487 | other data). |
---|
1488 | |
---|
1489 | The client puts in the stream any modes it knows about, and the server |
---|
1490 | ignores any modes it does not know about. This allows some degree of |
---|
1491 | machine-independence, at least between systems that use a POSIX-like |
---|
1492 | [POSIX] tty interface. The protocol can support other systems as |
---|
1493 | well, but the client may need to fill reasonable values for a number |
---|
1494 | of parameters so the server pty gets set to a reasonable mode (the |
---|
1495 | server leaves all unspecified mode bits in their default values, and |
---|
1496 | only some combinations make sense). |
---|
1497 | |
---|
1498 | The following opcodes have been defined. The naming of opcodes mostly |
---|
1499 | follows the POSIX terminal mode flags. |
---|
1500 | .IP "0 TTY_OP_END" |
---|
1501 | Indicates end of options. |
---|
1502 | .IP "1 VINTR" |
---|
1503 | Interrupt character; 255 if none. Similarly for the other characters. |
---|
1504 | Not all of these characters are supported on all systems. |
---|
1505 | .IP "2 VQUIT" |
---|
1506 | The quit character (sends SIGQUIT signal on UNIX systems). |
---|
1507 | .IP "3 VERASE" |
---|
1508 | Erase the character to left of the cursor. |
---|
1509 | .IP "4 VKILL" |
---|
1510 | Kill the current input line. |
---|
1511 | .IP "5 VEOF " |
---|
1512 | End-of-file character (sends EOF from the terminal). |
---|
1513 | .IP "6 VEOL " |
---|
1514 | End-of-line character in addition to carriage return and/or linefeed. |
---|
1515 | .IP "7 VEOL2" |
---|
1516 | Additional end-of-line character. |
---|
1517 | .IP "8 VSTART" |
---|
1518 | Continues paused output (normally ^Q). |
---|
1519 | .IP "9 VSTOP" |
---|
1520 | Pauses output (^S). |
---|
1521 | .IP "10 VSUSP" |
---|
1522 | Suspends the current program. |
---|
1523 | .IP "11 VDSUSP" |
---|
1524 | Another suspend character. |
---|
1525 | .IP "12 VREPRINT" |
---|
1526 | Reprints the current input line. |
---|
1527 | .IP "13 VWERASE" |
---|
1528 | Erases a word left of cursor. |
---|
1529 | .IP "14 VLNEXT" |
---|
1530 | More special input characters; these are probably not supported on |
---|
1531 | most systems. |
---|
1532 | .IP "15 VFLUSH" |
---|
1533 | .IP "16 VSWTCH" |
---|
1534 | .IP "17 VSTATUS" |
---|
1535 | .IP "18 VDISCARD" |
---|
1536 | |
---|
1537 | .IP "30 IGNPAR" |
---|
1538 | The ignore parity flag. The next byte should be 0 if this flag is not |
---|
1539 | set, and 1 if it is set. |
---|
1540 | .IP "31 PARMRK" |
---|
1541 | More flags. The exact definitions can be found in the POSIX standard. |
---|
1542 | .IP "32 INPCK" |
---|
1543 | .IP "33 ISTRIP" |
---|
1544 | .IP "34 INLCR" |
---|
1545 | .IP "35 IGNCR" |
---|
1546 | .IP "36 ICRNL" |
---|
1547 | .IP "37 IUCLC" |
---|
1548 | .IP "38 IXON" |
---|
1549 | .IP "39 IXANY" |
---|
1550 | .IP "40 IXOFF" |
---|
1551 | .IP "41 IMAXBEL" |
---|
1552 | |
---|
1553 | .IP "50 ISIG" |
---|
1554 | .IP "51 ICANON" |
---|
1555 | .IP "52 XCASE" |
---|
1556 | .IP "53 ECHO" |
---|
1557 | .IP "54 ECHOE" |
---|
1558 | .IP "55 ECHOK" |
---|
1559 | .IP "56 ECHONL" |
---|
1560 | .IP "57 NOFLSH" |
---|
1561 | .IP "58 TOSTOP" |
---|
1562 | .IP "59 IEXTEN" |
---|
1563 | .IP "60 ECHOCTL" |
---|
1564 | .IP "61 ECHOKE" |
---|
1565 | .IP "62 PENDIN" |
---|
1566 | |
---|
1567 | .IP "70 OPOST" |
---|
1568 | .IP "71 OLCUC" |
---|
1569 | .IP "72 ONLCR" |
---|
1570 | .IP "73 OCRNL" |
---|
1571 | .IP "74 ONOCR" |
---|
1572 | .IP "75 ONLRET" |
---|
1573 | |
---|
1574 | .IP "90 CS7" |
---|
1575 | .IP "91 CS8" |
---|
1576 | .IP "92 PARENB" |
---|
1577 | .IP "93 PARODD" |
---|
1578 | |
---|
1579 | .IP "192 TTY_OP_ISPEED" |
---|
1580 | Specifies the input baud rate in bits per second (as a 32-bit int, msb |
---|
1581 | first). |
---|
1582 | .IP "193 TTY_OP_OSPEED" |
---|
1583 | Specifies the output baud rate in bits per second (as a 32-bt int, msb |
---|
1584 | first). |
---|
1585 | .RT |
---|
1586 | |
---|
1587 | |
---|
1588 | .ti 0 |
---|
1589 | The Authentication Agent Protocol |
---|
1590 | |
---|
1591 | The authentication agent is a program that can be used to hold RSA |
---|
1592 | authentication keys for the user (in future, it might hold data for |
---|
1593 | other authentication types as well). An authorized program can send |
---|
1594 | requests to the agent to generate a proper response to an RSA |
---|
1595 | challenge. How the connection is made to the agent (or its |
---|
1596 | representative) inside a host and how access control is done inside a |
---|
1597 | host is implementation-dependent; however, how it is forwarded and how |
---|
1598 | one interacts with it is specified in this protocol. The connection |
---|
1599 | to the agent is normally automatically forwarded over the secure |
---|
1600 | channel. |
---|
1601 | |
---|
1602 | A program that wishes to use the agent first opens a connection to its |
---|
1603 | local representative (typically, the agent itself or an SSH server). |
---|
1604 | It then writes a request to the connection, and waits for response. |
---|
1605 | It is recommended that at least five minutes of timeout are provided |
---|
1606 | waiting for the agent to respond to an authentication challenge (this |
---|
1607 | gives sufficient time for the user to cut-and-paste the challenge to a |
---|
1608 | separate machine, perform the computation there, and cut-and-paste the |
---|
1609 | result back if so desired). |
---|
1610 | |
---|
1611 | Messages sent to and by the agent are in the following format: |
---|
1612 | .TS |
---|
1613 | ; |
---|
1614 | l l. |
---|
1615 | 4 bytes Length, msb first. Does not include length itself. |
---|
1616 | 1 byte Packet type. The value 255 is reserved for future extensions. |
---|
1617 | data Any data, depending on packet type. Encoding as in the ssh packet |
---|
1618 | protocol. |
---|
1619 | .TE |
---|
1620 | |
---|
1621 | The following message types are currently defined: |
---|
1622 | .IP "1 SSH_AGENTC_REQUEST_RSA_IDENTITIES" |
---|
1623 | |
---|
1624 | (no arguments) |
---|
1625 | |
---|
1626 | Requests the agent to send a list of all RSA keys for which it can |
---|
1627 | answer a challenge. |
---|
1628 | .IP "2 SSH_AGENT_RSA_IDENTITIES_ANSWER" |
---|
1629 | .TS |
---|
1630 | ; |
---|
1631 | l l. |
---|
1632 | 32-bit int howmany |
---|
1633 | howmany times: |
---|
1634 | 32-bit int bits |
---|
1635 | mp-int public exponent |
---|
1636 | mp-int public modulus |
---|
1637 | string comment |
---|
1638 | .TE |
---|
1639 | The agent sends this message in response to the to |
---|
1640 | SSH_AGENTC_REQUEST_RSA_IDENTITIES. The answer lists all RSA keys for |
---|
1641 | which the agent can answer a challenge. The comment field is intended |
---|
1642 | to help identify each key; it may be printed by an application to |
---|
1643 | indicate which key is being used. If the agent is not holding any |
---|
1644 | keys, howmany will be zero. |
---|
1645 | .IP "3 SSH_AGENTC_RSA_CHALLENGE |
---|
1646 | .TS |
---|
1647 | ; |
---|
1648 | l l. |
---|
1649 | 32-bit int bits |
---|
1650 | mp-int public exponent |
---|
1651 | mp-int public modulus |
---|
1652 | mp-int challenge |
---|
1653 | 16 bytes session_id |
---|
1654 | 32-bit int response_type |
---|
1655 | .TE |
---|
1656 | Requests RSA decryption of random challenge to authenticate the other |
---|
1657 | side. The challenge will be decrypted with the RSA private key |
---|
1658 | corresponding to the given public key. |
---|
1659 | |
---|
1660 | The decrypted challenge must contain a zero in the highest (partial) |
---|
1661 | byte, 2 in the next byte, followed by non-zero random bytes, a zero |
---|
1662 | byte, and then the real challenge value in the lowermost bytes. The |
---|
1663 | real challenge must be 32 8-bit bytes (256 bits). |
---|
1664 | |
---|
1665 | Response_type indicates the format of the response to be returned. |
---|
1666 | Currently the only supported value is 1, which means to compute MD5 of |
---|
1667 | the real challenge plus session id, and return the resulting 16 bytes |
---|
1668 | in a SSH_AGENT_RSA_RESPONSE message. |
---|
1669 | .IP "4 SSH_AGENT_RSA_RESPONSE" |
---|
1670 | .TS |
---|
1671 | ; |
---|
1672 | l l. |
---|
1673 | 16 bytes MD5 of decrypted challenge |
---|
1674 | .TE |
---|
1675 | Answers an RSA authentication challenge. The response is 16 bytes: |
---|
1676 | the MD5 checksum of the 32-byte challenge. |
---|
1677 | .IP "5 SSH_AGENT_FAILURE" |
---|
1678 | |
---|
1679 | (no arguments) |
---|
1680 | |
---|
1681 | This message is sent whenever the agent fails to answer a request |
---|
1682 | properly. For example, if the agent cannot answer a challenge (e.g., |
---|
1683 | no longer has the proper key), it can respond with this. The agent |
---|
1684 | also responds with this message if it receives a message it does not |
---|
1685 | recognize. |
---|
1686 | .IP "6 SSH_AGENT_SUCCESS" |
---|
1687 | |
---|
1688 | (no arguments) |
---|
1689 | |
---|
1690 | This message is sent by the agent as a response to certain requests |
---|
1691 | that do not otherwise cause a message be sent. Currently, this is |
---|
1692 | only sent in response to SSH_AGENTC_ADD_RSA_IDENTITY and |
---|
1693 | SSH_AGENTC_REMOVE_RSA_IDENTITY. |
---|
1694 | .IP "7 SSH_AGENTC_ADD_RSA_IDENTITY" |
---|
1695 | .TS |
---|
1696 | ; |
---|
1697 | l l. |
---|
1698 | 32-bit int bits |
---|
1699 | mp-int public modulus |
---|
1700 | mp-int public exponent |
---|
1701 | mp-int private exponent |
---|
1702 | mp-int multiplicative inverse of p mod q |
---|
1703 | mp-int p |
---|
1704 | mp-int q |
---|
1705 | string comment |
---|
1706 | .TE |
---|
1707 | Registers an RSA key with the agent. After this request, the agent can |
---|
1708 | use this RSA key to answer requests. The agent responds with |
---|
1709 | SSH_AGENT_SUCCESS or SSH_AGENT_FAILURE. |
---|
1710 | .IP "8 SSH_AGENT_REMOVE_RSA_IDENTITY" |
---|
1711 | .TS |
---|
1712 | ; |
---|
1713 | l l. |
---|
1714 | 32-bit int bits |
---|
1715 | mp-int public exponent |
---|
1716 | mp-int public modulus |
---|
1717 | .TE |
---|
1718 | Removes an RSA key from the agent. The agent will no longer accept |
---|
1719 | challenges for this key and will not list it as a supported identity. |
---|
1720 | The agent responds with SSH_AGENT_SUCCESS or SSH_AGENT_FAILURE. |
---|
1721 | .RT |
---|
1722 | |
---|
1723 | If the agent receives a message that it does not understand, it |
---|
1724 | responds with SSH_AGENT_FAILURE. This permits compatible future |
---|
1725 | extensions. |
---|
1726 | |
---|
1727 | It is possible that several clients have a connection open to the |
---|
1728 | authentication agent simultaneously. Each client will use a separate |
---|
1729 | connection (thus, any SSH connection can have multiple agent |
---|
1730 | connections active simultaneously). |
---|
1731 | |
---|
1732 | |
---|
1733 | .ti 0 |
---|
1734 | References |
---|
1735 | |
---|
1736 | .IP "[DES] " |
---|
1737 | FIPS PUB 46-1: Data Encryption Standard. National Bureau of |
---|
1738 | Standards, January 1988. FIPS PUB 81: DES Modes of Operation. |
---|
1739 | National Bureau of Standards, December 1980. Bruce Schneier: Applied |
---|
1740 | Cryptography. John Wiley & Sons, 1994. J. Seberry and J. Pieprzyk: |
---|
1741 | Cryptography: An Introduction to Computer Security. Prentice-Hall, |
---|
1742 | 1989. |
---|
1743 | .IP "[GZIP] " |
---|
1744 | The GNU GZIP program; available for anonymous ftp at prep.ai.mit.edu. |
---|
1745 | Please let me know if you know a paper describing the algorithm. |
---|
1746 | .IP "[IDEA] " |
---|
1747 | Xuejia Lai: On the Design and Security of Block Ciphers, ETH Series in |
---|
1748 | Information Processing, vol. 1, Hartung-Gorre Verlag, Konstanz, |
---|
1749 | Switzerland, 1992. Bruce Schneier: Applied Cryptography, John Wiley & |
---|
1750 | Sons, 1994. See also the following patents: PCT/CH91/00117, EP 0 482 |
---|
1751 | 154 B1, US Pat. 5,214,703. |
---|
1752 | .IP [PKCS#1] |
---|
1753 | PKCS #1: RSA Encryption Standard. Version 1.5, RSA Laboratories, |
---|
1754 | November 1993. Available for anonymous ftp at ftp.rsa.com. |
---|
1755 | .IP [POSIX] |
---|
1756 | Portable Operating System Interface (POSIX) - Part 1: Application |
---|
1757 | Program Interface (API) [C language], ISO/IEC 9945-1, IEEE Std 1003.1, |
---|
1758 | 1990. |
---|
1759 | .IP [RFC0791] |
---|
1760 | J. Postel: Internet Protocol, RFC 791, USC/ISI, September 1981. |
---|
1761 | .IP [RFC0793] |
---|
1762 | J. Postel: Transmission Control Protocol, RFC 793, USC/ISI, September |
---|
1763 | 1981. |
---|
1764 | .IP [RFC1034] |
---|
1765 | P. Mockapetris: Domain Names - Concepts and Facilities, RFC 1034, |
---|
1766 | USC/ISI, November 1987. |
---|
1767 | .IP [RFC1282] |
---|
1768 | B. Kantor: BSD Rlogin, RFC 1258, UCSD, December 1991. |
---|
1769 | .IP "[RSA] " |
---|
1770 | Bruce Schneier: Applied Cryptography. John Wiley & Sons, 1994. See |
---|
1771 | also R. Rivest, A. Shamir, and L. M. Adleman: Cryptographic |
---|
1772 | Communications System and Method. US Patent 4,405,829, 1983. |
---|
1773 | .IP "[X11] " |
---|
1774 | R. Scheifler: X Window System Protocol, X Consortium Standard, Version |
---|
1775 | 11, Release 6. Massachusetts Institute of Technology, Laboratory of |
---|
1776 | Computer Science, 1994. |
---|
1777 | .RT |
---|
1778 | |
---|
1779 | |
---|
1780 | .ti 0 |
---|
1781 | Security Considerations |
---|
1782 | |
---|
1783 | This protocol deals with the very issue of user authentication and |
---|
1784 | security. |
---|
1785 | |
---|
1786 | First of all, as an implementation issue, the server program will have |
---|
1787 | to run as root (or equivalent) on the server machine. This is because |
---|
1788 | the server program will need be able to change to an arbitrary user |
---|
1789 | id. The server must also be able to create a privileged TCP/IP port. |
---|
1790 | |
---|
1791 | The client program will need to run as root if any variant of .rhosts |
---|
1792 | authentication is to be used. This is because the client program will |
---|
1793 | need to create a privileged port. The client host key is also usually |
---|
1794 | stored in a file which is readable by root only. The client needs the |
---|
1795 | host key in .rhosts authentication only. Root privileges can be |
---|
1796 | dropped as soon as the privileged port has been created and the host |
---|
1797 | key has been read. |
---|
1798 | |
---|
1799 | The SSH protocol offers major security advantages over existing telnet |
---|
1800 | and rlogin protocols. |
---|
1801 | .IP o |
---|
1802 | IP spoofing is restricted to closing a connection (by encryption, host |
---|
1803 | keys, and the special random cookie). If encryption is not used, IP |
---|
1804 | spoofing is possible for those who can hear packets going out from the |
---|
1805 | server. |
---|
1806 | .IP o |
---|
1807 | DNS spoofing is made ineffective (by host keys). |
---|
1808 | .IP o |
---|
1809 | Routing spoofing is made ineffective (by host keys). |
---|
1810 | .IP o |
---|
1811 | All data is encrypted with strong algorithms to make eavesdropping as |
---|
1812 | difficult as possible. This includes encrypting any authentication |
---|
1813 | information such as passwords. The information for decrypting session |
---|
1814 | keys is destroyed every hour. |
---|
1815 | .IP o |
---|
1816 | Strong authentication methods: .rhosts combined with RSA host |
---|
1817 | authentication, and pure RSA authentication. |
---|
1818 | .IP o |
---|
1819 | X11 connections and arbitrary TCP/IP ports can be forwarded securely. |
---|
1820 | .IP o |
---|
1821 | Man-in-the-middle attacks are deterred by using the server host key to |
---|
1822 | encrypt the session key. |
---|
1823 | .IP o |
---|
1824 | Trojan horses to catch a password by routing manipulation are deterred |
---|
1825 | by checking that the host key of the server machine matches that |
---|
1826 | stored on the client host. |
---|
1827 | .RT |
---|
1828 | |
---|
1829 | The security of SSH against man-in-the-middle attacks and the security |
---|
1830 | of the new form of .rhosts authentication, as well as server host |
---|
1831 | validation, depends on the integrity of the host key and the files |
---|
1832 | containing known host keys. |
---|
1833 | |
---|
1834 | The host key is normally stored in a root-readable file. If the host |
---|
1835 | key is compromised, it permits attackers to use IP, DNS and routing |
---|
1836 | spoofing as with current rlogin and rsh. It should never be any worse |
---|
1837 | than the current situation. |
---|
1838 | |
---|
1839 | The files containing known host keys are not sensitive. However, if an |
---|
1840 | attacker gets to modify the known host key files, it has the same |
---|
1841 | consequences as a compromised host key, because the attacker can then |
---|
1842 | change the recorded host key. |
---|
1843 | |
---|
1844 | The security improvements obtained by this protocol for X11 are of |
---|
1845 | particular significance. Previously, there has been no way to protect |
---|
1846 | data communicated between an X server and a client running on a remote |
---|
1847 | machine. By creating a fake display on the server, and forwarding all |
---|
1848 | X11 requests over the secure channel, SSH can be used to run any X11 |
---|
1849 | applications securely without any cooperation with the vendors of the |
---|
1850 | X server or the application. |
---|
1851 | |
---|
1852 | Finally, the security of this program relies on the strength of the |
---|
1853 | underlying cryptographic algorithms. The RSA algorithm is used for |
---|
1854 | authentication key exchange. It is widely believed to be secure. Of |
---|
1855 | the algorithms used to encrypt the session, DES has a rather small key |
---|
1856 | these days, probably permitting governments and organized criminals to |
---|
1857 | break it in very short time with specialized hardware. 3DES is |
---|
1858 | probably safe (but slower). IDEA is widely believed to be secure. |
---|
1859 | People have varying degrees of confidence in the other algorithms. |
---|
1860 | This program is not secure if used with no encryption at all. |
---|
1861 | |
---|
1862 | |
---|
1863 | .ti 0 |
---|
1864 | Additional Information |
---|
1865 | |
---|
1866 | Additional information (especially on the implementation and mailing |
---|
1867 | lists) is available via WWW at http://www.cs.hut.fi/ssh. |
---|
1868 | |
---|
1869 | Comments should be sent to Tatu Ylonen <ylo@cs.hut.fi> or the SSH |
---|
1870 | Mailing List <ssh@clinet.fi>. |
---|
1871 | |
---|
1872 | .ti 0 |
---|
1873 | Author's Address |
---|
1874 | |
---|
1875 | .TS |
---|
1876 | ; |
---|
1877 | l. |
---|
1878 | Tatu Ylonen |
---|
1879 | Helsinki University of Technology |
---|
1880 | Otakaari 1 |
---|
1881 | FIN-02150 Espoo, Finland |
---|
1882 | |
---|
1883 | Phone: +358-0-4354-3205 |
---|
1884 | Fax: +358-0-4354-3206 |
---|
1885 | EMail: ylo@cs.hut.fi |
---|
1886 | .TE |
---|