Zarafa exchange replacement
For a long time I’m searching for a free exchange that runs on Ubuntu. Zimbra is very nice but you can’t connect with outlook for free. OpenExchange has the same issue and OpenChange is far from finished. I came across this news message.
Zarafa is licenced under the AGPL
Zarafa is a Mail Delivery Agent that supports:
- AJAX webaccess with mail, contacts, todo, calendar
- POP,IMAP support
- Z-Push (ActiveSync replacement, I use this with my iphone)
- 3 outlook users (via a closed source component)
- iCal support
- LDAP support (Active Directory)
You can use Postfix and other MTA’s to send and receive mails.
This tutorial describes how you can configure Zarafa. I use this for all my mail and it works perfect (also on my iPhone).
The webmail demo: http://demo.zarafa.com/
Step 1: install Zarafa
install depedencies:
Zarafa use Mysql as a storage backend. You need apache if you want to use the WebAccess and Z-Push, both are written in PHP.apt-get install mysql-server-5.0 libmysqlclient15off apache2-mpm-prefork libapache2-mod-php5
Download zarafa community edition, the download page is a little bit annoying because there is no direct download link. With lynx you can download it very easy. If you don’t have lynx: apt-get install lynx
Next we need to untar it:
Start the installer:tar zxvf zarafa-6.20-ubuntu8.04-i386.tar.gz
cd zarafa-6.20-ubuntu8.04-i386
Follow the steps on the screen. Don’t enter a serial number. You can enter all questions except of the MySQL password../install.sh
Next we need to change a configuration in php.ini:
Find with ctrl-w the line “magic_quotes_gpc = On” and turn On in Off.nano /etc/php5/apache2/php.ini
Restart apache:
Zarafa needs some older versions of some packages. Therefore you need to hold back some new packages otherwise zarafa will be removed when you run "apt-get dist-upgrade"apache2ctl restart
Done, zarafa is installed! Time to add a user.echo libvmime0 hold | dpkg --set-selections
echo libical0 hold | dpkg --set-selections
-c = create userzarafa-admin -c jan -p secret -e jan@debaas.nl -f “Jan Peter Balkenende” -a 0
-p = password
-e = email
-f = full name
-a = administrator 1 or 0 (true of false)
To test Zarafa Webaccess, check with ifconfig the ip address and go this url:
https://<ip>/webaccess
Works great isn’t it? Pop, imap, mapi etc everything is working..
Step 3: install postfix and get mail working)
Install postfix:
Click oke and choose “No Configuration”apt-get install postfix
Next we have to change the config files. The fastest way is to copy these config files:
master.cf
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ================================================== ========================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ================================================== ========================
smtp inet n - - - - smtpd
zarafa unix - n n - 10 pipe flags= user=vmail argv=/usr/bin/zarafa-dagent ${user}
#submission inet n - - - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - - - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticate d,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - - 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - - - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ================================================== ==================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ================================================== ==================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
main.cf
Finally you have to add your hostname at this line: "myhostname = "See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
mailbox_transport = zarafa: zarafa_destination_recipient_limit = 1
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, $mydomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
add the user vmail:
Now you can send mail. To receive mail you have to configure the MX records for your domain and point them to your IP.useradd vmail
Everything is working right now.
Step 4: run as non-root user (optional)
This step is very recommended, but not necessary to get zarafa working.
Add a user:
You can change the config files of every zarafa service in /etc/zarafa. Open them all and edit the run_as_user and run_as_group options in zarafa.addgroup --system zarafa
adduser --system –-home /dev/null –-no-create-home –-ingroup zarafa –-disabled-password --gecos 'Zarafa services' --shell /bin/false zarafa
mkdir /var/log/zarafa
chown zarafa.zarafa /var/log/zarafa
When you change the user of zarafa-licenced you can't use Outlook anymore. This is some annoying bug. A work around is to change some permissions:
But when you restart zarafa licenced with /etc/init.d/zarafa-licenced restart you have to change the permissions of /var/run/zarafa-licenced again. You can solve this by adding the chown command to the init script.chown zarafa.zarafa /var/run/zarafa-licensed
chown -R zarafa.zarafa /var/lib/zarafa/
Step 5: get Z-push working (optional)
download Z-Push
untar to the apache directory
Change some permissions:tar zxvf z-push-<version>.tgz -C /var/www
Add an alias to the apache config.chmod 755 /var/www/z-push/state
chown www-data.www-data /var/www/z-push/state
/etc/apache2/sites-availiable/default
*WARNING* You CANNOT simply rename the Z-Push directory to Microsoft-Server-ActiveSync.Alias /Microsoft-Server-ActiveSync /var/www/z-push/index.php
This will cause Apache to send redirects to the PDA, which will definitely break your PDA
synchronisation.
Done
More information
http://www.zarafa.nl/?q=en/content/documentation
Bookmarks