Hello,

I'm using a Postfix after-queue configuration very close to what is
documented on the SpamAssassin wiki[1].  Works great with mail where
localpart matches a user, but doesn't work so great for aliases.  I'm
using the spamc -u argument so that each user has their own prefs,
bayes, awl, etc., master.cf will fallback to 'nobody' if setuid fails
(in the case of an alias), and there will be a few harmless errors and
spamassassin will still get the job done with system-wide default
behavior.

Looks like Postfix alias lookup is only handled by local(8) and not
something accessible to pipe(8).  The only foreseeable option is to
duplicate the lookup in a shell script, which isn't pretty because I'm
using a combination of aliases db and LDAP.

Anyone have experience with this?


Example fallback messages when using an alias:

  spamd: connection from localhost [127.0.0.1] at port 49244
  spamd: handle_user unable to find user: 'admins'
  spamd: still running as root: user not specified with -u, not found, or set 
to root, falling back to nobody
  spamd: processing message <XYZ> for admins:65534
  auto-whitelist: open of auto-whitelist file failed: locker: safe_lock: cannot 
create lockfile /nonexistent/.spamassassin/auto-whitelist.mutex: No such file 
or directory
  spamd: clean message (-0.1/3.0) for admins:65534 in 1.7 seconds, 2879 bytes.
  spamd: result: . 0 - AAA,BBB 
scantime=1.7,size=2879,user=admins,uid=65534,required_score=3.0,rhost=localhost,raddr=127.0.0.1,rport=49244,mid=<XYZ>,autolearn=no,shortcircuit=no
  prefork: child states: IIIII

  ... then pickup/qmgr/local take over and 'admins' is expanded to the
  real user(s)


Configuration:

main.cf:

  spamc_destination_recipient_limit = 1

master.cf:

  smtp      inet  n       -       -       -       20      smtpd
    -o content_filter=spamc

  spamc     unix  -       n       n       -       5       pipe
    flags=u user=nobody argv=/etc/postfix/spamc-filter -u ${user}
    -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

spamc-filter:

  #!/bin/sh

  (/bin/cat | /usr/bin/spamc -x $@) || {
    echo spamc exit code $? 1>&2
    exit 75
  }

[1] http://wiki.apache.org/spamassassin/IntegratedSpamdInPostfix

-- 
Gerald Turner   Email: gtur...@unzane.com   JID: gtur...@unzane.com
GPG: 0xFA8CD6D5  21D9 B2E8 7FE7 F19E 5F7D  4D0C 3FA0 810F FA8C D6D5

Attachment: pgpeQbKgTKLgf.pgp
Description: PGP signature

Reply via email to