Changes between Version 1 and Version 2 of faq/email/setup-postfix-debian


Ignore:
Timestamp:
Dec 12, 2010, 4:27:01 PM (10 years ago)
Author:
Matthew James Goins
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • faq/email/setup-postfix-debian

    v1 v2  
    1 back in 15 minutes
     1= Hints for running postfix on a debian workstation/laptop =
     2
     3Security 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.
     4
     5Some users may wish to run a full mail system on their personal machines. 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.
     6
     7This setup is likely to work with ubuntu, but at the time of writing it hasn't been tried.
     8
     9These instructions all require root access to the machine in question.
     10
     11== Installing the Software ==
     12First install postfix, making sure to include the suggest package for the sasl modules:
     13
     14{{{
     15aptitude install libsasl2-modules postfix
     16}}}
     17
     18You may have to uninstall some other MTA, such as exim or ssmtp. aptitude should tell you what's up.
     19
     20=== Config Questions ===
     21You will be presented with an interactive prompt asking some questions.
     22
     23First it will ask you to choose a type of system. I chose
     24
     25{{{
     26internet site with smarthost
     27}}}
     28
     29
     30
     31The 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?)
     32
     33Next, you'll be asked for the smarthost name. This is the same as your primary host as described on the [wiki:configure_email] page, and you can include a port. So for chavez, it's
     34
     35{{{
     36chavez.mayfirst.org:587
     37}}}
     38
     39Aptitude will then finish installing the packages.
     40
     41== Configure Postfix ==
     42
     43Edit the file /etc/postfix/main.cf
     44
     45The default file should be sufficient as is, with the following additions (add them at the bottom)
     46
     47{{{
     48smtp_sasl_auth_enable = yes
     49smtp_tls_security_level = encrypt
     50smtp_sasl_tls_security_options = noanonymous
     51smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
     52}}}
     53
     54See `man smtp` for details on those configuration options.
     55
     56Next, create a file called `/etc/postfix/sasl_passwd`, containing:
     57
     58{{{
     59chavez.mayfirst.org:587           username:PASSWORD
     60}}}
     61
     62Replacing username and PASSWORD with your credentials. When that file is saved, run the command
     63
     64{{{
     65postmap /etc/postfix/sasl_passwd
     66}}}
     67
     68Any time in the future that you change `/etc/postfix/sasl_passwd`, you will need to run `postmap` again.
     69
     70== Dealing with User Agents ==
     71
     72(this section needs work)
     73
     74At this point you should have a working `/usr/bin/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.
     75
     76I 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
     77
     78{{{
     79set envelope_from = yes
     80set from = mjgoins@openflows.com
     81set use_from = yes
     82}}}
     83
     84Substitute your email address above, and mutt should do the right thing.