Live data from Hacker News

Why does SSH send 100 packets per keystroke?

eieio.games

251–260 of 375 posts

Re: Why does SSH send 100 packets per keystroke?

#251

Earlier quoted context omitted.

I think those all have reasonable counterarguments: (1) This sounds brittle. Are you really going to have a good mental model about what's secret when using ssh and reliably refrain from typing those things? Seems to kinda defeat the idea of securing the channel. Also, as a collection your activities might be more confidential to you than single inputs, or correlated with your other activities outside ssh, etc - it's…

Bandwidth is not the problem when you are using mobile connections (4G, weaker 5G). Videos work just fine, but ssh can be painful already without keystroke obfuscation. The problem is latency. Especially when roaming abroad it can 100s of ms. Not sure whether the obfuscation is fully synchronous, i.e waiting for the server response before continuing. That would really kill it. Working with LTS distros I don't think I…

> Not sure whether the obfuscation is fully synchronous, i.e waiting for the server response before continuing.

The people who designed SSH aren't idiots, and also, you can answer this question by simple observation: When you connect to a server with ~200ms ping, which is somewhat common in the scenarios you describe and which I've done many times, it does not take 20 seconds to show a keystroke.

Re: Why does SSH send 100 packets per keystroke?

#252

The reliance on LLMs is unfortunate. I bet this mystery could gave been solved much quicker by simply looking at the packet capture in Wireshark. The Wireshark dissectors are quite mature, SSH is covered fairly well.

Sure it could have been, if you knew about SSH packet inspectors in Wireshark...

The author didn't, and used a general tool to their aid - why is that unfortunate?

Re: Why does SSH send 100 packets per keystroke?

#253
post #194

Earlier quoted context omitted.

> several 56k baud modems These were almost definitely 8k baud.

In case anyone else is curious, since this is something I was always confused about until I looked it up just now: "Baud rate" refers to the symbol rate, that is the number of pulses of the analog signal per second. A signal that has two voltage states can convey two bits of information per symbol. "Bit rate" refers to the amount of digital data conveyed. If there are two states per symbol, then the baud rate and bit…

Not sure about your last point but in serial comms there are start and stop bits and sometimes parity. We generally used 8 data bits with no parity so in effect there are 10 bits per character including the stop and start bits. That pretty much matched up with file transfer speeds achieved using one of the good protocols that used sliding windows to remove latency. To calculate expected speed just divide baud by 10 to covert from bits per second to characters per second then there is a little efficiency loss due to protocol overhead. This is direct without modems once you introduce those the speed could be variable.

Re: Why does SSH send 100 packets per keystroke?

#254
post #245

Hmm, if the author is doing something high performance, they should probably use whatever mosh is doing to update the screen, not ssh.

That would require end users to install additional software though, which they do not want

Oh, true, ssh is not just the protocol, but also the name of the client software.

Though I would suggest to make mosh available, too. Many nethack servers are available via mosh and ssh. (And in an earlier age, telnet.)

Re: Why does SSH send 100 packets per keystroke?

#256

Funny to see this fixed in 2023 and the side effects. Back in 2004, before I focused on performance, I did some security work including inter-keystroke latency analysis of captured SSH sessions to estimate the commands typed: https://www.brendangregg.com/sshanalysis.html The 2023 patch should finally fix that 2004 issue.

Memories! I was at the hacking conference HAL2001 and listening to Dug Song and Solar Designer, who were talking about their SSH timing analysis: https://download.openwall.net/pub/advisories/OW-003-ssh-traf...

Time flies

Re: Why does SSH send 100 packets per keystroke?

#258

> Obviously forking go’s crypto library is a little scary, and I’m gonna have to do some thinking about how to maintain my little patch in a safe way This should really be upstreamed as an option on the ssh library. Its good to default to sending chaff in untrusted environments, but there are plenty of places where we might as well save the bandwidth

Relying on not advertising some feature for it is very janky way to do it.

The proper fix would be adding option server-side to signal client it's not needed and have client side have option to accept or warn about that

Re: Why does SSH send 100 packets per keystroke?

#259
post #61
post #21

The really mysterious part is how ~10,000 packets per second costs ~20% of a core. That would mean SSH is bottlenecking in its code at ~50,000 packets per second per core which would be ~500 Mbps per core (assuming full packets) which is ludicrously slow. It is trivial to do 10x that packet per second rate. Is SSH really that poorly designed?

> It is trivial to do 10x that packet per second rate. When making this statement, are you taking into account that SSH encrypts the traffic by default?

doing a gigabit takes ~35% of single core to saturate my 1Gbit ethernet. On i3-3250 which is 12 years old CPU

Your assumptions are way off

Post reply on HN