There is a new version of this tutorial available for Ubuntu 18.04 (Bionic Beaver).

Postfix Virtual Hosting With LDAP Backend And With Dovecot As IMAP/POP3 Server On Ubuntu Trusty Tahr 14.04

Note this it the updated version of the old guide which doesn't work anymore with the new versions of Ubuntu, Postfix and Dovecot.

Here we we use an LDAP backend for both the MTA (Postfix) and POP3/IMAP server (Dovecot), and a web based management interface.

Optional in this how to is the use of Roundcube webmail and proftpd.

Software to be used in this how to: <pPostfix MTA, Dovecot IMAP / POP3, OpenLDAP, Gnarwl as autoresponder (vacation), Proftpd as ftp server, Phamm as management interface, MySQL as database backend for the webmail and Roundcube as webmail.

This worked for me, but I cannot guarantee that this set up will work for you so this how to comes without any guarantee.

Assumptions

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/

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

A read only account for the o=hosting,dc=example,dc=tld tree:

cn=phamm,o=hosting,dc=example,dc=tld

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

If you want for example o=maildomains or ou=domains, 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. If you want a different read only user than phamm than replace cn=phamm with cn=wat-you everywhere in this how to.

This guide also assumes that you have installed and configured your Ubuntu server to your needs, there are plenty of good guides on Howtoforge for example:

The Perfect Server - Ubuntu 14.04 (Apache2, PHP, MySQL, PureFTPD, BIND, Dovecot, ISPConfig 3

Do not install and configure Postfix and Dovecot since we are going to do that in this guide.

I know there are Phamm packages in the Ubuntu repository but they do not configure anything for one and on the other hand the new configurations required for both Postfix and Dovecot are not taken in to account.

Step1:

Download the Phamm package since it contains Openldap schema's we will need:

cd /usr/src

Get the latest version of phamm:

wget http://open.rhx.it/phamm/phamm-0.6.2.tar.gz

Unpack the archive:

tar xvzf phamm-0.6.2.tar.gz

Change back to the root directory

cd ~

 

So now let's get started

Share this page:

8 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: lightjail

Hello,
thank you for this HowTo. I have tested on Ubuntu 14.04.1 (64bit) >> not runnig.
Please check the path information. There are some errors:
Page 2:
cp /usr/src/phamm-0.5.17/schema/phamm.schema /etc/ldap/schema.
cp /usr/src/phamm-0.5.17/schema/contrib/perversia.net.schema /etc/ldap/schema. 
 Please check syntax  base.ldif (code-box)

dn: o=hosting,dc=example,dc=tldobjectClass: organizationalUnit
objectClass: top
o: hosting
description: Hosting Organization

# Read only account
dn: cn=phamm,o=hosting,dc=example,dc=tld
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: phamm
userPassword: {MD5}M267sheb6qc0Ck8WIPOvQA==
description: Read only account

After import with ldapmodify -a -D cn=admin,dc=example,dc=tld -W -f base.ldif
Error:
ldap_add: Server is unwilling to perform (53)
        additional info: no global superior knowledge
 
Is this correct? 

 dn: o=hosting,dc=example,dc=tld
objectClass: organizationalUnit
objectClass: top
o: hosting
description: Hosting Organization

# Read only account
dn: cn=phamm,o=hosting,dc=example,dc=tld
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: phamm
userPassword: {MD5}M267sheb6qc0Ck8WIPOvQA==
description: Read only account

After this:
adding new entry "o=hosting,dc=example,dc=tld"
ldap_add: Object class violation (65)
        additional info: object class 'organizationalUnit' requires attribute 'ou' 
Page 5:
Apache Docroot:
/var/www/ ??? perhaps /var/www/html (I´m not sure)
 Page 7
Base-System ist Perfect Server. There are pureftp installed!? Why do they want to install proftpd? These are two programs for the same service (FTP).
Please excuse my bad english.
 

By:

The typo's have been removed and corrected.

Well I assumed if someone installs a base system, they would not install ftp software since this guide covers it.

 If you need help, use the messaging system.

 Regards,

 Miguel

By: J_Kruis

there are still 3 typos on page 2

the dot at the end of the two lines should by deleted.   Page 2:     cp /usr/src/phamm-0.6.4/schema/phamm.schema /etc/ldap/schema cp /usr/src/phamm-0.6.4/schema/contrib/perversia.net.schema /etc/ldap/schema    and apt should by apt-get

 apt-get install slapd ldap-utils

By: patmarmat

Thank you for the guideline provided.

 

however this guideline aswell as the others provided for PHAMM aren't working.

Not only it is impossible to have the base.ldif version as described cannot being included, it needs to being adjusted as followed:

dn: o=hosting,dc=example,dc=tld

o: hosting description: Hosting Organization

objectClass: organization

objectClass: top

# Read only account

 

dn: cn=phamm,o=hosting,dc=example,dc=tld

objectClass: simpleSecurityObject

objectClass: organizationalRole

cn: phamm

userPassword: {MD5}Uv67nQ8+4ca2bDRMu5tuyYIA==

description: Read only account

 

also the schema cannot being imported into the LDAP unless the dc=example,dc=tld is included.

 

After walking through the entire document and installation of the exact same version used I finally could start the Phamm GUI.

Logged in with the admin user as have being set, tried to add a domain with password.

this results into the the error Error: LDAP Error: Invalid DN syntax (Code 34)

which is freaking frustrating.

 

Isn't there a preinstalled version which can be downloaded in an iso or image?

 

Thank you in advance,

 

Patrick

By: JSBTech

Thankyou for updating this to the newest version of Dovecot and Postfix. Just in time for my server migration at that =)

Im stuck at uploading the base DN to the database.

ldapmodify -a -D cn=admin,dc=example,dc=tld -W -f base.ldif

Enter LDAP Password:ldap_bind: Invalid credentials (49)

This install is stock besides changes in this How to. Only one pass has been configured. Any thoughts?

By: JSBTech

Reply wouldn't work so started a new thread.

I ended up missing a few dc=example,dc=tlds that needed to be edited which later caused my ldap_bind: Invalid credentials (49) Error. After a redo, I was able to complete the HowTo. I am, however, at a loss of what to input to login to phamm. Nothing seems to work.

Will create a backup image and try again from the beginning.

By: Leandro

After applying the olcAccess modifications, I can't simply locate any of the LDAP objects that I've added. If I restore to the original one, I can list all of them

By: Saumya

 Can you please post the official method to modify acls?