On Friday 08 December 2006 07:12, Vince Hoffman wrote:
> On Fri, 8 Dec 2006, å¼ é~_¡æ­¦ wrote:
> > Hello. My office use this method to access wikipedia behind the great
> > firewall of China:
> >
> > 1) we have a server in europ, let's call it server;
> > 2) I run this command on my desktop:
> > $ ssh -L 80:en.wikipedia.org:80 server;
> > 3) everybody in the office edit /etc/hosts, add this line:
> > [my_ip_addr] en.wikipedia.org
> >
> > So my computer become a 'proxy'.
> >
> > The trouble is I have to keep the ssh running there. The 'proxy' will
> > not automatically set up next time I reboot my computer.
> >
> > Is it possible to install some software to run as a daemon and do this
> > proxy?
> >
> > I think of stunnel, but I have too few knowledge to know if stunnel can
> > do this.
>
> maybe autossh ?
> http://www.harding.motd.ca/autossh/
> Its in ports
> Port:   autossh-1.4a
> Path:   /usr/ports/security/autossh
> Info:   Automatically restart SSH sessions and tunnels

Autossh might do this better/more elegantly, but a quick and dirty solution 
would be something like this:

1) Set up certificates so that "ssh server" from your machine will 
automatically log in to the server without prompting for a password.

2) Write a script to see if ssh is running and run it if it's not, e.g.

#!/bin/sh
netstat -na | grep LISTEN | grep 80 || \
        /usr/bin/ssh -fnN -L 80:en.wikipedia.org:80 server

3) Add an entry to your crontab to run the script every X minutes.

JN
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to