What's Zentyal?

Zentyal is an easy to use Linux alternative to Windows Server. Its features include replacing an MS Active Directory, securing Internet access using VPN and firewall, etc. It also has a dedicated mail server, however it doesn’t have email archiving capabilities. This is where piler comes to play. Piler enterprise is a flexible application, and able to run on various environments. In this article I’ll show how to deploy it to a Zentyal host.

Docker is to the rescue

Even though Zentyal 6.2 is based on Ubuntu 18.04 LTS, and we could use the native piler deb package, it’s much easier and faster to take a containerization approach, and use Docker.

Zentyal runs postfix on port 25, so our containers will bind to port 2525 and 8080.

First, we need to install docker and docker-compose:

apt-get install -y docker-compose docker.io

Clone the piler-examples Github repo

git clone https://github.com/jsuto/piler-examples.git
cd examples/zentyal

Fix the MYSQL_PILER_PASSWORD and PILER_HOSTNAME in the docker-compose.yaml, then start the containers

docker-compose up -d

Then we configure the piler GUI allowing us to authenticate against the Zentyal LDAP database, and we also fix the http port to be 8080.

$config['ENABLE_LDAP_AUTH'] = 1;
$config['LDAP_HOST'] = 'ldap://zentyal.yourdomain.com:389';
$config['LDAP_HELPER_DN'] = 'CN=zentyal-mail-zentyal,CN=Users,DC=zentyal-domain,DC=lan';
$config['LDAP_HELPER_PASSWORD'] = 'xxxxx';
$config['LDAP_BASE_DN'] = 'DC=zentyal-domain,DC=lan';
$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'user';
$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'member';
$config['LDAP_MAIL_ATTR'] = 'mail';

$config['SITE_URL'] = 'http://' . $config[SITE_NAME_CONST] . ':8080/';


Setup Zentyal

Create a transport map for piler

echo "archive.yourdomain.com   smtp:[]:2525" > /etc/postfix/transport.piler

Create a Zentyal hook having postfix to copy an email to piler

cp /usr/share/zentyal/stubs/mail/main.cf.mas .
patch < main.cf.mas.diff
mkdir -p /etc/zentyal/stubs/mail
cp main.cf.mas /etc/zentyal/stubs/mail
cp mail.postsetconf /etc/zentyal/hooks
chmod +x /etc/zentyal/hooks/mail.postsetconf

Select “Mail” menu, then “Virtual Mail Domains” on the Zentyal dashboard. Click on the “Settings” gear icons for the domain you want to archive emails.

Select “Address to sent the copy” from the dropdown menu, and type “archive@archive.yourdomain.com“, then click “Change”, and “Save changes”.

Enable port 8080 on the firewall

Select “Firewall” menu, then “Packet filter”, and “Filtering rules from internal networks to Zentyal”. Click on “Configure rules”, and add a service and a rule to allow incoming requests to port 8080.

See the detailed process in the github examples.


You just got a piler deployment in a containerized environment on Zentyal. Note that these settings are good enough to get going, however feel free to customize the archive, eg. add HTTPS support, etc.

Again, just as we saw it using Nethserver that we had a choice whether we wanted to deploy piler to the mail server or to a separate instance, the same applies to Zentyal as well. Either way, Zentyal is a great choice to run your email archive featuring piler.