Live data from Hacker News

How SSH Port Became 22

ssh.com

41–50 of 89 posts

Re: How SSH Port Became 22

#41
post #7

Earlier quoted context omitted.

I've written a lot of TCP deep-packet inspection code, including parsing FTP control protocol. So I was surprised by this post by Robert Graham: https://blog.erratasec.com/2019/08/hacker-jeopardy-wrong-ans... - FTP control protocol follows the specification for Telnet.

You might find the MUD community interesting in this regard, as they've built de facto standards for 16-bit color encoding, text compression, hidden sideband metadata communication usable by clients, and even simple embedded HTML and image rendering all on top of telnet. On top of that, because of the wildly varying capabilities of MUD clients, every single feature has to be totally backwards-compatible with a plain…

I can vouch for this wholeheartedly! However, be aware that these are all ad-hoc in some fascinating yet depressing ways. I can't help but mention a few names and fun facts...

> 16-bit color encoding

I think the xterm-256 escape codes came from somewhere other than MUDs, but it is forever frustrating to me that whoever designed them used the parameter separator `;` instead of the subparameter separator `:`. For SGR (`\e[m`-type escapes), each parameter is an individual change to the graphic state, so you can combine multiple settings into a single SGR. (For instance, `\e[1;32m` means "bold" followed by "green foreground".) But the 256-color extensions use a pattern "\e[38;5;m", which makes itself into a fresh edge case you have to handle specially instead of treating "38", "5", and the chosen as individual commands. `:` is perfectly well defined as binding more tightly than `;`, so "38:5:" would have worked perfectly well as a definition for the otherwise-undefined "38" code, but no...

> text compression

The MCCP (Mud Client Compression Protocol) is very cool, but its first version called to signal the start of compression with the byte sequence `IAC SB MCCP SE`. The intent was to send an empty MCCP subnegotiation frame and immediately return to the main Telnet channel, but they left off an `IAC` to preceed the `SE`, meaning that this just starts a subnegotion frame, sends `SE` as the first byte, and then forgets to close the frame. Ever. So if you want to support MCCPv1, you have to add a little hack to detect this situation and pretend the frame was actually closed as intended. (Please don't support MCCPv1.)

> hidden sideband metadata communication usable by clients

Yes! One of my favorite topics. Iron Realms-published MUDs introduced "ATCP", another subnegotiation-based protocol that would provide additional information about your character, which directions you can move, your inventory, etc., so that your client could provide graphical representations of this information in the UI. They replaced it with "GMCP" later on -- the "standardization" process behind that was memorable -- which used JSON as the payload format.

Fun fact about ATCP: It was originally designed with a lightweight handshake mechanism so that only Iron Realms clients ("Nexus") could utilize this information. Before my time, someone seems to have reverse engineered this algorithm, so it pretty quickly spread to custom plugins for third-party clients. They never seemed openly upset about this development, and GMCP dropped this mechanism.

And none of this is even getting into MXP, which embedded XML-inspired tags directly into the main data channel instead of using a subnegotiation. The presence of tags is controlled by using a non-standard ANSI-style escape sequence. I never ended up implementing MXP, because ATCP and GMCP were so much simpler to work with, but it's still a very cool piece of tech.

> every single feature has to be totally backwards-compatible with a plain text terminal.

Telnet is actually a shockingly cool little protocol. Sure, there are some anachronisms, like the "Network Virtual Terminal" (NVT) defining a variety of special text editing commands to provide a common representation for the many terminals sold by many vendors and their incompatible command representations. But Telnet at its core is a data multiplexer with 1 primary data channel and 256 negotiable framed channels ("options"). The mechanism for negotiating the use of a channel is symmetric, meaning that the client and server are on equal footing -- both have to agree, and either one can advertise its willingness to use a channel. It's a really cool protocol to study -- and small enough that you really can understand the whole thing!

Source for all this: I was a MUD enthusiast for several years as a teenager, and wrote my own Telnet stack, ANSI escape parser (referencing the ECMA spec!), and started on my own web-based MUD client. I did a heck of a lot of digging back then on these topics. It's still one of my favorite esoteric technology stacks to play around with.

Re: How SSH Port Became 22

#42
post #37

Personally I find how/why FTP uses two ports, 20 and 21, to be more interesting: So the first thing to know is the FTP is 'old', in that it predates TCP and originally ran on NCP: > The original specification for the File Transfer Protocol was written by Abhay Bhushan and published as RFC 114 on 16 April 1971. Until 1980, FTP ran on NCP, the predecessor of TCP/IP.[2] The protocol was later replaced by a TCP/IP versio…

FTP was also how mail was transported in the NCP days (and you'll notice that RFC 733 still refers to FTP mail for back compatibility).

Wasn't UUCP more popular, or was it after?

Re: How SSH Port Became 22

#43

Personally I find how/why FTP uses two ports, 20 and 21, to be more interesting: So the first thing to know is the FTP is 'old', in that it predates TCP and originally ran on NCP: > The original specification for the File Transfer Protocol was written by Abhay Bhushan and published as RFC 114 on 16 April 1971. Until 1980, FTP ran on NCP, the predecessor of TCP/IP.[2] The protocol was later replaced by a TCP/IP versio…

>... was carried over for simplicity's sake. Or for simplexity's sake! From the previous discussion of SSH port 22: https://news.ycombinator.com/item?id=14178993 Back in the "bad old days" of the simplex NCP protocol, before the full duplex TCP/IP protocol legalized same-sex network connections, connect and listen sockets had gender defined by their parity, and all connections were required to use sockets with differ…

This is actually more interesting than the original article. When reading the title (ftp+telnet)/2 was my guess and turned out it was correct.

Re: How SSH Port Became 22

#44
post #31

So the crux of the story is “I had to email an internet icon and she mailed me back right away having done what I asked”. I can sympathize. When I worked at Sendmail I was tasked with running DNS for the company, which included Sendmail.org. The first thing I had to do was find a secondary DNS. Our founder said to “email his friend Paul”. It turned out his friend was Paul Vixie, the inventor of BIND, who responded in…

And this, fellow posters, is what humblebrag is.

Re: How SSH Port Became 22

#45
post #38

Earlier quoted context omitted.

> When I worked at Sendmail > Here I was, 22 years old at my first job, emailing with the inventor of critical internet infrastructure who was relying on a database I ran as a source of truth. But you were working for a company who employed or was started by the creator of Sendmail, Eric Allman? Surely you were already rubbing shoulders with the Internet giants of old? According to Wikipedia, "in 1996, approximately…

> Surely you were already rubbing shoulders with the Internet giants of old? I was, but I just didn't see Eric that way, I guess because I saw him all the time? I mean looking back, there were quire a few Internet giants that either worked there or hung out at the office, but that email with Paul was the one that really got me. Maybe because the response was that data I was creating was getting mirrored to a-root.

This reminds me of a time in the nineties I was at USENIX LISA conference and got into an elevator with a gentleman with a badge that read "Eric Allman". I (barely) restrained myself from exclaiming "You are Eric Allman!"

LISA is in Portland next week, by the way: https://www.usenix.org/conference/lisa19

Re: How SSH Port Became 22

#46
My memory may be flawed here but I vaguely remember there being a minor controversy over SSH being awarded port 22 instead of a competing protocol/program called “stelnet”. It was a similar solution to SSH but only “replaced” telnet, not FTP. Back then there were “strong feelings about” rsh versus telnet, with SSH actually being modeled more after rsh/rcp/rlogin. Anyway at best this is probably just more internet protocol trivia but I do wonder if anybody can confirm I am remembering this right?

Re: How SSH Port Became 22

#47
post #37

Earlier quoted context omitted.

FTP was also how mail was transported in the NCP days (and you'll notice that RFC 733 still refers to FTP mail for back compatibility).

Wasn't UUCP more popular, or was it after?

UUCP wasn't written until '78 which was much later than we're talking about, though the Internet transition to TCP (and thus, for this conversation, SMTP) didn't happen until (my memory is hazy) '82 or '83.

Also UUCP was for unix machines only (at least back then) which were a small proportion of machines on the net. Most of them were 36-bit machines plus a few IBM machines. You can still see the old 36-bit influence in some contemporary protocols (e.g. a high level protocol like FTP has a commend to set byte size), big-endian traffic etc.

Re: How SSH Port Became 22

#49
post #39
post #31

So the crux of the story is “I had to email an internet icon and she mailed me back right away having done what I asked”. I can sympathize. When I worked at Sendmail I was tasked with running DNS for the company, which included Sendmail.org. The first thing I had to do was find a secondary DNS. Our founder said to “email his friend Paul”. It turned out his friend was Paul Vixie, the inventor of BIND, who responded in…

Paul did not invent/created BIND, in fact BIND was created 8 years before he took over its maintenance. BIND was created in Berkeley by grad students (probably that's why originally was so buggy) and the name stands for Berkeley Internet Name Domain. Paul of course made major contributions to DNS and of course BIND.

His biggest contribution is getting the highest score for CVEs.

Re: How SSH Port Became 22

#50
post #39
post #31

So the crux of the story is “I had to email an internet icon and she mailed me back right away having done what I asked”. I can sympathize. When I worked at Sendmail I was tasked with running DNS for the company, which included Sendmail.org. The first thing I had to do was find a secondary DNS. Our founder said to “email his friend Paul”. It turned out his friend was Paul Vixie, the inventor of BIND, who responded in…

Paul did not invent/created BIND, in fact BIND was created 8 years before he took over its maintenance. BIND was created in Berkeley by grad students (probably that's why originally was so buggy) and the name stands for Berkeley Internet Name Domain. Paul of course made major contributions to DNS and of course BIND.

Berkeley Internet Name Daemon
Post reply on HN