Wed, 13 Aug 2008

I often find myself on what I would call "hostile" networks: They allow only very limited
Internet access, like by blocking port 25 so I can't connect to my mail server. Maybe for you,
you're never on filtered Internet access, but your home ISP doesn't let you send mail out
when you're not at home, but you want to send email directly from your laptop anyway.

Just do what I do! Let me explain.

Summary

inetd listens on port 125

Connections to it go through an SSH tunnel that executes "nc localhost 25" on some mail server

(Optional) A real MTA runs on the laptop, so that I can send mail when offline; when mail delivery fails temporarily, Postfix queues the message until I get back online.

Justification

Easy. Apps can be configured to use localhost port 25 (or port 125) with no password.

Step 3: Postfix (optional)

This is my favorite part, but it's only necessary if you plan to send email when you're not
connected to the Internet.

Just install Postfix, and add this to /etc/postfix/main.cf:

relayhost = 127.0.0.1:125

Restart Postfix and you should be set. Try sending some mail!

Closing

I was inspired by a Debian
Administration post, except I had my own ideas about the best way to do it. I still like
my way best.

One problem with the above approach is that it requires root on "server". It would be
possible to do the ssh tunnel thing without using a separate "tunnelendpoint" account, but
instead to add that key to your regular username.