This how to will allow you to configure a Postfix mail server with with virtual hosting. Virtual hosting means that you can add as many maildomains as you want and subsequentially as many mailboxes for these domains as you want. Here we we use an LDAP backend for both the MTA (Postfix) and POP3/IMAP server (Dovecot), and a web based management interface.

This how to assumes the following configurations, if your
installation differs from this, then replace the entries below with your
actual configuration.

Mail delivery (mailboxes) path:

/home/vmail/domains

User vmail:

UID:1000, GID:1000

User postfix:

UID: 108, GID:108

OpenLDAP base dn:

dc=example,dc=tld

OpenLDAP admin account:

cn=admin,dc=example,dc=tld

Phamm search dn:

o=hosting,dc=example,dc=tld

You're using root as the user during this guide.

If you want for example o=maildomains or o=whatever, please make sure to replace o=hosting with what you want, especially in the acl.ldif. This acl file is strict, phamm will not work correctly if it is not exactly as it should be.

Step 1: Install And Configure An Ubuntu Server

I recommend following the guide below for this (I do not need to rewrite or reinvent what others did better than me) :

OpenLDAP in Intrepid is no longer configured using a slapd.conf file, but by using ldif files stored in /etc/ldap/slapd.d so we need to convert the schema files to ldif files first.

Make a temporary directory for the converted schema files:

cd ..mkdir ldif_out

Copy the phamm.schema for convenience:

cp phamm-0.5.15/schema/phamm.schema .

Create a schema.convert file:

vi schema.convert

Paste the following into the file:

include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/nis.schema
include /etc/ldap/schema/inetorgperson.schema
include phamm.schema
include ISPEnv2.schema
include amavis.schema
include pureftpd.schema

The additional schemas are needed for the conversion to succeed since from these schema's certain objects are used by the other shema's.

Now we're going to convert the schema files to ldif files:

slaptest -f schema.convert -F ldif_out

This will convert the schemas to ldif, but we have to edit them before we can import them into the OpenLDAP server.

vi ldif_out/cn\=config/cn\=schema/cn\=\{4\}phamm.ldif

And change the needed entries to match the following:

dn: cn=phamm,cn=schema,cn=config...cn: phamm

And remove the following from the end of the ldif (ignore the content after: since it will vary depending on the date, time, ... of conversion):

What a joke of a tutorial -- dumping configuration files is such a cop-out that makes this "howto" fall very short of being a proper article. It would go a long way to properly identify _why_ and _how_ things work rather than providing obtuse config dumps, at least if you're calling this a tutorial.