|
|
@ -1,5 +1,7 @@
|
|
|
|
from mailu import db, models
|
|
|
|
from mailu import db, models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import socket
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SUPPORTED_AUTH_METHODS = ["none", "plain"]
|
|
|
|
SUPPORTED_AUTH_METHODS = ["none", "plain"]
|
|
|
|
|
|
|
|
|
|
|
@ -12,6 +14,12 @@ STATUSES = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERVER_MAP = {
|
|
|
|
|
|
|
|
"imap": ("imap", 143),
|
|
|
|
|
|
|
|
"smtp": ("smtp", 25)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_authentication(headers):
|
|
|
|
def handle_authentication(headers):
|
|
|
|
""" Handle an HTTP nginx authentication request
|
|
|
|
""" Handle an HTTP nginx authentication request
|
|
|
|
See: http://nginx.org/en/docs/mail/ngx_mail_auth_http_module.html#protocol
|
|
|
|
See: http://nginx.org/en/docs/mail/ngx_mail_auth_http_module.html#protocol
|
|
|
@ -57,8 +65,6 @@ def get_status(protocol, status):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_server(protocol):
|
|
|
|
def get_server(protocol):
|
|
|
|
servers = {
|
|
|
|
hostname, port = SERVER_MAP[protocol]
|
|
|
|
"imap": ("172.18.0.12", 143),
|
|
|
|
address = socket.gethostbyname(hostname)
|
|
|
|
"smtp": ("172.18.0.9", 25)
|
|
|
|
return address, port
|
|
|
|
}
|
|
|
|
|
|
|
|
return servers[protocol]
|
|
|
|
|
|
|
|