1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00

z-push: an Exchange ActiveSync server

This commit is contained in:
Joshua Tauberer
2014-07-12 00:02:32 +00:00
parent 67c7391546
commit 2a7669a0d3
4 changed files with 168 additions and 3 deletions

View File

@@ -36,9 +36,14 @@ rm -f /etc/init.d/php-fastcgi
ln -s $(pwd)/conf/phpfcgi-initscript /etc/init.d/php-fastcgi
update-rc.d php-fastcgi defaults
# Put our webfinger server script into a well-known location.
cp tools/webfinger.php /usr/local/bin/mailinabox-webfinger.php
chown www-data.www-data /usr/local/bin/mailinabox-webfinger.php
# Put our webfinger and Exchange autodiscover.xml server scripts
# into a well-known location.
for f in webfinger exchange-autodiscover; do
cp tools/$f.php /usr/local/bin/mailinabox-$f.php
chown www-data.www-data /usr/local/bin/mailinabox-$f.php
done
# Make some space for users to customize their webfinger responses.
mkdir -p $STORAGE_ROOT/webfinger/acct;
chown -R $STORAGE_USER $STORAGE_ROOT/webfinger

54
setup/zpush.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
#
# Z-Push: The Microsoft Exchange protocol server.
# Mostly for use on iOS which doesn't support IMAP.
#
# Although Ubuntu ships Z-Push (as d-push) it has a dependency on Apache
# so we won't install it that way.
#
# Thanks to http://frontender.ch/publikationen/push-mail-server-using-nginx-and-z-push.html.
source setup/functions.sh # load our functions
source /etc/mailinabox.conf # load global vars
# Prereqs.
apt_install \
php-soap php5-imap
php5enmod imap
# Copy Z-Push into place.
if [ ! -d /usr/local/lib/z-push ]; then
ZPUSH=z-push-2.1.3-1892
wget -O /tmp/zpush.tgz http://download.z-push.org/final/2.1/$ZPUSH.tar.gz
tar -C /tmp -zxf /tmp/zpush.tgz
mv /tmp/$ZPUSH /usr/local/lib/z-push
ln -s /usr/local/lib/z-push/z-push-admin.php /usr/sbin/z-push-admin
ln -s /usr/local/lib/z-push/z-push-top.php /usr/sbin/z-push-top
rm /tmp/zpush.tgz;
fi
# Configure. Tell is to connect to email via IMAP using SSL. Since we connect on
# localhost, the certificate won't match (it may be self-signed and invalid anyway)
# so don't check the cert.
sed -i "s/define('BACKEND_PROVIDER', .*/define('BACKEND_PROVIDER', 'BackendIMAP');/" /usr/local/lib/z-push/config.php
#sed -i "s/define('IMAP_SERVER', .*/define('IMAP_SERVER', '$PRIMARY_HOSTNAME');/" /usr/local/lib/z-push/backend/imap/config.php
sed -i "s/define('IMAP_PORT', .*/define('IMAP_PORT', 993);/" /usr/local/lib/z-push/backend/imap/config.php
sed -i "s/define('IMAP_OPTIONS', .*/define('IMAP_OPTIONS', '\/ssl\/norsh\/novalidate-cert');/" /usr/local/lib/z-push/backend/imap/config.php
# Some directories it will use.
mkdir -p /var/log/z-push
mkdir -p /var/lib/z-push
chmod 750 /var/log/z-push
chmod 750 /var/lib/z-push
chown www-data:www-data /var/log/z-push
chown www-data:www-data /var/lib/z-push
# Restart service.
service php-fastcgi restart