[TUTO] Push Mail sur un serveur Zimbra OSE via Z-push
Je travaille depuis un moment sur Zimbra. J’ai remplacé il y à peu mon serveur d’entreprise Lotus Domino par Zimbra NE. Dans sa version NE, Zimbra possède un outil de synchro mobile intégré et très performant donc pas de problème. Par contre j’utilise aussi la version Zimbra OSE pour mes potes et des associations. C’est pour cela qu’il était pour moi interessant de fournir à mes utilisateurs une solution de Push-mail performante et gratuite.
C’est pour cela que je me suis penché sur Z-push. Z-Push est une solution Open-Source de Zarafa qui permet de faire du push mail depuis des terminaux mobiles. Mais aussi la synchro des contacts et des calendriers !
Z-Push utilise le protocole Microsoft ActiveSync qui est supporté sur un grand nombre de terminaux mobiles (Iphone, Android, Windows Mobile, Maemo, Symbian…).
J’ai effectué mon install sur un DomU Xen routed à base d’un template Ubuntu 10.04 64 bits paravirtualisé
Installation des prérequis:
Installation de apache2, php5 et php-curl openssl
Activation de ssl dans apache a2enmod ssl
Installation de Z-push
Téléchargement de Z-push sur http://prdownload.berlios.de/z-push/z-push-1.5.1.tar.gz
Téléchargement du backend Zimbra sur http://sourceforge.net/projects/zimbrabackend/files/Release48/zimbra48.tgz/download
J’ai placé z-push à la racine de mon espace web /var/www
#tar xvfz z-push-1.5.1.tar.gz -C /var/www
J’ai extrait le backend Zimbra zimbra.php dans /var/www/z-push/backend/
#tar xvfz zimbra48.tgz -C /var/www/z-push/backend
Modifications des droits
#chown -R www-data:www-data /var/www/z-push #chmod 755 /var/www/z-push/state #chown www-data:www-data /var/www/z-push/state
configuration de Z-push et Apache:
Mon serveur est un DomU Xen dédié nommé push.info16.fr. Il sera accessible en http et https. Pensez à activer l’écoute sur les ports 80 et 443 dans /etc/apache/ports.conf
- Virtualhost en http ( non ssl): etc/apache2/sites-enabled/default
<VirtualHost *:80> ServerName push.info16.fr DocumentRoot /var/www/z-push/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/z-push/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/ssl_access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> Alias /Microsoft-Server-ActiveSync /var/www/z-push/index.php php_flag short_open_tag on php_flag magic_quotes_runtime off php_flag register_globals off php_flag magic_quotes_gpc off </VirtualHost>
- Virtualhost en https ( ssl) : /etc/apache2/sites-enabled/ssl
<VirtualHost *:443> ServerName push.info16.fr DocumentRoot /var/www/z-push/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/z-push/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/ssl_access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> Alias /Microsoft-Server-ActiveSync /var/www/z-push/index.php php_flag short_open_tag on php_flag magic_quotes_runtime off php_flag register_globals off php_flag magic_quotes_gpc off SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile /etc/apache2/ssl/push.crt SSLCertificateKeyFile /etc/apache2/ssl/push.key SSLProxyCACertificateFile /etc/apache2/ssl/push.crt <FilesMatch "\\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> BrowserMatch ".*MSIE.*" \\ nokeepalive ssl-unclean-shutdown \\ downgrade-1.0 force-response-1.0 </VirtualHost>
Creation des certificats 2048 bits
#cd /etc/apache2/ssl #openssl genrsa -out push.key 2048
#openssl req -new -key push.key -out push.csr
#openssl x509 -req -days 365 -in push.csr -signkey push.key -out push.crt
Pensez bien sur à activer les vhosts:
#a2ensite default; a2ensite ssl
Modification de /var/www/z-push/config.php
<?php /*********************************************** * File : config.php * Project : Z-Push * Descr : Main configuration file * * Created : 01.10.2007 * * Copyright 2007 - 2010 Zarafa Deutschland GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation with the following additional * term according to sec. 7: * * According to sec. 7 of the GNU Affero General Public License, version 3, * the terms of the AGPL are supplemented with the following terms: * * "Zarafa" is a registered trademark of Zarafa B.V. * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH * The licensing of the Program under the AGPL does not imply a trademark license. * Therefore any rights, title and interest in our trademarks remain entirely with us. * * However, if you propagate an unmodified version of the Program you are * allowed to use the term "Z-Push" to indicate that you distribute the Program. * Furthermore you may use our trademarks where it is necessary to indicate * the intended purpose of a product or service provided you use it in accordance * with honest practices in industrial or commercial matters. * If you want to propagate modified versions of the Program under the name "Z-Push", * you may only do so if you have a written permission by Zarafa Deutschland GmbH * (to acquire a permission please contact Zarafa at trademark@zarafa.com). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Consult LICENSE file for details ************************************************/ // Defines the default time zone if (function_exists("date_default_timezone_set")){ date_default_timezone_set("Europe/Paris"); } // Defines the base path on the server, terminated by a slash define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . "/"); // Define the include paths ini_set('include_path', BASE_PATH. "include/" . PATH_SEPARATOR . BASE_PATH. PATH_SEPARATOR . ini_get('include_path') . PATH_SEPARATOR . "/usr/share/php/" . PATH_SEPARATOR . "/usr/share/php5/" . PATH_SEPARATOR . "/usr/share/pear/"); define('STATE_DIR', BASE_PATH.'/state'); // Try to set unlimited timeout define('SCRIPT_TIMEOUT', 0); //Max size of attachments to display inline. Default is 1MB define('MAX_EMBEDDED_SIZE', 1048576); // Device Provisioning define('PROVISIONING', false); // This option allows the 'loose enforcement' of the provisioning policies for older // devices which don't support provisioning (like WM 5 and HTC Android Mail) - dw2412 contribution // false (default) - Enforce provisioning for all devices // true - allow older devices, but enforce policies on devices which support it define('LOOSE_PROVISIONING', false); // Default conflict preference // Some devices allow to set if the server or PIM (mobile) // should win in case of a synchronization conflict // SYNC_CONFLICT_OVERWRITE_SERVER - Server is overwritten, PIM wins // SYNC_CONFLICT_OVERWRITE_PIM - PIM is overwritten, Server wins (default) define('SYNC_CONFLICT_DEFAULT', SYNC_CONFLICT_OVERWRITE_PIM); // The data providers that we are using (see configuration below) $BACKEND_PROVIDER = "BackendZimbra"; // ************************ // BackendICS settings // ************************ // Defines the server to which we want to connect define('MAPI_SERVER', 'file:///var/run/zarafa'); define('ZIMBRA_URL','https://webmail.info16.fr'); 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',false); define('IMAP_DEFAULTFROM', ''); define('IMAP_SENTFOLDER', ''); // ************************ // BackendIMAP settings // ************************ // Defines the server to which we want to connect // recommended to use local servers only define('IMAP_SERVER', 'localhost'); // connecting to default port (143) define('IMAP_PORT', 143); // best cross-platform compatibility (see http://php.net/imap_open for options) define('IMAP_OPTIONS', '/notls/norsh'); // overwrite the "from" header if it isn't set when sending emails // options: 'username' - the username will be set (usefull if your login is equal to your emailaddress) // 'domain' - the value of the "domain" field is used // '@mydomain.com' - the username is used and the given string will be appended define('IMAP_DEFAULTFROM', ''); // copy outgoing mail to this folder. If not set z-push will try the default folders define('IMAP_SENTFOLDER', ''); // forward messages inline (default off - as attachment) define('IMAP_INLINE_FORWARD', false); // use imap_mail() to send emails (default) - off uses mail() define('IMAP_USE_IMAPMAIL', true); // ************************ // BackendMaildir settings // ************************ define('MAILDIR_BASE', '/tmp'); define('MAILDIR_SUBDIR', 'Maildir'); // ********************** // BackendVCDir settings // ********************** define('VCARDDIR_DIR', '/home/%u/.kde/share/apps/kabc/stdvcf'); // Alternative backend to perform SEARCH requests (GAL search) // if an empty value is used, the default search functionality of the main backend is used // use 'SearchLDAP' to search in a LDAP directory (see backend/searchldap/config.php) define('SEARCH_PROVIDER', ''); ?>
Il ne reste plus qu’a paramétrer un mobile compatible activesync for Exchange à notre serveur Z-push.
- username = adresse_mail
- password= votre_mot_de_passe
- domaine= adresse_mail
- serveur= push.info16.fr
Cet article a été publié par bartounet sur le blog info16. Si vous désirez comme bartounet publier en guest-blogging sur Geek de France, vous pouvez me contacter.