This page is out of date, it has been replaced by a newer version which you can find here.
Here we’ll describe what to do to install the Postfix Admin package and what to do to solve the bugs we encountered.
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/Apache2/htdocs
, that is if you used the installation package from Server Logistics we’ve discussed earlier. Otherwise extract it in the document root for 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:
ln -s /Library/Apache2/htdocs/postfixadmin-2.1.0 /Library/Apache2/htdocs/postfixadmin
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.
chown -R www:www /Library/Apache2/htdocs/postfixadmin-2.1.0
cd /Library/Apache2/htdocs/postfixadmin-2.1.0
chmod 640 *.php *.css
cd /Library/Apache2/htdocs/postfixadmin-2.1.0/admin/
chmod 640 *.php .ht*
cd /Library/Apache2/htdocs/postfixadmin-2.1.0/images/
chmod 640 *.gif *.png
cd /Library/Apache2/htdocs/postfixadmin-2.1.0/languages/
chmod 640 *.lang
cd /Library/Apache2/htdocs/postfixadmin-2.1.0/templates/
chmod 640 *.tpl
cd /Library/Apache2/htdocs/postfixadmin-2.1.0/users/
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/Apache2/htdocs/postfixadmin
to config.inc.php
to get a starting point. Then edit the file config.inc.php
and change following items:
// the location of the files:
$CONF['postfix_admin_url'] = '/postfixadmin/admin';
$CONF['postfix_admin_path'] = '/Library/Apache2/htdocs/postfixadmin/admin';
// how to connect to the database
$CONF['database_type'] = 'mysql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfixadmin';
$CONF['database_password'] = 'postfixadmin';
$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/Apache2/htdocs/postfixadmin/admin
. Change the line
AuthUserFile /usr/local/www/<domain.tld>/admin/.htpasswd
into this:
AuthUserFile
/Library/Apache2/htdocs/postfixadmin/admin/.htpasswd
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/Apache2/htdocs/postfixadmin/admin
. To change the default password you can go into the directory /Library/Apache2/htdocs/postfixadmin/admin
as root and type the following command:
htpasswd -c .htpasswd admin
You then will be asked to type the new password twice, if you did that correctly the password has changed.
NOTE:
There is an old bug in the sendmail function that send improper SMTP commands for our setup. You need to edit the file functions.inc.php
in the postfixadmin directory. Find the function smtp_mail()
and change the line:
fputs ($fh, "EHLO $smtp_server\r\n");
into:
fputs ($fh, "HELO $smtp_server\r\n");
Next page ->, Configuring TLS for postfix.
December 28th, 2005 at 4:34 am
if you have trouble going to http://localhost/postfixadmin you have to enable apache2 and disable the original version of apache that came with OSX (probably obvious to most of you but not me )
Make sure you copy the Apache2.prefpane file into /Library/PreferencePanes then you can activate Apache2 from system preferences
January 7th, 2006 at 12:46 pm
Hi Richard,
First of all, thank you for putting this great report online. It’s a great help.
I have a problem though. For the second time I install this setup I get stuck at the same point. First I thought I made a mistake somewhere, so I started over again.
The point i’m at now is the configuration of the Postfix Admin. Ik I go to localhost/postfixadmin I get the following message:
Warning: Unknown(/Library/Apache2/htdocs/postfixadmin-2.1.0/index.php): failed to open stream: Permission denied in Unknown on line 0
Warning: (null)(): Failed opening ‘/Library/Apache2/htdocs/postfixadmin-2.1.0/index.php’ for inclusion (include_path=’.:/Library/PHP4/lib/php’) in Unknown on line 0
I’m desperate now. Do you have an idea where I made a mistake?
Thanx in advance!
Richard5: The problem is solved, Wout forgot to set the permissions on the postfix php pages.