Handle relays as virtual transports through podop

master
kaiyou 6 years ago
parent 9890e1fb2a
commit f5668dea51

@ -35,11 +35,8 @@ def postfix_alias_map(alias):
return flask.abort(404) return flask.abort(404)
@internal.route("/postfix/spoofed/<email>")
def postfix_spoofed(email):
return flask.abort(404)
@internal.route("/postfix/transport/<email>") @internal.route("/postfix/transport/<email>")
def postfix_transport(email): def postfix_transport(email):
return flask.abort(404) localpart, domain = email.split('@', 1) if '@' in email else (None, email)
relay = models.Relay.query.get(domain) or flask.abort(404)
return flask.jsonify("smtp:[{}]".format(relay.smtp))

@ -62,8 +62,8 @@ virtual_mailbox_domains = ${podop}domain
virtual_mailbox_maps = ${podop}mailbox virtual_mailbox_maps = ${podop}mailbox
# Mails are transported if required, then forwarded to Dovecot for delivery # Mails are transported if required, then forwarded to Dovecot for delivery
# relay_domains = ${podop}transport relay_domains = ${podop}transport
# transport_maps = ${podop}transport transport_maps = ${podop}transport
virtual_transport = lmtp:inet:{{ HOST_LMTP }} virtual_transport = lmtp:inet:{{ HOST_LMTP }}
# In order to prevent Postfix from running DNS query, enforce the use of the # In order to prevent Postfix from running DNS query, enforce the use of the

@ -17,7 +17,6 @@ def start_podop():
("alias", "url", "http://admin/internal/postfix/alias/§"), ("alias", "url", "http://admin/internal/postfix/alias/§"),
("domain", "url", "http://admin/internal/postfix/domain/§"), ("domain", "url", "http://admin/internal/postfix/domain/§"),
("mailbox", "url", "http://admin/internal/postfix/mailbox/§"), ("mailbox", "url", "http://admin/internal/postfix/mailbox/§"),
("spoofed", "url", "http://admin/internal/postfix/spoofed/§"),
]) ])
convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ)) convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))

Loading…
Cancel
Save