Zimbra ActiveSync with Z-Push v2

Install Zimbra ActiveSync with Z-Push on your Zimbra Community and enable mobile device support. This feature has been disabled but this trick will do it.

Setup Apache to access Z-Push

You need to setup your Apache server to access the folder where you are going to install your Z=Push files

vi /etc/apache2/sites-available/activesync.conf
<VirtualHost *:80>
        ServerAdmin info@mobile.domain.com
        ServerName  mobile.domain.com

        # Indexes + Directory Root.
        DirectoryIndex index.php
        DocumentRoot /var/www/z-push/
        Alias /Microsoft-Server-ActiveSync /var/www/z-push/index.php

        <Directory />
                AllowOverride All
        </Directory>

	php_flag magic_quotes_gpc off
	php_flag register_globals off
	php_flag magic_quotes_runtime off
	php_flag short_open_tag on

        # Logfiles
        ErrorLog  /var/log/apache2/z-push/error.log
        CustomLog /var/log/apache2/z-push/access.log combined

 </VirtualHost>

If you want SSL support add this to your config also:

<IfModule mod_ssl.c>
 <VirtualHost _default_:443>
        ServerAdmin info@mobile.domain.com
        ServerName  mobile.domain.com

        # Indexes + Directory Root.
        DirectoryIndex index.php
        DocumentRoot /var/www/z-push/
        Alias /Microsoft-Server-ActiveSync /var/www/z-push/index.php

        <Directory />
               AllowOverride None
        </Directory>

        php_flag magic_quotes_gpc off
        php_flag register_globals off
        php_flag magic_quotes_runtime off
        php_flag short_open_tag on

        # Logfiles
        ErrorLog  /var/log/apache2/z-push/error.log
        CustomLog /var/log/apache2/z-push/access.log combined

        #   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine on

        #   Server Certificate:
        SSLCertificateFile /etc/apache2/ssl/web.crt

        #   Server Private Key:
        SSLCertificateKeyFile /etc/apache2/ssl/server.key

        #   Server Certificate Chain:
        SSLCertificateChainFile /etc/apache2/ssl/ca.crt

        #   Certificate Authority (CA):
        SSLCACertificateFile /etc/apache2/ssl/ca.crt

 </VirtualHost>
</IfModule>
ln -s /etc/apache2/sites-available/activesync.conf /etc/apache2/sites-enabled/activesync.conf

Install latest version of Z-Push

Install the nececary requirements, create folders and download Z-Push and the Zimbra backend

apt-get install subversion php5-curl
mkdir /var/www/z-push
wget http://zarafa-deutschland.de/z-push-download/final/2.0/z-push-2.0.7-1690.tar.gz
tar zxvf z-push-2.0.7-1690.tar.gz
mv z-push-2.0.7-1690* /var/www/z-push/
mkdir /var/lib/z-push
mkdir /var/log/z-push
chgrp www-data /var/lib/z-push
chmod g+w /var/lib/z-push
chgrp www-data /var/log/z-push
chmod g+w /var/log/z-push
svn checkout svn://svn.code.sf.net/p/zimbrabackend/code/zimbra-backend/branches/z-push-2 /var/www/z-push/backend/zimbra

Don’t forget to add z-push logs to your logrotate

vi /etc/logrotate.d/z-push
/var/log/z-push/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
}

Configure Z-Push for Zimbra

Change the config file for Z-Push to use Zimbra as backend and change the Zimbra backend configuration.

vi /var/www/z-push/config.php
// Update existing fields in config
define('TIMEZONE', 'Europe/Skopje"');
define('PROVISIONING', false);
$BACKEND_PROVIDER = "BackendZimbra";
vi /var/www/z-push//backend/zimbra/config.php
define('ZIMBRA_URL', 'https://mail.domain.com');
define('ZIMBRA_USER_DIR', 'zimbra');
define('ZIMBRA_SYNC_CONTACT_PICTURES', true);
define('ZIMBRA_VIRTUAL_CONTACTS',true);
define('ZIMBRA_VIRTUAL_APPOINTMENTS',true);
define('ZIMBRA_VIRTUAL_TASKS',true);
define('ZIMBRA_IGNORE_EMAILED_CONTACTS',true);
define('ZIMBRA_HTML',true);
define('ZIMBRA_ENFORCE_VALID_EMAIL', true);
define('ZIMBRA_SMART_FOLDERS',false);
define('ZIMBRA_RETRIES_ON_HOST_CONNECT_ERROR',5);
define('ZIMBRA_LOCAL_CACHE', true);
define('ZIMBRA_DEBUG',false);

Test your configuration

Navigate your browser to http://mobile.domain.com/Microsoft-Server-ActiveSync and you should be promped with username and password

If you login with a valid username and password you should get “Z-Push – Open Source ActiveSync” with no errors on the site.

You should now be able to setup your mobile device to get your Mail, Calendar, Tasks trough Microsoft Exchange ActiveSync protocol.

Zimbra: http://www.zimbra.com/
Z-Push: http://z-push.sourceforge.net/soswp/

Nikola Stojanoski

System Administrator and Developer. Giving back to the community by blogging about my problems, solutions and practical howto's.

  • Pierre

    a2ensite activesync.conf makes the link between apache directories available and enabled, then apache2ctl restart

    thanks for your post

  • fish

    Now. I config z-push 2.0.8 SSL mode it cannot open browser

    URL : https://zpush.domain.com/Microsoft-Server-ActiveSync

    Not Found

    The requested URL /Microsoft-Server-ActiveSync was not found on this server.

    But it work in port 80.

    Help me please . Thank you

    • nstojanoski

      your SSL part of the Apache config is not configured good, Please paste the config or if you have other SSL sites maybe it’s overlapping with some of them.

  • Stanko

    Thanks