[FrontPage] [TitleIndex] [WordIndex]

TmdaPostfixPolicy

The Postfix MTA has the ability to invoke external policy services to determine what to do with an incoming email. The advantage of this approach is that the MTA can evaluate how to dispose the email while the sending server is connected. Because the envelope sender address can be forged, this can reduce the impact of sending a bounce or message delivery error to the wrong address.

With that in mind, I created a simplistic Postfix policy service which queries TMDA to determine what to do. The code below is an initial trial, which has some caveats:

Here's how you install this policy daemon:

  1. Make sure that you've set "ALLOW_MODE_640 = True" in /etc/tmdarc
  2. Make sure that all users .tmda/config and .tmda/crypt_key have their group set to "mail" and have 640 permissions
  3. Copy the code (see below) into /usr/local/src/tmda/contrib/tmda-postfix-policy.sh
  4. Add the following to master.cf:
    tmda    unix  -       n       n       -       -       spawn
        user=mail argv=/bin/bash /usr/local/src/tmda/contrib/tmda-postfix-policy.sh
  5. Add the following to main.cf:
    smtpd_recipient_restrictions =
            permit_mynetworks,
            check_policy_service unix:private/tmda
    Alternatively, you can add it to "smtpd_data_restrictions" or "smtpd_end_of_data_restrictions".
  6. Restart Postfix

This is the code that implements this: tmda-postfix-policy.sh


2007-02-24 17:18