-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
OK,
Seems SpamAssassin is decidely thick about virtual hosting, and I've had to do something about it.
All the --virtual-config-dir stuff seems like a load of shite to me. I have solved this problem by not bothering with any of that, and to instead add
use Mail::SpamAssassin::AuthCourier;
to my spamd program.
Invoking spamc with -u $USER is now sufficient for a full virtual mail account implementation with Courier's authdaemond.
I've attached Mail::SpamAssassin::AuthCourier, and it should be placed in your @INC where the rest of the SpamAssassin modules are. This module overrides the getpwnam and getpwuid builtin's and retrieves this from authdaemond instead :)
I have noticed that authdaemond is not actually returning the UID from authpam, which makes me wonder where it does get this from ...
If anyone finds this useful, please let me know.
Cheers, Alan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.3.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org Comment:
iD8DBQE/5RlyCfroLk4EZpkRAt4RAJ9yXT4hfOqtntg+Y6+zBNcvvXq2rQCfe96q oInP5PwmCuMc3w+dbVrtWSg= =R6au -----END PGP SIGNATURE-----
# Copyright (C) 2003 Corporation of Balclutha. All rights reserved. # # Visit us at http://www.balclutha.org for all of your open source # software development and support requirements and hosted solutions. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # package Mail::SpamAssassin::AuthCourier;
# # A mechanism which uses the Courier MTA's authdaemond server to # determine mail account information. Courier is found at http://courier-mta.org # # This module automagically overrides the builtin getpwnam and getpwuid # functions. # use Exporter; use IO::Socket::UNIX; @ISA = qw(Exporter); @EXPORT = qw( getpwnam getpwuid ); # # ensure overriding for our own internal usage as well ... # use subs qw( getpwnam getpwuid ); # # For some frustrating reason, the socket seems to be unusable unless set each time. # Please contact us if you have the solution to this enhancement. # BEGIN { # $socket = IO::Socket::UNIX->new('/usr/lib/courier/var/authdaemon/socket'); } END { $socket->close if $socket; } sub getpwnam { my $socket = IO::Socket::UNIX->new('/usr/lib/courier/var/authdaemon/socket'); print $socket "PRE . login $_[0]\n"; my %results = (); my ($k, $v); while (<$socket>) { ($k,$v) = split '=', $_, 2; chomp $v if $v; $results{$k} = $v; } $socket->close if $socket; # authpam seems not to return UID - so we'll take a punt on UID/GID being the same ... # stop some naf 'uninitialized' errors ... return wantarray ? ('','','','','','','') : undef unless $results{'UID'} or $results{'GID'}; my $uid = int( $results{'UID'} || $results{'GID'} ); return wantarray ? ( $results{'USERNAME'}, $results{'PASSWD'}, $uid, int($results{'GID'}), $results{'QUOTA'}, $results{'COMMENT'}, $results{'GCOS'}, $results{'HOME'}, '/bin/bash') : $uid; } sub getpwuid { return (getpwnam($_[0]))[2]; } 1;
