Re: udev and devfs - The final word

From: Rob Landley
Date: Mon Jan 05 2004 - 19:16:57 EST


On Monday 05 January 2004 15:06, Vojtech Pavlik wrote:
> On Mon, Jan 05, 2004 at 03:11:44PM -0500, Theodore Ts'o wrote:
> > On Mon, Jan 05, 2004 at 12:15:56PM +0100, Vojtech Pavlik wrote:
> > > Mutt with IMAP is rather bearable even on a GPRS connection (40kbps,
> > > 1sec latency). On a 100baseTX it's not distinguishable from local
> > > operation.
> >
> > Hmm... I've tried using mutt/IMAP over GPRS connection, and I find it
> > extremely unpleasant, myself. My solution is to use isync to provide
> > a local cached copy of the IMAP server on my laptop, and then run mutt
> > against the local cached copy.
> >
> > I have a patch to isync which allows it to issue multiple IMAP
> > commands in parallel (instead of operating in lockstep fashion):
> >
> > http://bugs.debian.org/cgi-bin/bugreport.cgi//tmp/async-imap-patch?bug=22
> >6222&msg=3&att=1
> >
> > With this patch, isync works very well, even over high latency, slow
> > speed links.
>
> That looks very nice. Now, if there were a way how to make the isync
> IMAP connections go over a compressed ssh link (like I'm doing with
> Mutt/IMAP) that'd be very cool.

You can run any tcp/ip service over ssh.

Tell isync that the imap server it's synchronizing with lives on the loopback
interface, and then run a variant this little python script I use to check my
email (adjusting the last line for your connection info). (Note that the far
end needs netcat. If you haven't got it, try the version in busybox.)

Yeah, the script's a quick and dirty hack, but really easy to modify. I have
a more complicated one using SO_ORIGINAL_DEST and a lookup table if you
prefer to setup some firewall rules and tell your imap server it lives in the
192.168.x.x or 10.x.x.x address range... But I've never gotten around to
configuring my laptop to use it just to tunnel pop. :)

I keep meaning to put the full solution up on http://dvpn.sf.net, but nobody's
pestered me about it. :)

Rob
#!/usr/bin/python

import socket,struct,sys,os,signal

vpnip="127.0.0.1"
vpnport=int(sys.argv[1]) # 110 25

signal.signal(signal.SIGCHLD, lambda a,b: os.waitpid(-1,os.WNOHANG))

sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.bind((vpnip,vpnport))
sock.listen(10)

while 1:
try: (conn,addr)=sock.accept()
except socket.error: continue

if os.fork():
conn.close()
continue

os.dup2(conn.fileno(),0)
os.dup2(conn.fileno(),1)
conn.close()
sock.close()

os.execvp("ssh",("ssh","-i","/home/landley/.ssh/id_dsa","landley@xxxxxxxxxxxx","./netcat","192.168.1.31",str(vpnport)))