Add autodiscover and autoconfig

master
andryyy 2016-12-21 12:16:05 +01:00
parent 036d547415
commit 49e09d3ca0
5 changed files with 85 additions and 4 deletions

View File

@ -9,7 +9,7 @@ server {
ssl_ecdh_curve secp384r1; ssl_ecdh_curve secp384r1;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
index index.php index.html; index index.php index.html;
server_name _; server_name _ autodiscover.* autoconfig.*;
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;
root /web; root /web;
@ -39,6 +39,14 @@ server {
deny all; deny all;
} }
if ($host ~* autodiscover\.(.*)) {
rewrite ^(.*) /autodiscover.php last;
}
if ($host ~* autoconfig\.(.*)) {
rewrite ^(.*) /autoconfig.php last;
}
location ^~ /Microsoft-Server-ActiveSync { location ^~ /Microsoft-Server-ActiveSync {
proxy_pass http://sogo/SOGo/Microsoft-Server-ActiveSync; proxy_pass http://sogo/SOGo/Microsoft-Server-ActiveSync;
proxy_connect_timeout 1000; proxy_connect_timeout 1000;

View File

@ -0,0 +1,69 @@
<?php
if (empty($mailcow_hostname)) { exit(); }
header("Content-Type: application/xml");
require_once "inc/vars.inc.php";
?>
<?='<?xml version="1.0"?>';?>
<clientConfig version="1.1">
<emailProvider id="<?=$mailcow_hostname;?>">
<displayName>A mailcow mail server</displayName>
<displayShortName>mail server</displayShortName>
<incomingServer type="imap">
<hostname><?=$mailcow_hostname;?></hostname>
<port>993</port>
<socketType>SSL</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<incomingServer type="imap">
<hostname><?=$mailcow_hostname;?></hostname>
<port>143</port>
<socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<incomingServer type="pop3">
<hostname><?=$mailcow_hostname;?></hostname>
<port>995</port>
<socketType>SSL</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<incomingServer type="pop3">
<hostname><?=$mailcow_hostname;?></hostname>
<port>110</port>
<socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<outgoingServer type="smtp">
<hostname><?=$mailcow_hostname;?></hostname>
<port>465</port>
<socketType>SSL</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</outgoingServer>
<outgoingServer type="smtp">
<hostname><?=$mailcow_hostname;?></hostname>
<port>587</port>
<socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</outgoingServer>
<enable visiturl="https://<?=$mailcow_hostname;?>/admin.php">
<instruction>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.</instruction>
<instruction lang="de">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.</instruction>
</enable>
</emailProvider>
<webMail>
<loginPage url="https://<?=$mailcow_hostname;?>/SOGo/" />
</webMail>
</clientConfig>

View File

@ -5,17 +5,17 @@ $config = array(
'useEASforOutlook' => 'yes', 'useEASforOutlook' => 'yes',
'autodiscoverType' => 'activesync', 'autodiscoverType' => 'activesync',
'imap' => array( 'imap' => array(
'server' => 'MAILCOW_HOST.MAILCOW_DOMAIN', 'server' => $mailcow_hostname,
'port' => '993', 'port' => '993',
'ssl' => 'on', 'ssl' => 'on',
), ),
'smtp' => array( 'smtp' => array(
'server' => 'MAILCOW_HOST.MAILCOW_DOMAIN', 'server' => $mailcow_hostname,
'port' => '465', 'port' => '465',
'ssl' => 'on' 'ssl' => 'on'
), ),
'activesync' => array( '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. // If useEASforOutlook == no, the autodiscoverType option will be replaced to imap.

View File

@ -12,6 +12,9 @@ $database_host = "mysql";
$database_user = getenv('DBUSER'); $database_user = getenv('DBUSER');
$database_pass = getenv('DBPASS'); $database_pass = getenv('DBPASS');
$database_name = getenv('DBNAME'); $database_name = getenv('DBNAME');
// Other variables
$mailcow_hostname = getenv('MAILCOW_HOSTNAME');
date_default_timezone_set(getenv('TZ')); date_default_timezone_set(getenv('TZ'));
// Where to go after adding and editing objects // Where to go after adding and editing objects

View File

@ -82,6 +82,7 @@ services:
- DBNAME=${DBNAME} - DBNAME=${DBNAME}
- DBUSER=${DBUSER} - DBUSER=${DBUSER}
- DBPASS=${DBPASS} - DBPASS=${DBPASS}
- MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
- TZ=${TZ} - TZ=${TZ}
restart: always restart: always
networks: networks: