Archive for September, 2008

tunnel your imap over ssh

I recently had the situation that I needed access to my private email accounts at work. Lucky me, my employee prohibits imap connections to the outer world (security risk). So I had to find a way around that proxy to the mail server.

I stumbled upon an article how to use a persistant ssh connection as tunnel through different networks. So starting at that point and checking the ssh man page I came to the following statement (works only with public key authentication):

ssh -N -L 4510:localhost:25 -L 4500:localhost:143

This statement establishes a connection between the local and the remote host and hereby connects the local port 4510 with the remote port 25 (same with 4500). The next step was easy,I just configured my mail client to read from the imap server localhost:4500 and send mails via localhost:4510.

Now that I had the basics running I needed a way to make this connection persistant.

This could be done via a simple bash script which is called by the cron repeatedly.

COMMAND="ssh -N -L 4510:localhost:25 -L 4500:localhost:143"
pgrep -f -x "$COMMAND" > /dev/null 2>&1 || $COMMAND

This script basicly runs a ps and greps the output for the search string. When the string is not found it runs the string as command. If the string is found nothing would we done.

(I’m aware that clients like evolution have built-in support for ssh tunnelling but I couldn’t get it running smoothly. It had always Problems with disconnects which never appeared with this solution)

, , ,


Hello World!

So, this is my my first entry. So lets start with some facts about me.

I work for a major german company as a Software Engineer (according to me – according to my employer my job title changes every 6month or so and I don’t keep track of it). At work I’m part of a team which develops an ESB for the whole company. Our base technology is TIBCO BusinessWorks.

This site is only about my private projects. So far only 3 projects exists but I think there will come more. So here a short Review of the existing projects:

cdmfs is a project of a friend of mine. Goal of this projects is to build an client/server architecture for an distributed filesystem which can handle meta information for every file and folder.

pidgin-ocs is the beginning of implementing an Office Communication Server protcol for pidgin. I got stuck at the ntln authentication so far. The pidgin ntlm doesn’t work on my companies server, so I’m trying now get the ntlm from heimdal running. Let’s see how this goes. is a projects of mine of a new webpage. The page should consist of the essential shell tools so you can user them online with an web-interface.

That’s it so far from me.

No Comments