Email server Autoconfiguration with Zimbra and Z-Push

You have your email server but when you setup new clients or users, you find it tedious to remember all the settings. Or if you want others to use your email server you find it difficult for those users due to many steps it would take to add your email server. Well lucky for you you can keep using your opensource free email server, in my case Zimbra. Once you get autodiscover configured, users just need to type in their email address and password and then the rest will be added automatically!

Overview

  1. Setup DNS for autodiscover.example.com
  2. Setup certifcates for autodiscover.example.com
  3. Configure Nginx with autodiscover certificate and autodiscover z-push module
  4. Configure Autodiscover module to connect to Z-Push and Email Server (Zimbra)

Requirements

  • Ubuntu Packages “z-push-common, z-push-autodiscover, php7.0-xml”
  • DNS “autodiscover.example.com”
  • Email Server in this case “Zimbra Open Source Edition”
  • Z-Push Server (I am running Autodiscover and Z-Push on same server)

Set your DNS for “autodiscover.example.com” to your autodiscover server
Generate certificates for “autodiscover.example.com” and put them into locations defined below.

/etc/ssl/autodiscover.example.com.crt
/etc/ssl/private/autodiscover.example.com.key

Step 1: Install Ubuntu packages

sudo apt-get update
sudo apt-get install z-push-autodiscover php7.0-xml

Step 2: Update Nignx Configuration

server {
server_name autodiscover.example.com;
listen 443 ssl; listen [::]:443 ssl; ssl on; ssl_certificate /etc/ssl/autodiscover.example.com.crt; ssl_certificate_key /etc/ssl/private/autodiscover.example.com.key; # If you're using PHP-FPM uncomment the following lines. include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param REQUEST_URI $1; fastcgi_param PHP_FLAG "magic_quotes_gpc=off \n register_globals=off \n magic_quotes_runtime=off \n short_open_tag=on"; fastcgi_param PHP_VALUE "post_max_size=20M \n upload_max_filesize=20M \n max_execution_time=3660"; fastcgi_param HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities fastcgi_read_timeout 3660; # Z-Push Ping might run 3600s, but to be safe location ~* /AutoDiscover/AutoDiscover.xml { alias /usr/share/z-push/autodiscover/autodiscover.php; access_log /var/log/nginx/z-push-autodiscover-access.log; error_log /var/log/nginx/z-push-autodiscover-error.log; # Select one of the fastcgi_pass values or adapt to your configuration #fastcgi_pass unix:/var/run/php5-fpm.sock; # for PHP 5.X Debian/Ubuntu fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; # usually RedHat and its derivatives #fastcgi_pass 127.0.0.1:9000; # default php-fpm config #fastcgi_index autodiscover.php; }
}

Step 3: Configure Autodiscover configuration

sudo nano /usr/share/z-push/autodiscover/config.php
define('ZPUSH_HOST', 'zpush.example.com');
define('USE_FULLEMAIL_FOR_LOGIN', true);
define('BACKEND_PROVIDER', 'BackendZimbra');

Troubleshooting

Ensure you have php-xml & z-push-autodiscover installed
Certificate for autodiscover.example.com
Check /var/log/z-push/z-push.log

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top