|
|
@ -17,6 +17,9 @@ STATUSES = {
|
|
|
|
"smtp": "535 5.7.8",
|
|
|
|
"smtp": "535 5.7.8",
|
|
|
|
"pop3": "-ERR Authentication failed"
|
|
|
|
"pop3": "-ERR Authentication failed"
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
"encryption": ("Must issue a STARTTLS command first", {
|
|
|
|
|
|
|
|
"smtp": "530 5.7.0"
|
|
|
|
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,12 +31,27 @@ def handle_authentication(headers):
|
|
|
|
protocol = headers["Auth-Protocol"]
|
|
|
|
protocol = headers["Auth-Protocol"]
|
|
|
|
# Incoming mail, no authentication
|
|
|
|
# Incoming mail, no authentication
|
|
|
|
if method == "none" and protocol == "smtp":
|
|
|
|
if method == "none" and protocol == "smtp":
|
|
|
|
server, port = get_server(headers["Auth-Protocol"], False)
|
|
|
|
server, port = get_server(protocol, False)
|
|
|
|
return {
|
|
|
|
if app.config["INBOUND_TLS_ENFORCE"]:
|
|
|
|
"Auth-Status": "OK",
|
|
|
|
if "Auth-SSl" in headers and headers["Auth-SSL"] == "on":
|
|
|
|
"Auth-Server": server,
|
|
|
|
return {
|
|
|
|
"Auth-Port": port
|
|
|
|
"Auth-Status": "OK",
|
|
|
|
}
|
|
|
|
"Auth-Server": server,
|
|
|
|
|
|
|
|
"Auth-Port": port
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
status, code = get_status(protocol, "encryption")
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
"Auth-Status": status,
|
|
|
|
|
|
|
|
"Auth-Error-Code" : code,
|
|
|
|
|
|
|
|
"Auth-Wait": 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
"Auth-Status": "OK",
|
|
|
|
|
|
|
|
"Auth-Server": server,
|
|
|
|
|
|
|
|
"Auth-Port": port
|
|
|
|
|
|
|
|
}
|
|
|
|
# Authenticated user
|
|
|
|
# Authenticated user
|
|
|
|
elif method == "plain":
|
|
|
|
elif method == "plain":
|
|
|
|
server, port = get_server(headers["Auth-Protocol"], True)
|
|
|
|
server, port = get_server(headers["Auth-Protocol"], True)
|
|
|
|