TELNET PROTOCOL IN C-KERMIT 8.0 AND KERMIT 95 2.0

Author:
Jeffrey Altman
The Kermit Project
Columbia University

Most recent update:
4 June 2002

[ Kermit Home ] [ C-Kermit Home ] [ Kermit 95 Home ]

CONTENTS

  1. INTRODUCTION
  2. SUPPORTED TELNET OPTIONS
  3. TELNET OPTION MANAGEMENT
  4. TELNET COMMAND SUMMARY
  5. DIAGNOSING AND FIXING PROBLEMS CONNECTING TO TELNET SERVERS

1. INTRODUCTION

[ Top ] [ Contents ] [ Next ]

The Telnet protocol is one of the original protocols developed for the ARPANET, the precursor to today's Internet. Telnet has evolved since the early 1970s due to the extensibility provided by its "option" model. To quote RFC854:

"The purpose of the TELNET Protocol is to provide a fairly general, bi-directional, eight-bit byte oriented communications facility. Its primary goal is to allow a standard method of interfacing terminal devices and terminal-oriented processes to each other. It is envisioned that the protocol may also be used for terminal-terminal communication ("linking") and process-process communication (distributed computation)."

Not so long ago the requirements for a Telnet client were fairly minimal: support echo management, window size notification, terminal type negotiation, and perhaps the transmission of environment variables from the client to the server. Option negotiations were not time sensitive nor were they interdependent. Everyone was happy as long as each option specification was followed and infinite negotiation loops were avoided.

This simplicity began to change with the introduction of telnet options that provide for mutual authentication, data encryption, transport layer security, and synchronization of remote processes. The new options have order and timing dependencies that require increased sophistication from both client and server even though the original Telnet protocol specification did not change.

Prior to C-Kermit 7.0 and K95 1.1.19, Kermit implemented Telnet protocol by opening a connection to the host and then transmitting the options that it supported. What happened next was determined by how the connection was being used. If the user told Kermit to:

  TELNET host

then, immediately after the initial telnet options were transmitted, the terminal emulator started and began processing the incoming data. The rest of the Telnet protocol implementation was purely reactive (with minor exceptions such as window-size changes): when a Telnet option was received it would be processed and a response sent as required.

However, if the user said:

  SET HOST host

then, after the initial telnet options were transmitted, Kermit would wait for the next command from the user. If a CONNECT command was next the behavior would be the same as for TELNET host. However, if Kermit was executing a script containing a series of INPUT and OUTPUT commands, the incoming telnet option negotiations would be processed while waiting for INPUT.

This was adequate when there were no ordering or timing requirements for the Telnet negotiations. But with the introduction of authentication, encryption, transport-layer security, and the Kermit option for managing the states of the Kermit server on both the workstation and host it is necessary for Telnet negotiations to take place before the TELNET command enters the terminal emulator or the SET HOST command completes and allows any subsequent INPUT and OUTPUT commands to execute.

The timing requirements for the telnet options supported by Kermit are as follows:

The result is that Kermit must, to the best of its ability, attempt to process all of the above options before TELNET enters CONNECT mode or SET HOST completes to process the next command. Therefore it might take Kermit longer to make a connection to a host than before.

The reality is actually far different. Even if the CONNECT mode or first INPUT command was executed sooner no user data could be received until the Telnet negotiations were complete. In addition, the timing of the initial INPUT command used to require that the length of time it takes to process the Telnet negotiations be factored in. This is no longer necessary and was inappropriate in the first place. A login script should not have to be modified for different connection types; the telnet negotiations should be transparent to the script. In C-Kermit 7.0 and Kermit 95 1.1.18 they are.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


2. SUPPORTED TELNET OPTIONS

[ Top ] [ Contents ] [ Next ] [ Previous ]

AUTHENTICATION (Authenticate end user to host) [RFC2941]
The AUTHENTICATION option is used to determine which if any authentication method such as Kerberos 4, Kerberos 5, Secure Remote Password, etc, should be used to authenticate the user to the host.

BINARY (Binary Transmission Mode) [RFC856]
When a telnet session is initiated, the connection is in Network Virtual Terminal (NVT) mode. NVT mode provides for special treatment of the carriage return (CR) control character to provide for deterministic parsing of the input stream. Every CR that is transmitted must be followed by a line feed (LF) control character or a NUL control character. This enables an NVT to distiguish between the Carriage Return function and the End of Line indicator. This works fine for textual data. But in transmission of random binary data there is the possibility that the sequence CR NUL might be misinterpreted.

Binary mode removes the ambiguity by removing the requirement that CR be followed by either LF or NUL. It is negotiatied separately in each direction of data transmission. Binary transmission mode is not required for transferring files with Kermit protocol but it might be required when transfering files with Xmodem, Ymodem, or Zmodem.

Binary mode is one of the most frequently misimplemented telnet options. Many implementation will negotiate Binary mode in only one direction but apply it in both. Kermit provides workarounds for these problems with its SET TELNET BUG BINARY-ME-MEANS-U-TOO and SET TELNET BUG BINARY-U-MEANS-ME-TOO commands.

Kermit also provides the SET TELNET BINARY-TRANSFER-MODE command to automatically enter binary mode at the start of a file transfer and return to NVT mode when the transfer is completed.

COM-PORT-CONTROL (Remote Serial Port device control) [RFC2217]
This option is designed for use with reverse terminal servers and other network services that share serial line devices such as modems across the network. A long term issue has been the need for the network administrator to pre-configure the modem and serial line parameters to meet the requirements of the client applications. Client applications are able to adjust the modem configuration by issuing modem specific command sequences. Many options require the modem and serial line device to be adjusted simultaneously. Two examples are the use of dynamic speed matching and flow control protocols. When the com-port control option is negotiated the telnet client is able to treat the remote serial line device as if it were locally attached. This allows Kermit's SHOW COMMUNICATIONS, SET FLOW, SET SPEED, SET PARITY, SET STOP-BITS, SET MODEM SPEED-MATCHING and WAIT commands to remotely control or respond to changes in the modem or serial line properties.

ECHO (Echo Mode) [RFC857]
When a telnet session is initiated, data is not echoed by the receiver. This means that a telnet client must echo each character locally as it is being sent to the host. While this reduces network traffic it can cause problems with terminal emulation and echoing of sensitive data.

The echo option allows the each side to specify that it intends to echo the data that it receives. Normally this would be used to negotiate that the server should echo the data it receives from the client. While it is possible for the client to state that it will echo the data received from the server this makes no sense and if negotiatied could result in an infinite loop of a single character being echoed back and forth.

As a piece of telnet trivia, the BSD 4.2 telnet client would echo incoming data sent by the server if the host requested it. Kermit will always respond WONT ECHO to a DO ECHO request when it is the client.

ENCRYPTION (Encrypt session) [RFC2946]
The ENCRYPTION option is used in conjunction with the AUTHENTICATE option to encrypt all the data transmitted during the session if START_TLS is not negotiated. The ENCRYPTION option must be negotiated separately in each direction.

FORWARD X (Forward X Windows Systems data with X authorization) [Internet-Draft]
The FORWARD X option (developed by the Kermit Project) allows the telnet server to redirect all output from X Windows clients and transmit it across an encrypted telnet connection. The telnet client then forwards the data to the local X Windows server. Connections from the X Windows client to the Telnet Server are authorized using the strongest X authorization method supported by both X Windows client and the Telnet Server. Unauthorized connections are rejected.

KERMIT (Synchronize Kermit File Transfers) [RFC2840]
The Kermit option (developed by the Kermit Project) is designed to allow a Kermit file-transfer client and a Kermit server to synchronize their operations. This allows a change in "mode" of the server to automatically switch the client into the complementary mode, and vice versa.

LOGOUT (Logout user from host) [RFC727]
Some operating systems such as VMS support the notion of a login session that can continue across separate telnet connections. If a telnet connection is prematurely interrupted by a network failure, the user may reconnect to a pre-existing session on their next login attempt.

The Telnet Logout option is sent by the telnet client just before the tcp/ip socket is closed to indicate to the host that the connection is being intentionally terminated by the user and is not being closed due to a network error.

NAWS (Negotiate About Window Size) [RFC1073]
The Negotiate About Windows Size (NAWS) lets the client report its current Window size to the host. Every time the client's window size changes, the new size is reported to the host automatically. It is not possible for the host to report a window size to the client.

NEW ENVIRONMENT (Report Environment to host) [RFC1572]
The NEW ENVIRONMENT option is used by the client to reply to requests from the server for either all or specified environment variables such as DISPLAY, USERNAME, ACCOUNT, JOB, PRINTER, and SYSTEMTYPE. When the NEW ENVIRONMENT option is used to transmit the username, many telnet servers skip their login or username prompt and go directly to the password prompt.

SEND LOCATION (Send Terminal Location) [RFC779]
The Send Location option provides the host with a method for requesting the location of the telnet client. When a location string has been specified with the SET TELNET LOCATION command, Kermit transmits this string to the host upon request.

START TLS (Transmit Telnet over TLS) [Internet-Draft]
The START TLS option is used by the client and server to determine whether the telnet session should be restarted after first establishing a TLSv1 session. TLS provides strong encryption and optionally authenticates the client and the server using X.509 certificates or Kerberos 5 credentials. START_TLS can be used with the AUTHENTICATE option. TLS connections may implement data compression. When negotiatied START_TLS replaces the ENCRYPTION option.

SUPPRESS GO AHEAD (Suppress Go Ahead commands) [RFC858]
When a telnet session is initiated, all data transmitted by the sender is to be followed by a Go Ahead (GA) command sequence. This is to enable telnet to be used over half-duplex (two-way alternate) connections, and it gives the telnet partner permission to transmit. But to our knowledge, all telnet sessions used over the Internet are full duplex connections. The Suppress Go Ahead (SGA) option is negotiated in both directions to suppress the transmission of the GA commands and treat the connection as full duplex (two-way simultaneous).

TERMINAL TYPE (Negotiate Terminal Type) [RFC1091]
The Terminal Type option allows the client and server to agree to a common terminal type that they both support. C-Kermit reports the value of the local TERM environment variable. Since Kermit 95 supports more than 30 terminal types, it continues to offer additional terminal types to the host until the host decides which one to use.

XDISPLOC (Report X Window Display location) [RFC1096]
The X Windows display option is used to report to the host the address of the local X Windows Server. Kermit sends the contents of the local DISPLAY environment variable or the string specified by the SET TELNET ENVIRONMENT DISPLAY command. XDISPLOC is not used if FORWARDX is negotiated.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


3. TELNET OPTION MANAGEMENT

[ Top ] [ Contents ] [ Next ] [ Previous ]

One of the benefits of processing all the Telnet options during the SET HOST and TELNET commands is that it is now possible to configure policy requirements for a valid connection. This capability is necessary when the connection must be secure (authenticated and encrypted) or else fail. Policies are specified with the new command:

SET TELOPT [ switch ] option local-mode
SET TELOPT [ switch ] option remote-mode
SET TELOPT [ switch ] option local-mode remote-mode
Which of the SET TELOPT command forms is used is dependent on the telnet option. Some options, such as authentication, terminal type and window size, are negotiated in one direction and others, such as binary, encryption and kermit are negotiated separately in each direction.

For each option, the mode can be:

ACCEPTED
Kermit does not offer the option but if the peer requests it Kermit agrees to use it.

REFUSED
Kermit does not offer the option and if the peer requests it Kermit refuses to use it.

REQUESTED
Kermit requests the option but agrees not to use it if the peer refuses it.

REQUIRED
Kermit requests the option and terminates the connection if the peer refuses it.

The optional can be:

/CLIENT
Specifies that the command is being used to set the configuration for when Kermit is the Telnet client. This is the default when Kermit is not acting as an Internet Kermit Service.

/SERVER
Specifies that the command is being used to set the configuration for when Kermit is the Telnet server. Kermit is a telnet server when it is accepting incoming connections with SET HOST * or when it is acting as an Internet Kermit Service. This is the default when Kermit is acting as an Internet Kermit Service.

The options that can be configured and their default settings, as viewed by SHOW TELOPT, are:

       Telnet Option          Me (client)   U (client)  Me (server)   U (server)

   000 BINARY                ACCEPTED     ACCEPTED     ACCEPTED     ACCEPTED
                                 WONT         DONT
   001 ECHO                   REFUSED     ACCEPTED    REQUESTED      REFUSED
                                 WONT         DONT
   003 SUPPRESS-GO-AHEAD     ACCEPTED     ACCEPTED    REQUESTED    REQUESTED
                                 WONT         DONT
   023 SEND-LOCATION        REQUESTED      REFUSED      REFUSED      REFUSED
                                 WONT         DONT
   024 TERMINAL-TYPE        REQUESTED      REFUSED      REFUSED    REQUESTED
                                 WONT         DONT
   031 NAWS                 REQUESTED      REFUSED      REFUSED    REQUESTED
                                 WONT         DONT
   035 XDISPLOC               REFUSED      REFUSED      REFUSED      REFUSED
                                 WONT         DONT
   037 AUTHENTICATION       REQUESTED      REFUSED      REFUSED    REQUESTED
                                 WONT         DONT
   038 ENCRYPTION           REQUESTED    REQUESTED    REQUESTED    REQUESTED
                                 WONT         DONT
   039 NEW-ENVIRONMENT      REQUESTED      REFUSED      REFUSED    REQUESTED
                                 WONT         DONT
   044 COM-PORT-CONTROL     REQUESTED      REFUSED      REFUSED      REFUSED
                                 WONT         DONT
   046 START-TLS             ACCEPTED      REFUSED      REFUSED    REQUESTED
                                 WONT         DONT
   047 KERMIT               REQUESTED    REQUESTED    REQUESTED    REQUESTED
                                 WONT         DONT
   049 FORWARD-X              REFUSED     ACCEPTED      REFUSED      REFUSED
                                 WONT         DONT
                                                                         

The second line listed for each option shows the currently negotiated state of the option for the current connection.

The SET TELOPT command should be used instead of the older commands:

  SET TELNET AUTHENTICATION {ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  SET TELNET BINARY-MODE    {ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  SET TELNET ENCRYPTION     {ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  SET TELNET ENVIRONMENT    {ON, OFF }
  SET TELNET NAWS           {ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  SET TELNET XDISPLAY-LOC   {ACCEPTED, REFUSED, REQUESTED, REQUIRED }

which are now considered obsolete (but still supported).

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


4. TELNET COMMAND SUMMARY

[ Top ] [ Contents ] [ Next ] [ Previous ]

The Telnet protocol is used by Kermit when establishing the vast majority of its connections with the SET HOST or TELNET commands. The format of the SET HOST command is SET HOST [ switches ] hostname-or-address [ service ] [ protocol-switch ] Telnet protocol is used when the protocol-switch is one of the following:

/TELNET
Send initial Telnet negotiations even if this is not a Telnet port.

/NO-TELNET-INIT
Use Telnet protocol, but do not initiate any telnet negotiations unless the server sends a telnet first. For use with non-Telnet servers which expect the client to use Telnet NVT mode.

/SSL-TELNET
Perform SSL negotiations and if successful start Telnet negotiations.

/TLS-TELNET
Perform TLS negotiations and if successful start Telnet negotiations.

TELNET /AUTH:type /ENCRYPT:type /USERID:name /PASSWORD:string host port
The TELNET command is a shortcut for making interactive connections. It is the equivalent of specifying:

  SET TELOPT AUTH ...
  SET TELNET AUTH TYPE ...
  SET TELOPT ENCRYPT ...
  SET TELNET ENCRYPT TYPE ...
  SET LOGIN USERID ...
  SET LOGIN PASSWORD ...
  SET HOST /CONNECT host port /TELNET

/AUTH:type
Is equivalent to SET TELNET AUTH TYPE type and SET TELOPT AUTH REQUIRED with the following exceptions. If the type is AUTO, then SET TELOPT AUTH REQUESTED is executed and if the type is NONE, then SET TELOPT AUTH REFUSED is executed. If START_TLS is negotiated, REQUIRED becomes REQUESTED.

/ENCRYPT:type
Is equivalent to SET TELNET ENCRYPT TYPE type and SET TELOPT ENCRYPT REQUIRED REQUIRED with the following exceptions. If the type is AUTO then SET TELOPT AUTH REQUESTED REQUESTED is executed and if the type is NONE then SET TELOPT ENCRYPT REFUSED REFUSED is executed. If START_TLS is negotiated, REQUIRED becomes REFUSED.

/USERID:[name]
This switch is equivalent to SET LOGIN USERID name or SET TELNET ENVIRONMENT USER name. If a string is given, it sent to host during Telnet negotiations; if this switch is given but the string is omitted, no user ID is sent to the host. If this switch is not given, your current USERID value, \v(userid), is sent. When a userid is sent to the host it is a request to login as the specified user.

/PASSWORD:[string]
This switch is equivalent to SET LOGIN PASSWORD. If a string is given, it is treated as the password to be used (if required) by any Telnet Authentication protocol (Kerberos Ticket retrieval, Secure Remote Password, or X.509 certificate private key decryption.) If no password switch is specified a prompt is issued to request the password if one is required for the negotiated authentication method.

For TCP/IP TELNET connections, which are in NVT (ASCII) mode by default:

SET LOGIN USERID name
If a name is given, it sent to host during Telnet negotiations; if this switch is given but the string is omitted, no user ID is sent to the host. If this command is not given, your current USERID value, \v(userid), is sent. When a userid is sent to the host it is a request to login as the specified user.

SET LOGIN PASSWORD password
If a is given, it is treated as the password to be used (if required) by any Telnet Authentication protocol (Kerberos Ticket retrieval, Secure Remote Password (SRP), or X.509 certificate private key decryption.) If no password is specified a prompt is issued to request the password if one is required for the negotiated authentication method.

SET TELNET AUTHENTICATION TYPE -
{AUTOMATIC, KERBEROS_IV, KERBEROS_V, NTLM, SSL, SRP, NONE } [ { ... } ... ]
AUTOMATIC allows the host to choose the preferred type of authentication. Other values allow a specific authentication method to be used. AUTOMATIC is the default. Available options can vary depending on configuration; type SET TELNET AUTHENTICATION TYPE ? for a list.

When the type is AUTOMATIC and Kermit is accepting incoming connections the supported authentication methods will be offered in the following order:

  1. NTLM (windows only)
  2. Kerberos 5
  3. Kerberos 4
  4. Secure Remote Password
  5. SSL

    This is the equivalent of the command:

      SET TELNET AUTH TYPE NTLM KRB5 KRB4 SRP SSL
    

    SET TELNET AUTHENTICATION FORWARDING { ON, OFF }
    Set this to ON to forward Kerberos V ticket-granting-tickets to the host after authentication is complete. OFF by default.

    SET TELNET AUTHENTICATION ENCRYPT-FLAG { ANY, NONE, TELOPT }
    Use this command to specify which AUTH telopt encryption flags may be accepted in client mode or offered in server mode. The default is ANY.

    SET TELNET AUTHENTICATION HOW-FLAG { ANY, ONE-WAY, MUTUAL }
    Use this command to specify which AUTH telopt how flags may be accepted in client mode or offered in server mode. The default is ANY.

    SET TELNET BINARY-TRANSFER-MODE { ON, OFF }
    Set this command to ON if you want to force Kermit to negotiate Telnet Binary in both directions when performing file transfers. Default is OFF. Alias SET TELNET BINARY-XFER-MODE.

    SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF }
    Set this to ON to try to overcome TELNET binary-mode misnegotiations by C-Kermit's TELNET partner.

    SET TELNET BUG BINARY-U-MEANS-ME-TOO { ON, OFF }
    Set this to ON to try to overcome TELNET binary-mode misnegotiations by C-Kermit's TELNET partner.

    SET TELNET BUG INFINITE-LOOP-CHECK { ON, OFF }
    Set this to ON to prevent Kermit from responding to a telnet negotiation sequence that enters an infinite loop. The default is OFF because this should never occur.

    SET TELNET BUG SB-IMPLIES-WILL-DO { ON, OFF }
    Set this to ON to allow Kermit to respond to telnet sub-negotiations if the peer forgets to respond to WILL with DO or to DO with WILL before sending a SB (subnegotiation).

    SET TELNET DEBUG ON
    Displays all TELNET negotiations in full detail.

    SET TELNET DELAY-SB { ON, OFF }
    When ON, telnet subnegotiation responses are delayed until after all authentication and encryption options are either successfully negotiated or refused. This ensures that private data is protected. When OFF, telnet subnegotiation responses are sent immediately. The default is ON.

    SET TELNET ECHO { LOCAL, REMOTE }
    C-Kermit's initial echoing state for TELNET connections, LOCAL by default. After the connection is made, TELNET negotiations determine the echoing.

    SET TELNET ENCRYPTION TYPE { AUTOMATIC, CAST128_CFB64, CAST128_OFB64,CAST5_40_CFB64, CAST5_40_OFB64, DES_CFB64, DES_OFB64, DES3_CFB64, DES3_OFB64, NONE }
    AUTOMATIC allows the host to choose the preferred type of encryption. Other values allow a specific encryption method to be specified. AUTOMATIC is the default. The list of options will vary depending on the encryption types selected at compilation time. When the type is AUTOMATIC and Kermit is accepting incoming connections the supported encryption methods will be offered in the following order:
      DES3_CFB64
      CAST128_CFB64
      DES_CFB64
      CAST5_40_CFB64
      DES3_OFB64
      CAST128_OFB64
      DES_OFB64
      CAST5_40_OFB64
    

    SET TELNET ENVIRONMENT [ USERVAR ] { variable-name [ value ] }
    This feature lets Kermit send the values of certain environment variables to the other computer if it asks for them. The variable-name can be any of the "well-known" variables "USER", "JOB", "ACCT", "PRINTER", "SYSTEMTYPE", or "DISPLAY". The default values are taken from your environment; use this command to change or remove them. If USERVAR is specified you can include any non-standard environment variables.

    The most commonly used variables and their default values are:

    USER:
    Telnet servers that request this value will use it as the name of the account to be accessed and will therefore not prompt you for a username. If a password is required to access the specified user's account only the password prompt will be issued. The default value is the name of the user on the local machine. This value may also be set with the command SET LOGIN USER name.

    DISPLAY:
    This variable is used to specify the location of the X Windows Server to be used by X Windows client applications executed on the remote host. This value is used by three telnet options: ENVIRONMENT, XDISPLOC, and FORWARD-X. The default value is retrieved from the value of the DISPLAY environment variable in the local environment.

    PRINTER:
    This variable is used to specify the location of the LPR printer to be used for printing files on the host. This variable is not set by default.

    SYSTEM:
    This variable is used to specify the operating system type of the local machine. The default value is determined by Kermit. Typical values are "UNIX", "VMS", "WIN32", and "OS2".

    See RFC1572 for further details.

    SET TELNET LOCATION [ text ]
    Location string to send to the Telnet server if it asks. By default this is picked up from the LOCATION environment variable. Give this command with no text to disable this feature. This string is sent either by using the SNDLOC option or as USERVAR "LOCATION" within the NEW-ENV option.

    SET TELNET NEWLINE-MODE { NVT, BINARY-MODE } { OFF, ON, RAW }
    Determines how carriage returns are handled on TELNET connections. There are separate settings for NVT (ASCII) mode and binary mode. ON (default for NVT mode) means CRLF represents CR. OFF means CR followed by NUL represents CR. RAW (default for BINARY mode) means CR stands for itself.

    SET TELNET PROMPT-FOR-USERID prompt
    Specifies a custom prompt to be used when prompting for a userid. Kermit will prompt for a userid if "set login userid {}" has been issued prior to a telnet authentication negotiation for an authentication type that requires the transmission of a name. (e.g. Secure Remote Password).

    SET TELNET REMOTE-ECHO { ON, OFF }
    Applies only to incoming connections created with: "set host * port /telnet". This command determines whether Kermit will actually echo characters received from the remote when it has negotiated to do so. The default is ON. Remote echoing may be turned off when it is necessary to read a password with the INPUT command.

    SET TELNET SFU-COMPATIBILITY-MODE { ON, OFF }
    Turns on the SFUTLNTVER and SFUTLNTMODE environment variables for use on connections to Microsoft's Services for Unix and Windows 2000 Telnet Servers.

    SET TELNET TERMINAL-TYPE name
    The terminal type to send to the remote TELNET host. If none is given, your current SET TERMINAL TYPE value is sent, e.g. VT220.

    SET TELNET TRANSFER-MODE { ON, OFF }
    When ON (OFF by default) and BINARY negotiations are not REFUSED Kermit will attempt to negotiate BINARY mode in each direction before the start of each file transfer. After the transfer is complete BINARY mode will be restored to the pre-transfer state.

    SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
    Each Telnet option must be fully negotiated either On or Off before the session can continue. This is especially true with options that require subnegotiations such as Authentication, Encryption, and Kermit; for proper support of these options Kermit must wait for the negotiations to complete. Of course, Kermit has no way of knowing whether a reply is delayed or not coming at all, and so will wait forever before continuing the session. If you know that Kermit's Telnet partner will not be sending the required replies, you should instruct Kermit to REFUSE specific options with the SET TELOPT command. If you do not know which command the host is not responding to set this option of OFF.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5. DIAGNOSING AND FIXING PROBLEMS CONNECTING TO TELNET SERVERS

[ Top ] [ Contents ] [ Previous ]

SECTION CONTENTS

  5.1.  BUG: Telnet Server does not respond to telnet options.
  5.2.  BUG: Server sends a subnegotiation without negotiating the option
  5.3.  BUG: Server sends DO TERM_TYPE but then never asks for the terminal type.
  5.4.  BUG: Server negotiates BINARY mode in one direction but uses it in both.
  5.5.  PROBLEM: Long login times
  5.6.  PROBLEM: The Telnet Server skips "login:" prompt
  5.7.  BUG: The host echos input but never negotiates WILL ECHO
  5.8.  BUG: BSDI BSD/OS 3.1 Telnetd improperly implements WILL BINARY mode
  5.9.  PROBLEM: The host supports Telnet AUTH but you wish to login manually
  5.10. PROBLEM:  Applications on the host are unable to open the X Windows DISPLAY
  5.11. PROBLEM: The Telnet Server is the Microsoft Windows 2000 Telnet Service
  5.12. PROBLEM: The Telnet Server is Seattle Lab's SLNet Telnet Server for NT

After we replaced the Telnet engine and added support for the new functionality we found many Telnet servers that do not adhere to the Telnet protocol as described in the IETF RFCs. Here are some of the most common bugs and the workarounds that Kermit provides the user to avoid them.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.1 BUG: Telnet Server does not respond to telnet options.

[ Top ] [ Contents ] [ Section Contents ] [ Next ]

Description:
The telnet protocol requires that all initial requests for action (WILL or DO) must be responded to either in the affirmative (DO or WILL) or in the negative (DONT or WONT). A negative response is required for all unrecognized options. A failure to respond to a Telnet option may result in the peer waiting forever.

This behavior is known to exist in the following telnet servers:

Symptom:
Kermit connects to the host, waits two minutes, and then reports a telnet protocol error followed by the list of outstanding negotiations. Kermit has sent a Telnet option such as WILL AUTH and is waiting for the required response which never comes. In C-Kermit you will see "Negotiations...." with many dots. In K95 you will see the "spinner" twirl.

Example:

  DNS Lookup...  Trying xxx.xxx.xxx.xxx...  Reverse DNS Lookup... (OK)
  Negotiations... ?Telnet Protocol Timeout
  ?Telnet waiting for response to WILL TERMINAL-TYPE
  ?Telnet waiting for response to WILL NAWS
  ?Telnet waiting for response to WILL AUTHENTICATION
  ?Telnet waiting for response to WILL NEW-ENVIRONMENT

  **** AOS/VS II  Release 2.20.00.39 / Press NEW-LINE to begin logging on ****

  Too slow - input timed out

Workaround:
For each of the telnet options listed as missing a response issue a

  SET TELOPT option REFUSED [ REFUSED ]

command. For instance:

  SET TELOPT TERMINAL-TYPE REFUSED
  SET TELOPT NAWS REFUSED
  SET TELOPT AUTHENTICATION REFUSED
  SET TELOPT NEW-ENVIRONMENT REFUSED

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.2 BUG: Server sends a subnegotiation without negotiating the option

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
The telnet protocol requires that subnegotiations not be sent until the peers have agreed to WILL or DO the specified option. All subnegotiations received in a WONT or DONT state are to be ignored.

Symptom:
There are two possibilities. In the first, the host sends a subnegotiation such as

  IAC SB TERM_TYPE SEND IAC SE

without Kermit attempting to use the telnet option.

  IAC WILL TERM_TYPE
  IAC DO TERM_TYPE

In this case the subnegotiation request will be ignored and the subnegotiation response

  IAC SB TERM_TYPE IS type IAC SE

will not be sent. How this affects the sender of the illegal subnegotation is unknown.

In the second scenario, Kermit sends

  IAC WILL TERM_TYPE

But the host sends the subnegotiation without responding to the request with:

  IAC DO TERM_TYPE

This scenario degenerates into the previous bug. (See "Telnet Server does not respond to telnet options it does not recognize.")

Workaround:
For the first scenario, there is nothing that can be done. Kermit is already ignoring the subnegotiations and there is nothing that Kermit can do to force the host to adhere to the protocol. If you have a support contract with the maker of the Telnet Server, file a report.

For the second scenario, Kermit implements a workaround which is on by default:

 SET TELNET BUG SB-IMPLIES-WILL-DO ON

This causes Kermit to treat:

  IAC SB TERM_TYPE SEND IAC SE

as if it were:

  IAC WILL TERM_TYPE
  IAC SB TERM_TYPE SEND IAC SE

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.3 BUG: Server sends DO TERM_TYPE but then never asks for the terminal type.

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
Although it is not required by the Telnet Terminal-Type RFC, it makes sense that if a server asks the client to negotiate the terminal type, that it will actually go through with the negotiation.

Symptom:
Kermit reports that Terminal Type negotiation is in use but the terminal type is not configured properly on the host.

Workaround:
There isn't much that can be done other than to instruct Kermit to:

  SET TELOPT TERMINAL-TYPE REFUSE

so it doesn't appear to the user that the terminal type has indeed been negotiated.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.4 BUG: Server negotiates BINARY mode in one direction but uses it in both.

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
When either the client or the server says it WILL BINARY and the peer accepts, it is an indication that CR is to be sent without a following NUL or LF by the sender of WILL BINARY. A misunderstanding about the meaning of this negotiation can prevent files from being transfered as the packet lengths and checksums will not match.

Symptom:
File transfers fail, reporting checksum or packet length errors.

Workaround:
Use SET TERMINAL DEBUG ON to determine which direction the host is negotiating BINARY mode in.

Then use either:

  SET TELNET BUG BINARY-ME-MEANS-U-TOO ON
or:
  SET TELNET BUG BINARY-U-MEANS-ME-TOO ON

to instruct Kermit to follow the broken behavior.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.5 PROBLEM: Long login times

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
A connection is made to the Telnet Server but then it takes 30 to 60 seconds for a login prompt, or disconnects without displaying a prompt.

Symptom:
The host is trying to resolve a host name for the IP Address assigned to your computer and is unable to.

Workaround
Check with your network administrator or ISP to make sure that the IP address you are using has a valid DNS entry for reverse lookups (IP address to name).

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.6 PROBLEM: The Telnet Server does not display a "login:" prompt

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
The server you are connecting to supports the Telnet environment option and has been given your username on the workstation during the telnet option negotiations.

Workaround:
If your username on the workstation is not the same as the username on the host, or if you are using a script that requires a username or login prompt, use the command:

  SET TELNET ENVIRONMENT USER {}
or:
  SET LOGIN USERID {}

to specify your name on the host; or disable this option with:

  SET TELOPT NEW-ENVIRONMENT REFUSED

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.7 BUG: The host echos input but never negotiates WILL ECHO

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
The Telnet protocol requires that all Telnet options be in a state of I DONT and you WONT until otherwise negotiated. That means that unless a host says WILL ECHO it should not echo data; the client should echo it locally.

Symptom:
Failure to follow the protocol definition can result in no echoing or double echoing. This kind of confusion has been seen with two well-known sites:

Workaround:
SET TELNET ECHO REMOTE
SET TELOPT ECHO REFUSE

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.8 BUG: BSDI BSD/OS 3.1 Telnetd improperly implements WILL BINARY mode

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
The BSDI telnetd when it negotiaties WILL BINARY (host to client) binary mode refuses to transmit CR control characters. The man page for telnetd states, "Binary mode has no common interpretation except between similar operating systems (Unix in this case)." The implementors clearly have misread RFC856 (TELNET BINARY TRANSMISSION) which clearly states that the only affect that BINARY mode has on the channel is to disable NVT (network virtual terminal) handling of CR (CR no longer must be followed by NUL if it is not followed by LF) and that the 8th data bit must not be stripped.

Symptom:
By refusing to transmit CR control characters and instead translating them to LF the BSDI telnetd causes end of lines to be misinterpreted by the terminal and for file transfers to become corrupted if the host is allowed to negotiate WILL BINARY.

Workaround:
SET TELOPT BINARY ACCEPT REFUSE

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.9 PROBLEM: The host supports Telnet AUTH but you wish to login manually

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
You are using Kermit to connect to a host that supports Telnet Authentication except you need to login manually for one of the following reasons:

Workaround:
SET TELOPT AUTH REFUSE

To login anonymously, set the userid to anonymous. This will force Kermit to refuse to authenticate.

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.10 PROBLEM: Applications on the host are unable to open the X Windows DISPLAY

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
Some applications such as the editor 'emacs' are dual mode. They execute either in terminal mode or as an X Windows client. If the application terminates with an error that it is unable to open the DISPLAY it could be for one of the following reasons:

Workaround:
If you wish to use the application as an X Windows client you must have a working X Windows Server running on your local machine and specify a valid DISPLAY string for your server. This can either be specified on the host via:

  export DISPLAY=host:display[.screen]

or by specifying the display in Kermit with the command

   SET TELNET ENVIRONMENT DISPLAY [host:]display[.screen]

If your telnet server supports any of the following telnet options:

then Kermit will transmit the DISPLAY value to the host during the initial telnet negotiations.

If you wish to use the application in terminal mode you can prevent Kermit from transmitting the local DISPLAY value to the host by issuing the following commands:

  SET TELOPT XDISPLOC REFUSE
  SET TELOPT FORWARD-X REFUSE
  SET TELNET ENVIRONMENT DISPLAY

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.11 PROBLEM: The Telnet Server is the Microsoft Windows 2000 Telnet Service

[ Top ] [ Contents ] [ Section Contents ] [ Next ] [ Previous ]

Description:
The Microsoft Windows 2000 (and NT Services for Unix) Telnet Service is a bit of a challenge to work with due to limitations that are imposed by the Windows platform and the choices made by the developers. The Telnet Service supports three terminal emulations (ANSI, VT100, and VTNT) and two types of end user login (Telnet AUTH NTLM and plaintext domain\username/password.) Depending on the choices that are made will determine the levels of functionality that can be obtained for the service.

Terminal types:
ANSI and VT100 are considered to be the same terminal type by Microsoft even though they have some very significant differences. The Microsoft ANSI is closest to the Kermit 95 "ANSI-BBS" which should be used in preference to VT100 when communicating with this service. The VTNT terminal type is Microsoft specific (and undocumented.) Kermit 95 implements a reverse engineered implementation. VTNT uses raw Win32 data structures to implement transmission of screen snapshots from the service to the client; and keystroke events from the client to the service. VTNT is the preferred terminal type to use with the Microsoft Telnet service provided that you do not need access to Kermit 95 keyboard verbs or any form of scripting. If Keyboard verbs or scripting are required ANSI or VT100 must be used.

When using ANSI or VT100 the Backspace key must send BS and not DEL.

ANSI and VT100 do not support color whereas VTNT does.

VTNT supports Unicode characters. ANSI and VT100 only support the local ANSI code page. You must configure the Kermit local and remote character sets to properly convert between ANSI code pages.

End user login:
The Microsoft provides two forms of end user login. The first is via the use of "login:" and "password:" prompts. The username is either the name of a user with a local account; or a domain\name which specifies a user with an account in the provided domain. Since the login is performed over an unencrypted channel the password is easily stolen by monitoring the local network traffic.

The second method is a proprietary (and undocumented) Telnet authentication method based upon the NT Lan Manager (NTLM) protocol. This protocol has also been reverse engineered and implemented in Kermit 95. NTLM does not produce a shared secret that can be used for encrypting the connection. NTLM can only be implemented on Windows 9x, NT, or Windows 2000 so connections from other operating systems must use plaintext logins.

If NTLM is used, the user can only log into the service with the identity they are logged into the local workstation. If another username is desired NTLM must be disabled on the client (SET TELOPT AUTH REFUSE). [K95 1.1.20 only]

Other quirks:

Recommendations:
If using Kermit 95 and scripts are not required:

  SET TERMINAL TYPE VTNT
  SET TELNET DELAY-SB OFF
  SET KEY \264 \8

If scripts are required:

  SET TERMINAL TYPE ANSI
  SET TELNET DELAY-SB OFF
  SET KEY \264 \8

If the Telnet Server has NTLM authentication disabled use the command:

  SET TELOPT AUTH REFUSE
or:
  TELNET /AUTH:none host

If you are using C-Kermit:

  SET TELNET TERMINAL ANSI
  SET TELNET DELAY-SB OFF

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


5.12 PROBLEM: The Telnet Server is Seattle Lab's SLNet Telnet Server for NT

[ Top ] [ Contents ] [ Section Contents ] [ Previous ]

Version 2.5 of the SLNet Telnet Server violates serveral IETF RFCs which hamper the interoperability of SLNet with conforming Telnet client implementations.

Problem 1:
The SLNet Telnet Server negotiates a Telnet AUTH TYPE (99) which has not been requested from nor registered with IANA. All telnet option and sub-option values MUST be approved and issued by IANA in order to facilitate interoperability among products distributed by developers from all over the world.

When Kermit refuses to perform authentication using the unknown method, the SLNet Telnet Server does not respond to the refusal:

  TELNET SENT WILL AUTHENTICATION
  TELNET RCVD DO AUTHENTICATION
  TELNET RCVD SB AUTHENTICATION SEND UNKNOWN=99 CLIENT_TO_SERVER|MUTUAL=2 IAC SE
  TELNET SENT SB AUTHENTICATION IS NULL NULL IAC SE
  TELNET SENT WONT AUTHENTICATION

Problem 2:
As per RFC 855, Telnet requires a default WONT or DONT response for any telnet option that is not supported or recognized. The SLNet Telnet server does not respond in either an affirmative or negative manner to
  IAC WILL NEW-ENVIRONMENT
The Telnet Server also does not respond to
  IAC WILL ENCRYPTION
  IAC DO ENCRYPTION
  IAC WILL KERMIT
  IAC DO KERMIT
  IAC DO FORWARD_X
  IAC WILL COM-PORT-CONTROL
when initiated by the telnet client.

Problem 3:
The SLNet Telnet responds to a request to perform Window Size negotiations with the wrong negative response.

  TELNET SENT WILL NAWS
  TELNET RCVD WONT NAWS

The proper response is:

  TELNET RCVD DONT NAWS

Problem 4:
The SLNet Telnet Server does not keep track of the state of Telnet Options and transmits requests for Telnet Option state changes that have already been agreed to. In particular, the SLNet server retransmits

  TELNET SENT DO BINARY
  TELNET SENT WILL ECHO
  TELNET SENT WILL BINARY

after these negotiations were already agreed to. As per RFC 855, a telnet option state command (WILL, WONT, DO, DONT) MUST NOT be sent unless it results in a change of state. RFC 1143 "The Q Method of Implementing Telnet Option Negotiation" provides extensive hints on how to properly construct a telnet state machine to adhere to the rules of the Telnet protocol.

Workaround:
To enable Kermit to establish a connection to this very broken server Kermit must be told to:

  SET TELOPT AUTHENTICATION REFUSE
  SET TELOPT KERMIT REFUSE REFUSE
  SET TELOPT NEW-ENVIRONMENT REFUSE
  SET TELOPT NAWS REFUSE
  SET TELOPT FORWARD-X REFUSE
  SET TELOPT COM-PORT-CONTROL REFUSE

[ C-Kermit ] [ Kermit 95 ] [ Kermit Home ]


C-Kermit 8.0 and Kermit 95 2.0 Telnet Protocol / Columbia University / kermit@columbia.edu / 4 June 2002