RFC 1258

BSD Rlogin

๐Ÿ“… published September 1991, from ietf

BSD Rlogin ๐ŸŽ€

RFC: 1258 ๐Ÿ’– Series: Network Working Group Author: Brian Kantor, Univ. of Calif San Diego Date: September 1991 Status: provides information for the Internet community, and does not specify an Internet standard Obsoletes / Updates: nothing listed in the title block

Okay bestie, this is the RFC for rlogin, the remote login thing that's been around forever! ๐Ÿงš It's an older document, so it's a little rough around the edges, but the vibes are immaculate.


Status of This Memo โœจ

This memo documents a protocol and a common implementation that are already extensively used on the Internet ๐ŸŒ It's giving "this is already real, we're just writing it down" energy. It provides information for the Internet community. It does not specify an Internet standard ๐Ÿ™ˆ Distribution is unlimited, so share away ๐Ÿ’œ

Protocol Description ๐Ÿฆ‹

rlogin is a remote-echoed, locally flow-controlled virtual terminal with proper flushing of output ๐Ÿ“ It's super popular between Unix hosts because it carries more of the Unix terminal environment semantics than Telnet does. On lots of Unix hosts, it can also be set up so you don't have to type a password when connections come from trusted hosts ๐Ÿ”‘

The rlogin protocol requires the use of the TCP. The contact port is 513. An eight-bit transparent stream is assumed ๐Ÿงธ

Connection Establishment ๐ŸŒธ

When the connection is established, the client sends four null-terminated strings to the server ๐Ÿ’Œ The first one is an empty string (just a single zero byte). After that come three non-null strings: the client username, the server username, and the terminal type and speed. Here's the breakdown:

<null>
client-user-name<null>
server-user-name<null>
terminal-type/speed<null>

For example:

<null>
bostic<null>
kbostic<null>
vt100/9600<null>

The server returns a zero byte to say "got it, we're now in data transfer mode" โœจ Window size negotiation may follow this initial exchange. More on that below ๐Ÿช„

From Client to Server (and Flow Control) ๐Ÿ’…

To start, the client begins in "cooked" mode (as opposed to "raw" mode). In cooked mode, the START and STOP characters (usually ASCII DC1,DC3) are intercepted and interpreted by the client to start and stop output from the remote server to the local terminal ๐Ÿ›‘โ–ถ๏ธ Every other character gets sent to the remote host as soon as it's typed. (But check the local-escape stuff below, it's its own whole thing ๐Ÿ˜‰)

In "raw" mode, the START and STOP characters aren't processed locally. They get sent to the remote server like any other character ๐Ÿงƒ So the server decides what they mean. They might be used for flow control, or they might have totally different meanings from their usual ones on the client ๐Ÿคฏ

Screen/Window Size ๐Ÿ“

The remote server lets the client know it can accept window size change info by requesting a window size message. It does this right after the connection is set up and the user identification exchange is done. The client should reply to that request with its current window size ๐ŸชŸ

If the remote server has said it can accept client window size changes, and the client's window or screen dimensions change, a 12-byte special sequence gets sent to the server. It shows the current dimensions of the client's window, in case the user process on the server wants to use that info ๐Ÿ“โœจ

The window change control sequence is 12 bytes long. It has a magic cookie (two consecutive bytes of hex FF) ๐Ÿช„, then two bytes of lower-case ASCII "s". Then come 8 bytes holding 16-bit values for the number of character rows, the number of characters per row, the number of pixels in the X direction, and the number of pixels in the Y direction. Everything is in network byte order ๐Ÿ”ข So it looks like this:

FF FF s s rr cc xp yp

Other flags than "ss" may be used in future for other in-band control messages. None are currently defined ๐Ÿ”ฎ

From Server to Client ๐ŸŽ€

Data from the remote server gets sent to the client as a stream of characters. Normal data just goes to the client's display, but it may be processed before it's shown (tabs expanded, etc.) ๐Ÿ“บ

The server can slip single-byte control messages into the data stream. It does this by inserting the control byte into the stream and pointing the TCP "urgent-data" pointer at it ๐Ÿซฃ When the client receives a TCP urgent-data pointer, the data in the TCP stream up to the urgent byte is buffered for possible display after the control byte is handled. Then the control byte that was pointed to is received and interpreted like this:

  • 02: a control byte of hex 02 makes the client discard all buffered data received from the server that hasn't been written to the client user's screen yet ๐Ÿ—‘๏ธ
  • 10: a control byte of hex 10 commands the client to switch to "raw" mode, where START and STOP are no longer handled by the client and are treated as plain data instead ๐Ÿงธ
  • 20: a control byte of hex 20 commands the client to resume intercepting and locally processing START and STOP flow control characters ๐Ÿ”

All other values of the urgent-data control byte are ignored. In every case, the byte the urgent data pointer points to is NOT written to the client user's display ๐Ÿ™…โ€โ™€๏ธ

Connection Closure ๐Ÿ’ค

When the TCP connection closes in either direction, the client or server process that notices the close should do an orderly shut-down. That means restoring terminal modes and notifying the user or processes of the close before closing the connection in the other direction ๐Ÿซถ

Implementation Notes ๐Ÿ› ๏ธ

The client defines a client-escape character (customarily the tilde, "~"). It's only handled specially if it's the first character typed at the beginning of a line ๐ŸŽฏ The beginning of a line is defined as the first character typed by the client user after a new-line [CR or LF] character, after a line-cancel character, after resumption of a suspended client session, or after initiation of the connection ๐ŸŒˆ

The client-escape character isn't transmitted to the server until the character after it has been examined. If that character is one of the defined client escape sequences, neither the client-escape character nor the character following it gets sent. Otherwise, both of them get sent to the server as ordinary user input ๐Ÿ“จ

If the character following the client-escape character is the dot ".", or the client-defined end-of-file character (usually control-D), the connection is closed. The server normally treats this as a disconnection, not an orderly logout ๐Ÿ‘‹

Other characters (client-defined, usually control-Z and control-Y) temporarily suspend the rlogin client when the host has that ability ๐Ÿ’ค One suspends both remote input and output. The other suspends remote input but lets remote output keep going to the local client's terminal ๐Ÿช„

Most client implementations have invocation switches that can defeat normal output processing on the client system. Those switches can also force the client to stay in raw mode, even after the server sends a switching notification ๐Ÿšจ

A Cautionary Tale โš ๏ธ

The rlogin protocol (as commonly implemented) lets a user set up a class of trusted users and/or hosts that are allowed to log on as themselves without typing a password. It's super convenient, but it's a weakening of security that has been successfully exploited in previous attacks on the Internet ๐Ÿ˜ญ If you want to use the password-bypass facilities of rlogin, it is essential to understand the compromises that may be possible ๐Ÿ™ˆ

Bypassing password authentication from trusted hosts opens ALL the systems so configured when just one is compromised. ๐Ÿ’€

Just like using the same password for every system you can access lets a villain in everywhere you have access, allowing passwordless login among all your systems gives a marauder a wide playing field once they've gotten into any one of them ๐Ÿฆนโ€โ™€๏ธ One compromise that many feel achieves a workable balance between convenience and security is to allow password bypass from only ONE workstation to the other systems you use, and NOT allow it between those systems ๐Ÿ’œ With this measure, you may have reduced exposure to a workable minimum โœจ

The trusted host specification is ordinarily just a host name. It's possible, by compromising your organization's domain name server or by compromising your network itself, for a villain to make an untrusted host masquerade as a trusted system ๐Ÿ•ต๏ธ There's little a user can do about this form of attack. Luckily, so far these attacks have been rare, and they often cause enough disruption to the network that attempts get noticed quickly ๐Ÿšจ

When the file containing a user's list of trusted logins is inadvertently left writeable by other users, untrustworthy additions may be made to it ๐Ÿ“œ

Secure authentication extensions to the rlogin protocol (Kerberos, et al) can greatly reduce the possibility of compromise while still allowing the convenience of skipping password entry ๐Ÿ” As these get more widely deployed in the internet community, the hazards of rlogin will decrease ๐ŸŒŸ

Security Considerations ๐Ÿ”’

Bestie, this section is short but it's a big deal, so please read the thing it points to ๐Ÿ˜ค See the "A Cautionary Tale" section above.

Author's Address ๐Ÿ’Œ

Brian Kantor
University of California at San Diego
Network Operations C-024
La Jolla, CA 92093-0214

Phone: (619) 534-6865

EMail: brian@UCSD.EDU
๐Ÿ“ฆ where this page comes from