20041105: had forgotten to include CC in my config - sorry for that.motivation / why to do this:
20040831: new version (0.2b) of MA released
20040728: created a Mailinglist for exim-MA. You can subscribe here.
20040703: MySQL-Queries for white- and blacklist rewritten - now using SQL-wildcards, guestbook opened.
The intention of setting up a mailserver without any local users is for security and comfortability. You (or even your users if you create a WEB-Interface) can easily add Email-Addresses and POP3-/IMAP-Boxes with just adding them to a MySQL-Table - deciding on a per-email-basis if incoming emails should be spam-scanned, piped through AMaViS, ...What you need (and hopefully already have):
Hopefully this page will show you a way how to configure the mailserver exim to do the following things:
- handling virtual email-addresses: You can create any number of email-addresses for forwarding or local storage.
- handling virtual boxes: Any number of email-addresses can point to one box.
- handling local / relaydomains
- deciding on a per-email-basis what actions should be performed (Virscan, Spamscan, ...)
What to do next:Even if you use debian or another good distribution I would compile exim from source (don't forget to include MySQL-Support); MySQL can safely be installed using your distribution-own installation-mechanism.
- The exim mailserver (a really great piece of software from Philip Hazel)
- MySQL (other database engines should do even well)
- spamassassin
- AMaViS (my config is for amavisd - not yet for amavisd_new!)
- a virus scanner (I suggest using f-prot which is free for personal use)
- probably you want to get for example the courier POP3- and IMAP-daemon - they work with my config, and are pretty easy to configure
After you have installed all this software (there should be sufficient documentation explaining how to do this) you should first create a MySQL-Database ('exim') , a user for the mailserver exim ('exim') with sufficient permission to read the tables and finally these tables (they are needed by MA in this form. If you don't like MA and don't want to use it, you can delete some rows...):Everything works - what to do now ?
Now we can have a look at the exim-config-File exim.conf; here is mine.
- White- & Blacklist (you can use user@domain and *@domain)
CREATE TABLE whitelist ( address varchar(50) NOT NULL default '', ) TYPE=MyISAM; CREATE TABLE blacklist ( address varchar(50) NOT NULL default '', ) TYPE=MyISAM;- Local-Domain & Domain-Relaytable
CREATE TABLE domaintable ( domain varchar(30) NOT NULL default '', ) TYPE=MyISAM; CREATE TABLE relaytable ( domain varchar(50) NOT NULL default '' ) TYPE=MyISAM;- Table containing the email-addresses
- local_part & domain form the recipient email-address
- forward can be filled out if you like to forward the above email address to another (external or local)
- box can be any name for a local mailbox (I'm using box0001 ... box9999 for my own config)
- if the is_away flag is set, away_text will be sent to every sender of incoming emails
- opt_virscan controls, if incoming mails for this address will be piped through AMaViS
- opt_spamscan does the same for spamassassin; if opt_spampurge is set to yes, spam positive mails will be discarded automatically
- lc_ts and lc_ip are used from my webfrontend (IP and timestamp of last change)
- create_ts finally holds the timestamp when this address was created
CREATE TABLE emailtable ( local_part varchar(30) NOT NULL default '', domain varchar(30) NOT NULL default '', cc varchar(50) NOT NULL default '', forward varchar(50) NOT NULL default '', box varchar(7) NOT NULL default '', is_away enum('yes','no') NOT NULL default 'no', away_text tinytext NOT NULL, user varchar(12) NOT NULL default '', is_enabled enum('yes','no') NOT NULL default 'yes', opt_virscan enum('yes','no') NOT NULL default 'no', opt_spamscan enum('yes','no') NOT NULL default 'no', opt_spampurge enum('on','off') NOT NULL default 'off', idstring varchar(50) NOT NULL default '', create_ts int(11) NOT NULL default '0', lc_ts int(11) NOT NULL default '0', lc_ip varchar(15) NOT NULL default '' ) TYPE=MyISAM;- Table for courier and authentication
CREATE TABLE boxauth ( boxname varchar(7) NOT NULL default '', boxpwd varchar(20) NOT NULL default '', boxinfo varchar(30) NOT NULL default '', ts_created int(11) NOT NULL default '0', lc_ts int(11) NOT NULL default '0', lc_ip varchar(15) NOT NULL default '', user varchar(20) NOT NULL default '', KEY id (boxname) ) TYPE=MyISAM;
Next, you have to configure the courier suite. This is pretty easy - nevertheless, here are some hints.
btw: the config is a subset of mine - mine works; I hope, this one will, too ... Don't hit me if there are any small flaws ;P
- First of all: I would be glad if you could file me your experiences !
- Then, you can subscribe to my mailinglist - I will report changes there - and maybe you can talk to other exim-MySQL user
- Well, you can play with my webinterface get a copy of it, rewrite it, add features, make it good-looking and send me a copy ;)
- - and of course you can tell me any suggestions, bugreports or so...
If you have any questions feel free to contact me ...