On 2007-12-19 at 22:46 +0100, Leonardo Boselli wrote:
> I have two servers and two more secondary MX.
> I want: avoid that the secondary mx accept email that in turn is sent to
> the primary and then bounced.
> So i would like to set a list of possible address that are accepted.
> such list however is not just a plain list of addresses, but it could be
> also a list with some addresses written as:
> abc-g*
> to say that it must accept any address whose five characters are abc-g
> what is the easier and quicher way to accomplish this, other than
> adding many director sections in exim4.conf ???
There are no Directors since Exim3, so I think that you mean Routers.
The secondary MXs have your domain(s) in the relay_domains domainlist,
right? Or some other domainlist which you can substitute in below?
Make the very first Router something like (untested):
relay_domains_filter:
driver = redirect
domains = +relay_domains
local_parts = ! /etc/mail-config-dir/relay-accept
allow_fail
data = :fail: No such user
If the domain matches +relay_domains and if the local_part does *NOT*
match the local_part patterns in the relay-accept file, then reject the
address.
This assumes one set of domains, to be treated identically, so that the
same LHS is the same in each domain. If you want to do this for just
one domain that you relay for, that's easy, just change the value of
+domains. If you want a directory with a file for each domain, then
instead try something like this router; note that it still checks
relay_domains for safety, so that you can't end up filtering mail for a
domain that isn't yours. Note that both "require_files" and "condition"
are evaluated after "local_parts", which is why I put the file checks in
domains; there are other valid ways of doing this.
relay_domains_filter:
driver = redirect
domains = ${if and{\
{match_domain {$domain}{+relay_domains}}\
{exists {/etc/mail-config-dir/relay-filters/$domain}}\
} {$domain}{}}
local_parts = ! /etc/mail-config-dir/relay-filters/$domain
allow_fail
data = :fail: No such user
-Phil