XAMS [http://www.xams.org/] is a management interface and database schema for
virtual hosting. It includes configuration files for integration with Exim, and
an authdaemon that integrates with Courier POP/IMAP.

XAMS has a bit more complicated a schema than many of the virtual hosting
models in common. It groups domains, users and aliases in terms of "sites". A
given site can be associated with multiple domains (either subdomains of the
main one, or completely different domains), and then the users of that site are
associated with all the related domains. For example:

 * Site: Footastic Bars
    * Domains
       * footastic.com
       * footastic.org
       * footastic.net
    * Users
       * wombat
       * moose
       * info
    * Aliases
       * postmaster
       * root
       * spammersmustdie

Mail to 'info@footastic.com', '.org', or '.net' would all go to the same
Maildir-formated mailbox,'/var/mail/Footastic Bars/info'

Because of the schema used, a somewhat complicated query is necessary in
dovecot-sql.conf. The basic structure of these queries is lifted from the
XAMS-provided authdaemon.pl. They assume that the 'exim' user and group on your
system is at uid/gid 80, and that virtual mailboxes are owned by exim.
Obviously, you should change these numbers as appropriate for your system.

For delivery, I continue to use the XAMS-supplied transport and Exim's built-in
appendfile driver, because I can't figure out a way to make XAMS quota schema
work with the LDA's dict driver, yet.

---%<-------------------------------------------------------------------------
password_query = SELECT '80' as userdb_uid, '80' as userdb_gid,
concat(LOWER(u.name), '@', d.name) AS user, u.password AS p
assword, concat('/var/mail/', s.name, '/', LOWER(u.name)) as userdb_mail FROM
pm_sites s INNER JOIN pm_domains d ON s.id =
d.siteid INNER JOIN pm_users u ON s.id = u.siteid WHERE s.sitestate = 'default'
AND d.name = '%d' AND u.name = '%n' AND u.a
ccountstate = 'default'
---%<-------------------------------------------------------------------------

---%<-------------------------------------------------------------------------
user_query = SELECT '80' as uid, '80' as gid, concat(LOWER(u.name), '@',
d.name) AS user, concat('/var/mail/', s.name, '/',
 LOWER(u.name)) as mail FROM pm_sites s INNER JOIN pm_domains d ON s.id =
d.siteid INNER JOIN pm_users u ON s.id = u.siteid
 WHERE s.sitestate = 'default' AND d.name = '%d' AND u.name = '%n' AND
u.accountstate = 'default'
---%<-------------------------------------------------------------------------

(This file was created from the wiki on 2007-10-31 04:42)
