On 1/14/08, Jo Rhett <[EMAIL PROTECTED]> wrote: > > On Jan 11, 2008, at 9:27 AM, Mark Martinec wrote: > >>>> The problem is that I'm hosting a bunch of friends, and I in no way > >>>> really want to be editing/restarting everything any time they > >>>> host a > >>>> new domain. (same set of problems for other hosting providers too) > >>>> > >>>> What are my choices to resolve this? I need some sort of db > >>>> lookup > >>>> for what domains are local. > >>> > >>> Yes, sql based lookups, see readme's or restart amavisd every > >>> time a new > >>> domain comes on. > > > > If you want to avoid a restart, the only options are SQL or LDAP - > > based > > lookup tables. This needn't be a full-featured SQL server, it would > > suffice to use a SQLite database (embedded, no SQL server). > > 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. > > -- > Jo Rhett > Net Consonance : consonant endings by net philanthropy, open source > and other randomness >
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", '', ''] ); Gary V ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ AMaViS-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/
