Re: [exim] multi-domain setup

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Roland Illig
Dátum:  
Címzett: Lars Schimmer
CC: exim-users
Tárgy: Re: [exim] multi-domain setup
Lars Schimmer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi!
>
> I set a exim4 server up some time ago for 2 different domains. But I
> just added the domains to the relay_domains options. So I can use only
> unique users server-wide (eg usera@domain1 and usera@domain2 are equal
> in exim4).
>
> Now I need to handle at least 5 domains with that mailserver.
> Is there a quick way to setup 5 unique domains (all with unique users
> [postmaster,webmaster...]) and without a database setup?


I appended my configuration, which handles multiple domains quite
flexible and elegantly.

To create 5 completely equivalent domains, create a directory in
/var/mailboxes with the name of one of the domains. Populate it with
directories (for mailboxes) or regular files (for redirections, mailing
lists, etc.) and create symlinks for the other four domains, pointing to
the first domain.

In order to use this configuration, you have to patch exim a little (see
patch-ah), since it doesn't like it when you use a file as directory
name and search in it (the require_files in the ri_redirect router
doesn't work without this patch).

Roland
--- configure.orig    2007-09-19 12:11:40.000000000 +0200
+++ configure    2007-10-01 11:01:39.232740433 +0200
@@ -56,7 +56,7 @@
 # +local_domains, +relay_to_domains, and +relay_from_hosts, respectively. They
 # are all colon-separated lists:


-domainlist local_domains = @
+domainlist local_domains = dsearch;/var/mailboxes
domainlist relay_to_domains =
hostlist relay_from_hosts = 127.0.0.1

@@ -173,7 +173,7 @@
# unqualified addresses from remote sources. If this option is not set, the
# primary_hostname value is used for qualification.

-# qualify_domain =
+qualify_domain = k-wv.de


# If you want unqualified recipient addresses to be qualified with a different
@@ -290,6 +290,7 @@

# split_spool_directory = true

+trusted_users = wwwrun


######################################################################
@@ -394,7 +395,7 @@
# check before any black list tests.

   accept  authenticated = *
-          control       = submission
+          control       = submission/sender_retain


# Insist that any other recipient address that we accept is either in one of
# our local domains, or is in a domain for which we explicitly allow
@@ -545,9 +546,11 @@
# to set up different ones for pipe and file deliveries from aliases.

system_aliases:
+ condition = false
driver = redirect
allow_fail
allow_defer
+ require_files = /etc/aliases
data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
file_transport = address_file
@@ -579,6 +582,7 @@
# up an auto-reply, respectively.

userforward:
+ condition = false
driver = redirect
check_local_user
# local_part_suffix = +* : -*
@@ -602,6 +606,7 @@
# in the same way as xxxx@??? by this router.

localuser:
+ condition = false
driver = accept
check_local_user
# local_part_suffix = +* : -*
@@ -611,6 +616,35 @@



+ri_postmaster:
+  driver = redirect
+  domains = +local_domains
+  local_parts = postmaster : abuse
+  file = /var/mailboxes/postmaster
+  no_more
+
+ri_redirect:
+  driver = redirect
+  domains = +local_domains
+  local_parts = dsearch;/var/mailboxes/$domain
+  file = /var/mailboxes/$domain/$local_part
+  require_files = !/var/mailboxes/$domain/$local_part/.
+
+ri_mailbox:
+  driver = accept
+  domains = +local_domains
+  local_parts = dsearch;/var/mailboxes/$domain
+  transport = ri_maildir
+  require_files = /var/mailboxes/$domain/$local_part/.
+  cannot_route_message = Unknown user
+
+ri_catchall:
+  driver = redirect
+  domains = +local_domains
+  file = /var/mailboxes/$domain/catchall
+  require_files = /var/mailboxes/$domain/catchall
+  no_more
+
 ######################################################################
 #                      TRANSPORTS CONFIGURATION                      #
 ######################################################################
@@ -677,6 +711,12 @@
   driver = autoreply



+ri_maildir:
+ driver = appendfile
+ directory = /var/mailboxes/$domain/$local_part
+ maildir_format = true
+ user = exim
+ group = exim

 ######################################################################
 #                      RETRY CONFIGURATION                           #
@@ -755,6 +795,11 @@
 #  server_condition           = Authentication is not yet configured
 #  server_advertise_condition = ${if def:tls_cipher }


+login:
+ driver = plaintext
+ public_name = LOGIN
+ server_prompts = <| Username: | Password:
+ server_condition = ${if crypteq{$auth2}{${extract{1}{:}{${lookup {$auth1}lsearch{/webserver/etc/pop3/poppasswd}}}}}{yes}{no}}

 ######################################################################
 #                   CONFIGURATION FOR local_scan()                   #

$NetBSD$

--- src/route.c.orig    2007-04-17 15:06:39.000000000 +0200
+++ src/route.c    2007-08-15 15:09:20.000000000 +0200
@@ -773,7 +773,7 @@ while ((check = string_nextinlist(&listp
         errno = ENOENT;   /* Treat as non-existent */
         }
       }
-    if (errno != ENOENT)
+    if (errno != ENOENT && errno != ENOTDIR)
       {
       *perror = string_sprintf("require_files: error for %s: %s", ss,
         strerror(errno));