From 6d7af7e4c307f410b2494a0431f2a8b070e39af1 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 6 Mar 2014 01:59:29 +0000 Subject: [PATCH] divmap.m4, lists.m4, vhost.m4: End-stop for required local parts. We really want to support `postmaster' and `abuse' (any maybe other local parts which every domain should have), so send them to the domain owner if nobody has accepted them already. This involves moving the end-stop for `final' domains into a separate router, which is a little strange in its configuration, but it does the job. --- divmap.m4 | 14 ++++++++------ lists.m4 | 3 +++ vhost.m4 | 20 +++++++++++++++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/divmap.m4 b/divmap.m4 index ed9e47a..0e71d7f 100644 --- a/divmap.m4 +++ b/divmap.m4 @@ -107,12 +107,14 @@ DEFDIVERSION(routers, 400) DEFDIVERSION(routers/route, 402) DEFDIVERSION(routers/remote, 404) DEFDIVERSION(routers/virtual, 406) -DEFDIVERSION(routers/real, 408) -DEFDIVERSION(routers/alias, 410) -DEFDIVERSION(routers/allspam, 412) -DEFDIVERSION(routers/dispatch, 414) -DEFDIVERSION(routers/forward, 416) -DEFDIVERSION(routers/deliver, 418) +DEFDIVERSION(routers/virtual-hooks, 408) +DEFDIVERSION(routers/virtual-tail, 410) +DEFDIVERSION(routers/real, 412) +DEFDIVERSION(routers/alias, 414) +DEFDIVERSION(routers/allspam, 416) +DEFDIVERSION(routers/dispatch, 418) +DEFDIVERSION(routers/forward, 420) +DEFDIVERSION(routers/deliver, 422) DEFDIVERSION(transports, 500) diff --git a/lists.m4 b/lists.m4 index 52c42da..485663c 100644 --- a/lists.m4 +++ b/lists.m4 @@ -54,5 +54,8 @@ localpartlist dom_locals = ${expand:KV(locals, {$value}{+user_extaddr})} localpartlist user_extaddr = ^CONF_user_extaddr_regexp addresslist user_extaddr = ^CONF_user_extaddr_regexp +## All of the `standard' local parts which ought to be provided by a domain. +localpartlist required = postmaster : abuse + DIVERT(null) ###----- That's all, folks -------------------------------------------------- diff --git a/vhost.m4 b/vhost.m4 index 4ac677b..96b7505 100644 --- a/vhost.m4 +++ b/vhost.m4 @@ -30,7 +30,6 @@ m4_define(<:VHOST_FILTER:>, VHOST condition = DOMKV($2, {true}{false}) router_home_directory = DOMKV(home, {$value} fail) - more = ${if bool{DOMKV(final, {$value}{true})} {false} {true}} $1 = ${expand:DOMKV($2)}:>) m4_define(<:VHOST_USER:>, <:user = DOMKV(owner, {$value}{CONF_filter_user}) @@ -63,5 +62,24 @@ FILTER_ROUTER(virtual_file, <:VHOST_FILTER(file, filter):>,, <: VHOST_USER:>) +SECTION(routers, virtual-tail)m4_dnl +## Last ditch effort for required local parts. This is a bit strange because +## we should only try this for `final' domains -- where we're not going to +## route using the system-wide rules -- and we want the router to decline if +## the local part isn't one of our required set so that routing as a whole +## fails. +virtual_endstop: + VHOST + condition = DOMKV(final, {$value}{true}) + driver = redirect + no_more + data = ${if match_local_part{$local_part}{+required} \ + {DOMKV(errors_to, \ + {$value} \ + {DOMKV(owner, \ + {$value} \ + {postmaster})})} \ + {:unknown:}} + DIVERT(null) ###----- That's all, folks -------------------------------------------------- -- 2.11.0