chiark / gitweb /
vhost-local.m4: New hack for delivery to system users via vhosts.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 6 May 2016 17:55:29 +0000 (18:55 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 7 May 2016 07:59:47 +0000 (08:59 +0100)
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).

Makefile
README
divmap.m4
vhost-local.m4 [new file with mode: 0644]

index 49a117939a9a8448a2c357b8d631ca32da44c5ce..46aa594400b73685df8e0c5ab89cbce488fe86d3 100644 (file)
--- 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 045e99bbdc365054dc01f7f3ce7456cacb7526d3..22132d4e415bd2503ede54c27c2e350fa981b259 100644 (file)
--- 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
index 4f41c57eab4fe6799a60e30ac61f603263f631e9..048abd0445d819fcfd4f7d3de351f06a55e15830 100644 (file)
--- 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 (file)
index 0000000..7794669
--- /dev/null
@@ -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 --------------------------------------------------