version 4.41 update
[exim-website.git] / config.samples / C008
1 Date: Thu, 6 Aug 1998 16:51:07 -0700
2 From: Stuart Lynne <sl@poste.com>
3
4 And of course it is possible to do a very interesting solution to 
5 this [virtual domains] using LDAP. 
6
7 Selected portions of my configuration using LDAP:
8
9     # Routers entries
10  
11     # ensure we don't attempt delivery unless MX points to this host
12     lookuphost:
13       driver = lookuphost
14       self = fail_soft
15       transport = smtp           
16
17     # punt to director if MX points to this host
18     self:
19       driver = lookuphost
20       self = local
21       transport = smtp                    
22
23     # Director entries
24                                                            
25     # lookup virtual users in directory IFF MX matches "virtual..fireplug.net"
26     virtual_fireplug_net_aliasfile_ldap:
27       condition = "${if match{$self_hostname}{virtual..fireplug.net}{$domain}}"
28       driver = aliasfile
29       search_type = ldap
30       expand
31       errors_to = sl@whiskey.poste.com
32       queries = "ldap:://wilt.fireplug.net/?mailforwardingaddress?sub?(&(mail=$local_part@$domain)(ou=accounts)):\
33             ldap:://wilt.fireplug.net/?mailforwardingaddress?sub?(&(mail=\\\\2a@$domain)(ou=accounts))"
34                                            
35     # specify vacation processing IFF prefix of address is "vacation-"
36     vacation_prefix:
37       condition = "${if match{$local_part}{.*%.*}{$domain}}"
38       driver = smartuser
39       prefix = "vacation-"
40       transport = vacation_delivery
41       new_address = "${if match{$local_part}{(.*)%.*}{$1}{$domain}}@${if match{$local_part}{.*%(.*)}{$1}{$domain}}"
42                                           
43     # specify delivery to pop mailbox IFF prefix of address is "pop-"
44     pop_prefix:
45       condition = "${if match{$local_part}{.*%.*}{$domain}}"
46       prefix = "pop-"
47       driver = smartuser
48       transport = pop_delivery
49       new_address = "${if match{$local_part}{(.*)%.*}{$1}{$domain}}@${if match{$local_part}{.*%(.*)}{$1}{$domain}}"
50
51     # specify delivery to imap mailbox IFF prefix of address is "imap-"
52     imap_prefix:
53       condition = "${if match{$local_part}{.*%.*}{$domain}}"
54       prefix = "imap-"
55       driver = smartuser
56       transport = imap_delivery
57       new_address = "${if match{$local_part}{(.*)%.*}{$1}{$domain}}@${if match{$local_part}{.*%(.*)}{$1}{$domain}}"
58                                            
59                                                                                         
60     # Transport entries
61
62     # perform delivery to pop mailbox 
63     pop_delivery:
64       driver = appendfile
65       #create_directory
66       from_hack
67       file = /var/mail/${domain}/${lc:$local_part}
68       user = mail
69       group = mail                               
70
71     # perform delivery to imap mailbox 
72     imap_delivery:
73       driver = appendfile
74       no_from_hack
75       prefix = ""
76       suffix = ""
77       maildir_format
78       create_directory
79       directory = "/var/imap/${domain}/${length_2:${lc:$local_part}}/${lc:$local_part}/INBOX"
80       user = mail
81       group = mail            
82
83     # perform vacation processing
84     vacation_delivery:
85       driver = autoreply
86       file = /etc/exim/vacation-msg.txt
87       file_optional
88       user = mail
89       group = mail
90       to = $sender_address
91       subject = "Autoreply: Vacation message for ${local_part}@${domain}"
92       headers = "Mime-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"m1Stw9KgbdL9/HM9\""
93       text = "--m1Stw9KgbdL9/HM9\nContent-Type: text/plain; charset=us-ascii\n\
94         Content-Disposition: attachment; filename=\"${local_part}@${domain} vacation message\"\n\
95         \n\n${expand:${lookup ldap\
96         {ldap://src.fireplug.net/?mailAutoReplyText?sub?(&(mail=${local_part}@${domain})(ou=accounts))}{$value}{}}}\n\
97         \n--\n${local_part}@${domain}\n\n"
98       log = "/var/mail/${domain}/${local_part}_vlog"
99       once = "/var/mail/${domain}/${local_part}_vdb"
100                                                                             
101
102 To use this we have LDAP entries for each user that look something like:
103
104     bjectclass: top
105     objectclass: account
106     objectclass: mailRecipient
107     objectclass: fireMessagingUser
108     objectclass: person
109     objectclass: organizationalPerson
110     objectclass: inetorgPerson
111     objectclass: fireNewsAccess
112     uid: richard@big-cats.com
113     mail: richard@big-cats.com
114     mailforwardingaddress: richard@poste.com
115     mailforwardingaddress: vacation-richard%fireplug.net@popserver.fireplug.net
116     mailforwardingaddress: richard%fireplug.net@popserver.fireplug.net
117     userpassword: abcedfg
118     cn: richard
119     sn: richard
120     mailautoreplytext: I'm on vacation
121
122 The exim ldap lookup simply finds the entry based on the mail attribute
123 and returns the mailforwardingaddress attribute value.
124
125 This can take several forms and is multi-valued. For example:
126
127     richard@poste.com
128                 deliver somewhere else, in this case to another
129                 address on another server
130
131     pop-richard%big-cats.com@popserver.fireplug.net
132                 deliver into pop mailbox in virtual host directory
133                 for big-cats.com on server popserver.fireplug.net
134
135     vacation-richard%big-cats.com@popserver.fireplug.net
136                 perform vacation processing for user
137
138 This setup has the interesting property that we can setup multiple
139 mailbox servers with identical configuration files that will all
140 deliver mail to mailboxes they are told to deliver to or will forward
141 to the correct server for the mailbox. All of the interesting 
142 information about where to deliver mail for a user is in the LDAP
143 server database. 
144
145 In other words, not only can a single host act as a server for
146 multiple virtual domains, but all of the virtual domains can have
147 mailboxes spread across a number of physical servers.