|
|
@ -158,21 +158,6 @@ def postfix_sender_rate(sender):
|
|
|
|
user = models.User.get(sender) or flask.abort(404)
|
|
|
|
user = models.User.get(sender) or flask.abort(404)
|
|
|
|
return flask.abort(404) if user.sender_limiter.hit() else flask.jsonify("450 4.2.1 You are sending too many emails too fast.")
|
|
|
|
return flask.abort(404) if user.sender_limiter.hit() else flask.jsonify("450 4.2.1 You are sending too many emails too fast.")
|
|
|
|
|
|
|
|
|
|
|
|
@internal.route("/postfix/sender/access/<path:sender>")
|
|
|
|
|
|
|
|
def postfix_sender_access(sender):
|
|
|
|
|
|
|
|
""" Simply reject any sender that pretends to be from a local domain
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
if '@' in sender:
|
|
|
|
|
|
|
|
if sender.startswith('<') and sender.endswith('>'):
|
|
|
|
|
|
|
|
sender = sender[1:-1]
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
localpart, domain_name = models.Email.resolve_domain(sender)
|
|
|
|
|
|
|
|
if models.Domain.query.get(domain_name):
|
|
|
|
|
|
|
|
return flask.jsonify("REJECT")
|
|
|
|
|
|
|
|
except sqlalchemy.exc.StatementError:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
return flask.abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# idna encode domain part of each address in list of addresses
|
|
|
|
# idna encode domain part of each address in list of addresses
|
|
|
|
def idna_encode(addresses):
|
|
|
|
def idna_encode(addresses):
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|