Thank you, Gary for the detailed response (quoted below).  However it 
appears that these queries will break the existing amavisd tables used 
for kill score, etc.

Is there a way I can use (different) SQL tables for determining if an 
address is a local user?

> On 1/14/08, Jo Rhett <[EMAIL PROTECTED]> wrote:
>> I am honestly trying to find documentation on how to do this, and
>> coming up blank.
>>
>> I have an existing SQL table with all of my mail users, if I can
>> query that it would be perfect.

Gary V wrote:
> This thread (in which I think you will find a solution):
> 
> http://marc.info/?l=amavis-user&m=115672419610264
> 
> Led to this note in amavisd.conf-sample:
> 
> # Does a database mail address field with no '@' character represent a
> # local username or a domain name?  By default it implies a username in
> # SQL and LDAP lookups (but represents a domain in hash and acl lookups),
> # so domain names in SQL and LDAP should be specified as '@domain'.
> # Setting these to true will cause 'xxx' to be interpreted as a domain
> # name, just like in hash or acl lookups.
> #
> # $sql_lookups_no_at_means_domain  = 0;  # default is 0
> # $ldap_lookups_no_at_means_domain = 0;  # default is 0
> 
> # Here is an example of a SELECT clause that fabricates an artificial 'users'
> # table from actual table 'postfix_domains' containing a field 'domain_name'.
> # The effect is that domains listed in the 'postfix_domains' table will be
> # treated as local by amavisd, and be given settings from a policy id 99
> # if such a policy id exists, or just fall back to static lookups.
> # The user.id (with a value 1) is there only to provide a user id (same id
> # for all listed domains) when global SQL-based white/blacklisting is used.
> #
> # $sql_lookups_no_at_means_domain = 1;
> # $sql_select_policy =
> #   'SELECT *, user.id'.
> #   ' FROM (SELECT 1 as id, 99 as policy_id, "Y" AS local'.
> #         ' FROM postfix_domains WHERE domain_name IN (%k)) AS user'.
> #   ' LEFT JOIN policy ON policy_id=policy.id';
> 
> This assumes you are not currently using SQL in amavisd-new (if you
> were, and you were using the amavisd-new schema, you probably would
> not need to do this). If you are, then changing the default
> $sql_select_policy in this manner should break the way amavisd-new
> normally queries SQL data.
> 
> Don't forget that you also need to configure the @lookup_sql_dsn. For example:
> 
> @lookup_sql_dsn = ( ['DBI:mysql:database:localhost', 'user', 'password'] );
> 
> This is from amavisd.conf-sample:
> 
> # Where to find SQL server(s) and database to support SQL lookups?
> # A list of triples: (dsn,user,passw).   (dsn = data source name)
> # More than one entry may be specified for multiple (backup) SQL servers.
> # See 'man DBI', 'man DBD::mysql', 'man DBD::Pg', ... for details.
> # When chroot-ed, accessing SQL server over inet socket may be more 
> convenient.
> #
> # @lookup_sql_dsn =
> #   ( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'user1', 
> 'passwd1'],
> #     ['DBI:mysql:database=mail;host=host2', 'username2', 'password2'],
> #     ["DBI:SQLite:dbname=$MYHOME/sql/mail_prefs.sqlite", '', ''] );

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to