12/08/05 - Release 0.1
I had the need to setup a squid server to bring up a ssh tunnel to another squid server "on demand", that means "bring up
the connection only when a client want to go there, and bring it down 30 minutes after last request came".
After one day of digging, coding and beer, this is what I've done; probably is not perfect and could be improved, but
"It Just Works (TM)". :)
Prerequisites:
1) Basic
squid knowledge
2) Basic
openssh knowledge and a RSA key for the remote host
3)
Perl
4) My
ondemandssh.pl and
vpncheck scripts
Configure the ondemandssh.pl script according to your settings:
1) <YOURREMOTELOGINHERE> is the username you have on the remote server
2) <REMOTEPORTHERE> is the port on which the remote ssh server listens to (usally 22)
3) <LOCALIPHERE> is your local ip address
4) <REMOTESQUIDIPHERE> is the ip address of the remote squid server
5) <REMOTESQUIDPORTHERE> is the port on which the remote squid listens to
6) <REMOTEHOSTHERE> is the (public) ip addresso of the remote ssh server
7) <YOURRSAKEYHERE> is the path to your RSA key
So, assuming you have remote userid "squid", the remote ssh server listens to port 22, your local ip is 10.10.10.10, the remote squid ip:port is
192.168.1.10:3128, the remote ssh server has the ip address 212.110.120.30 and the path to you RSA key is /home/staff/rsa, your ssh line would be