From: Mark Wooding Date: Fri, 6 May 2016 17:55:29 +0000 (+0100) Subject: vhost-local.m4: New hack for delivery to system users via vhosts. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/exim-config/commitdiff_plain/d90bdbcfdce8b632aa7fc386a82aac8788ccfe34 vhost-local.m4: New hack for delivery to system users via vhosts. I decided that `final' is awful. Now there is a new `sysusers' option which uses a separate forward file (which can usefully be symlinked to one's `forward.suffix' if one is careful). --- diff --git a/Makefile b/Makefile index 49a1179..46aa594 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ OPTIONS_srv = exchange.m4 spam.m4 vhost.m4 sat-rewrite.m4 MODES += hub OPTIONS_hub = auth.m4 exchange.m4 local.m4 spam.m4 -OPTIONS_hub += user-spam.m4 vhost.m4 +OPTIONS_hub += user-spam.m4 vhost.m4 vhost-local.m4 MODES += usersat OPTIONS_usersat = auth.m4 local.m4 satellite.m4 diff --git a/README b/README index 045e99b..22132d4 100644 --- a/README +++ b/README @@ -297,7 +297,8 @@ the name of a key wrongly. measure, mail to the special local-parts =postmaster= and =abuse= is redirected to the global administrator.) If false, local parts not routed using the =domains.conf= machinery are handled as for the - main system domain. + main system domain. You probably don't want to turn this off; see + =sysusers= instead. + home :: The home directory for the virtual domain administrator. This is available to other expansions as =$home=. @@ -353,6 +354,12 @@ the name of a key wrongly. service should be invoked to find the spam-score limit for a message sent to the virtual domain. + + sysusers :: If true, then mail can be delivered to general system + users. Local part suffixes are supported, as for the primary + domain. Spam limit customization can be done in the usual way. + Users can opt into virtual hosts by writing a + =~/.mail/forward.vhost=. + + tls-certificate :: The name (subject to expansion) of a file containing the TLS client certificate list to present when sending mail to this domain. Requires a *route* entry for the target diff --git a/divmap.m4 b/divmap.m4 index 4f41c57..048abd0 100644 --- a/divmap.m4 +++ b/divmap.m4 @@ -106,19 +106,21 @@ DEFDIVERSION(auth, 300, begin authenticators) DEFDIVERSION(routers, 400) DEFDIVERSION(routers/virtual-spam, 402) -DEFDIVERSION(routers/route, 404) -DEFDIVERSION(routers/remote, 406) -DEFDIVERSION(routers/virtual, 408) -DEFDIVERSION(routers/virtual-hooks, 410) -DEFDIVERSION(routers/virtual-tail, 412) -DEFDIVERSION(routers/real, 414) -DEFDIVERSION(routers/alias, 416) -DEFDIVERSION(routers/alias-opts, 418) -DEFDIVERSION(routers/smarthost, 420) -DEFDIVERSION(routers/allspam, 422) -DEFDIVERSION(routers/dispatch, 424) -DEFDIVERSION(routers/forward, 426) -DEFDIVERSION(routers/deliver, 428) +DEFDIVERSION(routers/virtual-sysusers-spam, 404) +DEFDIVERSION(routers/route, 406) +DEFDIVERSION(routers/remote, 408) +DEFDIVERSION(routers/virtual, 410) +DEFDIVERSION(routers/virtual-sysusers, 412) +DEFDIVERSION(routers/virtual-hooks, 414) +DEFDIVERSION(routers/virtual-tail, 416) +DEFDIVERSION(routers/real, 418) +DEFDIVERSION(routers/alias, 420) +DEFDIVERSION(routers/alias-opts, 422) +DEFDIVERSION(routers/smarthost, 424) +DEFDIVERSION(routers/allspam, 426) +DEFDIVERSION(routers/dispatch, 428) +DEFDIVERSION(routers/forward, 430) +DEFDIVERSION(routers/deliver, 432) DEFDIVERSION(transports, 500) diff --git a/vhost-local.m4 b/vhost-local.m4 new file mode 100644 index 0000000..7794669 --- /dev/null +++ b/vhost-local.m4 @@ -0,0 +1,41 @@ +### -*-m4-*- +### +### Delivery to users via vhosts for distorted.org.uk Exim configuration +### +### (c) 2016 Mark Wooding +### + +###----- Licensing notice --------------------------------------------------- +### +### This program is free software; you can redistribute it and/or modify +### it under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 2 of the License, or +### (at your option) any later version. +### +### This program is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with this program; if not, write to the Free Software Foundation, +### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +SECTION(routers, virtual-sysusers)m4_dnl +## If the vhost delivers to system users, see if any of them match. +FILTER_ROUTER(filter_vhost, + <:FILTER_LOCALUSER(CONF_userconf_dir/forward.vhost) + VHOST + condition = DOMKV(sysusers, {$value}{false}) + local_part_suffix = CONF_user_suffix_list + local_part_suffix_optional = true:>) + +SECTION(routers, virtual-sysusers-spam)m4_dnl +## If we're letting general system users receive mail through this vhost then +## we should ask them about their spam-limit rules. +USER_SPAMLIMIT_ROUTERS(<:vhost:>, + <:CURRENT_LOCAL_PART:>, <:$domain:>, <:$sender_address:>, + <:VHOST + condition = DOMKV(sysusers, {$value}{false}):>) + +###----- That's all, folks --------------------------------------------------