Postfix Virtual Hosting With LDAP Backend And With Dovecot As IMAP/POP3 Server On Ubuntu Intrepid Ibex Server 8.10 - Page 2

Want to support HowtoForge? Become a subscriber!
 
Submitted by Miguel (Contact Author) (Forums) on Mon, 2009-01-19 19:20. ::

Step 3: Install And Configure phamm

Since we downloaded and extracted the phamm archive before, we can directly begin with the installation and configuration of the phamm interface.

Note: I hacked into the phamm configuration and .php script files to accomplish the following:

  • Maildrop to to postmaster@example.tld rather than postmaster wich is a Unix account
  • Maildrop for abuse to postmaster@example.tld rather than postmaster
  • %domain% for the welcome message to reflect postmaster@domain.tld rather than postmaster
  • cc for the welcome message to postmaster@example.tld to have an idea of the number of mailboxes created by the virtual mail domain admins. ==> default maps to postmaster so your Unix account will get the mails or rather root.

The other hacks are just to define other defaults:

  • Setting smtp auth to default
  • Setting the quota number for mail
  • Setting the default home directory for ftp
  • Setting the default quota for ftp

In any case I believe that these changes are an improvement rather than customization so I will list them here before we go into the actual installation and configuration of phamm. Those who do not care about these features can skip the following section until the actual phamm configuration and installation.

But first we need to get the phamm scripts to their proper location:

cd /usr/src/phamm-install
mv phamm-0.5.15 /var/www/

My hacks:

The hacks are done on the source, not the actual (see later installation).

First we will do the welcome message part.

cd /var/www/phamm
vi config.inc.php

Change (starting line 147 at the time of writing this how to):

// Welcome message
define ('SEND_WELCOME',0);
$welcome_msg = '../welcome_message.txt';
$welcome_subject = 'Welcome!';
$welcome_sender = 'postmaster@localhost';
$welcome_bcc = 'postmaster@localhost';

to

// Welcome message
define ('SEND_WELCOME',1);
$welcome_msg = '../welcome_message.txt';
$welcome_subject = 'Welcome!';
$welcome_sender = 'postmaster@%domain%';
$welcome_bcc = 'postmaster@example.tld';

This will send the welcome email as from postmaster@domain.tld (domain.tld being the mail domain (virtual)) and send a bcc to postmaster@example.tld where example.tld represents the technical domain.

Next we will set the defaults for email and domain creation:

vi www-data/main.php

Change (line 311):

$entry["maildrop"] = "postmaster";

to

$entry["mail"] = "postmaster@".$domain_new;

And also (line  330) from:

$entry_abuse["maildrop"] = "postmaster";

to

$entry_abuse["maildrop"] = "postmaster@".$domain_new;

Change the quota in mail.xml plugin to support Dovecot quota format:

vi plugins/mail.xml 

Change (line 121):

<suffix>S</suffix>

to

<suffix></suffix>
OK these were my custom hacks, now let's go to the configuration of phamm.

chown -R www-data:www-data /var/www/phamm
cd /var/www/phamm
rm -R examples
rm -R doc
rm -R DTD
rm -R schema

This in order to remove files that are not needed in the www directory.

Now we will configure phamm for actual use.

vi config.inc.php

Change the ldap connection parameters to fit your actual configuration.

// *============================*
// *=== LDAP Server Settings ===*
// *============================*

// The server address (IP or FQDN)
define ('LDAP_HOST_NAME','127.0.0.1');

// The protocol version [2,3]
define ('LDAP_PROTOCOL_VERSION','3');

// The server port
define ('LDAP_PORT','389');

// The container
define ('SUFFIX','dc=example,dc=tld');

// The admin bind dn (could be rootdn)
define ('BINDDN','cn=admin,dc=example,dc=tld');

// The Phamm container
define ('LDAP_BASE','o=hosting,dc=example,dc=tld');

Enable the fpt plugin (line  113) by removing the //

Enable the person plugin  (line 118) by removing the //

And on line 170 change CRYPT to MD5. Most other software that uses LDAP use MD5 hashing, so it is therefore a good thing to have phamm use MD5.

Since the transport maildrop: is hardcoded in phamm we need to change this in order to enable Dovecot delivery.

vi plugins/mail.xml

Replace each entry with maildrop: with dovecot: (do no forget the colon). In ordinary situations, the commands in Postfix's main.cf would do (that we added before), but ldap transport as used and implemented by phamm overrides this and implements maildrop.

This has to be done for line  75. This will substitute maildrop for Dovecot delivery.

That's it for the configuration.

You can edit plugins/mail.xml to change the defaults for smtp and quota, modify them to your needs.

Please note that the multiplier used for quota is x*y representing x*1024. So if you want a quota of 1000Mb you need to set the quota to 1000.

<attribute name="quota">
                                <prettyName>Quota</prettyName>
                                <table>1</table>
                                <default>50</default> ==> 50=50Mb, 100=100Mb
                                <multiplier>1048576</multiplier>
                                <suffix></suffix>
                                <minAuthLevel>4</minAuthLevel>
</attribute> 

You can edit plugins/ftp.xml to change the defaults for default ftp (base) directory and quota, modify them to your needs.

This concludes the phamm configuration.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by P. Larsen (not registered) on Fri, 2009-09-11 01:15.

Thanks for your guide - it's been helpful getting me to understand phamm better.

I wish you could clarify a few areas of why you choose to do what you did. First of all, how/where do you bind phamm into the mail delivery process so anti-virus and spam filters can be applied or not, depending on the user's configuration option?

What's the advantage of using dovecot as a delivery method?