The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
Using smtp from remote locations
7 April 2001
|
Regular readers will know that I'm in Ottawa for a short trip. That
means you know something my parents don't know yet. They're still in Portugal on
holiday. I'll be picking them up upon their return. That's when they'll find
out I'm visiting. Before I left, I set up an APOP server so I could remotely and securely get my mail from home. I have set myself up with a local (actually regional) ISP. I'm free to use their mail servers and that works well. But some sites (freebsd.org included) are very strict about the mail they will receive. In this case, they won't accept mail from the look.ca mail server (I suspect this is because my mail will have a different reply-to domain other than look.ca). I was getting around this using a very simple procedure but I quickly grew tired of doing this every time I logged into my ISP. So I've found a better way. In case it makes any difference, I'm using FreeBSD 4.3-BETA and sendmail 8.11.3. |
relay-domains
|
sendmail uses the file /etc/mail/relay-domains1 as a list of domains from which it will accept mail for
relay. In short, if you send from a host within one of the domains listed in this
file, sendmail will accept it and redeliver it for you. This file already
contained the names of the domains within my subnet. In order to tell sendmail to
accept mail from my dial up account with look.ca, I did the following:
Then I was able to send mail. This had two side effects.
1 This local may vary from one operating system to another and is determined by the sendmail.cf setting FR-o /etc/mail/relay-domains or by the feature FEATURE(relay_entire_domain). See http://www.sendmail.org/tips/relaying.html for more detail. |
ssh tunnel
|
This method requires a ssh login from your local workstation to the remote
mail server. It's not very scalable as you don't necessarily want all users to have
an ssh connection. This solution is fine for just yourself and/or a few trusted
users. I've talked about an ssh tunnel before in the cvs remote article. With an ssh tunnel, you can redirect a local port to a port on a remote machine. In this case, I want to redirect port 25 on my box to port 25 on my mail server. This can be done easily with a FreeBSD client with the following command:
This will redirect port 25 on your box to port 25 on your mail server at example.org. If you are using a Windows, I know that Terra Tera (TTSSH)works. See my list of windows ssh clients. To set up SSH Forwarding in TTSSH, do the following steps:
With an ssh tunnel, you do have to connect to the mail server via ssh each time. But you don't have to modify anything and your mail headers look the same no matter where you send your mail from. My thanks to Lazarus for help with this. |
Other options
|
You can also do POP-before-smtp. This is probably
a better solution if you have many users. For examples, I searched with Google and found:
See also smtpAuth at http://www.sendmail.org/~ca/email/auth.html. |
more remote SMTP stuff
9 April 2001
|
Patrick Hawley writes:
|