Introduction
Maybe you know the situation: You successfully logged in to a corporate network and somehow you can’t reach your server. You check all possibilities and realize that some of the ports you desperately need to manage your daily life have been blocked. And mostly this happens when you have to have shell access.
The first thing you think of is to set up OpenVPN. Unfortunately, the default port 1194 is blocked for UDP and TCP. So having a normal OpenVPN is not an option.
Port 80 and 443 are accessible, but you already have services running there.
Wouldn’t it be absolutely great to be able to share one of these ports, to have two or three services listening on a single port? Indeed.
This is possible: sslh is an easy-to-configure and small tool which is doing exactly what we want. (Fantastic, isn’t it?)
Configuration
sshl has been packaged for Debian, gentoo and FreeBSD. I will show you the gentoo-way.
1. install your favourite webserver and configure it to listen on localhost:443
2. install OpenVPN an let it run in TCP mode on localhost:1194
3. set up OpenSSH to listen to localhost:22
4. install sslh:
emerge sslh
edit /etc/conf.d/sslh to look like this (replace the x-es with your IP)
OPTIONS="--listen xxx.xxx.xxx.xxx:443 --ssl localhost:443 \
--ssh localhost:22 --openvpn localhost:1194"
restart your services (if necessary), start sslh and add it to your default runlevel:
/etc/init.d/sslh start
rc-update add sslh default
That’s all. Really. :)