chiark / gitweb /
Delay ACL header edits until transport time.
[exim-config] / vhost.m4
CommitLineData
185b5456
MW
1### -*-m4-*-
2###
3### Virtual host support for distorted.org.uk Exim configuration
4###
5### (c) 2012 Mark Wooding
6###
7
8###----- Licensing notice ---------------------------------------------------
9###
10### This program is free software; you can redistribute it and/or modify
11### it under the terms of the GNU General Public License as published by
12### the Free Software Foundation; either version 2 of the License, or
13### (at your option) any later version.
14###
15### This program is distributed in the hope that it will be useful,
16### but WITHOUT ANY WARRANTY; without even the implied warranty of
17### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18### GNU General Public License for more details.
19###
20### You should have received a copy of the GNU General Public License
21### along with this program; if not, write to the Free Software Foundation,
22### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24m4_define(<:VHOST:>,
df2d1f18
MW
25 <:domains = ${if exists{CONF_sysconf_dir/domains.conf} \
26 {partial0-lsearch; CONF_sysconf_dir/domains.conf} \
37a602db 27 {}}:>)
185b5456
MW
28m4_define(<:VHOST_FILTER:>,
29 <:FILTER_BASE
37a602db
MW
30 VHOST
31 condition = DOMKV($2, {true}{false})
a76bd3de 32 router_home_directory = DOMKV(home, {$value} fail)
37a602db 33 $1 = ${expand:DOMKV($2)}:>)
185b5456
MW
34m4_define(<:VHOST_USER:>,
35 <:user = DOMKV(owner, {$value}{CONF_filter_user})
36 errors_to = DOMKV(errors_to, {$value} fail):>)
37
38###--------------------------------------------------------------------------
39### Routers and transports for virtual hosting.
40
41SECTION(routers, route)m4_dnl
42## If we're a front-end for some other domain, or we have special information
beb15dae
MW
43## about the domain, then pass stuff along as instructed. The hack for the
44## `transport' is very nasty; see the commentary for `smtp'.
53b7804d 45virtual_route:
185b5456
MW
46 driver = manualroute
47 self = fail
37a602db
MW
48 VHOST
49 condition = DOMKV(route, {true}{false})
ccf76d84 50 route_data = <;DOMKV(route)
185b5456 51 same_domain_copy_routing = true
beb15dae 52 transport = DOMKV(tls-min-dh-bits, {smtp_dhbits_$value}{smtp})
185b5456
MW
53 no_more
54
55SECTION(routers, virtual)m4_dnl
56## Remap recipients according to the virtual host's instructions. This must
57## be done in two passes, so that we can identify the correct user's spam
58## threshold during address verification.
7ab75d6f 59FILTER_ROUTER(virtual_data,
37a602db 60 <:VHOST_FILTER(data, redirect):>,, <:
7ab75d6f
MW
61 VHOST_USER:>)
62FILTER_ROUTER(virtual_file,
37a602db 63 <:VHOST_FILTER(file, filter):>,, <:
7ab75d6f 64 VHOST_USER:>)
185b5456 65
08248c8f
MW
66SECTION(routers, virtual-spam)m4_dnl
67## If we're dealing with a virtual host, see if we have special spam-limit
68## rules to apply.
69SPAMLIMIT_ROUTER(virtual_spam_limit_lookup)
70 VHOST
71 condition = DOMKV(spam-limit-file, {true}{false})
72 SPAMLIMIT_LOOKUP(DOMKV(spam-limit-file),
73 , $local_part,, $domain, $sender_address)
74SPAMLIMIT_ROUTER(virtual_spam_limit_userv)
75 VHOST
76 condition = DOMKV(spam-limit-userv, {true}{false})
77 SPAMLIMIT_USERV(DOMKV(spam-limit-userv),, $local_part,,
78 $domain, $sender_address)
79
6d7af7e4
MW
80SECTION(routers, virtual-tail)m4_dnl
81## Last ditch effort for required local parts. This is a bit strange because
82## we should only try this for `final' domains -- where we're not going to
83## route using the system-wide rules -- and we want the router to decline if
84## the local part isn't one of our required set so that routing as a whole
85## fails.
86virtual_endstop:
87 VHOST
88 condition = DOMKV(final, {$value}{true})
89 driver = redirect
90 no_more
91 data = ${if match_local_part{$local_part}{+required} \
92 {DOMKV(errors_to, \
93 {$value} \
94 {DOMKV(owner, \
95 {$value} \
96 {postmaster})})} \
97 {:unknown:}}
98
185b5456
MW
99DIVERT(null)
100###----- That's all, folks --------------------------------------------------