Monday, October 11, 2010

Setting up a little SMTP server to interface to another

I'd say, "Look, a non-radio post!", but this post is an elaboration of a reply I made to someone on Pubtech, so... :)

By way of background, someone on Pubtech was asking a Nautel rep when their VS Series transmitters would support SMTP servers that require login. I replied that until such a time, you could set up your own little SMTP server and use the server that requires login as a smarthost. Here's how you do it:

Step 1: get yourself a Linux box of some sort. Since this is (presumably) going to live at a transmitter site, and it would sure be nice if you could just "set it and forget it", as it were, I would recommend something like EMAC's Server-in-a-Box (SiB). With the SiB, It's not clear from their website whether or not it an SMTP server included in the Linux distribution it ships with, so contact the manufacturer to make sure. If it doesn't, I'm certain they can install the requisite software.

Step 2: configure the SiB's SMTP server to log in to your other SMTP server. There are a variety of SMTP server software packages out there, and I can't cover them all. I'm going to use Postfix for this example; if you need another example, comment on this post and I'll see what I can do.

This example is based heavily on the example posted here. Whenever you see mail.myserver.com, you should replace it with the host name of the mail server that requires login. Replace myusername with the username to log in to the SMTP server, and myPassword with the password associated with that username.

Create a text file on your server called "/etc/postfix/password". This file should look like so:


# server username:password
mail.myisp.com myusername:myPassword


Now, execute the following commands (note the '#' is used to indicate a command prompt):


# chown root:root /etc/postfix/password
# chmod 0600 /etc/postfix/password
# postmap hash:/etc/postfix/password


Then append the following lines to /etc/postfix/main.cf:


relayhost = mail.myserver.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password
smtp_sasl_security_options =


Finally, restart postfix:


# /etc/init.d/postfix reload


Give the SiB a static IP address (how this is done is outside the scope of this post), connect it to the network, rack it up, and give the Nautel the SiB's IP address for a mail server.

EDIT: The original poster on Pubtech replied that he couldn't have an open SMTP relay floating around. I'm not sure that I'd have my transmitter with a publicly (or semi-publicly) accessible IP, but then again, I'm not sure that I wouldn't. There are benefits and drawbacks to each, but that's a topic for another post. In his situation, I would lock down Postfix to only relay from the Nautel's IP. To do this, add these line to /etc/postfix/main.cf:


mynetworks = 127.0.0.0/8 192.168.1.23
smtpd_client_restrictions = permit_mynetworks, reject


Substitute 192.168.1.23 with the IP of the Nautel, of course. Reload Postfix again when you've added those lines.


And then

No comments: