Autodiscovery microsoft style

master
Florent Daigniere 3 years ago
parent 523cee1680
commit ccd2cad4f1

@ -37,6 +37,38 @@ def autoconfig_mozilla():
<descr lang=\"en\">Configure your email client</descr>
</documentation>
</emailProvider>
</clientConfig>\r\n
'''
</clientConfig>\r\n'''
return flask.Response(xml, mimetype='text/xml', status=200)
@internal.route("/autoconfig/microsoft")
def autoconfig_microsoft():
# https://docs.microsoft.com/en-us/previous-versions/office/office-2010/cc511507(v=office.14)?redirectedfrom=MSDN#Anchor_3
hostname = app.config['HOSTNAME']
xml = f'''<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<Autodiscover xmlns=\"https://schemas.microsoft.com/exchange/autodiscover/responseschema/2006\">
<Response xmlns=\"https://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a\">
<Account>
<AccountType>email</AccountType>
<Action>settings</Action>
<Protocol>
<Type>IMAP</Type>
<Server>{hostname}</Server>
<Port>993</Port>
<DomainRequired>on</DomainRequired>
<SPA>off</SPA>
<SSL>on</SSL>
<AuthRequired>on</AuthRequired>
</Protocol>
<Protocol>
<Type>SMTP</Type>
<Server>{hostname}</Server>
<Port>465</Port>
<DomainRequired>on</DomainRequired>
<SPA>off</SPA>
<SSL>on</SSL>
<AuthRequired>on</AuthRequired>
</Protocol>
</Account>
</Response>
</Autodiscover>\r\n'''
return flask.Response(xml, mimetype='text/xml', status=200)

@ -121,8 +121,14 @@ http {
add_header Referrer-Policy 'same-origin';
# mozilla autoconfiguration
location ^~ /.well-known/autoconfig/mail/config-v1.1.xml {
rewrite /.well-known/autoconfig/mail/config-v1.1.xml /internal/autoconfig/mozilla break;
location ~ ^/(\.well\-known/autoconfig/)?mail/config\-v1\.1\.xml {
rewrite ^ /internal/autoconfig/mozilla break;
include /etc/nginx/proxy.conf;
proxy_pass http://$admin;
}
# microsoft autoconfiguration
location ~* ^/Autodiscover/Autodiscover.xml {
rewrite ^ /internal/autoconfig/microsoft break;
include /etc/nginx/proxy.conf;
proxy_pass http://$admin;
}

Loading…
Cancel
Save