Re: [Exim] Virtual domains & users with mysql.

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Steve Thomas
Dátum:  
Címzett: Matt
CC: exim-users
Tárgy: Re: [Exim] Virtual domains & users with mysql.
On Sat, Oct 04, 2003 at 12:32:31AM +0100, Matt is rumored to have said:
>
> Does anyone have a smaple config for exim 4.xx which will read users and domains from mysql and store mail in /var/spool/$domain/$user
>
> been trying to do this for months with no luck
>
> would prefer mysql although flat files wouldn't bother me.


I'm no exim guru, but this is from my config, which seems to work well. I wrote some quick and dirty perl scripts to manage the users. Most of this is from a HowTo I found on the web, but can't seem to find now. Be sure to edit the details as needed... Hopefully this will help you out in getting it running.


In the main part of your config file, put:

hide mysql_servers = localhost/dbname/dbuser/dbpassword
domainlist local_domains = @ : mysql;SELECT userid FROM domains WHERE userid='$domain';


My router for virtual users is as follows:

# mysql users
virtual_users:
driver = redirect
allow_fail
allow_defer
data = ${lookup mysql{select maildir from users where id='$local_part@$domain'}{$value}fail}
directory_transport = virtual_delivery


Here's the virtual_delivery transport:

virtual_delivery:
driver = appendfile
maildir_format
delivery_date_add
envelope_to_add
return_path_add
group = mail
user = mail
mode = 0660


The structure I'm using for the mysql db is as follows:

CREATE DATABASE maildb;
USE maildb;

--
-- Table structure for table 'domains'
--

CREATE TABLE domains (
userid char(128) NOT NULL default '',
KEY userid (userid)
) TYPE=MyISAM;


--
-- Table structure for table 'users'
--

CREATE TABLE users (
id varchar(128) NOT NULL default '',
crypt varchar(128) NOT NULL default '',
clear varchar(128) NOT NULL default '',
name varchar(128) NOT NULL default '',
uid int(10) unsigned NOT NULL default '8',
gid int(10) unsigned NOT NULL default '12',
home varchar(255) NOT NULL default '',
maildir varchar(255) NOT NULL default '',
webdir varchar(255) default NULL,
quota varchar(255) NOT NULL default '',
KEY id (id)
) TYPE=MyISAM;



HTH,
Steve


--
"Maybe this world is another planet's Hell."
- Aldous Huxley (1894-1963)