home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ck9197.zip / telnet.txt < prev   
Text File  |  2000-02-01  |  43KB  |  1,006 lines

  1. TELNET FUNCTIONALITY FOR C-KERMIT 7.0 AND KERMIT 95 1.1.19
  2.  
  3.   Jeffrey Altman
  4.   The Kermit Project
  5.   Columbia University
  6.  
  7. Most recent update: Tue Jan  30, 2000
  8.  
  9.  
  10. CONTENTS
  11.  
  12.   1. INTRODUCTION
  13.   2. SUPPORTED TELNET OPTIONS
  14.   3. TELNET OPTION MANAGEMENT
  15.   4. TELNET COMMAND SUMMARY
  16.   5. DIAGNOSING AND FIXING PROBLEMS CONNECTING TO TELNET SERVERS
  17.  
  18.  
  19. 1. INTRODUCTION
  20.  
  21. The Telnet protocol is one of the original protocols developed for the 
  22. ARPAnet, the precursor to today's Internet.  Telnet has evolved since 
  23. the early 1970s due to the extensibility provided by its "option" model.
  24. To quote RFC854:
  25.  
  26.    "The purpose of the TELNET Protocol is to provide a fairly general,
  27.    bi-directional, eight-bit byte oriented communications facility.  Its
  28.    primary goal is to allow a standard method of interfacing terminal
  29.    devices and terminal-oriented processes to each other.  It is
  30.    envisioned that the protocol may also be used for terminal-terminal
  31.    communication ("linking") and process-process communication
  32.    (distributed computation)."
  33.  
  34. Not so long ago the requirements for a Telnet client were fairly minimal:
  35. support echo management, window size notification, terminal type negotiation,
  36. and perhaps the transmission of environment variables from the client to the
  37. server.  Option negotiations were not time sensitive nor were they
  38. interdependent.  Everyone was happy as long as each option specification was
  39. followed and infinite negotiation loops were avoided.
  40.  
  41. This simplicity began to change with the introduction of telnet options 
  42. that provide for mutual authentication, data encryption, transport layer 
  43. security, and synchronization of remote processes.  The new options have order
  44. and timing dependencies that require increased sophistication from both client
  45. and server even though the original Telnet protocol specification did not 
  46. change.
  47.  
  48. Prior to C-Kermit 7.0 and K95 1.1.18, Kermit implemented Telnet protocol by
  49. opening a connection to the host and then transmitting the options that it
  50. supported.  What happened next was determined by how the connection was being
  51. used.  If the user told Kermit to:
  52.  
  53.   TELNET <host>
  54.  
  55. then, immediately after the telnet options were transmitted, the terminal
  56. emulator started and began reading the incoming data.  The rest of the Telnet
  57. protocol implementation was purely reactive (with minor exceptions such as
  58. window-size changes): when a Telnet option was received it would be processed
  59. and a response sent if necessary.
  60.  
  61. However, if the user said:
  62.  
  63.   SET HOST <host>
  64.  
  65. then, after the telnet options were transmitted, Kermit would wait for the
  66. next command from the user.  If a CONNECT command was next the behavior would
  67. be the same as for TELNET <host>.  However, if Kermit was executing a script
  68. containing a series of INPUT and OUTPUT commands, the incoming telnet option
  69. negotiations would be processed while waiting for INPUT.
  70.  
  71. This was adequate when there were no ordering or timing requirements for the
  72. Telnet negotiations.  But with the introduction of authentication,
  73. encryption, transport-layer security, and the Kermit option for managing the
  74. states of the Kermit server on both the workstation and host (see iksd.txt),
  75. it is necessary for Telnet negotiations to take place before the TELNET
  76. command enters the terminal emulator or the SET HOST command completes and
  77. allows any subsequent INPUT and OUTPUT commands to execute.
  78.  
  79. The timing requirements for the telnet options supported by Kermit are as
  80. follows:
  81.  
  82.  . START_TLS (Transport Layer Security) must be negotiated or refused before
  83.    any other option.
  84.  
  85.  . AUTH (Authentication) must be negotiated or refused before ENCRYPT.  AUTH
  86.    must also be negotiated before the login process is initiated.
  87.  
  88.  . ENCRYPT (Encryption) must be negotiated/refused in both directions before
  89.    it is safe to transmit any data that might be considered private, including
  90.    Telnet options such as terminal type, location, xdisplay, or environment
  91.    variables.  ENCRYPT may not be negotiated if START_TLS has been negotiated
  92.    or if AUTH has not been.
  93.  
  94.  . KERMIT (Internet Kermit Service) must wait for a response to any request
  95.    for the peer to either turn on or off the Kermit Server capabilities in
  96.    order to facilitate automatic uploading or downloading of files or
  97.    processing of remote commands.
  98.  
  99.  . NEW_ENV (Transmission of Environment Variables to the Host) must be 
  100.    negotiated before the login process is initiated if the USER variable
  101.    is to be requested from the client.
  102.  
  103. The result is that Kermit must, to the best of its ability, attempt to
  104. process all of the above options before TELNET enters CONNECT mode or SET
  105. HOST completes to process the next command.  Therefore it might take Kermit
  106. longer to make a connection to a host than before.
  107.  
  108. The reality is actually far different.  Even if the CONNECT mode or first
  109. INPUT command was executed sooner no user data could be received until the
  110. Telnet negotiations were complete.  In addition, the timing of the initial
  111. INPUT command used to require that the length of time it takes to process the
  112. Telnet negotiations be factored in.  This is no longer necessary and was
  113. inappropriate in the first place.  A login script should not have to be
  114. modified for different connection types; the telnet negotiations should be
  115. transparent to the script.  In C-Kermit 7.0 and Kermit 95 1.1.18 they are.
  116.  
  117.  
  118. 2. SUPPORTED TELNET OPTIONS
  119.  
  120. BINARY (Binary Transmission Mode)                  [RFC  856]
  121.  
  122. When a telnet session is initiated, the connection is in Network Virtual
  123. Terminal (NVT) mode.  NVT mode provides for special treatment of the carriage
  124. return (CR) control character to provide for deterministic parsing of the
  125. input stream.  Every CR that is transmitted must be followed by a line feed
  126. (LF) control character or a NUL control character.  This enables an NVT to
  127. distiguish between the Carriage Return function and the End of Line indicator.
  128. This works fine for textual data.  But in transmission of random binary data
  129. there is the possibility that the sequence CR NUL might be misinterpreted.
  130.  
  131. Binary mode removes the ambiguity by removing the requirement that 
  132. CR be followed by either LF or NUL.  It is negotiatied separately
  133. in each direction of data transmission.  Binary transmission mode is
  134. not required for transferring files with Kermit protocol but it might be
  135. required when transfering files with Xmodem, Ymodem, or Zmodem.
  136.  
  137. Binary mode is one of the most frequently misimplemented telnet options.
  138. Many implementation will negotiate Binary mode in only one direction
  139. but apply it in both.  Kermit provides workarounds for
  140. these problems with its SET TELNET BUG BINARY-ME-MEANS-U-TOO and 
  141. SET TELNET BUG BINARY-U-MEANS-ME-TOO commands.
  142.  
  143. Kermit also provides the SET TELNET BINARY-TRANSFER-MODE command to
  144. automatically enter binary mode at the start of a file transfer
  145. and return to NVT mode when the transfer is completed.
  146.  
  147. ECHO (Echo Mode)                                   [RFC  857] 
  148.  
  149. When a telnet session is initiated, data is not echoed by the receiver.
  150. This means that a telnet client must echo each character locally as
  151. it is being sent to the host.  While this reduces network traffic it 
  152. can cause problems with terminal emulation and echoing of sensitive data.
  153.  
  154. The echo option allows the each side to specify that it intends to 
  155. echo the data that it receives.  Normally this would be used to negotiate
  156. that the server should echo the data it receives from the client.  While it
  157. is possible for the client to state that it will echo the data received
  158. from the server this makes no sense and if negotiatied could result in
  159. an infinite loop of a single character being echoed back and forth.
  160.  
  161. As a piece of telnet trivia, the BSD 4.2 telnet client would echo 
  162. incoming data sent by the server if the host requested it.  Kermit
  163. will always respond WONT ECHO to a DO ECHO request when it is the client.
  164.  
  165. SUPPRESS GO AHEAD (Suppress Go Ahead commands)     [RFC  858]
  166.  
  167. When a telnet session is initiated, all data transmitted by the sender is to
  168. be followed by a Go Ahead (GA) command sequence.  This is to enable telnet to
  169. be used over half-duplex (two-way alternate) connections, and it gives the
  170. telnet partner permission to transmit.  But to our knowledge, all telnet
  171. sessions used over the Internet are full duplex connections.  The Suppress Go
  172. Ahead (SGA) option is negotiated in both directions to suppress the
  173. transmission of the GA commands and treat the connection as full duplex
  174. (two-way simultaneous).
  175.  
  176. LOGOUT (Logout user from host)                     [RFC  727]
  177.  
  178. Some operating systems such as VMS support the notion of a login session
  179. that can continue across separate telnet connections.  If a telnet 
  180. connection is prematurely interrupted by a network failure, the user
  181. may reconnect to a pre-existing session on their next login attempt.
  182.  
  183. The Telnet Logout option is sent by the telnet client just before the
  184. tcp/ip socket is closed to indicate to the host that the connection is
  185. being intentionally terminated by the user and is not being closed
  186. due to a network error.
  187.  
  188. SEND LOCATION (Send Terminal Location)             [RFC  779]
  189.  
  190. The Send Location option provides the host with a method for requesting
  191. the location of the telnet client.  When a location string has been
  192. specified with the SET TELNET LOCATION command, Kermit transmits
  193. this string to the host upon request.
  194.  
  195. TERMINAL TYPE (Negotiate Terminal Type)            [RFC 1091]
  196.  
  197. The Terminal Type option allows the client and server to 
  198. agree to a common terminal type that they both support.  C-Kermit
  199. reports the value of the local TERM environment variable.  Since Kermit 95
  200. supports more than 30 terminal types, it continues to offer additional
  201. terminal tyeps to the host until the host accepts one.
  202.  
  203. NAWS (Negotiate About Window Size)                 [RFC 1073]
  204.  
  205. The Negotiate About Windows Size (NAWS) lets the client report its current
  206. Window size to the host.  Every time the client's window size changes, the new
  207. size is reported to the host automatically.  It is not possible for the host
  208. to report a window size to the client.
  209.  
  210. XDISPLOC (Report X Window Display location)        [RFC 1096]
  211.  
  212. The X Windows display option is used to report to the host the address
  213. of the local X Windows Server.  Kermit sends the contents of the
  214. local DISPLAY environment variable or the string specified by the
  215. SET TELNET ENVIRONMENT DISPLAY command.  
  216.  
  217. AUTHENTICATION (Authenticate end user to host)     [Internet-Draft]
  218.  
  219. The AUTHENTICATION option is used to determine which if any authentication
  220. method such as Kerberos 4, Kerberos 5, Secure Remote Password, etc, should
  221. be used to authenticate the user to the host.
  222.  
  223. ENCRYPTION (Encrypt session)                       [Internet-Draft]
  224.  
  225. The ENCRYPTION option is used in conjunction with the AUTHENTICATE option
  226. to encrypt all the data transmitted during the session.  The ENCRYPTION
  227. option must be negotiated separately in each direction.
  228.  
  229. NEW ENVIRONMENT (Report Environment to host)       [RFC 1572]
  230.  
  231. The NEW ENVIRONMENT option is used by the client to reply to requests 
  232. from the server for either all or specified environment variables such
  233. as DISPLAY, USERNAME, ACCOUNT, JOB, PRINTER, and SYSTEMTYPE.  When the
  234. NEW ENVIRONMENT option is used to transmit the username, many telnet 
  235. servers skip their login or username prompt and go directly to the 
  236. password prompt.
  237.  
  238. START TLS (Transmit Telnet over TLS)               [Internet-Draft]
  239.  
  240. The START TLS option is used by the client and server to determine whether the
  241. telnet session should be restarted after first establishing a TLSv1 session.
  242. TLS provides strong encryption and optionally authenticates the client and the
  243. server using X.509 certificates.  START_TLS can be used with the AUTHENTICATE
  244. option.  When negotiatied START_TLS replaces the ENCRYPTION option.
  245.  
  246. KERMIT (Synchronize Kermit File Transfers)         [Internet-Draft]
  247.  
  248. The Kermit option (invented by the Kermit Project) is designed to 
  249. allow a Kermit file-transfer client and a Kermit server to synchronize
  250. their operations.  This allows a change in "mode" of the server to
  251. automatically switch the client into the complementary mode, and vice
  252. versa.
  253.  
  254. FORWARD X (Transmit X Windows data over Telnet)    [Internet-Draft]
  255.  
  256. The FORWARD X option (invented by the Kermit Project) allows the
  257. telnet server to redirect all output from X Windows clients and 
  258. transmit it across to telnet connection.  The telnet client then
  259. forwards the data to the local X Windows server.  When the telnet
  260. connection is encrypted, both the telnet data and X Windows session data
  261. are protected.
  262.  
  263. 3. TELNET OPTION MANAGEMENT
  264.  
  265. One of the benefits of processing all the Telnet options during the SET HOST
  266. and TELNET commands is that it is now possible to configure policy 
  267. requirements for a valid connection.  This capability is necessary when the
  268. connection must be secure (authenticated and encrypted) or else fail.  
  269. Policies are specified with the new command:
  270.  
  271.   SET TELOPT [ <switch> ] <option> <local-mode>
  272.   SET TELOPT [ <switch> ] <option> <remote-mode>
  273.   SET TELOPT [ <switch> ] <option> <local-mode> <remote-mode>
  274.  
  275. Which of the SET TELOPT command forms is used is dependent on the telnet 
  276. option.  Some options, such as authentication, terminal type and window size, 
  277. are negotiated in one direction and others, such as binary, encryption and 
  278. kermit are negotiated separately in each direction.  For each option, the
  279. mode can be:
  280.  
  281. ACCEPTED
  282.   Kermit does not offer the option but if the peer requests it
  283.   Kermit agrees to use it.
  284.  
  285. REFUSED
  286.   Kermit does not offer the option and if the peer requests it
  287.   Kermit refuses to use it.
  288.  
  289. REQUESTED
  290.   Kermit requests the option but agrees not to use it if the peer
  291.   refuses it.
  292.  
  293. REQUIRED
  294.   Kermit requests the option and terminates the connection if
  295.   the peer refuses it.
  296.  
  297. The optional <switch> can be:
  298.  
  299. /CLIENT
  300.   Specifies that the command is being used to set the configuration for when 
  301.   Kermit is the Telnet client.  This is the default when Kermit is not acting
  302.   as an Internet Kermit Service.
  303.  
  304. /SERVER
  305.   Specifies that the command is being used to set the configuration
  306.   for when Kermit is the Telnet server.  Kermit is a telnet server when it
  307.   is accepting incoming connections with SET HOST * or when it is acting as
  308.   an Internet Kermit Service.  This is the default when Kermit is acting as 
  309.   an Internet Kermit Service.
  310.  
  311. The options that can be configured and their default settings, as viewed by
  312. SHOW TELOPT, are:
  313.  
  314.        Telnet Option  Me (client)   U (client)  Me (server)   U (server)
  315.  
  316.               BINARY     ACCEPTED     ACCEPTED     ACCEPTED     ACCEPTED
  317.                              WONT         WONT
  318.                 ECHO      REFUSED     ACCEPTED    REQUESTED      REFUSED
  319.                              WONT         WONT
  320.    SUPPRESS-GO-AHEAD     ACCEPTED     ACCEPTED    REQUESTED    REQUESTED
  321.                              WONT         WONT
  322.        SEND-LOCATION    REQUESTED      REFUSED      REFUSED      REFUSED
  323.                              WONT         WONT
  324.        TERMINAL-TYPE    REQUESTED      REFUSED      REFUSED    REQUESTED
  325.                              WONT         WONT
  326.                 NAWS    REQUESTED      REFUSED      REFUSED    REQUESTED
  327.                              WONT         WONT
  328.             XDISPLOC      REFUSED      REFUSED      REFUSED      REFUSED
  329.                              WONT         WONT
  330.       AUTHENTICATION    REQUESTED      REFUSED      REFUSED    REQUESTED
  331.                              WONT         WONT
  332.           ENCRYPTION    REQUESTED    REQUESTED    REQUESTED    REQUESTED
  333.                              WONT         WONT
  334.      NEW-ENVIRONMENT    REQUESTED      REFUSED      REFUSED    REQUESTED
  335.                              WONT         WONT
  336.            start-tls     ACCEPTED      REFUSED      REFUSED    REQUESTED
  337.                              WONT         WONT
  338.               kermit    REQUESTED    REQUESTED    REQUESTED    REQUESTED
  339.                              WONT         WONT
  340.            forward-X      REFUSED     ACCEPTED      REFUSED      REFUSED
  341.                              WONT         WONT
  342.  
  343. The second line listed for each option shows the currently negotiated state
  344. of the option for the current connection.
  345.  
  346. The SET TELOPT command should be used instead of the older commands:
  347.  
  348.   SET TELNET AUTHENTICATION { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  349.   SET TELNET BINARY-MODE    { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  350.   SET TELNET ENCRYPTION     { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  351.   SET TELNET ENVIRONMENT    { ON, OFF }
  352.   SET TELNET NAWS           { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  353.   SET TELNET XDISPLAY-LOC   { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  354.  
  355. which are now considered obsolete (but still supported).
  356.  
  357.  
  358. 4. TELNET COMMAND SUMMARY
  359.  
  360. TELNET /AUTH:<type> /ENCRYPT:<type> /USERID:<name> /PASSWORD:<string>
  361.        <host> <port>
  362.   The TELNET command is a shortcut for making interactive connections.
  363.   It is the equivalent of specifying:
  364.  
  365.     SET TELOPT AUTH ...
  366.     SET TELNET AUTH TYPE ...
  367.     SET TELOPT ENCRYPT ...
  368.     SET TELNET ENCRYPT TYPE ...
  369.     SET LOGIN USERID ...
  370.     SET LOGIN PASSWORD ...
  371.     SET HOST /CONNECT <host> <port> /TELNET
  372.  
  373.   /AUTH:<type> is equivalent to SET TELNET AUTH TYPE <type> and
  374.   SET TELOPT AUTH REQUIRED with the following exceptions.  If the type
  375.   is AUTO, then SET TELOPT AUTH REQUESTED is executed and if the type
  376.   is NONE, then SET TELOPT AUTH REFUSED is executed.
  377.  
  378.   /ENCRYPT:<type> is equivalent to SET TELNET ENCRYPT TYPE <type>
  379.   and SET TELOPT ENCRYPT REQUIRED REQUIRED with the following exceptions.
  380.   If the type is AUTO then SET TELOPT AUTH REQUESTED REQUESTED is executed
  381.   and if the type is NONE then SET TELOPT ENCRYPT REFUSED REFUSED is
  382.   executed.
  383.  
  384.   /USERID:[<name>]
  385.   This switch is equivalent to SET LOGIN USERID <name> or SET TELNET
  386.   ENVIRONMENT USER <name>.  If a string is given, it sent to host during
  387.   Telnet negotiations; if this switch is given but the string is omitted, no
  388.   user ID is sent to the host.  If this switch is not given, your current
  389.   USERID value, \v(userid), is sent.  When a userid is sent to the host
  390.   it is a request to login as the specified user.
  391.  
  392.   /PASSWORD:[<string>]
  393.   This switch is equivalent to SET LOGIN PASSWORD.  If a string is given,
  394.   it is treated as the password to be used (if required) by any Telnet
  395.   Authentication protocol (Kerberos Ticket retrieval, Secure Remote
  396.   Password, or X.509 certificate private key decryption.)  If no password
  397.   switch is specified a prompt is issued to request the password if one
  398.   is required for the negotiated authentication method.
  399.  
  400. For TCP/IP TELNET connections, which are in NVT (ASCII) mode by default:
  401.  
  402. SET LOGIN USERID <name>
  403.   If a <name> is given, it sent to host during Telnet negotiations; if this
  404.   switch is given but the string is omitted, no user ID is sent to the host.
  405.   If this command is not given, your current USERID value, \v(userid), is
  406.   sent.  When a userid is sent to the host it is a request to login as the
  407.   specified user.
  408.  
  409. SET LOGIN PASSWORD <password>
  410.   If a <password> is given, it is treated as the password to be used (if
  411.   required) by any Telnet Authentication protocol (Kerberos Ticket retrieval,
  412.   Secure Remote Password (SRP), or X.509 certificate private key decryption.)
  413.   If no password is specified a prompt is issued to request the password if
  414.   one is required for the negotiated authentication method.
  415.  
  416. SET TELNET AUTHENTICATION TYPE { AUTOMATIC, KERBEROS_IV, KERBEROS_V,
  417.   NTLM, SSL, SRP, NONE } [ { ... } ... ]
  418.   AUTOMATIC allows the host to choose the preferred type of authentication.
  419.   Other values allow a specific authentication method to be used.  AUTOMATIC
  420.   is the default.  Available options can vary depending on configuration;
  421.   type SET TELNET AUTHENTICATION TYPE ? for a list.
  422.  
  423.   When the type is AUTOMATIC and Kermit is accepting incoming connections
  424.   the supported authentication methods will be offered in the following
  425.   order:
  426.  
  427.     NTLM (windows only)
  428.     Kerberos 5
  429.     Kerberos 4
  430.     Secure Remote Password
  431.     SSL
  432.  
  433.   This is the equivalent of the command:
  434.  
  435.     SET TELNET AUTH TYPE NTLM KRB5 KRB4 SRP SSL
  436.  
  437. SET TELNET AUTHENTICATION FORWARDING { ON, OFF }
  438.   Set this to ON to forward Kerberos V ticket-granting-tickets to the host
  439.   after authentication is complete.  OFF by default.
  440.  
  441. SET TELNET AUTHENTICATION ENCRYPT-FLAG { ANY, NONE, TELOPT }
  442.   Use this command to specify which AUTH telopt encryption flags may be
  443.   accepted in client mode or offered in server mode.  The default is ANY.
  444.  
  445. SET TELNET AUTHENTICATION HOW-FLAG { ANY, ONE-WAY, MUTUAL }
  446.   Use this command to specify which AUTH telopt how flags may be
  447.   accepted in client mode or offered in server mode.  The default is ANY.
  448.  
  449. SET TELNET BINARY-TRANSFER-MODE { ON, OFF }
  450.   Set this command to ON if you want to force Kermit to negotiate 
  451.   Telnet Binary in both directions when performing file transfers.  
  452.   Default is OFF.  Alias SET TELNET BINARY-XFER-MODE.
  453.  
  454. SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF }
  455.   Set this to ON to try to overcome TELNET binary-mode misnegotiations by
  456.   C-Kermit's TELNET partner.
  457.  
  458. SET TELNET BUG BINARY-U-MEANS-ME-TOO { ON, OFF }
  459.   Set this to ON to try to overcome TELNET binary-mode misnegotiations by
  460.   C-Kermit's TELNET partner.
  461.  
  462. SET TELNET BUG INFINITE-LOOP-CHECK { ON, OFF }
  463.   Set this to ON to prevent Kermit from responding to a telnet negotiation
  464.   sequence that enters an infinite loop.  The default is OFF because this
  465.   should never occur.
  466.  
  467. SET TELNET BUG SB-IMPLIES-WILL-DO { ON, OFF }
  468.   Set this to ON to allow Kermit to respond to telnet sub-negotiations if
  469.   the peer forgets to respond to WILL with DO or to DO with WILL before
  470.   sending a SB (subnegotiation).
  471.  
  472. SET TELNET DEBUG ON
  473.   Displays all TELNET negotiations in full detail.
  474.  
  475. SET TELNET DELAY-SB { ON, OFF }
  476.   When ON, telnet subnegotiation responses are delayed until after all
  477.   authentication and encryption options are either successfully negotiated
  478.   or refused.  This ensures that private data is protected.  When OFF, telnet
  479.   subnegotiation responses are sent immediately.  The default is ON.
  480.  
  481. SET TELNET ECHO { LOCAL, REMOTE }
  482.   C-Kermit's initial echoing state for TELNET connections, LOCAL by default.
  483.   After the connection is made, TELNET negotiations determine the echoing.
  484.  
  485. SET TELNET ENCRYPTION TYPE { AUTOMATIC, CAST128_CFB64, CAST128_OFB64,
  486.   CAST5_40_CFB64, CAST5_40_OFB64, DES_CFB64, DES_OFB64,
  487.   DES3_CFB64, DES3_OFB64, NONE }
  488.   AUTOMATIC allows the host to choose the preferred type of encryption.
  489.   Other values allow a specific encryption method to be specified.
  490.   AUTOMATIC is the default.  The list of options will vary depending
  491.   on the encryption types selected at compilation time.
  492.  
  493.   When the type is AUTOMATIC and Kermit is accepting incoming connections
  494.   the supported encryption methods will be offered in the following order:
  495.  
  496.     DES3_CFB64
  497.     CAST128_CFB64
  498.     DES_CFB64
  499.     CAST5_40_CFB64
  500.     DES3_OFB64
  501.     CAST128_OFB64
  502.     DES_OFB64
  503.     CAST5_40_OFB64
  504.  
  505. SET TELNET ENVIRONMENT { variable-name [ value ] }
  506.   This feature lets Kermit send the values of certain environment variables
  507.   to the other computer if it asks for them.  The variable-name can be any
  508.   of the "well-known" variables "USER", "JOB", "ACCT", "PRINTER",
  509.   "SYSTEMTYPE", or "DISPLAY".  The default values are taken from your
  510.   environment; use this command to change or remove them.
  511.  
  512.   The most commonly used variables and their default values are:
  513.  
  514.   USER:
  515.     Telnet servers that request this value will use it as the name of the
  516.     account to be accessed and will therefore not prompt you for a username.
  517.     If a password is required to access the specified user's account only
  518.     the password prompt will be issued.  The default value is the name of
  519.     the user on the local machine.  This value may also be set with the
  520.     command SET LOGIN USER <name>.
  521.  
  522.   DISPLAY:
  523.     This variable is used to specify the location of the X Windows Server
  524.     to be used by X Windows client applications executed on the remote host.
  525.     This value is used by three telnet options: ENVIRONMENT, XDISPLOC, and
  526.     FORWARD-X.  The default value is retrieved from the value of the DISPLAY
  527.     environment variable in the local environment.
  528.  
  529.   PRINTER:
  530.     This variable is used to specify the location of the LPR printer to be
  531.     used for printing files on the host.  This variable is not set by
  532.     default.
  533.  
  534.   SYSTEM:
  535.     This variable is used to specify the operating system type of the local
  536.     machine.  The default value is determined by Kermit.  Typical values
  537.     are "UNIX", "VMS", "WIN32", and "OS2".
  538.  
  539.   See RFC1572 for further details.
  540.  
  541. SET TELNET LOCATION [ text ]
  542.   Location string to send to the Telnet server if it asks.  By default this
  543.   is picked up from the LOCATION environment variable.  Give this command
  544.   with no text to disable this feature.
  545.  
  546. SET TELNET NEWLINE-MODE { NVT, BINARY-MODE } { OFF, ON, RAW }
  547.   Determines how carriage returns are handled on TELNET connections.
  548.   There are separate settings for NVT (ASCII) mode and binary mode.
  549.   ON (default for NVT mode) means CRLF represents CR.
  550.   OFF means CR followed by NUL represents CR.
  551.   RAW (default for BINARY mode) means CR stands for itself.
  552.  
  553. SET TELNET PROMPT-FOR-USERID <prompt>
  554.   Specifies a custom prompt to be used when prompting for a userid.
  555.   Kermit will prompt for a userid if
  556.     SET LOGIN USERID {}
  557.   has been issued prior to a telnet authentication negotiation for
  558.   an authentication type that requires the transmission of a name.
  559.   (e.g. Secure Remote Password).
  560.  
  561. SET TELNET REMOTE-ECHO { ON, OFF }
  562.   Applies only to incoming connections created with:
  563.     SET HOST * <port> /TELNET
  564.   This command determines whether Kermit will actually echo characters
  565.   received from the remote when it has negotiated to do so.  The default
  566.   is ON.  Remote echoing may be turned off when it is necessary to read
  567.   a password with the INPUT command.
  568.  
  569. SET TELNET TERMINAL-TYPE name
  570.   The terminal type to send to the remote TELNET host.  If none is given,
  571.   your current SET TERMINAL TYPE value is sent, e.g. VT220.
  572.  
  573. SET TELNET TRANSFER-MODE { ON, OFF }
  574.   When ON (OFF by default) and BINARY negotiations are not REFUSED Kermit
  575.   will attempt to negotiate BINARY mode in each direction before the start
  576.   of each file transfer.  After the transfer is complete BINARY mode will
  577.   be restored to the pre-transfer state.
  578.  
  579. SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
  580.   Each Telnet option must be fully negotiated either On or Off before the
  581.   session can continue.  This is especially true with options that require
  582.   subnegotiations such as Authentication, Encryption, and Kermit; for
  583.   proper support of these options Kermit must wait for the negotiations to
  584.   complete.  Of course, Kermit has no way of knowing whether a reply is
  585.   delayed or not coming at all, and so will wait forever before continuing
  586.   the session.  If you know that Kermit's Telnet partner will not be sending
  587.   the required replies, you should instruct Kermit to REFUSE specific
  588.   options with the SET TELOPT command.  If you do not know which command
  589.   the host is not responding to set this option of OFF.
  590.  
  591.  
  592. 5. DIAGNOSING AND FIXING PROBLEMS CONNECTING TO TELNET SERVERS
  593.  
  594. After we replaced the Telnet engine and added support for the new
  595. functionality we found many Telnet servers that do not adhere to the Telnet
  596. protocol as described in the IETF RFCs.  Here are some of the most common
  597. bugs and the workarounds that Kermit provides the user to avoid them.
  598.  
  599. BUG: Telnet Server does not respond to telnet options.
  600.  
  601. Description:
  602.   The telnet protocol requires that all initial requests for action (WILL or
  603.   DO) must be responded to either in the affirmative (DO or WILL) or in the
  604.   negative (DONT or WONT).  A negative response is required for all
  605.   unrecognized options.  A failure to respond to a Telnet option may result
  606.   in the peer waiting forever.
  607.  
  608.   This behavior is known to exist in the following telnet servers:
  609.  
  610.   AOS/VS II Release 2.20.00.39
  611.   IBM OS/2 Warp 4.0 (all versions not configured with authentication modules)
  612.  
  613. Symptom:
  614.  
  615.   Kermit connects to the host, waits two minutes, and then reports a telnet
  616.   protocol error followed by the list of outstanding negotiations.  Kermit
  617.   has sent a Telnet option such as WILL AUTH and is waiting for the required
  618.   response which never comes.  In C-Kermit you will see "Negotiations...."
  619.   with many dots.  In K95 you will see the "spinner" twirl.
  620.  
  621.   Example:
  622.  
  623.   DNS Lookup...  Trying xxx.xxx.xxx.xxx...  Reverse DNS Lookup... (OK)
  624.   Negotiations... ?Telnet Protocol Timeout
  625.   ?Telnet waiting for response to WILL TERMINAL-TYPE
  626.   ?Telnet waiting for response to WILL NAWS
  627.   ?Telnet waiting for response to WILL AUTHENTICATION
  628.   ?Telnet waiting for response to WILL NEW-ENVIRONMENT
  629.  
  630.   **** AOS/VS II  Release 2.20.00.39 / Press NEW-LINE to begin logging on ****
  631.  
  632.   Too slow - input timed out
  633.  
  634. Workaround:
  635.  
  636.   For each of the telnet options listed as missing a response issue a
  637.  
  638.     SET TELOPT <option> REFUSED [REFUSED]
  639.  
  640.   command.  For instance:
  641.  
  642.     SET TELOPT TERMINAL-TYPE REFUSED
  643.     SET TELOPT NAWS REFUSED
  644.     SET TELOPT AUTHENTICATION REFUSED
  645.     SET TELOPT NEW-ENVIRONMENT REFUSED
  646.  
  647. BUG: Server sends a subnegotiation without negotiating the option
  648.  
  649. Description:
  650.   The telnet protocol requires that subnegotiations not be sent until the
  651.   peers have agreed to WILL or DO the specified option.  All subnegotiations
  652.   received in a WONT or DONT state are to be ignored.
  653.  
  654. Symptom:
  655.   There are two possibilities.  In the first, the host sends a subnegotiation
  656.   such as
  657.  
  658.      IAC SB TERM_TYPE SEND IAC SE
  659.  
  660.   without Kermit attempting to use the telnet option.
  661.  
  662.      IAC WILL TERM_TYPE
  663.      IAC DO TERM_TYPE
  664.  
  665.   In this case the subnegotiation request will be ignored and the
  666.   subnegotiation response
  667.  
  668.      IAC SB TERM_TYPE IS <type> IAC SE
  669.  
  670.   will not be sent.  How this affects the sender of the illegal subnegotation
  671.   is unknown.
  672.  
  673.   In the second scenario, Kermit sends
  674.  
  675.      IAC WILL TERM_TYPE
  676.  
  677.   but the host sends the subnegotiation without responding to the request with
  678.  
  679.      IAC DO TERM_TYPE
  680.  
  681.   This scenario degenerates into the previous bug.  (See "Telnet Server does
  682.   not respond to telnet options it does not recognize.")
  683.  
  684. Workaround:
  685.   For the first scenario, there is nothing that can be done.  Kermit is
  686.   already ignoring the subnegotiations and there is nothing that Kermit
  687.   can do to force the host to adhere to the protocol.  If you have a
  688.   support contract with the maker of the Telnet Server, file a report.
  689.  
  690.   For the second scenario, Kermit implements a workaround which is on by
  691.   default:
  692.  
  693.     SET TELNET BUG SB-IMPLIES-WILL-DO ON
  694.  
  695.   This causes Kermit to treat
  696.  
  697.      IAC SB TERM_TYPE SEND IAC SE
  698.  
  699.   as if it were
  700.  
  701.      IAC WILL TERM_TYPE
  702.      IAC SB TERM_TYPE SEND IAC SE
  703.  
  704.  
  705. BUG: Server sends DO TERM_TYPE but then never asks for the terminal type.
  706.  
  707. Description:
  708.   Although it is not required by the Telnet Terminal-Type RFC, it makes
  709.   sense that if a server asks the client to negotiate the terminal
  710.   type, that it will actually go through with the negotiation.
  711.  
  712. Symptom:
  713.   Kermit reports that Terminal Type negotiation is in use but the terminal
  714.   type is not configured properly on the host.
  715.  
  716. Workaround:
  717.   There isn't much that can be done other than to instruct Kermit to:
  718.  
  719.      SET TELOPT TERMINAL-TYPE REFUSE
  720.  
  721.   so that it doesn't appear to the user that the terminal type has
  722.   indeed been negotiated.
  723.  
  724. BUG: Server negotiates BINARY mode in one direction but uses it in both.
  725.  
  726. Description:
  727.   When either the client or the server says it WILL BINARY and the peer
  728.   accepts, it is an indication that CR is to be sent without a following
  729.   NUL or LF by the sender of WILL BINARY.  A misunderstanding about the
  730.   meaning of this negotiation can prevent files from being transfered as
  731.   the packet lengths and checksums will not match.
  732.  
  733. Symptom:
  734.   File transfers fail, reporting checksum or packet length errors.
  735.  
  736. Workaround:
  737.   Use SET TERMINAL DEBUG ON to determine which direction the host is
  738.   negotiating BINARY mode in.
  739.  
  740.   Then use either:
  741.  
  742.     SET TELNET BUG BINARY-ME-MEANS-U-TOO ON
  743.  
  744.   or:
  745.  
  746.     SET TELNET BUG BINARY-U-MEANS-ME-TOO ON
  747.  
  748.   to instruct Kermit to follow the broken behavior.
  749.  
  750.  
  751. PROBLEM: A connection is made to the Telnet Server but then it takes 30 to 60
  752.   seconds for a login prompt, or disconnects without displaying a prompt.
  753.  
  754. Description:
  755.   The host is trying to resolve a host name for the IP Address assigned to
  756.   your computer and is unable to.  Check with your network administrator
  757.   or ISP to make sure that the IP address you are using has a valid DNS
  758.   entry for reverse lookups (IP address to name).
  759.  
  760.  
  761. PROBLEM: The Telnet Server does not display a "login:" or "Username:" prompt
  762.   and instead immediately displays the "Password:" prompt.
  763.  
  764. Description:
  765.   The server you are connecting to supports the Telnet environment option
  766.   and has been given your username on the workstation during the telnet
  767.   option negotiations.
  768.  
  769. Workaround:
  770.   If your username on the workstation is not the same as the username
  771.   on the host, or if you are using a script that requires a username
  772.   or login prompt, use the command:
  773.  
  774.     SET TELNET ENVIRONMENT USER {<username>}
  775.  
  776.   or:
  777.  
  778.     SET LOGIN USERID {<username>}
  779.  
  780.   to specify your name on the host; or disable this option with:
  781.  
  782.     SET TELOPT NEW-ENVIRONMENT REFUSED
  783.  
  784.  
  785. BUG: The host echos input but never negotiates WILL ECHO.
  786.  
  787. Description:
  788.   The Telnet protocol requires that all Telnet options be in a state of I
  789.   DONT and you WONT until otherwise negotiated.  That means that unless a
  790.   host says WILL ECHO it should not echo data; the client should echo it
  791.   locally.
  792.  
  793. Symptom:
  794.   Failure to follow the protocol definition can result in no echoing or
  795.   double echoing.  This kind of confusion has been seen with two
  796.   well-known sites:
  797.  
  798.     The USA Library of Congress
  799.     Dow Jones News Retrieval
  800.  
  801. Workaround:
  802.   SET TELNET ECHO REMOTE
  803.   SET TELOPT ECHO REFUSE
  804.  
  805.  
  806. BUG: BSDI BSD/OS 3.1 Telnetd improperly implements WILL BINARY mode.
  807.  
  808. Description:
  809.   The BSDI telnetd when it negotiaties WILL BINARY (host to client) binary
  810.   mode refuses to transmit CR control characters.  The man page for telnetd
  811.   states, "Binary mode has no common interpretation except between similar
  812.   operating systems (Unix in this case)."  The implementors clearly have
  813.   misread RFC-856 (TELNET BINARY TRANSMISSION) which clearly states that
  814.   the only affect that BINARY mode has on the channel is to disable NVT
  815.   (network virtual terminal) handling of CR (CR no longer must be followed
  816.   by NUL if it is not followed by LF) and that the 8th data bit must not
  817.   be stripped.
  818.  
  819. Symptom:
  820.   By refusing to transmit CR control characters and translate them to LF
  821.   the BSDI telnetd causes end of lines to be misinterpreted by the
  822.   terminal and for file transfers to become corrupted if the host is
  823.   allowed to negotiate WILL BINARY.
  824.  
  825. Workaround:
  826.   SET TELOPT BINARY ACCEPT REFUSE
  827.  
  828.  
  829. PROBLEM:  The host supports Telnet AUTH but you wish to login manually
  830.  
  831. Description:
  832.   You are using Kermit to connect to a host that supports Telnet
  833.   Authentication except you need to login manually for one of the
  834.   following reasons:
  835.  
  836.   . You do not have credentials that match the supported Telnet AUTH
  837.     type.  For example, the host supports Kerberos 5 but you do not
  838.     have a principal defined in the Kerberos realm even though you
  839.     have a valid account on the host.
  840.  
  841.   . You wish to login to an Internet Kermit Service anonymously.
  842.  
  843. Workaround:
  844.     SET TELOPT AUTH REFUSE
  845.  
  846.  
  847. PROBLEM:  Applications on the host are unable to open the DISPLAY
  848.  
  849. Description:
  850.   Some applications such as the editor 'emacs' are dual mode.  They execute
  851.   either in terminal mode or as an X Windows client.  If the application
  852.   terminates with an error that it is unable to open the DISPLAY it could
  853.   be for one of the following reasons:
  854.  
  855.   . a DISPLAY environment variable is defined in the shell's script that is
  856.     executed at login and it points to an invalid value;
  857.  
  858.   . there is a DISPLAY environment variable defined on the local machine
  859.     which has been forwarded to the host by Kermit and the specified
  860.     DISPLAY is unreachable.
  861.  
  862.   . a SET TELNET ENVIRONMENT DISPLAY command was issued prior to connecting
  863.     to the host and the specified DISPLAY value is invalid.
  864.  
  865. Workaround:
  866.   If you wish to use the application as an X Windows client you must
  867.   have a working X Windows Server running on your local machine and specify
  868.   a valid DISPLAY string for your server.  This can either be specified on
  869.   the host via
  870.  
  871.      export DISPLAY=<host>:<display>[.<screen>]
  872.  
  873.   or by specifying the display in Kermit with the command
  874.  
  875.      SET TELNET ENVIRONMENT DISPLAY [<host>:]<display>[.<screen>]
  876.  
  877.   If your telnet server supports any of the following telnet options:
  878.  
  879.      . X-Display Location
  880.      . Environment Variables
  881.      . X-Windows Forwarding
  882.  
  883.   then Kermit will transmit the DISPLAY value to the host during the initial
  884.   telnet negotiations.
  885.  
  886.   If you wish to use the application in terminal mode you can prevent Kermit
  887.   from transmitting the local DISPLAY value to the host by issuing the
  888.   following commands:
  889.  
  890.      SET TELOPT XDISPLOC REFUSE
  891.      SET TELOPT FORWARD-X REFUSE
  892.      SET TELNET ENVIRONMENT DISPLAY
  893.  
  894. PROBLEM: The Telnet Server is the Microsoft Windows 2000 Telnet Service
  895.  
  896. Description:
  897.   The Microsoft Windows 2000 (and NT Services for Unix) Telnet Service is a 
  898.   bit of a challenge to work with due to limitations that are imposed by the
  899.   Windows platform and the choices made by the developers.  The Telnet Service
  900.   supports three terminal emulations (ANSI, VT100, and VTNT) and two types of
  901.   end user login (Telnet AUTH NTLM and plaintext domain\username/password.)
  902.   Depending on the choices that are made will determine the levels of 
  903.   functionality that can be obtained for the service.
  904.  
  905.   Terminal types:
  906.  
  907.   ANSI and VT100 are considered to be the same terminal type by Microsoft
  908.   even though they have some very significant differences.  The Microsoft
  909.   ANSI is closest to the Kermit 95 "ANSI-BBS" which should be used in 
  910.   preference to VT100 when communicating with this service.  The VTNT
  911.   terminal type is Microsoft specific (and undocumented.)  Kermit 95 
  912.   implements a reverse engineered implementation.  VTNT uses raw Win32
  913.   data structures to implement transmission of screen snapshots from the
  914.   service to the client; and keystroke events from the client to the service.
  915.   VTNT is the preferred terminal type to use with the Microsoft Telnet service
  916.   provided that you do not need access to Kermit 95 keyboard verbs or any 
  917.   form of scripting.  If Keyboard verbs or scripting are required ANSI or 
  918.   VT100 must be used.  
  919.  
  920.   When using ANSI or VT100 the Backspace key must send BS and not DEL.
  921.  
  922.   ANSI and VT100 do not support color whereas VTNT does.
  923.  
  924.   VTNT supports Unicode characters.  ANSI and VT100 only support the local
  925.   ANSI code page.  You must configure the Kermit local and remote character
  926.   sets to properly convert between ANSI code pages.
  927.  
  928.   End user login:
  929.  
  930.   The Microsoft provides two forms of end user login.  The first is via the
  931.   use of "login:" and "password:" prompts.  The username is either the name
  932.   of a user with a local account; or a domain\name which specifies a user 
  933.   with an account in the provided domain.  Since the login is performed over
  934.   an unencrypted channel the password is easily stolen by monitoring the local 
  935.   network traffic.
  936.  
  937.   The second method is a proprietary (and undocumented) Telnet authentication
  938.   method based upon the NT Lan Manager (NTLM) protocol.  This protocol has 
  939.   also been reverse engineered and implemented in Kermit 95.  NTLM only works
  940.   if the client machine shares the same domain (or security authority) as the
  941.   machine the service is running on.  NTLM does not produce a shared secret
  942.   that can be used for encrypting the connection.  NTLM can only be 
  943.   implemented on Windows 9x, NT, or Windows 2000 so connections from other
  944.   operating systems must use plaintext logins.
  945.  
  946.   If NTLM is used, the user can only log into the service with the identity
  947.   they are logged into the local workstation.  If another username is desired
  948.   NTLM must be disabled on the client (SET TELOPT AUTH REFUSE).
  949.   
  950.   Other quirks:
  951.  
  952.   The Microsoft Telnet Service implements Telnet NAWS (Negotiate About Window 
  953.   Size) but only listens to it when the connection is initially established.
  954.   This has two side effects when used with Kermit.  First, the Telnet Service
  955.   may completely ignore the screen size reported by Kermit if it is not sent
  956.   immediately after the Telnet Service agrees to use NAWS.  Second, the Telnet
  957.   Service will not recognize changes to the screen size after the connection
  958.   is established.
  959.  
  960.   The Microsoft Telnet Service does not create a proper environment for the
  961.   end user.  The user's profile, home directory and environment variables are 
  962.   not loaded onto the system.  Applications that require this information may
  963.   fail to execute or otherwise run incorrectly.
  964.    
  965.   The Microsoft Telnet Service only allows a single telnet session to be
  966.   running at any one time.
  967.   
  968.   The Microsoft Telnet Service provides no mechansim for performing file 
  969.   transfers.
  970.  
  971.   The Microsoft Telnet Service performs its job by taking snapshots of the
  972.   console's active virtual window.  This means that it is possible for data
  973.   to be lost due to scrolling or other screen updates between snapshots.
  974.   This can play havoc with scripts and prevents Kermit from being able to
  975.   store data into its scrollback buffers.
  976.  
  977.   Recommendations:
  978.  
  979.   If using Kermit 95 and scripts are not required:
  980.  
  981.      SET TERMINAL TYPE VTNT
  982.      SET TELNET DELAY-SB OFF
  983.      SET KEY \264 \8
  984.   
  985.   If scripts are required:
  986.  
  987.      SET TERMINAL TYPE ANSI
  988.      SET TELNET DELAY-SB OFF
  989.      SET KEY \264 \8
  990.  
  991.   If you are using Kermit 95 on a Windows platform and wish to login as
  992.   a user other than yourself:
  993.  
  994.      SET TELOPT AUTH REFUSE
  995.  
  996.   or
  997.  
  998.      TELNET /AUTH:none <host>
  999.  
  1000.   If you are using C-Kermit:
  1001.  
  1002.       SET TELNET TERMINAL ANSI
  1003.       SET TELNET DELAY-SB OFF
  1004.  
  1005. (End of TELNET.TXT)
  1006.