> > I tried using '[EMAIL PROTECTED]', '[EMAIL PROTECTED]' and > '@testdomain.com' as the username in our SA database but it > doesn't work (using 2.61). Not a *huge* problem, we can > either just use @GLOBAL or just set them in the actual .cf > files, but it would be cool to have per-domain whitelists > when using SQL preferences... >
i'll just copy+paste an old message i sent to the list that patches ConfSourceSQL.pm to do what you want it to. Note: there has been no changes to ConfSourceSQL.pm since 2.50, so this patch will apply cleanly to 2.61 also. there is also a post titled "patch: @GLOBAL at domain level for sql config" by Davide Giunchi [EMAIL PROTECTED] that tries to deal with per-domain settings.... although i think you'll like this method better?? okay.... here is the original message... ---------------------- Microsoft Mail Internet Headers Version 2.0 Received: from mailgw.nmgi.com ([64.217.128.174]) by exchange.nmgi.com with Microsoft SMTPSVC(5.0.2195.5329); Fri, 14 Mar 2003 16:44:43 -0600 Received: (qmail 27111 invoked by uid 204); 14 Mar 2003 22:44:44 -0000 Received: from [EMAIL PROTECTED] by mailgw.nmgi.com by uid 201 with qmail-scanner-1.14 (uvscan: v4.1.60/v4251. spamassassin: 2.50. Clear:SA:0(-4.9/4.5):. Processed in 1.824063 secs); 14 Mar 2003 22:44:44 -0000 X-Qmail-Scanner-Mail-From: [EMAIL PROTECTED] via mailgw.nmgi.com X-Qmail-Scanner: 1.14 (Clear:SA:0(-4.9/4.5):. Processed in 1.824063 secs) Received: from unknown (HELO sc8-sf-list2.sourceforge.net) (66.35.250.206) by 0 with SMTP; 14 Mar 2003 22:44:42 -0000 Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13] helo=sc8-sf-list1.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 18txni-0002SG-00; Fri, 14 Mar 2003 14:37:18 -0800 Received: from sonic.nmgi.com ([64.217.128.161] helo=exchange.nmgi.com) by sc8-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 18txdp-0003mz-00; Fri, 14 Mar 2003 14:27:05 -0800 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Message-ID: <[EMAIL PROTECTED]> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: PER-DOMAIN sql prefs patch Thread-Index: AcLqeNPSWVcUEaOPQB69QWiN14pW5w== From: "Dallas Engelken" <[EMAIL PROTECTED]> To: "Spamassassin List" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Subject: [SAdev] PER-DOMAIN sql prefs patch Sender: [EMAIL PROTECTED] Errors-To: [EMAIL PROTECTED] X-BeenThere: [EMAIL PROTECTED] X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Help: <mailto:[EMAIL PROTECTED]> List-Post: <mailto:[EMAIL PROTECTED]> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-devel>, <mailto:[EMAIL PROTECTED] be> List-Id: SpamAssassin Developers <spamassassin-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassassin-devel>, <mailto:[EMAIL PROTECTED] ribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum=spamassassin-devel> X-Original-Date: Fri, 14 Mar 2003 16:26:59 -0600 Date: Fri, 14 Mar 2003 16:26:59 -0600 X-Spam-Status: No, hits=-4.9 required=4.5 tests=AWL,BAYES_01,KNOWN_MAILING_LIST autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Pyzor: Reported 0 times. X-DCC-Rhyolite-Metrics: mailgw.nmgi.com 101; Body=2 Fuz1=2 Fuz2=6 Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 14 Mar 2003 22:44:43.0520 (UTC) FILETIME=[4E4AD800:01C2EA7B] I have wrote a patch to ConfSourceSQL.pm for per-domain sql prefs. It allows you to have PER-DOMAIN sql prefs on top of the GLOBAL and PER-USER sql prefs that it already provides. It assumes globals are specified as $GLOBAL and per-domains are specified as %DOMAIN.COM due to sorting problems discussed below. @GLOBAL and GLOBAL are still supported, but not recommended since per-domain configs will be read first. -- INSTALL -- untar and patch from root of Mail-SpamAssassin-2.50 with # patch -p0 < SA-2.50-perdomain-sql.patch or patch the ConfSourceSQL.pm in your perl libs directly (/usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssasin/ConfSourceSQL.pm in my case). configure SA to use sql prefs. (read man Mail::SpamAssassin::Conf if you dont know how). global prefs will be in in database as $GLOBAL (@GLOBAL and GLOBAL still work but not recommened do to sorting precedence) per-domain prefs will be in the database as %DOMAIN where DOMAIN is the part after the @ in the $username per-user prefs will be in the database as username or [EMAIL PROTECTED] Examples mysql> select username,preference,value,descript from sa_rules order by username,preference asc; +------------------+------------------+----------------+---------------- -------------------+ | username | preference | value | descript | +------------------+------------------+----------------+---------------- -------------------+ | $GLOBAL | required_hits | 12.0 | Start Hight. Change per-domain | | $GLOBAL | blacklist_from | [EMAIL PROTECTED] | Blacklisted for all domain | | %hutchnet.com | required_hits | 7.0 | Loosen the filter for this domain | | %nmgi.com | required_hits | 5.0 | Default req hits | | %nmgi.com | unblacklist_from | [EMAIL PROTECTED] | Except for nmgi.com | | [EMAIL PROTECTED] | required_hits | 4.5 | Lowering my Spam Hits | | [EMAIL PROTECTED] | blacklist_from | [EMAIL PROTECTED] | Reset to black for for this user | +------------------+------------------+----------------+---------------- -------------------+ 7 rows in set (0.00 sec) This allows the preferences that are fed into $main->{conf} to be ordered accordingly. Since you cannot prefix a domain with a special char greater than @ and less than [A-z] on the ascii chain, it had to be changed to $ and % which will sort the way we want. Feel free to change it if you'd like, this is just how I do it and I think it makes the most sense. If you dont, when you specify a global rule with a per-domain override, it will not work: ie. %nmgi.com unwhitelist_from [EMAIL PROTECTED] @GLOBAL whitelist_from [EMAIL PROTECTED] the per-domain rule will be read first because % < @ in ascii, and unwhitelist_from of [EMAIL PROTECTED] will not do anything for you, and then whitelist_from [EMAIL PROTECTED] will be done next, resulting in your per-domain override failing. if you do not use sql configs, or pass [EMAIL PROTECTED] to spamc via the -u switch, this patch will do nothing for you. it's mainly aimed at the vpopmail enviroment but I'm sure you can find your own uses... :) feedback is welcome! D ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk