May 082012
 
Article Postfix

(Leer este artículo en español)

In a previous post we explained how to perform the installation of the Postfix mail server.

In this post we will explain how to install Postfixadmin. Postfixadmin is a web frontend to the mysql database used by Postfix. With Postfixadmin we can easily manage from a web browser our Postfix service, adding and removing mail users and domains, mail aliases, disk quotas, etc.

First we download the gzipped Postfixadmin package from sourceforge. The filename we downloaded is ‘postfixadmin-2.3.5.tar.gz’

Once the package has been downloaded, we uncompress it (as root user) under the directory ‘/usr/share’, and create a symlink:

Next, we edit the config file /usr/share/postfixadmin/config.inc.php to specify the details of our setup. We must edit the mysql database name, and the username/password to access it:

Then, we proceed to create the database:

Next, we add an Alias directive in the configuration file of our apache web server:

and restart the web server. Now we can access from a browser the url http://localhost/postfixadmin/setup.php:

PostAdmin setup screen

In this screen, we introduce the setup password that we had previously configured in the postfixadmin config file ($CONF[‘setup_password’] ), and the email address and password of the admin user to be created.

When we submit the form for the first time, we get an error message about the setup password not matching, and a “hashed password” that we must copy, and paste as the value of the variable “$CONF[‘setup_password’]” in the postfixadmin configuration file.

Once this is done, we submit again the form, and this time we receive a success message “Admin has been added!”

Now we can access the login form at the url http://www.openalfa.com/postfixadmin/login.php  to administer our mail server:

Pantalla de login de postfixadmin

After login in, we reach the main admin screen:

Pagina principal de postfixadmin

How to configure Postfix to use the Postfixadmin mysql database

After completing the previous steps, we are able to access the Postfixadmin frontend and define virtual mailbox domains and users, and mail aliases.

But Postfix admin just stores this information in the mysql database, and we must tell Postfix to read this information from the Postfixadmin database.

We do this creating (with your text editor of choice) four files under the directory ‘/etc/postfix’.

1. /etc/postfix/mysql_virtual_alias_maps.cf:

2. /etc/postfix/mysql_virtual_domains_maps.cf

3. /etc/postfix/mysql_virtual_mailbox_maps.cf

4. /etc/postfix/mysql_virtual_mailbox_limit_maps.cf

To make sure that these files are only readable by root, we execute:

 

Create a ‘vmail’ user

To avoid creating a different userid for each of the mail users we are going to define in our server, we must create a unix user “vmail”, that will be the owner of all the files of our virtual mail users:

Next we edit ‘/etc/postfix/main.cf’ to tell postfix to use the previously created files, adding the lines:

We see that we have specified the ‘vmail’ user previously created (with UID and GID 5000 and login directory /home/vmail) as the effective user of all the virtual mail users to be created.

 Posted by at 11:18 am

  One Response to “How to install Postfixadmin to manage a Postfix mail server from a browser”

 Leave a Reply

(required)

(required)