From 49e09d3ca03f969ca296712d01e7eed53483873b Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 21 Dec 2016 12:16:05 +0100 Subject: [PATCH] Add autodiscover and autoconfig --- data/conf/nginx/site.conf | 10 +++++- data/web/autoconfig.php | 69 +++++++++++++++++++++++++++++++++++++++ data/web/autodiscover.php | 6 ++-- data/web/inc/vars.inc.php | 3 ++ docker-compose.yml | 1 + 5 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 data/web/autoconfig.php diff --git a/data/conf/nginx/site.conf b/data/conf/nginx/site.conf index 57d9c9bc..07578a4c 100644 --- a/data/conf/nginx/site.conf +++ b/data/conf/nginx/site.conf @@ -9,7 +9,7 @@ server { ssl_ecdh_curve secp384r1; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; index index.php index.html; - server_name _; + server_name _ autodiscover.* autoconfig.*; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /web; @@ -39,6 +39,14 @@ server { deny all; } + if ($host ~* autodiscover\.(.*)) { + rewrite ^(.*) /autodiscover.php last; + } + + if ($host ~* autoconfig\.(.*)) { + rewrite ^(.*) /autoconfig.php last; + } + location ^~ /Microsoft-Server-ActiveSync { proxy_pass http://sogo/SOGo/Microsoft-Server-ActiveSync; proxy_connect_timeout 1000; diff --git a/data/web/autoconfig.php b/data/web/autoconfig.php new file mode 100644 index 00000000..4fd03474 --- /dev/null +++ b/data/web/autoconfig.php @@ -0,0 +1,69 @@ + +';?> + + + + A mailcow mail server + mail server + + + + 993 + SSL + %EMAILADDRESS% + password-cleartext + + + + 143 + STARTTLS + %EMAILADDRESS% + password-cleartext + + + + + 995 + SSL + %EMAILADDRESS% + password-cleartext + + + + 110 + STARTTLS + %EMAILADDRESS% + password-cleartext + + + + + 465 + SSL + %EMAILADDRESS% + password-cleartext + + + + + 587 + STARTTLS + %EMAILADDRESS% + password-cleartext + + + + If you didn't change the password given to you by the administrator or if you didn't change it in a long time, please consider doing that now. + Sollten Sie das Ihnen durch den Administrator vergebene Passwort noch nicht geändert haben, empfehlen wir dies nun zu tun. Auch ein altes Passwort sollte aus Sicherheitsgründen geändert werden. + + + + + + + + diff --git a/data/web/autodiscover.php b/data/web/autodiscover.php index 45b738de..a503b80c 100644 --- a/data/web/autodiscover.php +++ b/data/web/autodiscover.php @@ -5,17 +5,17 @@ $config = array( 'useEASforOutlook' => 'yes', 'autodiscoverType' => 'activesync', 'imap' => array( - 'server' => 'MAILCOW_HOST.MAILCOW_DOMAIN', + 'server' => $mailcow_hostname, 'port' => '993', 'ssl' => 'on', ), 'smtp' => array( - 'server' => 'MAILCOW_HOST.MAILCOW_DOMAIN', + 'server' => $mailcow_hostname, 'port' => '465', 'ssl' => 'on' ), 'activesync' => array( - 'url' => 'https://MAILCOW_HOST.MAILCOW_DOMAIN/Microsoft-Server-ActiveSync' + 'url' => 'https://' . $mailcow_hostname . '/Microsoft-Server-ActiveSync' ) ); // If useEASforOutlook == no, the autodiscoverType option will be replaced to imap. diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index 6f52b969..0c716b38 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -12,6 +12,9 @@ $database_host = "mysql"; $database_user = getenv('DBUSER'); $database_pass = getenv('DBPASS'); $database_name = getenv('DBNAME'); + +// Other variables +$mailcow_hostname = getenv('MAILCOW_HOSTNAME'); date_default_timezone_set(getenv('TZ')); // Where to go after adding and editing objects diff --git a/docker-compose.yml b/docker-compose.yml index 3f4f21af..b91c5516 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,6 +82,7 @@ services: - DBNAME=${DBNAME} - DBUSER=${DBUSER} - DBPASS=${DBPASS} + - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME} - TZ=${TZ} restart: always networks: