Update: postfixadmin 2.2.x is released, read Upgrading Postfix Admin 2.1.0 to 2.2.x to upgrade. If you are installing the 2.2.x version for the first time please read installing Postfix admin 2.2.x
You need some administration tool to make the management of your new mailserver a bit easier than typing a lot of SQL commands. Luckily there is an easy tool that allows simple administration of your virtual domains and mail users. It’s called Postfix Admin.
To install the Postfix Admin package on your server and what to do to solve the bugs we’ve encountered with the 2.1.0 release read this page and you’ll end up with a functioning version.
First you need to download the software package from the Postfix Admin site, I’m using and basing these instructions on version 2.1.0. Don’t use the installation guide that comes with the installation package as some of the steps you have already performed and might conflict with other parts of the installation.
Extract the package into the directory ‘/Library/WebServer/Documents‘, that is if you used our installation instructions. Otherwise extract it in the document root of your Apache installation.
For ease of use you can rename the directory ‘postfixadmin-2.1.0‘ to just ‘postfixadmin‘ or create a symbolic link to that directory as follows:
Because you will enter the database user and password in the configuration files located in this directory it will be a lot safer if you change ownership and the permissions.
cd /Library/WebServer/Documents/postfixadmin-2.1.0
sudo chmod 640 *.php *.css
cd /Library/WebServer/Documents/postfixadmin-2.1.0/admin/
sudo chmod 640 *.php .ht*
cd /Library/WebServer/Documents/postfixadmin-2.1.0/images/
sudo chmod 640 *.png
cd /Library/WebServer/Documents/postfixadmin-2.1.0/languages/
sudo chmod 640 *.lang
cd /Library/WebServer/Documents/postfixadmin-2.1.0/templates/
sudo chmod 640 *.tpl
cd /Library/WebServer/Documents/postfixadmin-2.1.0/users/
sudo chmod 640 *.php
When you’ve done this you are ready to create the configuration file. Copy the file ‘config.inc.php.sample‘ in the directory ‘/Library/WebServer/Documents/postfixadmin‘ to ‘config.inc.php‘ to get a starting point. Then edit the file ‘config.inc.php‘ and change following items:
$CONF['postfix_admin_url'] = ‘/postfixadmin/admin’;
$CONF['postfix_admin_path'] = ‘/Library/WebServer/Documents/postfixadmin/admin’;
// how to connect to the database
$CONF['database_type'] = ‘mysql’;
$CONF['database_host'] = ‘localhost’;
$CONF['database_user'] = ‘postfixadmin’;
$CONF['database_password'] = ‘postfixadminpassword’;
$CONF['database_name'] = ‘postfix’;
$CONF['database_prefix'] = ”;
// your administrator e-mail address
$CONF['admin_email'] = ‘postmaster@yourmaindomain.tld’;
// The default aliases that need to be created for all domains.
$CONF['default_aliases'] = array (
‘abuse’ => ‘abuse@yourmaindomain.tld’,
‘hostmaster’ => ‘hostmaster@yourmaindomain.tld’,
‘postmaster’ => ‘postmaster@yourmaindomain.tld’,
‘webmaster’ => ‘webmaster@yourmaindomain.tld’
);
// to get a mailbox structure like /domain/user
$CONF['domain_path'] = ‘YES’;
$CONF['domain_in_mailbox'] = ‘NO’;
Next, to secure the overall admin module you need to edit the file ‘.htaccess‘ in the directory ‘/Library/WebServer/Documents/postfixadmin/admin‘. Change the line
into this:
You need to do the final step by starting up your favourite browser and point it to ‘http://localhost/postfixadmin/‘. Click on the setup link for the final step, it will do a test and checkup. After you got it working remove the setup.php file from the directory ‘/Library/Apache2/htdocs/postfixadmin‘ or rename it to keep your server safe.
You can then go into ‘http://localhost/postfixadmin/admin/‘ to administrate your users and domain admins. Please note that the default user and password for this is admin/admin and that that is defined in the .htpasswd file in the directory ‘/Library/WebServer/Documents/postfixadmin/admin‘. To change the default password you can go into the directory ‘/Library/WebServer/Documents/htdocs/postfixadmin/admin‘ as root and type the following command:
You then will be asked to type the new password twice, if you did that correctly the password has changed.
NOTE:
There is a bug in the sendmail function that send improper SMTP commands for our setup. You need to download the file ‘functions.inc.php‘ and copy it in the postfixadmin directory. You can find more on the changes I made in my old blog.
Next step: Securing your basic mailserver using TLS/SSL



4:25 pm
Followed the howto till here.
I added with Postfix admin a new domain and mailbox (admin@mit.be)
Shouldn’t postfix admin add the mailbox in /usr/local/virtual/ ?
# ls -al /usr/local/virtual/
total 0
drwxrwx–x 2 vmail postfix 68 Feb 20 13:49 .
drwxr-xr-x 16 root wheel 544 Feb 20 13:49 ..
Feb 20 16:17:50 rootmacgates-computer authdaemond: received auth request, service=smtp, authtype=login
Feb 20 16:17:50 rootmacgates-computer authdaemond: authmysql: trying this module
Feb 20 16:17:50 rootmacgates-computer authdaemond: SQL query: SELECT username, password, “”, ‘102′, ‘27′, ‘/usr/local/virtual’, maildir, “”, name, “” FROM mailbox WHERE username = “admin@mit.be”
Feb 20 16:17:50 rootmacgates-computer authdaemond: password matches successfully
Feb 20 16:17:59 rootmacgates-computer imapd: chdir mit.be/admin/: No such file or directory
11:11 pm
“After you got it working remove the setup.php file from the directory ‘/Library/Apache2/htdocs/postfixadmin’ or rename it to keep your server safe.”
I think you mean the directory ‘/Library/WebServer/Documents/postfixadmin’
and here:
“To change the default password you can go into the directory ‘/Library/WebServer/Documents/htdocs/postfixadmin/admin’ as root and type the following command:”
the directory ‘Library/WebServer/Documents/postfixadmin
both, by the way, assuming that the symbolic llink ‘postfixadmin’ you presented as optional, has indeed been made.
Did I understand that correctly?
6:07 pm
While looking at the Vacation options, I noticed there is a new version 2.2.0-RC1. I don’t know how stable / bug free it is yet, but I’m going to download it to my test server to see what has changed.