Hosted Exchange Replacement with DBMail, Postfix, Roundcube and Z-Push – Z-Push Setup

Now that DBMail and Roundcube are working it’s time to get push notifications working with Z-Push

  1. First step is to install the required PHP extensions
    [root@web1 tmp]# yum install php-mapi php-soap php-imap -y
    
  2. Next download and extract z-push
    [root@web1 webmail]# cd /tmp/
    [root@web1 tmp]# wget http://zarafa-deutschland.de/z-push-download/final/2.0/z-push-2.0.7-1690.tar.gz
    [root@web1 tmp]# tar -zxvf z-push-2.0.7-1690.tar.gz
    
  3. Copy the z-push files into your virtual host directory
    [root@web1 tmp]# mkdir /var/www/html/outlook
    [root@web1 tmp]# cp -rf z-push-2.0.7-1690/* /var/www/html/outlook/
    
  4. Z-Push needs a couple of directories created. Create them and set their permissions
    [root@web1 outlook]# mkdir /var/log/z-push
    [root@web1 outlook]# chown apache:apache /var/log/z-push/
    [root@web1 outlook]# mkdir /var/lib/z-push
    [root@web1 outlook]# chown apache:apache /var/lib/z-push/
    
  5. Change to the directory you copied z-push to and open the config.php file in your editor
    [root@web1 tmp]# cd /var/www/html/outlook/
    [root@web1 outlook]# vim config.php
    
  6. The following lines need to be updated with your configuration
    define('BACKEND_PROVIDER', "BackendIMAP");
    define('IMAP_SERVER', '192.168.100.16');
    define('IMAP_PORT', 143);
    
  7. Next create the virtual host in apache. You do have to create an alias as well as change some php settings for it to work
    
    ServerAdmin peter@onemetric.com.au
    DocumentRoot /var/www/html/outlook
    ServerName outlook.mytechtradie.com.au
    
    
    php_flag magic_quotes_gpc off
    php_flag register_globals off
    php_flag magic_quotes_runtime off
    php_flag short_open_tag on
    
    
    Alias /Microsoft-Server-ActiveSync /var/www/html/outlook/index.php
    
    SetEnvIf Request_URI "^/Microsoft-Server-ActiveSync(/|$)" zpush_request
    CustomLog /var/log/httpd/zpush_access_log common env=zpush_request
    
    
  8. To test it browse to http:///Microsoft-Server-ActiveSync You will be prompted for your username and password. If you enter it correctly you will then see a page with “Z-Push – Open Source ActiveSync GET not supported”
  9. You should now be able to setup Outlook/Mobile devices to sync.Test Z-Push
  10. You can also use the z-push-admin.php from the CLI to perform actions on synced phones such as remote wipe them
    [root@web1 outlook]# php z-push-admin.php -a list
    
    All synchronized devices
    
    Device id                           Synchronized users
    -----------------------------------------------------
    HTC27733c90sfd358aabfb1bfsdf5f07    peter@mytechtradie.com.au
    
  11. Note: This was just a test excercise, we haven’t configured SSL certificates so all data between the phone and server is in plan text. If you are going to put this into production please add an SSL cert.

So that is the end result. Overall I am pretty happy if the need arose we could roll back from hosted Email in the cloud to hosting on our own servers without too much hassle.

Posts in Series