| 1 | ### -*-m4-*- |
| 2 | ### |
| 3 | ### Virtual host support 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(<:VHOST:>, |
| 25 | <:domains = ${if exists{CONF_sysconf_dir/domains.conf} \ |
| 26 | {partial0-lsearch; CONF_sysconf_dir/domains.conf} \ |
| 27 | {}} |
| 28 | condition = DOMKV($1):>) |
| 29 | m4_define(<:VHOST_FILTER:>, |
| 30 | <:FILTER_BASE |
| 31 | VHOST(<:$1:>) |
| 32 | $2 = ${expand:DOMKV($1, {$value} fail)}:>) |
| 33 | m4_define(<:VHOST_USER:>, |
| 34 | <:user = DOMKV(owner, {$value}{CONF_filter_user}) |
| 35 | errors_to = DOMKV(errors_to, {$value} fail):>) |
| 36 | |
| 37 | ###-------------------------------------------------------------------------- |
| 38 | ### Routers and transports for virtual hosting. |
| 39 | |
| 40 | SECTION(routers, route)m4_dnl |
| 41 | ## If we're a front-end for some other domain, or we have special information |
| 42 | ## about the domain, then pass stuff along as instructed. |
| 43 | route: |
| 44 | driver = manualroute |
| 45 | self = fail |
| 46 | VHOST(route) |
| 47 | route_data = DOMKV(route, {$value} fail) |
| 48 | same_domain_copy_routing = true |
| 49 | transport = smtp |
| 50 | no_more |
| 51 | |
| 52 | SECTION(routers, virtual)m4_dnl |
| 53 | ## Remap recipients according to the virtual host's instructions. This must |
| 54 | ## be done in two passes, so that we can identify the correct user's spam |
| 55 | ## threshold during address verification. |
| 56 | virtual_verify_data: |
| 57 | VHOST_FILTER(redirect, data) |
| 58 | FILTER_VERIFY |
| 59 | virtual_verify_file: |
| 60 | VHOST_FILTER(filter, file) |
| 61 | FILTER_VERIFY |
| 62 | |
| 63 | virtual_filter_data: |
| 64 | VHOST_FILTER(redirect, data) |
| 65 | VHOST_USER |
| 66 | virtual_filter_file: |
| 67 | VHOST_FILTER(filter, file) |
| 68 | VHOST_USER |
| 69 | |
| 70 | DIVERT(null) |
| 71 | ###----- That's all, folks -------------------------------------------------- |