Hi,

 I'll take up this old thread again, since I never got the patch downloaded,
as instructed by Mr. Dallas L. Engelken below.

 Does anyone in here have a working patch for SA 2.63 - so SA can get the
filters/scores for each domain from an SQL database ?

Regards,

Brian

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Dallas L. Engelken
> Sent: 27. august 2003 18:58
> To: [EMAIL PROTECTED]
> Subject: RE: [Qmail-scanner-general]Qmail-scanner + SpamAssassin /
> domain-specific filters/databases
>
>
> >
> > Anyway, I wonder whether a "sort-of" domain setup is possible
> > with qmail-scanner and SpamAssassin ? What I want to achieve,
> > is that all mail for a specific domain uses its own bayesian
> > database - and maybe own customized filters.  The problem is,
> > that the domain is not hosted locally on the box running SA
> > and QS - but are relayed to the respective right mail-servers
> > (the box with SA and QS acts only as a anti-virus and
> > spam-identification box).
> >
> > Anyone ??
>
> patch spamassassin with the per-domain patch i made up, and call spamc
> with -u '$recips'.  make sure spamd is using -q to pull prefs from
> mysql.
> http://www.engelken.net/code/SA-2.55-perdomain.patch
>
> this will allow you to pull global, per-domain, or per-user settings out
> of SQL.
>
> my QS looks like this now,
>
> if (&single_recip($recips)) {
>   open(SA,"$spamc_binary $spamc_options -u \"$recips\"  <
> $scandir/$wmaildir/new/$file_id|")||&tempfail("cannot run $spamc_binary
> < $scandir/$wmaildir/new/$file_id - $!");
> }
> elsif (my $domain = &same_domain($recips)) {
>   open(SA,"$spamc_binary $spamc_options -u \"\%$domain\"  <
> $scandir/$wmaildir/new/$file_id|")||&tempfail("cannot run $spamc_binary
> < $scandir/$wmaildir/new/$file_id - $!");
> }
> else {
>   open(SA,"$spamc_binary $spamc_options -u \"\$GLOBAL"  <
> $scandir/$wmaildir/new/$file_id|")||&tempfail("cannot run $spamc_binary
> < $scandir/$wmaildir/new/$file_id - $!");
> }
>
> so, if there are multi-recips at different domains (rare!), it takes
> global config, if there are multi-recips but they are all at the same
> domain, it will take per-domain prefs, and if it's a single recip, it
> take per-user.
>
> make sense?
>
> dallas
>
>
>
> here is the post i made to SA-devel a while back...
> ---------------------
>
> 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:
>
> %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:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Qmail-scanner-general mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general
>


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general

Reply via email to