chiark / gitweb /
base.m4, exchange.m4: Move TLS tweaks to `base.m4'.
[exim-config] / local.m4
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
24 m4_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
37 SECTION(global, priv)m4_dnl
38 local_from_suffix = CONF_user_suffix_list
39
40 SECTION(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.
46 addresslist wrong_local = ! +user_extaddr
47 addresslist wrong_domain = ! *@+public
48 addresslist wrong_address = +wrong_local : +wrong_domain
49 untrusted_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
60 SECTION(routers, alias)m4_dnl
61 ## Look up the local part in the address map.
62 alias:
63         driver = redirect
64         allow_fail = true
65         allow_defer = true
66         user = CONF_filter_user
67         FILTER_TRANSPORTS
68         local_parts = nwildlsearch; CONF_alias_file
69         data = ${expand:$local_part_data}
70
71 SECTION(routers, real)m4_dnl
72 ## A special hack to get mail to a user who has a forward file.  Only for
73 ## special effects.
74 real:
75         driver = accept
76         check_local_user
77         local_part_prefix = real-
78         transport = deliver
79         condition = ${if match_ip {$sender_host_address} \
80                                   {<; ; 127.0.0.1 ; ::1}}
81
82 SECTION(routers, forward)m4_dnl
83 ## Handle user forward files.  Each user is granted an arbitrary number of
84 ## additional mailboxes named USER-SUFFIX.  Such addresses are handled by a
85 ## filter file `~/.mail/forward.suffix' in the USER's home directory.  The
86 ## filter may reject the incoming message (which is reported as an SMTP
87 ## rejection if possible).  Mail sent directly to the user is handled through
88 ## `~/.mail/forward', or `~/.forward', or if neither of those exists, by
89 ## writing the message to `/var/mail/USER'.
90 FILTER_ROUTER(filter_suffix,
91         <:FILTER_LOCALUSER(CONF_userconf_dir/forward.suffix)
92         local_part_suffix = CONF_user_suffix_list:>)
93 FILTER_ROUTER(filter,
94         <:FILTER_LOCALUSER(CONF_userconf_dir/forward):>)
95 FILTER_ROUTER(dot_forward,
96         <:FILTER_LOCALUSER($home/.forward):>)
97
98 SECTION(routers, deliver)m4_dnl
99 ## Deliver mail to a user, in the absence of any other instructions.
100 deliver:
101         driver = accept
102         check_local_user
103         transport = deliver
104         cannot_route_message = Unknown local part
105
106 DIVERT(null)
107 ###----- That's all, folks --------------------------------------------------