On Donnerstag, 29. März 2007 13:13 Anne wrote:
> But with such a domain rewrite you can't block unknown users at the
> MTA level. Your server will be very busy doing unnecessary content
> checking when a spammer does a dictionary attack.

I extended dbmail to have another table "domains" with a list of 
domains, and now it's a simple query to check if an alias domain has an 
allowed user:

query = SELECT (case when count(alias) > 0 then 'OK' when count(alias) = 
0 then 'REJECT' END) AS access
   FROM dbmail_aliases
   WHERE alias = (
      SELECT substring('%s' from 1 for position('@' in '%s')) || domain
         FROM zmi_domains
         WHERE domain_idnr = ( SELECT COALESCE(pridom.pridomain_idnr, 
pridom.domain_idnr) FROM zmi_domains pridom WHERE 
pridom.domain=substring('%s' from position('@' in '%s')+1))
   )

Maybe it could be simplified, but I'm no SQL guru. In my "zmi_domains" 
table there's a field "pridomain_idnr", if it's not NULL, it says what 
the primary domain is. Voila.

This "domains" table extension also makes it easier to check if we 
accept e-mail for a domain:
virtual_mailbox_domains = pgsql:/etc/postfix/domains.sql

and domains.sql is:
query = SELECT domain FROM zmi_domains WHERE domain='%s'

mfg zmi
-- 
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0676/846 914 666                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: EA39 8918 EDFF 0A68 ACFB  11B7 BA2D 060F 1C6F E6B0
// Keyserver: www.keyserver.net                   Key-ID: 1C6FE6B0

Attachment: pgpnXYjaTrjx6.pgp
Description: PGP signature

_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to