mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
fix what counts as a required alias, fixes #434
This commit is contained in:
parent
f792deeebd
commit
462a79cf47
@ -211,7 +211,7 @@ def get_mail_aliases_ex(env):
|
|||||||
for source, destination in get_mail_aliases(env):
|
for source, destination in get_mail_aliases(env):
|
||||||
# get alias info
|
# get alias info
|
||||||
domain = get_domain(source)
|
domain = get_domain(source)
|
||||||
required = ((source in required_aliases) or (source == get_system_administrator(env)))
|
required = (source in required_aliases)
|
||||||
|
|
||||||
# add to list
|
# add to list
|
||||||
if not domain in domains:
|
if not domain in domains:
|
||||||
@ -493,15 +493,17 @@ def get_required_aliases(env):
|
|||||||
# These are the aliases that must exist.
|
# These are the aliases that must exist.
|
||||||
aliases = set()
|
aliases = set()
|
||||||
|
|
||||||
|
# The system administrator alias is required.
|
||||||
|
aliases.add(get_system_administrator(env))
|
||||||
|
|
||||||
# The hostmaster alias is exposed in the DNS SOA for each zone.
|
# The hostmaster alias is exposed in the DNS SOA for each zone.
|
||||||
aliases.add("hostmaster@" + env['PRIMARY_HOSTNAME'])
|
aliases.add("hostmaster@" + env['PRIMARY_HOSTNAME'])
|
||||||
|
|
||||||
# Get a list of domains we serve mail for, except ones for which the only
|
# Get a list of domains we serve mail for, except ones for which the only
|
||||||
# email on that domain is a postmaster/admin alias to the administrator
|
# email on that domain are the required aliases or a catch-all/domain-forwarder.
|
||||||
# or a wildcard alias (since it will forward postmaster/admin).
|
|
||||||
real_mail_domains = get_mail_domains(env,
|
real_mail_domains = get_mail_domains(env,
|
||||||
filter_aliases = lambda alias :
|
filter_aliases = lambda alias :
|
||||||
((not alias[0].startswith("postmaster@") and not alias[0].startswith("admin@")) or alias[1] != get_system_administrator(env))
|
not alias[0].startswith("postmaster@") and not alias[0].startswith("admin@")
|
||||||
and not alias[0].startswith("@")
|
and not alias[0].startswith("@")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -538,12 +540,12 @@ def kick(env, mail_result=None):
|
|||||||
for s, t in existing_aliases:
|
for s, t in existing_aliases:
|
||||||
if s == source:
|
if s == source:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Doesn't exist.
|
# Doesn't exist.
|
||||||
administrator = get_system_administrator(env)
|
administrator = get_system_administrator(env)
|
||||||
add_mail_alias(source, administrator, env, do_kick=False)
|
add_mail_alias(source, administrator, env, do_kick=False)
|
||||||
results.append("added alias %s (=> %s)\n" % (source, administrator))
|
results.append("added alias %s (=> %s)\n" % (source, administrator))
|
||||||
|
|
||||||
|
|
||||||
for alias in required_aliases:
|
for alias in required_aliases:
|
||||||
ensure_admin_alias_exists(alias)
|
ensure_admin_alias_exists(alias)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user