From b9ca74c9159e16283b314351cce94f9208fae6e0 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sat, 31 Jan 2015 21:33:18 +0000 Subject: [PATCH] implement Mozilla (e.g. Thunderbird) autoconfiguration file fixes #241 --- conf/mozilla-autoconfig.xml | 44 +++++++++++++++++++++++++++++++++++++ conf/nginx.conf | 3 +++ setup/web.sh | 10 +++++++++ 3 files changed, 57 insertions(+) create mode 100644 conf/mozilla-autoconfig.xml diff --git a/conf/mozilla-autoconfig.xml b/conf/mozilla-autoconfig.xml new file mode 100644 index 00000000..03e2fef3 --- /dev/null +++ b/conf/mozilla-autoconfig.xml @@ -0,0 +1,44 @@ + + + + PRIMARY_HOSTNAME + + PRIMARY_HOSTNAME (Mail-in-a-Box) + PRIMARY_HOSTNAME + + + PRIMARY_HOSTNAME + 993 + SSL + %EMAILADDRESS% + password-cleartext + + + + PRIMARY_HOSTNAME + 587 + STARTTLS + %EMAILADDRESS% + password-cleartext + true + true + + + + PRIMARY_HOSTNAME website. + + + + + + + %EMAILADDRESS% + + + + + + + + + diff --git a/conf/nginx.conf b/conf/nginx.conf index 030a706d..6f00ac07 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -38,6 +38,9 @@ server { location = /mailinabox.mobileconfig { alias /var/lib/mailinabox/mobileconfig.xml; } + location = /.well-known/autoconfig/mail/config-v1.1.xml { + alias /var/lib/mailinabox/mozilla-autoconfig.xml; + } # Roundcube Webmail configuration. rewrite ^/mail$ /mail/ redirect; diff --git a/setup/web.sh b/setup/web.sh index ec1ef0ac..4e974ea8 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -53,6 +53,16 @@ cat conf/ios-profile.xml \ > /var/lib/mailinabox/mobileconfig.xml chmod a+r /var/lib/mailinabox/mobileconfig.xml +# Create the Mozilla Auto-configuration file which is exposed via the +# nginx configuration at /.well-known/autoconfig/mail/config-v1.1.xml. +# The format of the file is documented at: +# https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat +# and https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo. +cat conf/mozilla-autoconfig.xml \ + | sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \ + > /var/lib/mailinabox/mozilla-autoconfig.xml +chmod a+r /var/lib/mailinabox/mozilla-autoconfig.xml + # make a default homepage if [ -d $STORAGE_ROOT/www/static ]; then mv $STORAGE_ROOT/www/static $STORAGE_ROOT/www/default; fi # migration #NODOC mkdir -p $STORAGE_ROOT/www/default