chiark / gitweb /
Initial commit.
[exim-config] / local.m4
CommitLineData
185b5456
MW
1### -*-m4-*-
2###
3### Local senders and recipients 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(<:FILTER_LOCALUSER:>,
25 <:FILTER_BASE
26 check_local_user
27 ignore_enotdir
28 sieve_useraddress = $local_part
29 sieve_subaddress = CONF_user_extaddr_fixup
30 sieve_vacation_directory = CONF_userconf_dir/vacation
31 condition = ${if exists {<:$1:>}}
32 file = <:$1:>:>)
33
34###--------------------------------------------------------------------------
35### Be flexible about originator addresses, as long as they probably work.
36
37SECTION(global, priv)m4_dnl
38local_from_suffix = CONF_user_suffix_list
39
40SECTION(global, process)m4_dnl
41## Restrict users to plausible envelope sender addresses. This is
42## surprisingly fiddly. What I actually want to say is that the local part
43## must match ^$sender_ident(\$|-) and the domain part must match an
44## appropriate domain; but writing a conjunction is rather tricky. And so we
45## must burn some addresslist variables.
46addresslist wrong_local = ! +user_extaddr
47addresslist wrong_domain = ! *@+public
48addresslist wrong_address = +wrong_local : +wrong_domain
49untrusted_set_sender = : \
50 ${LOOKUP_DOMAIN($sender_address_domain,
51 {${if and {{match_local_part {$sender_ident} {+dom_users}} \
52 {match_local_part {$sender_address_local_part} \
53 {+dom_locals}}} \
54 {*}}})} : \
55 ! +wrong_address
56
57###--------------------------------------------------------------------------
58### Forwarding and redirection for incoming mail.
59
60SECTION(routers, alias)m4_dnl
61## Look up the local part in the address map.
62alias:
63 driver = redirect
64 allow_fail = true
65 allow_defer = true
66 user = CONF_filter_user
67 FILTER_TRANSPORTS
68 data = ${lookup {$local_part} lsearch {CONF_alias_file}}
69
70SECTION(routers, real)m4_dnl
71## A special hack to get mail to a user who has a forward file. Only for
72## special effects.
73real:
74 driver = accept
75 check_local_user
76 local_part_prefix = real-
77 transport = deliver
78 condition = ${if match_ip {$sender_host_address} \
79 {<; ; 127.0.0.1 ; ::1}}
80
81SECTION(routers, forward)m4_dnl
82## Handle user forward files. Each user is granted an arbitrary number of
83## additional mailboxes named USER-SUFFIX. Such addresses are handled by a
84## filter file `~/.mail/forward.suffix' in the USER's home directory. The
85## filter may reject the incoming message (which is reported as an SMTP
86## rejection if possible). Mail sent directly to the user is handled through
87## `~/.mail/forward', or `~/.forward', or if neither of those exists, by
88## writing the message to `/var/mail/USER'.
89filter_verify:
90 FILTER_LOCALUSER(CONF_userconf_dir/forward.suffix)
91 FILTER_VERIFY
92 local_part_suffix = CONF_user_suffix_list
93filter_suffix:
94 FILTER_LOCALUSER(CONF_userconf_dir/forward.suffix)
95 local_part_suffix = CONF_user_suffix_list
96 FILTER_TRANSPORTS
97filter:
98 FILTER_LOCALUSER(CONF_userconf_dir/forward)
99 FILTER_TRANSPORTS
100dot_forward:
101 FILTER_LOCALUSER($home/.forward)
102 FILTER_TRANSPORTS
103
104SECTION(routers, deliver)m4_dnl
105## Deliver mail to a user, in the absence of any other instructions.
106deliver:
107 driver = accept
108 check_local_user
109 transport = deliver
110 cannot_route_message = Unknown local part
111
112DIVERT(null)
113###----- That's all, folks --------------------------------------------------