# [SOLVED] Postfix and SpamAssassin

## papal_authority

Has anyone got these two working together sitewide without procmail? I cannot for the life of me seem to get any pipe command to execute. I've tried different users, different commands (including a simple debugging script) and all different combinations of options. Here's what I get in the log:

```
Jan 15 21:33:57 vatican postfix/smtpd[4142]: connect from zomg[192.168.0.3]

Jan 15 21:34:25 vatican postfix/smtpd[4142]: 3CFB437EAF: client=zomg[192.168.0.3]

Jan 15 21:34:32 vatican postfix/cleanup[4145]: 3CFB437EAF: message-id=<20070116053425.3CFB437EAF@localhost>

Jan 15 21:34:32 vatican postfix/qmgr[4140]: 3CFB437EAF: from=<zomgvan@lol.net>, size=337, nrcpt=1 (queue active)

Jan 15 21:34:32 vatican pipe[4148]: fatal: pipe_command: execvp /tmp/crap.sh: Permission denied

Jan 15 21:34:32 vatican postfix/pipe[4147]: 3CFB437EAF: to=<papal@localhost.localdomain>, orig_to=<papal>, relay=spam, delay=13, delays=13/0.01/0/0.08, dsn=4.3.0, status=deferred (temporary failure. Command output: pipe: fatal: pipe_command: execvp /tmp/crap.sh: Permission denied )

Jan 15 21:34:32 vatican postfix/pipe[4147]: warning: 3CFB437EAF: flush service failure

Jan 15 21:34:34 vatican postfix/smtpd[4142]: disconnect from zomg[192.168.0.3]
```

The /tmp/crap.sh script is 0755 and runs perfectly fine when I su - to the spam user. I've googled and googled, but everyone else's problem seemed to be that the command really wasn't executable. Mine is.

```
-rwxr-xr-x 1 root root 30 Jan 15 21:12 /tmp/crap.sh
```

Anyone have any insight? I'm used to sendmail and am fairly new to postfix. TIA  :Smile: 

----------

## magic919

Just use spamassassin as a content_filter under Postfix.

----------

## Dan

I used these as a ref when i setup.

http://www.akadia.com/services/postfix_spamassassin.html

http://wiki.apache.org/spamassassin/IntegratedSpamdInPostfix

----------

## papal_authority

 *magic919 wrote:*   

> Just use spamassassin as a content_filter under Postfix.

 

Err yes, I am doing that. It's just not being run for some reason.

----------

## papal_authority

 *dcoats wrote:*   

> I used these as a ref when i setup.
> 
> http://www.akadia.com/services/postfix_spamassassin.html
> 
> http://wiki.apache.org/spamassassin/IntegratedSpamdInPostfix

 

Oh thanks dcoats, I had been referencing the second link before, but the first one is new to me and seems to be more in depth. The "Permission denied" error is just bizarre though. The script is 0755 and the spam user can run it no problem, just not from postfix. I'll try using the information from the first link later today. Thanks again  :Smile: 

----------

## papal_authority

Ok I finally figured this out, it was #$@ing SELinux. This was a fresh FC6 install that I was using as a testbox for postfix. I disabled SELinux on spamassassin and it works now. Anyways for the sake of completeness, I'll post the two entries necessary in postfix's master.cf file to use spamassassin:

```
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spam:dummy
```

and

```
spam      unix  -       n       n       -       10      pipe

  flags=Rq user=spam argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
```

Although that one is actually two lines, it's just one entry. You'll have to create a spam user and group. I use this user to run both spamd (the spamassassin daemon) and spamc (the client invoked by postfix in the line above).

----------

