home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_q_t / draft-ietf-secsh-connect-00.txt < prev    next >
Text File  |  1997-03-26  |  28KB  |  885 lines

  1.  
  2. Network Working Group                           Tatu Ylonen <ylo@ssh.fi>
  3. INTERNET-DRAFT                               SSH Communications Security
  4. draft-ietf-secsh-connect-00.txt                           March 22, 1997
  5. Expires: September 1, 1997
  6.  
  7.  
  8.                                     
  9.  
  10. Status of This memo
  11.  
  12. This document is an Internet-Draft. Internet-Drafts are working
  13. documents of the Internet Engineering Task Force (IETF), its areas,
  14. and its working groups. Note that other groups may also distribute
  15. working documents as Internet-Drafts.
  16.  
  17. Internet-Drafts are draft documents valid for a maximum of six
  18. months and may be updated, replaced, or obsoleted by other documents
  19. at any time. It is inappropriate to use Internet-Drafts as reference
  20. material or to cite them other than as ``work in progress.''
  21.  
  22. To learn the current status of any Internet-Draft, please check
  23. the ``1id-abstracts.txt'' listing contained in the Internet-Drafts
  24. Shadow Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
  25. munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast),
  26. or ftp.isi.edu (US West Coast).
  27.  
  28. Abstract
  29.  
  30. This document describes the SSH connection protocol.  It runs over the
  31. SSH user authentication layer, and performs management of forwarded con-
  32. nections and the terminal session(s).
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59. Tatu Ylonen <ylo@ssh.fi>                                        [page 1]
  60.  
  61. INTERNET-DRAFT                                            March 22, 1997
  62.  
  63. Table of Contents
  64.  
  65. 1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  66. 2.  Channel Mechanism   . . . . . . . . . . . . . . . . . . . . . . .  2
  67.   2.1.  Opening a Channel   . . . . . . . . . . . . . . . . . . . . .  3
  68.   2.2.  Data Transfer   . . . . . . . . . . . . . . . . . . . . . . .  3
  69.   2.3.  Closing a Channel   . . . . . . . . . . . . . . . . . . . . .  4
  70. 3.  Sessions  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  71.   3.1.  Opening a Session   . . . . . . . . . . . . . . . . . . . . .  4
  72.   3.2.  Requesting a Pseudo-Terminal  . . . . . . . . . . . . . . . .  5
  73.   3.3.  Environment Variable Passing  . . . . . . . . . . . . . . . .  5
  74.   3.4.  Requesting X11 Forwarding   . . . . . . . . . . . . . . . . .  6
  75.   3.5.  Requesting Athentication Agent Forwarding   . . . . . . . . .  6
  76.   3.6.  Starting Shell or Command   . . . . . . . . . . . . . . . . .  6
  77.   3.7.  Session Data Transfer   . . . . . . . . . . . . . . . . . . .  7
  78.   3.8.  Additional Control Messages   . . . . . . . . . . . . . . . .  7
  79.     3.8.1.  Window Change Message   . . . . . . . . . . . . . . . . .  7
  80.     3.8.2.  Local Flow Control  . . . . . . . . . . . . . . . . . . .  7
  81.   3.9.  Terminating a Session   . . . . . . . . . . . . . . . . . . .  8
  82. 4.  X11 Forwarding  . . . . . . . . . . . . . . . . . . . . . . . . .  8
  83. 5.  Authentication Agent Forwarding   . . . . . . . . . . . . . . . .  8
  84. 6.  TCP/IP Port Forwarding  . . . . . . . . . . . . . . . . . . . . .  9
  85.   6.1.  Requesting Port Forwarding  . . . . . . . . . . . . . . . . .  9
  86.   6.2.  Opening a Forwarded Connection  . . . . . . . . . . . . . . .  9
  87. 7.  FTP Forwarding  . . . . . . . . . . . . . . . . . . . . . . . . . 10
  88. 8.  Encoding of Terminal Modes  . . . . . . . . . . . . . . . . . . . 10
  89. 9.  Summary of Message Numbers  . . . . . . . . . . . . . . . . . . . 14
  90. 10.  Address of Author  . . . . . . . . . . . . . . . . . . . . . . . 15
  91.  
  92.  
  93.  
  94. 1.  Introduction
  95.  
  96. This protocol has been designed to run over the SSH transport layer and
  97. user authentication protocols.  The service name for this protocol
  98. (after user authentication) is "ssh-connection".  It provides
  99. interactive login sessions, remote execution of commands, forwarded
  100. TCP/IP connections, and forwarded X11 connections.
  101.  
  102. 2.  Channel Mechanism
  103.  
  104. All terminal sessions, forwarded connections, etc. are channels.  Either
  105. side may open a channel.  Multiple channels are multiplexed on the
  106. single connection.
  107.  
  108. There are several ways to open a channel; typically the method used
  109. depends on the intended use of the channel.  After opening, however,
  110. different channels use the same mechanisms for communication.
  111.  
  112. Channels are identified by numbers at each end.  The number referring to
  113. a channel may be different on each side.  Requests to open a channel
  114. contain the sender's channel number.  Any other channel-related messages
  115. contain the recipient's channel number for the channel.
  116.  
  117.  
  118. Tatu Ylonen <ylo@ssh.fi>                                        [page 2]
  119.  
  120. INTERNET-DRAFT                                            March 22, 1997
  121.  
  122. All channel-related messages contain the number of the channel they
  123. refer to.
  124.  
  125. Channels are flow-controlled.  No data may be sent to a channel until a
  126. message is received to indicate that window space is available.
  127.  
  128. 2.1.  Opening a Channel
  129.  
  130. Regardless of the method used to open a channel, when a side wishes to
  131. open a channel, it allocates a local number for the channel.  It then
  132. sends a method-specific message to the other side, and includes the
  133. local channel number and initial window size in the message.  The remote
  134. side then decides whether it can open the channel, and responds with
  135. either
  136.  
  137.             vlint32   SSH_MSG_CHANNEL_OPEN_CONFIRMATION
  138.             vlint32   recipient_channel
  139.             vlint32   sender_channel
  140.             vlint32   initial_window_size
  141.  
  142. where recipient_channel is the channel number given in the original open
  143. request, and sender_channel is the channel number allocated by the other
  144. side, or
  145.  
  146.             vlint32   SSH_MSG_CHANNEL_OPEN_FAILURE
  147.             vlint32   recipient_channel
  148.  
  149. The window size specifies how many characters the other party can send
  150. before it must wait for the window to be adjusted.  Both parties use the
  151. following message to adjust the window.
  152.  
  153.             vlint32   SSH_MSG_CHANNEL_WINDOW_ADJUST
  154.             vlint32   recipient_channel
  155.             vlint32   bytes_to_add
  156.  
  157. Upon receiving this message, the recipient increases the number of bytes
  158. it is allowed to send by the given amount.
  159.  
  160. 2.2.  Data Transfer
  161.  
  162. Data transfer is done with messages of the following type.
  163.  
  164.             vlint32   SSH_MSG_CHANNEL_DATA
  165.             vlint32   recipient_channel
  166.             string    data
  167.  
  168. The maximum amount of data allowed is the current window size.  The
  169. window size is decremented by the amount of data sent.
  170.  
  171. Additionally, some channels can transfer several types of data.  An
  172. example of this is stderr data from interactive sessions.  Such data can
  173. be passed with SSH_MSG_CHANNEL_EXTENDED_DATA messages, where a separate
  174. integer specifies the type of the data.  The available types and their
  175.  
  176.  
  177. Tatu Ylonen <ylo@ssh.fi>                                        [page 3]
  178.  
  179. INTERNET-DRAFT                                            March 22, 1997
  180.  
  181. interpretation depend on the type of the channel.
  182.  
  183.             vlint32   SSH_MSG_CHANNEL_EXTENDED_DATA
  184.             vlint32   recipient_channel
  185.             vlint32   data_type_code
  186.             string    data
  187.  
  188. Data sent with these messages consumes the same window as ordinary data.
  189.  
  190. Currently, only the following type is defined.
  191.  
  192.           #define SSH_EXTENDED_DATA_STDERR                1
  193.  
  194. 2.3.  Closing a Channel
  195.  
  196. When a party will no longer send more data to a channel, it should send
  197. SSH_MSG_CHANNEL_EOF.
  198.  
  199.             vlint32   SSH_MSG_CHANNEL_EOF
  200.             vlint32   recipient_channel
  201.  
  202. No explicit response is sent to this message; however, the application
  203. may send EOF to whatever is at the other end of the channel.  Note that
  204. the channel remains open after this message, and more data may still be
  205. sent in the other direction.
  206.  
  207. When either party wishes to terminate the channel, it sends
  208. SSH_MSG_CHANNEL_CLOSE.  Upon receiving this message, a party must send
  209. back an SSH_MSG_CHANNEL_CLOSE unless it has already sent this message
  210. for the channel.  The channel is considered closed for a party when it
  211. has both sent and received SSH_MSG_CHANNEL_CLOSE, and the party may then
  212. reuse the channel number.  It is legal to send SSH_MSG_CHANNEL_CLOSE
  213. without having sent or received SSH_MSG_EOF.
  214.  
  215.   vlint32   SSH_MSG_CHANNEL_CLOSE
  216.   vlint32   recipient_channel
  217.  
  218. 3.  Sessions
  219.  
  220. A session is a remote execution of a command.  The command may be an
  221. shell, a program, or some built-in subsystem.  It may or may not have a
  222. tty, and may or may not involve X11 forwarding.  Multiple sessions can
  223. be active simultaneously.
  224.  
  225. A session is created by SSH_MSG_CHANNEL_CREATE_SESSION.  Then, the
  226. client may send preparatory requests for the session, such as starting
  227. X11 forwarding or allocating a pseudo-terminal.  Finally, the client
  228. requests to execute a command or to start an interactive shell.
  229.  
  230. 3.1.  Opening a Session
  231.  
  232. A session is started by sending the following message.  While this
  233. message can be sent by either side, it is normally recommended for
  234.  
  235.  
  236. Tatu Ylonen <ylo@ssh.fi>                                        [page 4]
  237.  
  238. INTERNET-DRAFT                                            March 22, 1997
  239.  
  240. clients not to permit opening new sessions to avoid a corrupt server
  241. from attacking clients.
  242.  
  243.             vlint32   SSH_MSG_CHANNEL_CREATE_SESSION
  244.             vlint32   sender_channel
  245.  
  246. The server allocates a channel number and responds with open
  247. confirmation or open failure.
  248.  
  249. 3.2.  Requesting a Pseudo-Terminal
  250.  
  251. A pseudo-terminal can be allocated for the session by sending the
  252. following message.
  253.  
  254.   vlint32   SSH_MSG_SESSION_REQUEST_PTY
  255.   vlint32   recipient_channel (session)
  256.   string    TERM environment variable value (e.g., vt100)
  257.   vlint32   terminal width, characters (e.g., 80)
  258.   vlint32   terminal height, rows (e.g., 24)
  259.   vlint32   terminal width, pixels (e.g., 480)
  260.   vlint32   terminal height, pixels (e.g., 640)
  261.   string    encoded terminal modes
  262.  
  263. The encoding of terminal modes is described in Section ``Encoding of
  264. Terminal Modes''.
  265.  
  266. The server responds with either SSH_MSG_CHANNEL_SUCCESS or
  267. SSH_MSG_CHANNEL_FAILURE.  The client is allowed to send further messages
  268. without waiting for the response to this message.
  269.  
  270.             vlint32   SSH_MSG_CHANNEL_SUCCESS
  271.             vlint32   recipient_channel
  272.  
  273.             vlint32   SSH_MSG_CHANNEL_FAILURE
  274.             vlint32   recipient_channel
  275.  
  276. 3.3.  Environment Variable Passing
  277.  
  278. Environment variables may be passed to the shell/command to be started
  279. later.  Typically, each machine will have a preconfigured set of
  280. variables that it will allow.  Since uncontrolled setting of environment
  281. variables can be very dangerous, it is recommended that implementations
  282. allow setting only variables whose names have been explicitly configured
  283. to be allowed.
  284.  
  285.             vlint32   SSH_MSG_SESSION_ENVIRONMENT_VARIABLE
  286.             vlint32   recipient_channel
  287.             string    variable_name
  288.             string    variable_value
  289.  
  290. The server responds with either SSH_MSG_CHANNEL_SUCCESS or
  291. SSH_MSG_CHANNEL_FAILURE.  The client is allowed to send further messages
  292. without waiting for the response to this message.
  293.  
  294.  
  295. Tatu Ylonen <ylo@ssh.fi>                                        [page 5]
  296.  
  297. INTERNET-DRAFT                                            March 22, 1997
  298.  
  299. 3.4.  Requesting X11 Forwarding
  300.  
  301. X11 forwarding may be requested for a session by sending
  302.  
  303.             vlint32   SSH_MSG_SESSION_REQUEST_X11_FORWARDING
  304.             vlint32   recipient_channel (session)
  305.             string    x11_authentication_protocol
  306.             string    x11_authentication_cookie
  307.             vlint32   x11_screen_number
  308.  
  309. It is recommended that the authentication cookie that is sent be a fake,
  310. random cookie, and that the cookie is checked and replaced by the real
  311. cookie when a connection request is received.
  312.  
  313. The server responds with either SSH_MSG_CHANNEL_SUCCESS or
  314. SSH_MSG_CHANNEL_FAILURE.  The client is allowed to send futher messages
  315. without waiting for the reponse to this message.
  316.  
  317. 3.5.  Requesting Athentication Agent Forwarding
  318.  
  319. Authentication agent forwarding may be requested for a session by
  320. sending
  321.  
  322.             vlint32   SSH_MSG_SESSION_REQUEST_AGENT_FORWARDING
  323.             vlint32   recipient_channel (session)
  324.  
  325. The server responds with either SSH_MSG_CHANNEL_SUCCESS or
  326. SSH_MSG_CHANNEL_FAILURE.  The client is allowed to send futher messages
  327. without waiting for the reponse to this message.
  328.  
  329. 3.6.  Starting Shell or Command
  330.  
  331. Once the session has been set up, a shell or command is started at the
  332. remote end.  This can happen in any of a number of ways.
  333.  
  334.             vlint32   SSH_MSG_SESSION_EXEC_SHELL
  335.             vlint32   recipient_channel
  336.  
  337.             vlint32   SSH_MSG_SESSION_EXEC_COMMAND
  338.             vlint32   recipient_channel
  339.             string    command
  340.  
  341.             vlint32   SSH_MSG_SESSION_EXEC_PREDEFINED
  342.             vlint32   recipient_channel
  343.             vlint32   subsystem_name
  344.  
  345. This last form executes a predefined subsystem.  It expected that these
  346. will include a general file transfer mechanism, and possibly other
  347. features.  Implementations may also allow configuring more such
  348. mechanisms.  Having a special message for them avoids the need to have
  349. their paths and command names be supplied by the other side.  This also
  350. makes it easier to implement them in the same executable as the rest of
  351. the protocol on platforms where that is desirable.
  352.  
  353.  
  354. Tatu Ylonen <ylo@ssh.fi>                                        [page 6]
  355.  
  356. INTERNET-DRAFT                                            March 22, 1997
  357.  
  358. 3.7.  Session Data Transfer
  359.  
  360. Data transfer for a session is done using SSH_MSG_CHANNEL_DATA and
  361. SSH_MSG_CHANNEL_EXTENDED_DATA packets and the window mechanism.  The
  362. extended data type SSH_EXTENDED_DATA_STDERR has been defined for stderr
  363. data.
  364.  
  365. 3.8.  Additional Control Messages
  366.  
  367. Smooth operation sometimes requires extra messages to be passed to
  368. notify the other side of some event or change.
  369.  
  370. A single message type, SSH_MSG_SESSION_NOTIFICATION has been defined for
  371. all of these notifications.  Implementations should ignore all
  372. notifications that they cannot interpret, and are free to ignore any
  373. notifications.
  374.  
  375.   vlint32   SSH_MSG_SESSION_NOTIFICATION
  376.   vlint32   recipient_channel
  377.   string    notification_type
  378.   ...
  379.  
  380. Currently, the following notification types have been defined:
  381.  
  382.             window_change          Window size changed
  383.             xon_xoff_flow_control  Local flow control
  384.  
  385. 3.8.1.  Window Change Message
  386.  
  387. When the window (terminal) size changes on the client side (client here
  388. means the party who sent the create message for the session), it may
  389. send a message to the other side to inform it of the new size.
  390.  
  391.             vlint32   SSH_MSG_SESSION_NOTIFICATION
  392.             vlint32   recipient_channel
  393.             string    "window_change"
  394.             vlint32   terminal width, columns
  395.             vlint32   terminal height, rows
  396.             vlint32   terminal width, pixels
  397.             vlint32   terminal height, pixels
  398.  
  399. 3.8.2.  Local Flow Control
  400.  
  401. On many systems it is possible to determine if a pseudo-terminal is
  402. using control-S control-Q flow control.  When this is the case, it is
  403. often desirable to do the flow control at the client end to speed up
  404. responses to user requests.  This is facilitated by the following two
  405. notifications.  Initially, the server is responsible for flow control.
  406. (Here, again, client means the side originating the session, and server
  407. the other side.)
  408.  
  409.   vlint32   SSH_MSG_SESSION_NOTIFICATION
  410.   vlint32   recipient_channel
  411.  
  412.  
  413. Tatu Ylonen <ylo@ssh.fi>                                        [page 7]
  414.  
  415. INTERNET-DRAFT                                            March 22, 1997
  416.  
  417.   string    "xon_xoff_flow_control"
  418.   boolean   client_can_do
  419.  
  420. If client_can_do is true, the client (originator) can do control-S
  421. control-Q flow control locally.
  422.  
  423. 3.9.  Terminating a Session
  424.  
  425. When the command running at the other end terminates,
  426. SSH_MSG_SESSION_EXIT_STATUS may be sent to return the exit status of the
  427. command.  Returning the status is optional, but recommended.  No
  428. acknowledgement is sent for this message.  The channel needs to be
  429. closed with SSH_MSG_CHANNEL_CLOSE after this message.
  430.  
  431.             vlint32   SSH_MSG_SESSION_EXIT_STATUS
  432.             vlint32   recipient_channel
  433.             vlint32   exit_status
  434.  
  435. 4.  X11 Forwarding
  436.  
  437. X11 forwarding is requested with respect to a session.  However,
  438. forwarded connections are independent of the session.
  439.  
  440. The request to forward X11 connections opens a fake X11 display on the
  441. server.  No connections are opened at this time.
  442.  
  443. When an X11 client connects the fake X11 server, a request is sent to
  444. the originator of the session.
  445.  
  446.             vlint32   SSH_MSG_X11_OPEN
  447.             vlint32   sender_channel
  448.             vlint32   initial_window_size
  449.             string    originator_string
  450.  
  451. The recipient should respond with open confirmation or open failure.
  452. Originator_string is a free-form implementation-dependent description of
  453. the X11 client that made the connection.  It should typically contain
  454. the IP address and port of the client, and may also contain user name or
  455. other information if available.  It should be in a format that is
  456. understandable by a user.
  457.  
  458. 5.  Authentication Agent Forwarding
  459.  
  460. Authentication agent forwarding is requested with respect to a session.
  461. However, forwarded connections are independent of the session.
  462.  
  463. When an application requests a connection to the authentication agent,
  464. the following message is sent to the originator of the session.
  465.  
  466.             vlint32   SSH_MSG_AGENT_OPEN
  467.             vlint32   sender_channel
  468.             vlint32   initial_window_size
  469.             string    originator_string
  470.  
  471.  
  472. Tatu Ylonen <ylo@ssh.fi>                                        [page 8]
  473.  
  474. INTERNET-DRAFT                                            March 22, 1997
  475.  
  476.             string    host_chain
  477.  
  478. The recipient should respond with open confirmation or open failure.
  479. Originator_string is a free-form implementation-dependent description of
  480. the application that made the connection, or empty if no description is
  481. available. host_chain is a comma-separated list of hosts this request
  482. has passed through. (Receiver of the message appends the sender's name,
  483. if the message will be passed on (i.e. receiver is not the actual
  484. agent).)
  485.  
  486. Because only one application can use a forwarded agent channel at a
  487. time, multiple channels cannot be multiplexed in a ssh daemon. Instead,
  488. ssh daemon must pass the request, and forward the reply all the way from
  489. the agent to the requesting application. This results in creation of a
  490. private channel for application using the agent. Agent stores the host
  491. chain for every channel and uses it to determine which operations are
  492. permitted.
  493.  
  494. 6.  TCP/IP Port Forwarding
  495.  
  496. 6.1.  Requesting Port Forwarding
  497.  
  498. A party need not explicitly request forwardings from its own end to the
  499. other direction.  However, it if wishes to have connections to a port on
  500. the other side be forwarded to the local side, it must explicitly
  501. request this.
  502.  
  503.             vlint32   SSH_MSG_REQUEST_TCPIP_PORT_FORWARDING
  504.             string    address_to_bind
  505.             vlint32   port_number_to_bind
  506.  
  507. Address_to_bind and port_number_to_bind specify the IP address and port
  508. to which the socket to be listened is bound.  The address should be
  509. "0.0.0.0" if connections are allowed from anywhere.  (Note that the
  510. client can still filter connections based on information passed in the
  511. open request.)
  512.  
  513. Implementations should only allow forwarding privileged ports if the
  514. user has been authenticated as a privileged user.
  515.  
  516. The recipient will respond to this message with either
  517. SSH_MSG_REQUEST_SUCCESS or SSH_MSG_REQUEST_FAILURE.
  518.  
  519.             vlint32   SSH_MSG_REQUEST_SUCCESS
  520.  
  521.             vlint32   SSH_MSG_REQUEST_FAILURE
  522.  
  523. 6.2.  Opening a Forwarded Connection
  524.  
  525. When a connection comes to a port for which forwarding was requested
  526. with SSH_MSG_REQUEST_TCPIP_PORT_FORWARDING, the following message is
  527. sent to the other side.
  528.  
  529.  
  530.  
  531. Tatu Ylonen <ylo@ssh.fi>                                        [page 9]
  532.  
  533. INTERNET-DRAFT                                            March 22, 1997
  534.  
  535.             vlint32   SSH_MSG_TCPIP_REMOTE_PORT_OPEN
  536.             vlint32   sender_channel
  537.             vlint32   initial_window_size
  538.             vlint32   port_that_was_connected
  539.             string    originator_ip_address
  540.             vlint32   originator_port
  541.             string    originator_string
  542.  
  543. When a connection comes to a locally forwarded TCP/IP port, the
  544. following packet is sent to the other side.  Note that these messages
  545. may be sent also for ports for which no forwarding has been explicitly
  546. requested.  The receiving side must decide whether to allow the
  547. forwarding.
  548.  
  549.             vlint32   SSH_MSG_TCPIP_PORT_OPEN
  550.             vlint32   sender_channel
  551.             vlint32   initial_window_size
  552.             string    host_to_connect
  553.             vlint32   port_to_connect
  554.             string    originator_ip_address
  555.             vlint32   originator_port
  556.             string    originator_string
  557.  
  558. Host_to_connect and port_to_connect specify the TCP/IP host and port
  559. where the recipient should connect the channel.  Host_to_connect may be
  560. either a domain name or a numeric IP address.
  561.  
  562. Originator_ip_address is the numeric IP address of the machine where the
  563. connection request comes from, and originator_port is the port on the
  564. originator host from where the connection came from.  Originator_string
  565. is a free-form description of where the connection came in a form that
  566. can be displayed to the user.
  567.  
  568. 7.  FTP Forwarding
  569.  
  570. XXX
  571.  
  572. 8.  Encoding of Terminal Modes
  573.  
  574. Terminal modes (as passed in SSH_MSG_SESSION_REQUEST_PTY) are encoded
  575. into a byte stream.  It is intended that the coding be portable across
  576. different environments.
  577.  
  578. The tty mode description is a stream of bytes.  The stream consists of
  579. opcode-argument pairs.  It is terminated by opcode TTY_OP_END (0).
  580. Opcodes 1-127 have one-byte arguments.  Opcodes 128-159 have 32-bit
  581. integer arguments (stored msb first).  Opcodes 160-255 are not yet
  582. defined, and cause parsing to stop (they should only be used after any
  583. other data).
  584.  
  585. The client puts in the stream any modes it knows about, and the server
  586. ignores any modes it does not know about.  This allows some degree of
  587. machine-independence, at least between systems that use a POSIX-like tty
  588.  
  589.  
  590. Tatu Ylonen <ylo@ssh.fi>                                       [page 10]
  591.  
  592. INTERNET-DRAFT                                            March 22, 1997
  593.  
  594. interface.  The protocol can support other systems as well, but the
  595. client may need to fill reasonable values for a number of parameters so
  596. the server pty gets set to a reasonable mode (the server leaves all
  597. unspecified mode bits in their default values, and only some
  598. combinations make sense).
  599.  
  600. The following opcodes have been defined.  The naming of opcodes mostly
  601. follows the POSIX terminal mode flags.
  602.  
  603.    0 TTY_OP_END
  604.       Indicates end of options.
  605.  
  606.    1 VINTR
  607.       Interrupt character; 255 if none.  Similarly for the other
  608.       characters.  Not all of these characters are supported on all
  609.       systems.
  610.  
  611.    2 VQUIT
  612.       The quit character (sends SIGQUIT signal on UNIX systems).
  613.  
  614.    3 VERASE
  615.       Erase the character to left of the cursor.
  616.  
  617.    4 VKILL
  618.       Kill the current input line.
  619.  
  620.    5 VEOF
  621.       End-of-file character (sends EOF from the terminal).
  622.  
  623.    6 VEOL
  624.       End-of-line character in addition to carriage return and/or
  625.       linefeed.
  626.  
  627.    7 VEOL2
  628.       Additional end-of-line character.
  629.  
  630.    8 VSTART
  631.       Continues paused output (normally control-Q).
  632.  
  633.    9 VSTOP
  634.       Pauses output (normally control-S).
  635.  
  636.    10 VSUSP
  637.       Suspends the current program.
  638.  
  639.    11 VDSUSP
  640.       Another suspend character.
  641.  
  642.    12 VREPRINT
  643.       Reprints the current input line.
  644.  
  645.    13 VWERASE
  646.       Erases a word left of cursor.
  647.  
  648.  
  649. Tatu Ylonen <ylo@ssh.fi>                                       [page 11]
  650.  
  651. INTERNET-DRAFT                                            March 22, 1997
  652.  
  653.    14 VLNEXT
  654.       More special input characters; these are probably not supported on
  655.       most systems.
  656.    15 VFLUSH
  657.       Character to flush output.
  658.  
  659.    16 VSWTCH
  660.       ???
  661.  
  662.    17 VSTATUS
  663.       ???
  664.  
  665.    18 VDISCARD
  666.       ???
  667.  
  668.    30 IGNPAR
  669.       The ignore parity flag.  The next byte should be 0 if this flag is
  670.       not set, and 1 if it is set.
  671.  
  672.    31 PARMRK
  673.       Mark parity and framing errors.
  674.  
  675.    32 INPCK
  676.       Enable checking of parity errors.
  677.  
  678.    33 ISTRIP
  679.       Strip 8th bit off chars.
  680.  
  681.    34 INLCR
  682.       Map NL into CR on input.
  683.  
  684.    35 IGNCR
  685.       Ignore CR on input.
  686.  
  687.    36 ICRNL
  688.       Map CR to NL on input.
  689.  
  690.    37 IUCLC
  691.       ???
  692.  
  693.    38 IXON
  694.       Enable output flow control.
  695.  
  696.    39 IXANY
  697.       Any char will restart after stop.
  698.  
  699.    40 IXOFF
  700.       Enable input flow control.
  701.  
  702.    41 IMAXBEL
  703.       Ring bell on input queue full.
  704.  
  705.    50 ISIG
  706.  
  707.  
  708. Tatu Ylonen <ylo@ssh.fi>                                       [page 12]
  709.  
  710. INTERNET-DRAFT                                            March 22, 1997
  711.  
  712.       Enable signals INTR, QUIT, DSUSP.
  713.  
  714.    51 ICANON
  715.       Canonicalize input lines.
  716.  
  717.    52 XCASE
  718.       ???
  719.    53 ECHO
  720.       Enable echoing.
  721.  
  722.    54 ECHOE
  723.       Visually erase chars.
  724.  
  725.    55 ECHOK
  726.       Kill character discards current line.
  727.  
  728.    56 ECHONL
  729.       Echo NL even if ECHO is off.
  730.  
  731.    57 NOFLSH
  732.       Don't flush after interrupt.
  733.  
  734.    58 TOSTOP
  735.       Stop background jobs from output.
  736.  
  737.    59 IEXTEN
  738.       Enable extensions.
  739.  
  740.    60 ECHOCTL
  741.       Echo control characters as ^(Char).
  742.  
  743.    61 ECHOKE
  744.       Visual erase for line kill.
  745.  
  746.    62 PENDIN
  747.       Retype pending input.
  748.  
  749.    70 OPOST
  750.       Enable output processing.
  751.  
  752.    71 OLCUC
  753.       Convert lowercase to uppercase.
  754.  
  755.    72 ONLCR
  756.       Map NL to CR-NL.
  757.  
  758.    73 OCRNL
  759.       ???
  760.  
  761.    74 ONOCR
  762.       ???
  763.  
  764.    75 ONLRET
  765.  
  766.  
  767. Tatu Ylonen <ylo@ssh.fi>                                       [page 13]
  768.  
  769. INTERNET-DRAFT                                            March 22, 1997
  770.  
  771.       ???
  772.  
  773.    90 CS7
  774.       7 bits.
  775.  
  776.    91 CS8
  777.       8 bits.
  778.  
  779.    92 PARENB
  780.       Parity enable.
  781.  
  782.    93 PARODD
  783.       Odd parity, else even.
  784.  
  785.    192 TTY_OP_ISPEED
  786.       Specifies the input baud rate in bits per second (as a 32-bit int,
  787.       msb first).
  788.  
  789.    193 TTY_OP_OSPEED
  790.       Specifies the output baud rate in bits per second (as a 32-bt int,
  791.       msb first).
  792.  
  793. 9.  Summary of Message Numbers
  794.  
  795. The following message numbers are used by this protocol.  If an
  796. unrecognized message is received, SSH_MSG_REQUEST_FAILURE should be sent
  797. in response.
  798.  
  799.           #define SSH_MSG_CHANNEL_OPEN_CONFIRMATION          40
  800.           #define SSH_MSG_CHANNEL_OPEN_FAILURE               41
  801.           #define SSH_MSG_CHANNEL_WINDOW_ADJUST              42
  802.           #define SSH_MSG_CHANNEL_DATA                       43
  803.           #define SSH_MSG_CHANNEL_EOF                        44
  804.           #define SSH_MSG_CHANNEL_CLOSE                      45
  805.           #define SSH_MSG_CHANNEL_CREATE_SESSION             46
  806.           #define SSH_MSG_SESSION_REQUEST_PTY                47
  807.           #define SSH_MSG_CHANNEL_SUCCESS                    48
  808.           #define SSH_MSG_CHANNEL_FAILURE                    49
  809.           #define SSH_MSG_SESSION_ENVIRONMENT_VARIABLE       50
  810.           #define SSH_MSG_SESSION_REQUEST_X11_FORWARDING     51
  811.           #define SSH_MSG_SESSION_REQUEST_AGENT_FORWARDING   52
  812.           #define SSH_MSG_SESSION_EXEC_SHELL                 53
  813.           #define SSH_MSG_SESSION_EXEC_COMMAND               54
  814.           #define SSH_MSG_SESSION_EXEC_PREDEFINED            55
  815.           #define SSH_MSG_SESSION_NOTIFICATION               56
  816.           #define SSH_MSG_SESSION_EXIT_STATUS                57
  817.           #define SSH_MSG_X11_OPEN                           58
  818.           #define SSH_MSG_AGENT_OPEN                         59
  819.           #define SSH_MSG_REQUEST_TCPIP_PORT_FORWARDING      60
  820.           #define SSH_MSG_REQUEST_SUCCESS                    61
  821.           #define SSH_MSG_REQUEST_FAILURE                    62
  822.           #define SSH_MSG_TCPIP_REMOTE_PORT_OPEN             63
  823.           #define SSH_MSG_TCPIP_PORT_OPEN                    64
  824.  
  825.  
  826. Tatu Ylonen <ylo@ssh.fi>                                       [page 14]
  827.  
  828. INTERNET-DRAFT                                            March 22, 1997
  829.  
  830. 10.  Address of Author
  831.  
  832.               Tatu Ylonen
  833.               SSH Communications Security Ltd.
  834.               Tekniikantie 12
  835.               FIN-02150 ESPOO
  836.               Finland
  837.  
  838.               E-mail: ylo@ssh.fi
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884. Tatu Ylonen <ylo@ssh.fi>                                       [page 15]
  885.