wiki:faq/email/setup-postfix-debian

Version 8 (modified by Dana, 7 years ago) (diff)

--

Hints for relaying Email through May First/People Link using postfix on debian

Security Warning: this method requires you put your password in a file under /etc, and if you run verbose mail logs, your password might end up in the mail.log files as well. Please secure those files accordingly.

Some users may wish to run a full mail system on their personal machines. Or, users may want to relay email from a server that might be assigned a dyna mic IP address or otherwise may not be a reliable mail relay.

For systems running recent debian systems (these instructions were tested on squeeze), these hints should help get postfix up and running with mayfirst's mail relays.

This setup is likely to work with ubuntu, but at the time of writing it hasn't been tried.

These instructions all require root access to the machine in question.

Installing the Software

First install postfix, making sure to include the sasl modules:

aptitude install libsasl2-modules postfix

You may have to uninstall some other MTA, such as exim or ssmtp. aptitude should tell you what's up.

Config Questions

You will be presented with an interactive prompt asking some questions.

First it will ask you to choose a type of system. I chose

internet site with smarthost

The next question is the mail name for you machine. Since my laptop already was set up with a fully-qualified domain name, I chose the default. Choosing a hostname may be beyond the scope of these instructions, but you should choose a name that resolves to some ip address (FIXME?)

Next, you'll be asked for the smarthost name.

mail.mayfirst.org:587

Aptitude will then finish installing the packages.

Configure Postfix

Edit the file /etc/postfix/main.cf

The default file should be sufficient as is, with the following additions (add them at the bottom)

smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

See man smtp for details on those configuration options.

Next, create a file called /etc/postfix/sasl_passwd, containing:

mail.mayfirst.org:587           username:PASSWORD

Replacing the server name and port with those appropriate to your mail server, and the username and PASSWORD with your credentials. When that file is saved, run the command

postmap /etc/postfix/sasl_passwd

Any time in the future that you change /etc/postfix/sasl_passwd, you will need to run postmap again.

Dealing with User Agents

(this section needs work)

At this point you should have a working /usr/sbin/sendmail on your machine, however, the envelopes around messages you send might contain strange information, such as From: set to the fully-qualified name of your laptop. This may result in mail you send being rejected by the mayfirst relay, depending on the domain you use for your laptop.

I work around this problem by telling mutt, my MUA of choice, to use my regular (mayfirst-provided) email address for the From: header. In my .muttrc, I include the lines

set envelope_from = yes
set from = mjgoins@openflows.com
set use_from = yes

Substitute your email address above, and mutt should do the right thing.