Looks good, below, but a couple of procmail/perl suggestions ...
> #/etc/procmailrc setup:
> #################
> # #
> # SpamAssassin #
> # #
> #################
> :0fw
> # skip passing to spamc/spamd if user is on
> # exempt list, or if message is really big.
> # all_spam_to has problems, and why burden
> # the server w/large messages if we can
> # catch them here!
> * < 500000
> * ! ? /usr/local/bin/nospam.pl $LOGNAME
> |/usr/bin/spamc -s 100000 -d <SPAMD SERVERNAME> -p 783
>
Above, the '< 500000' check, I believe, exceeds spamc/spamd's
maximum limit of 250000, so you might want to bring that in a bit. I see
you're using 100000 in the spamc invocation.
> The script:
>
> #!/usr/bin/perl
> #
> # nospam.pl -- accept username as option,
> # check a list of names, see if
> # user wants spam scanning or not
> # 0 = skip scanning
> # nonzero = scan (fail "safe" so that
> # majority of users are scanned)
> # [EMAIL PROTECTED]
>
> $userfile="/etc/spamassassin/exempt";
> $found="false";
>
More typical Perl style would be to use 1/0 for true/false.
> $user=$ARGV[0];
>
> open USERS,$userfile or die "unable to open $userfile $!\n";
> while (<USERS>) {
> next if ( /^#/ );
> if ( /^$user$/ ) {
> $found="true";
> last;
> };
> };
Since user-ids should be considered case insentitive, you might want to
lowercase your user-id,
$user = lc $ARGV[0];
and make sure that your list of exempt users is all lower-case as well.
The you can modify the check above to just do a straight string comparison
rather than a regex. You'll need to 'chomp' the line first to discard the
newline:
open USERS,$userfile or die "unable to open $userfile $!\n";
while (<USERS>) {
chomp;
next if ( /^#/ );
return 1 if ($user eq $_);
};
If your list gets big and you don't want to go to a more complicated
set up using DB files, you might take a look at John Connover's useful
flat file search utility:
http://www.johncon.com/ndex/