home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / e / id-forward-x.txt < prev    next >
Text File  |  2020-01-01  |  15KB  |  369 lines

  1. Independent Submission                                    Jeffrey Altman
  2. Internet-Draft                                            Peter Runestig
  3. draft-altman-telnet-fwdx-03.txt                               April 2002
  4.  
  5.  
  6.            Telnet Forwarding of X Window System Session Data
  7.  
  8. Status of this Memo
  9.  
  10.    This document is an Internet-Draft and is in full conformance with
  11.    all provisions of Section 10 of RFC2026.  Internet-Drafts are working
  12.    documents of the Internet Engineering Task Force (IETF), its areas,
  13.    and its working groups.  Note that other groups may also distribute
  14.    working documents as Internet-Drafts.
  15.  
  16.    Internet-Drafts are draft documents valid for a maximum of six months
  17.    and may be updated, replaced, or obsoleted by other documents at any
  18.    time.  It is inappropriate to use Internet-Drafts as reference mate-
  19.    rial or to cite them other than as "work in progress."
  20.  
  21.    The list of current Internet-Drafts can be accessed at
  22.    http://www.ietf.org/ietf/1id-abstracts.txt
  23.  
  24.    The list of Internet-Draft Shadow Directories can be accessed at
  25.    http://www.ietf.org/shadow.html.
  26.  
  27.    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  28.    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  29.    document are to be interpreted as described in RFC 2119.
  30.  
  31. 0. Abstract
  32.  
  33.    This document describes a mechanism via which X Window System 
  34.    client applications may have their communications with the X Windows
  35.    System server forwarded across a Telnet communications channel.  This
  36.    is desireable when the Telnet session is established through a Firewall
  37.    or Network Address Translator which does not allow arbitrary connections
  38.    to be created from the host machine to the client machine; or when the
  39.    Telnet session is using an authenticated and encrypted channel and that
  40.    same security is desired for the X Window System session data.  
  41.    Authorization to communicate across the tunnel is provided to the X 
  42.    Windows System client via use of X Display access control data.
  43.  
  44. 1. Command Names and Codes
  45.  
  46.    FORWARD_X                49 (assigned by IANA)   
  47.  
  48.    Sub-option Commands
  49.  
  50.       FWDX_SCREEN            0
  51.       FWDX_OPEN              1
  52.       FWDX_CLOSE             2
  53.       FWDX_DATA              3
  54.       FWDX_OPTIONS           4
  55.       FWDX_OPT_DATA          5
  56.       FWDX_XOFF              6
  57.       FWDX_XON               7
  58.  
  59.    Sub-option Options
  60.  
  61.       FWDX_OPT_NONE          0  
  62.       FWDX_OPT_NONE_MASK     0
  63.  
  64.  
  65. 2.  Command Meanings
  66.  
  67.    IAC WILL FORWARD_X
  68.  
  69.       The server side of the connection sends this command to indicate
  70.       that it is willing to send and receive X Window System session data
  71.       via the telnet connection.  The client must not send this command.
  72.  
  73.    IAC DO FORWARD_X
  74.   
  75.       The client side of the connection sends this command to indicate
  76.       that it is willing to send and receive X Window System session data
  77.       via the telnet connection.  The server must not send this command.
  78.  
  79.    IAC WONT FORWARD_X
  80.  
  81.       The server side of the connection sends this command to indicate
  82.       that it is not willing or able to send and receive X Window System 
  83.       session data via the telnet connection.  If the client receives
  84.       IAC DO FORWARD_X it must respond with IAC WONT FORWARD_X.
  85.  
  86.    IAC DONT FORWARD_X 
  87.  
  88.       The client side of the connection sends this command to indicate
  89.       that it is not willing or able to send and receive X Window System 
  90.       session data via the telnet connection.  If the server receives
  91.       IAC WILL FORWARD_X it must respond with IAC DONT FORWARD_X.
  92.                  
  93.    IAC SB FORWARD_X FWDX_SCREEN <screen> IAC SE
  94.  
  95.       The client side of the connection sends this command to the server
  96.       to indicate to the server the screen (or monitor) number being used
  97.       by the local X Window System server.  <screen> is a single octet with
  98.       legal values of 0 to 255.  The screen number is to be used by the
  99.       server when constructing the DISPLAY environment variable to be used
  100.       on the host.
  101.  
  102.       The server side of the connection must not send this command.
  103.  
  104.    IAC SB FORWARD_X FWDX_OPEN <channel> IAC SE
  105.  
  106.       The server side of the connection sends this command to the client
  107.       to indicate that a new X Window System session is being started and that 
  108.       a new channel should be allocated.  <channel> is two octets in network
  109.       byte order.
  110.  
  111.       The client side of the connection must not send this command.
  112.  
  113.    IAC SB FORWARD_X FWDX_CLOSE <channel> IAC SE
  114.  
  115.       Either side of the connection sends this command to indicate to the
  116.       other that the channel has been terminated and that the associated
  117.       resources should be freed.  <channel> is two octets in network byte
  118.       order.
  119.  
  120.    IAC SB FORWARD_X FWDX_DATA <channel> <data> IAC SE
  121.  
  122.       Either side of the connections sends this command to the other to
  123.       forward X Window System session data across the Telnet connection.  
  124.       <channel> is two octets in network byte order.  <data> is an arbitrary
  125.       length stream of bytes.  All occurances of 0xFF in the data stream must
  126.       be doubled to avoid confusion with telnet commands.
  127.       
  128.    IAC SB FORWARD_X FWDX_OPTIONS <bitmask-bytes> IAC SE
  129.  
  130.       The server sends this command to the client to specify the list of 
  131.       options which are supported by the server.  The client responds with
  132.       this command to indicate the subset of the specified options that 
  133.       are to be used.  The client must respond with the same number of bytes
  134.       as are provided by the server.  If no options are supported by the 
  135.       server, then a single zero byte is to be sent.  The eight bit of each
  136.       byte must be zero.
  137.  
  138.    IAC SB FORWARD_X FWDX_OPT_DATA <option> <option-data> IAC SE
  139.  
  140.       This command is used to communicate data specific to an option 
  141.       negotiated by the client and server.  The command may be sent
  142.       in either direction.  <option> is a byte containing the option
  143.       number (not the option mask).  The format of the <option-data>
  144.       is specific to the option and cannot be specified in this 
  145.       document.
  146.  
  147.    IAC SB FORWARD_X FWDX_XOFF <channel> IAC SE
  148.  
  149.       This command is sent by the telnet server to the telnet client
  150.       when the specified channel is no longer writeable.  When the
  151.       client receives this command is must immediately stop reading
  152.       data from the X Server.
  153.  
  154.    IAC SB FORWARD_X FWDX_XON  <channel> IAC SE
  155.  
  156.       This command is sent by the telnet server to the telnet client
  157.       when the specified channel becomes writeable.  This command
  158.       must only be sent if a FWDX_XOFF command has previously be
  159.       been sent without a matching FWDX_ON command.
  160.  
  161. 3.  Option Meanings
  162.  
  163.     FWDX_OPT_NONE       0
  164.     FWDX_OPT_NONE_MASK  0
  165.       No options are supported by the server or client.
  166.  
  167. 4.  Default Specification
  168.  
  169.    The default specification for this option is
  170.  
  171.       WONT FORWARD_X
  172.       DONT FORWARD_X
  173.                                        
  174.    meaning there will not be any forwarding of X Window System session data.
  175.  
  176. 5.  Motivation
  177.  
  178.    Firewalls and Network Address Translators sometimes make it impossible for
  179.    X Window System clients to connect to the local X Window System server.  In 
  180.    these situations it is necessary to have a method to forward (or tunnel) 
  181.    the data along a connection which is already established.
  182.  
  183.    When Telnet Authentication and Encryption or Telnet over TLS are in use it
  184.    is desireable to afford the same level of protection to the X Window System 
  185.    session data that is afforded to the Telnet session data.
  186.  
  187.    This option provides a mechanism for using the Telnet connection as a 
  188.    tunnel which then applies its own level of security to the X Window System 
  189.    sessions.  
  190.  
  191. 6. Implementation Rules
  192.  
  193.    WILL and DO are negotiated only at the beginning of the Telnet session to 
  194.    obtain and grant permission for future FORWARD_X sub-negotiations.  After
  195.    WILL and DO are exchanged the client must send a FWDX_SCREEN negotiation
  196.    so the server may establish the appropriate DISPLAY environment variable.
  197.  
  198.    After receipt of FWDX_SCREEN the server will define a DISPLAY variable on
  199.    the host which shall cause all future X Window System sessions created 
  200.    within that Telnet session to be redirected to the Telnet server.  This 
  201.    DISPLAY variable must point to a socket or other mechanism via which the 
  202.    Telnet Server will be able to listen for new X Window System sessions.
  203.    The Telnet Server will also create a temporary .Xauthority file containing
  204.    entries for each of the X Authority types (MIT-MAGIC-COOKIE-1, 
  205.    XDM-AUTHORIZATION-1, SUN-DES-1, MIT-KERBEROS-5) that it will accept for
  206.    X Windows System client authorization.
  207.  
  208.    Whenever the server accepts a new X Window System session it allocates a 
  209.    new channel and sends a FWDX_OPEN negotiation to the client.  The client 
  210.    allocates any necessary resources for the support of the channel and opens
  211.    a local connection to the X Window System Server specified by the local
  212.    environment.
  213.  
  214.    The client will then open the X Windows System display on its local system
  215.    using the local X Authority data for authorization (if it is available.)
  216.    If the client is unable to open the display, it sends a FWDX_CLOSE to the
  217.    server.
  218.  
  219.    The server when receiving the initial message from X Windows System client
  220.    will parse it for byte order and any specified X Authority data.  If no
  221.    X Authority data is provided or if the X Authority data is invalid, an 
  222.    X Authority error message will be sent to the X Windows System client and
  223.    the connection will be closed.  A FWDX_CLOSE message will be sent to the
  224.    client.
  225.  
  226.    If authorization is provided, the server will (using the designated byte
  227.    ordering for this session) replace the initial X Authority data from the
  228.    X Windows System client with null data and forward the data to the client.
  229.  
  230.    From this point forward all data read by the server from the X Window
  231.    System clients or from the X Windows Server by the client are forwarded to
  232.    the peer via the use of a FWDX_DATA negotiation.
  233.  
  234.    When the X Window System client closes the connection the server will send a
  235.    FWDX_CLOSE negotiation to the client.  If the X Window System Server closes 
  236.    the connection the client with send a FWDX_CLOSE to the server.
  237.  
  238.    The Telnet server should not allocate X Window System display number 0 but 
  239.    instead should leave it available for the local X Window System server on 
  240.    the same machine.
  241.  
  242.    The Telnet client should not negotiation FORWARD_X if it does not have a 
  243.    local X Window System server available.
  244.  
  245.    FORWARD_X takes precedence over Telnet X-Display Location and the DISPLAY 
  246.    variable transmitted via Telnet Environment.  If FORWARD_X has been 
  247.    negotiated prior to the receipt of other display information, this
  248.    subsequent information must be ignored.
  249.  
  250.    FORWARD_X must not be negotiated over an insecure connection.  If Telnet
  251.    AUTH and ENCRYPT or START_TLS are not in use, FORWARD_X must be refused
  252.    by both the client and server.
  253.  
  254.    Any Telnet server implementing FORWARD_X must implement at least one
  255.    of the X display access control (XAUTH) methods.  A failure to implement
  256.    access control on the server creates a serious security vulnerability
  257.    openning the X Windows Server on the client's machine to attack.                                                                              
  258.  
  259.    FORWARD_X is designed as an extensible protocol with the intention of 
  260.    adding support for the caching and compression of X Windows System 
  261.    messages.  FORWARD_X options are negotiated using the FWDX_OPTIONS 
  262.    messages.  Each option is to be given its own bit value.  As many bytes
  263.    of bit mask data as are needed to represent the options may be allocated
  264.    with one restriction: the 8th bit of each byte may not be assigned.
  265.  
  266.    The Telnet server must be able to handle a suspended X client.  When an
  267.    X Client is suspended it will not read data from its data input.  In this
  268.    situation the data path from the Telnet server to the X client will
  269.    eventually become blocked.  The Telnet Server must ensure that no data
  270.    is lost and that all other Forward X channels as well as normal telnet
  271.    session processing continue.  The FWDX_XOFF and FWDX_XON commands provide
  272.    the ability for the telnet server to implement flow control for each
  273.    channel on an individual basis.
  274.  
  275. 7. Example
  276.  
  277.    Initial negotiations
  278.  
  279.      S:  IAC WILL FORWARD_X
  280.      C:  IAC DO FORWARD_X  
  281.  
  282.    Server and client have agreed to negotiate FORWARD_X
  283.  
  284.      S:  IAC SB FORWARD_X FWDX_OPTIONS 00 IAC SE
  285.      C:  IAC SB FORWARD_X FWDX_OPTIONS 00 IAC SE 
  286.  
  287.    Server and client agree that no Forward X options are to be used.
  288.  
  289.      C:  IAC SB FORWARD_X FWDX_SCREEN 00 IAC SE
  290.   
  291.    Server established a listen socket on port 6001 (display 1) and puts an 
  292.    DISPLAY=<ip-address>:<display>.<screen> (i.e. 127.0.0.1:1.0) variable into 
  293.    the local environment.
  294.  
  295.    The server receives a connection from an X Window System client and allocates
  296.    channel 0:
  297.  
  298.      S:  IAC SB FORWARD_X FWDX_OPEN 00 00 IAC SE
  299.  
  300.    Client creates connection to local X Window System server.
  301.  
  302.    Server receives data to send from X Window System client to X Window System server.
  303.  
  304.      S:  IAC SB FORWARD_X FWDX_DATA 00 00 <data> IAC SE
  305.  
  306.    X Window System server replies:
  307.  
  308.      C:  IAC SB FORWARD_X FWDX_DATA 00 00 <data> IAC SE
  309.    
  310.    X Window System client closes the connection:
  311.  
  312.      S:  IAC SB FORWARD_X FWDX_CLOSE 00 00 IAC SE
  313.  
  314. 8. Security Considerations
  315.  
  316.    Although FORWARD_X is independent of Telnet Authentication and Encryption, and 
  317.    Telnet over TLS, the use of FORWARD_X without the use of Telnet Authentication 
  318.    and Encryption or Telnet over TLS (or other integrity protection) creates a
  319.    security hole.  Therefore, FORWARD_X MUST NOT be negotiated if neither 
  320.    Telnet over TLS nor Telnet Encryption are successfully negotiated and in 
  321.    use.
  322.  
  323. 9. IANA Considerations
  324.  
  325.    IANA is the responsible for assigning all FORWARD_X option numbers.  These
  326.    numbers are to be assigned sequentially.
  327.  
  328.    FORWARD_X options have valid values of 1 to 255 so that they can be
  329.    represented in a single byte in the FWDX_OPT_DATA message.  Each option
  330.    is assigned both an option value and a bitmask for use in the FWDX_OPTIONS
  331.    negotiation.  
  332.  
  333.    As there are no options defined as the present time an example of the
  334.    mechanism is provided.  Assume we define options ONE, FIVE and EIGHT.
  335.  
  336.      FWDX_OPT_ONE         1
  337.      FWDX_OPT_ONE_MASK    1       /* Byte 1 of FWDX_OPTIONS */
  338.  
  339.      FWDX_OPT_FIVE        5
  340.      FWDX_OPT_FIVE_MASK  16       /* Byte 1 of FWDX_OPTIONS */
  341.  
  342.      FWDX_OPT_EIGHT       8       
  343.      FWDX_OPT_EIGHT_MASK  1       /* Byte 2 of FWDX_OPTIONS */
  344.  
  345. 10. References
  346.  
  347.   X Windows System X Protocol documentation
  348.   ftp://ftp.x.org/pub/R6.4/xc/doc/hardcopy/XProtocol/proto.PS.gz
  349.  
  350.  
  351. Authors' Addresses
  352.  
  353.    Jeffrey Altman
  354.    Columbia University
  355.    Watson Hall Room 716
  356.    612 West 115th Street
  357.    New York NY 10025
  358.    Phone: +1 (212) 854-1344
  359.    EMail: jaltman@columbia.edu
  360.  
  361.    Peter Runestig
  362.    Bjorktjaravagen 5 C
  363.    821 35  Bollnas
  364.    Sweden
  365.    Phone: +46-278-35777
  366.    EMail: peter@runestig.com
  367.    Mailing List: telnet-wg@bsdi.com
  368.  
  369.