use z-push autodisover instead
This commit is contained in:
parent
da17466526
commit
a0df18506b
|
@ -61,7 +61,7 @@ server {
|
||||||
# Microsoft Exchange autodiscover.xml for email
|
# Microsoft Exchange autodiscover.xml for email
|
||||||
location /autodiscover/autodiscover.xml {
|
location /autodiscover/autodiscover.xml {
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME /usr/local/bin/mailinabox-exchange-autodiscover.php;
|
fastcgi_param SCRIPT_FILENAME /usr/local/lib/z-push/autodiscover/autodiscover.php;
|
||||||
fastcgi_param PHP_VALUE "short_open_tag=Off";
|
fastcgi_param PHP_VALUE "short_open_tag=Off";
|
||||||
fastcgi_pass php-fpm;
|
fastcgi_pass php-fpm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
/***********************************************
|
||||||
|
* File : config.php
|
||||||
|
* Project : Z-Push
|
||||||
|
* Descr : Autodiscover configuration file
|
||||||
|
************************************************/
|
||||||
|
|
||||||
|
/**********************************************************************************
|
||||||
|
* Default settings
|
||||||
|
*/
|
||||||
|
// Defines the base path on the server
|
||||||
|
define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/');
|
||||||
|
|
||||||
|
// The Z-Push server location for the autodiscover response
|
||||||
|
define('SERVERURL', 'https://'.$_SERVER['SERVER_NAME'].'/Microsoft-Server-ActiveSync');
|
||||||
|
|
||||||
|
define('USE_FULLEMAIL_FOR_LOGIN', true);
|
||||||
|
|
||||||
|
define('LOGFILEDIR', '/var/log/z-push/');
|
||||||
|
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
||||||
|
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
||||||
|
define('LOGLEVEL', LOGLEVEL_INFO);
|
||||||
|
define('LOGUSERLEVEL', LOGLEVEL);
|
||||||
|
/**********************************************************************************
|
||||||
|
* Backend settings
|
||||||
|
*/
|
||||||
|
// the backend data provider
|
||||||
|
define('BACKEND_PROVIDER', 'BackendCombined');
|
||||||
|
?>
|
|
@ -60,6 +60,10 @@ cp conf/zpush/backend_carddav.php /usr/local/lib/z-push/backend/carddav/config.p
|
||||||
rm -f /usr/local/lib/z-push/backend/caldav/config.php
|
rm -f /usr/local/lib/z-push/backend/caldav/config.php
|
||||||
cp conf/zpush/backend_caldav.php /usr/local/lib/z-push/backend/caldav/config.php
|
cp conf/zpush/backend_caldav.php /usr/local/lib/z-push/backend/caldav/config.php
|
||||||
|
|
||||||
|
# Configure Autodiscover
|
||||||
|
rm -f /usr/local/lib/z-push/autodiscover/config.php
|
||||||
|
cp conf/zpush/autodiscover_config.php /usr/local/lib/z-push/autodiscover/config.php
|
||||||
|
|
||||||
# Some directories it will use.
|
# Some directories it will use.
|
||||||
|
|
||||||
mkdir -p /var/log/z-push
|
mkdir -p /var/log/z-push
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
<?php
|
|
||||||
// Parse our configuration file to get the PRIMARY_HOSTNAME.
|
|
||||||
$PRIMARY_HOSTNAME = NULL;
|
|
||||||
foreach (file("/etc/mailinabox.conf") as $line) {
|
|
||||||
$line = explode("=", rtrim($line), 2);
|
|
||||||
if ($line[0] == "PRIMARY_HOSTNAME") {
|
|
||||||
$PRIMARY_HOSTNAME = $line[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($PRIMARY_HOSTNAME == NULL) exit("no PRIMARY_HOSTNAME");
|
|
||||||
|
|
||||||
// We might get two kinds of requests.
|
|
||||||
$post_body = file_get_contents('php://input');
|
|
||||||
$match = preg_match('/<AcceptableResponseSchema>(.*?)<\/AcceptableResponseSchema>/', $post_body, $match);
|
|
||||||
$AcceptableResponseSchema = $match[1];
|
|
||||||
|
|
||||||
if ($AcceptableResponseSchema == "http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006") {
|
|
||||||
// There is no way to convey the user's login name with this?
|
|
||||||
?>
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Autodiscover xmlns:autodiscover="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006">
|
|
||||||
<autodiscover:Response>
|
|
||||||
<autodiscover:Action>
|
|
||||||
<autodiscover:Settings>
|
|
||||||
<autodiscover:Server>
|
|
||||||
<autodiscover:Type>MobileSync</autodiscover:Type>
|
|
||||||
<autodiscover:Url>https://<?php echo $PRIMARY_HOSTNAME ?></autodiscover:Url>
|
|
||||||
<autodiscover:Name>https://<?php echo $PRIMARY_HOSTNAME ?></autodiscover:Name>
|
|
||||||
</autodiscover:Server>
|
|
||||||
</autodiscover:Settings>
|
|
||||||
</autodiscover:Action>
|
|
||||||
</autodiscover:Response>
|
|
||||||
</Autodiscover>
|
|
||||||
<?php
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// I don't know when this is actually used. I implemented this before seeing that
|
|
||||||
// it is not what my phone wanted.
|
|
||||||
|
|
||||||
// Parse the email address out of the POST request, which
|
|
||||||
// we pass back as the login name.
|
|
||||||
$match = preg_match('/<EMailAddress>(.*?)<\/EMailAddress>/', $post_body, $match);
|
|
||||||
$LOGIN = $match[1];
|
|
||||||
|
|
||||||
header("Content-type: text/xml");
|
|
||||||
?>
|
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
|
|
||||||
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
|
|
||||||
<ServiceHome>https://<?php echo $PRIMARY_HOSTNAME ?></ServiceHome>
|
|
||||||
<Account>
|
|
||||||
<AccountType>email</AccountType>
|
|
||||||
<Action>settings</Action>
|
|
||||||
|
|
||||||
<Protocol>
|
|
||||||
<Type>IMAP</Type>
|
|
||||||
<Server><?php echo $PRIMARY_HOSTNAME ?></Server>
|
|
||||||
<Port>993</Port>
|
|
||||||
<SSL>on</SSL>
|
|
||||||
<LoginName><?php echo $LOGIN ?></LoginName>
|
|
||||||
</Protocol>
|
|
||||||
|
|
||||||
<Protocol>
|
|
||||||
<Type>SMTP</Type>
|
|
||||||
<Server><?php echo $PRIMARY_HOSTNAME ?></Server>
|
|
||||||
<Port>587</Port>
|
|
||||||
<SSL>on</SSL>
|
|
||||||
<LoginName><?php echo $LOGIN ?></LoginName>
|
|
||||||
</Protocol>
|
|
||||||
|
|
||||||
<Protocol>
|
|
||||||
<Type>DAV</Type>
|
|
||||||
<Server>https://<?php echo $PRIMARY_HOSTNAME ?></Server>
|
|
||||||
<SSL>on</SSL>
|
|
||||||
<DomainRequired>on</DomainRequired>
|
|
||||||
<LoginName><?php echo $LOGIN ?></LoginName>
|
|
||||||
</Protocol>
|
|
||||||
|
|
||||||
<Protocol>
|
|
||||||
<Type>WEB</Type>
|
|
||||||
<Server>https://<?php echo $PRIMARY_HOSTNAME ?>/mail</Server>
|
|
||||||
<SSL>on</SSL>
|
|
||||||
</Protocol>
|
|
||||||
</Account>
|
|
||||||
</Response>
|
|
||||||
</Autodiscover>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
Loading…
Reference in New Issue