From owner-freebsd-questions@FreeBSD.ORG Fri Dec 8 15:44:10 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0BF116A416 for ; Fri, 8 Dec 2006 15:44:10 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B11C43CA8 for ; Fri, 8 Dec 2006 15:43:07 +0000 (GMT) (envelope-from lists@jnielsen.net) Received: from localhost (jn@ns1 [69.55.238.237]) (authenticated bits=0) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id kB8Fi32R019117; Fri, 8 Dec 2006 07:44:05 -0800 (PST) (envelope-from lists@jnielsen.net) From: John Nielsen To: freebsd-questions@freebsd.org Date: Fri, 8 Dec 2006 10:42:20 -0500 User-Agent: KMail/1.9.4 References: <1165559159.8140.5.camel@joe.realss.com> <20061208121109.L9081@unsane.co.uk> In-Reply-To: <20061208121109.L9081@unsane.co.uk> X-Face: #X5#Y*q>F:]zT!DegL3z5Xo'^MN[$8k\[4^3rN~wm=s=Uw(sW}R?3b^*f1Wu*.<=?utf-8?q?of=5F4NrS=0A=09P*M/9CpxDo!D6?=)IY1w<9B1jB; tBQf[RU-R<,I)e"$q7N7 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200612081042.20307.lists@jnielsen.net> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: =?utf-8?q?=E5=BC=A0=E9=9F=A1=E6=AD=A6?= , Vince Hoffman Subject: Re: access wikipedia (walk through the great firewall of China) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2006 15:44:10 -0000 On Friday 08 December 2006 07:12, Vince Hoffman wrote: > On Fri, 8 Dec 2006, =E5=BC=A0=E9~_=A1=E6=AD=A6 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= =20 would be something like this: 1) Set up certificates so that "ssh server" from your machine will=20 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