This tutorial exists for these OS versions
- Ubuntu 18.04 (Bionic Beaver)
- Ubuntu 14.04 LTS (Trusty Tahr)
- Ubuntu 9.10 (Karmic Koala)
- Ubuntu 8.10 (Intrepid Ibex)
- Ubuntu 8.04 (Hardy Heron)
On this page
Postfix Virtual Hosting With LDAP Backend With Dovecot As IMAP/POP3 Server On Ubuntu Hardy Heron 8.04 TLS
I've been running with a MySQL backend for virtual hosting for some time, but when I discovered Phamm and the added FTP feature (amongst others) I decided to switch to LDAP as backend for Postfix with virtual hosting.
In view of the fact that the installation and configuration guide of Phamm is lacking some basic information it took me quite some time (including crying, swearing, getting depressed, ...) to put it all together and get it working. Long live google to find hints or explanations for problems and configuration issues. Piecing it all together wasn't simple so I would like to share how I configured it and got it all working toghether (as I like), but I think that it will benefit other users as well.
Software to be used in this how to:
Note: this how to also uses dovecot deliver as maildrop agent and dovecot sasl for smtp sasl authentication. For one: postfix maildrop doesn't support ldap and I didn'd want to use courier (maildrop, authdaemon and sasl) if dovecot coud do the trick and also provide sieve support.
This how to assumes the following configurations, if your installtion differs from this, than replace the entries below with your actual configuration.
Mail delivery (mailboxes) path:
UID: 108, GID:108
Openldap base dn:
Openldap admin account:
Phamm search dn:
Step 1: Install and configure an ubuntu server
I recommend following one of the guides below for this (I do not need to rewrite or reinvent what others did bether than me):
or my favourite:
In both cases, skip the installtion of the courier packages.
So let's get started:
Step 2: Install postfix-ldap, php5-ldap, and openldap
apt-get install postfix-ldap php5-ldap slapd
When prompted provide a password for the openldap admin.
Install phpldapadmin for LDAP manipulation, we need to configure out ldap tree.
apt-get install phpldapadmin
Execute the above command after that you have installed openldap, then your openldap configuration will be taken into account eg base dn: dc=excample,dc=tld
Next we import the phamm schema's for openldap:
Now we download and extract phamm since we also need the phamm.schema
tar xvzf phamm0.5.12.tar.gz
Allwas look for new version before download!
cp /usr/src/phamm0.5.12/schema/phamm.schema .
Next we edit the slapd.conf to include the schema's needed for phamm:
Insert the following info the slapd.conf (after the last line that says include /etc/ldap/schema/..)
include /etc/ldap/schema/phamm.schema include /etc/ldap/schema/ISPEnv2.schema include /etc/ldap/schema/amavis.schema include /etc/ldap/schema/pureftpd.schema
These only for mail and ftp account. Add the other schem's if you would like to use them, but the integration of these services is not covered in this tutorial.
Next we restart openldap in order to load the new schemas:
Next login to phpldapadmin and create and organisation named hosting.
Click on dc=example,dc=tld.
Click on 'Create new child entry'.
In the next screen choose organization from the scroll box.
On the next sceen chose o from the RDN drop down box.
Enter hosting in the first field boxn scroll down and click create.
This concludes the first part of this how to.