On Wed, 09 Jan 2008 09:20:26 +0100
Per Jessen <[EMAIL PROTECTED]> wrote:

> Theo Van Dinter wrote:
> 
> > Well, the problem is that if you run at MTA time, you can't really
> > do per-user configs.
> > 
> > "spamc -u" will work, if there's only 1 user.  it won't work with
> > multiple users, such as when there are several recipients for a
> > single message, unless you can get the MTA to split the message up
> > into multiple messages, but that is problematic/has pros+cons
> > assuming the MTA will even let you do it.
> 
> In postfix you just need to set xxxx_destination_recipient_limit for
> the transport you're using for spamassassin.  

Yes. One needs to set:

  xxxx_destination_recipient_limit = 1

However, I have not been able to make it work without altering the
spamd daemon. In particular, spamd looks for a physical account on the
server it is running:

sub handle_user_setuid_basic {
  ...
  my ($name, $pwd, $uid, $gid, $quota, $comment, $gcos, $dir, $etc) =
      getpwnam($userid);

  if (!defined $uid) {
      my $errmsg = "spamd: handle_user unable to find user:
'$userid'\n"; #die $errmsg if $spamtest->{'paranoid'};
      # if we are given a username, but can't look it up, maybe name
      # services are down?  let's break out here to allow them to get
      # 'defaults' when we are not running paranoid
      info($errmsg);
      return 0;
  }
  ...
}

On our server there is a spamd user account. Therefore, I changed the
'if' section above to:

  if (!defined $uid) {
     ($name, $pwd, $uid, $gid, $quota, $comment, $gcos, $dir, $etc) =
      getpwnam("spamd");
  }

At this point spamd is able to find a local account and spamc is
correctly ran with the user it is suppose to, i.e.:

spamass   unix  -       n       n       -       32       pipe
  user=spamd argv=/usr/local/bin/spamc -u ${recipient}
-e /usr/local/sbin/sendmail -oi -f ${sender} ${recipient}

-------
  _|_
 (_| |

Reply via email to