Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The easiest way to integrate postfix and spamassassin is to use spamd. First, edit /etc/postfix/master.cf, find the

No Format

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (50)
# ==========================================================================
...
smtp

...

      inet  n       -       n       -       -       smtpd
...

line and just add " -o content_filter=spamassassin" to the end of the line:

No Format

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (50)
# ==========================================================================
...
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
...

Then, go to the end of the file, and add this:

No Format

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (50)
# ==========================================================================
...
spamassassin 
          unix  -       n       n       -       -       pipe 
  

Then, go to the end of the file, and add this:

No Format

spamassassin unix - n n - - pipe user=nobody argv=/path/to/spamc -f -e /path/to/postfix/sendmail -oi -f ${sender} ${recipient}
# make sure it's all on one line or 
# start the secondconsecutive linelines with a whitespace
# like I did here

Then, setup spamd to start with the system, and you are ready to go. If you wish to provide spamassassin preferences, change "user=nobody" to a valid system user (except for root, since Postfix will NOT call external programs as root), and add .spamassassin into that user's home directory.

...