[Lvlug] Spamassassin

Scott Phelan scottp at fivestarassoc.com
Sun Jun 10 16:05:02 EDT 2007


Scott Phelan wrote:
> Hello,
> I'm trying to get spamassassin set up on my new server.
> 
> I'm Following the instructions here to use it with postfix.
> http://www.akadia.com/services/postfix_spamassassin.html
> 
> But it's not working due to some syntax problem, (I think).
> 
> Here is the script that postfix calls.
> ----------------- snip ---------------------------
> #!/bin/sh
> 
> # -----------------------------------------------------------------
> # File:        spamchk
> #
> # Purpose:     SPAMASSASIN shell-based filter
> #
> # Location:    /usr/local/bin
> #
> # Usage:       Call this script from master.cf (Postfix)
> #
> # Certified:   GENTOO Linux, Spamassassin 3.0, Postfix
> # -----------------------------------------------------------------
> 
> # Variables
> #SENDMAIL="/usr/local/postfix/sendmail/sendmail -i"
> ENDMAIL="/usr/sbin/sendmail -i"
> EGREP=/bin/egrep
> 
> # Exit codes from <sysexits.h>
> EX_UNAVAILABLE=69
> 
> # Number of *'s in X-Spam-level header needed to sideline message:
> # (Eg. Score of 5.5 = "*****" )
> SPAMLIMIT=10
> 
> # Clean up when done or when aborting.
> trap "rm -f /var/tempfs/out.$$" 0 1 2 3 15
> 
> # Pipe message to spamc
> cat | /usr/bin/spamc -u filter > /var/tempfs/out.$$
> 
> # Are there more than $SPAMLIMIT stars in X-Spam-Level header? :
> if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}" < /var/tempfs/out.$$
> then
>   # Option 1: Move high scoring messages to sideline dir so
>   # a human can look at them later:
>   # mv out.$$ $SIDELINE_DIR/`date +%Y-%m-%d_%R`-$$
> 
>   # Option 2: Divert to an alternate e-mail address:
>   $SENDMAIL spammail at hobbyguild.com < /var/tempfs/out.$$
> 
>   # Option 3: Delete the message
>   # rm -f /var/tempfs/out.$$
> else
>   $SENDMAIL "$@" < /var/tempfs/out.$$
> fi
> 
> # Postfix returns the exit status of the Postfix sendmail command.
> exit $?
> ------------------- snip --------------------
> 
> When my spamchk script gets as far as
> 
> else
>  @SENDMAIL "$@" < /var/tempfs/out.$$
> fi
> 
> It throws the following error message out in maillog.
> 
> Jun 10 14:49:14 121479-www1 postfix/pipe[2920]: E5DD7FFC55F: 
> to=<hobbyguild at 121479-www1.fivestarassoc.com>, 
> orig_to=<scottp at hobbyguild.com>, relay=spamchk, delay=1, status=bounced 
> (Command died with status 127: "/usr/local/bin/spamchk". Command output: 
> /usr/local/bin/spamchk: line 46: -f: command not found )
> 
> It looks to me like it's trying to execute the -f that is in the argv= 
> that is located in master.cf.
> 
> The lines I added to /etc/postfix/master.cf are here...
> 
> spamchk   unix  -       n       n       -       10      pipe
>   flags=Rq user=filter argv=/usr/local/bin/spamchk -f ${sender} -- 
> ${recipient}
> 
> smtp      inet  n       -       n       -       -       smtpd -o 
> content_filter=spamchk:dummy
> 
> Any hints?
> 
Think I answered my own question. Typo in the SENDMAIL= line.
I'll let you know in a few minutes if that works.


-- 
Thanks,
Scott Phelan, President
Five Star Associates, Inc.
889 Lower South Main St.
Bangor, PA  18013
Ph: (610) 588-7426
Fax: (610) 599-0408
web: www.fivestarassoc.com


More information about the Lvlug mailing list