about me





Sam Hocevar’s .plan

This is an experimental blog engine. RSS feeds: everything | blog | Debian (DPL only) | VideoLAN | GNOME | Mono

Use sshd and httpd on the same port (almost)

Posted on Mon, 23 Apr 2007 17:50:25 +0200 - Keywords: debian, devel

Running sshd on port 443 is common practice, because even in a very hostile environment full of firewalls and proxies that only allow web access, it is usually possible to use the HTTPS proxy to open a full TCP connection to port 443. I use this a lot. The problem is that I also want to run my SSL web server on the same IP. Here is a hack to do both.

One essential difference between the SSH and HTTP/HTTPS protocols is that upon connection the SSH server sends a banner to the client, while the HTTP and HTTPS servers wait for the client to send a request. Which means that after a reasonable amount of time, one can be fairly sure the client at the other end talks HTTP/HTTPS or SSH.

Due to recent interest in it, I’m publishing redirect.c, a small program that implements this technique. Use it at your own risk, and read about the limitations.

Show the last 10 | 20 | 50 entries.