Open Source

DIY: Try the VBoxAdm Postfix graphical admin tool

Jack Wallen predicts a bright future for VBoxAdm, a new Postfix GUI tool still in Alpha release. If you can install and run VBoxAdm, he says it's worth trying on a non-production machine.

Any business on a tight budget in need of a mail server should go with Postfix. It's one of the most reliable mail servers available, and it's incredibly simple to set up and manage. And yet, there is still a need for a graphical tool for server management. After all, most administrators don't have time to use a command line tool to manage their email servers (especially when there are hundreds of users).

One new tool that might help make your job easier is VBoxAdm, which is very much in Alpha release, so it's not guaranteed to work or install. VBoxAdm has been heavily influenced by already established tools (such as Postfix.Admin), and even in its early stages the GUI has a number of solid features, which include:

  • Comprehensive Mailserver solution
  • Written in modern Perl
  • Written with security and maintainability in mind
  • No unencrypted passwords
  • HTML5, jQuery, jQuery UI, Datatables
  • Roundcube Integration
  • Custom Content-Filter (SMTP-Proxy)
  • Command Line Interface

When you add these features to the ability to manage nearly all aspects of Postfix and Dovecot, you have a real winner on your hands.

Now I'll describe the process of installing this new Postfix GUI on a Debian-based machine. It took me a number of attempts, but I finally got it up and running. Despite the fact that the functionality was iffy, it's clear this tool has a very bright future.

Note: The machine to house VBoxAdm will already have a running installation of Postfix, Dovecot, and cgi working on Apache. This installation will require the use of the aptitude package manager, as well as a working MySQL installation. I do not explain the installation and configuration processes of Apache, Dovecot, or MySQL.

Installing VBoxAdm

The initial installation is quite simple. Follow these steps:

  1. Open a terminal window.
  2. Add the necessary repository with the command: sudo echo "deb http://packages.gauner.org/ squeeze main contrib non-free" >> /etc/apt/sources.list.
  3. Download the necessary key for the repository with the command: gpg --keyserver x-hkp://gpg-keyserver.de --recv-key D31FA054C85AEFAC.
  4. Add the gpg key with the command: sudo gpg --export D31FA054C85AEFAC | apt-key add -.
  5. Update Aptitude with the command: sudo aptitude update.
  6. Install VBoxAdm with the command: sudo aptitude install vboxadm.

It is also necessary to install the Silk icon pack. Follow these steps:

  1. Download the Silk icon pack from the Famfamfam website.
  2. Create the directory /usr/share/icons/famfamfam/silk.
  3. Unzip the Silk icons zip file. This will create a new directory called icons.
  4. Move all of the files from the newly created icons directory into /user/share/icons/famfamfam/silk/.

The next step is required for the use of the vacation reminder and the SMTP-Proxy scripts. Both of these features require the vboxadm user, which must be created with the command:

sudo adduser --system --home /var/lib/vboxadm --no-create-home --group --disabled-password --disabled-login vboxadm.

Follow these steps to create a user whose sole purpose is to hold incoming mail:

  1. Open a terminal window.
  2. Issue the command: sudo mkdir -p /var/www/vmail/.
  3. Add the user with the command: sudo adduser --system --home /var/www/vmail --no-create-home --group --disabled-password --disabled-login vmail.
  4. Change the ownership of the newly created directory with the command: sudo chown -R vmail:vmail /var/www/vmail/.

Now you need to create a couple of databases. I prefer to use MySQL Workbench to create all of my databases, but if you prefer the command line, follow these steps:

  1. Open a terminal window.
  2. Gain access to the MySQL command prompt with the command: mysql -u root -p <MYSQL_ROOT_PW> (where MYSQL_ROOT_PW is the password of the MySQL admin user).
  3. Create the vboxadm database with the command: CREATE DATABASE vboxadm;.
  4. Create the Roundcube database with the command: CREATE DATABASE roundcube;.
  5. Exit out of the MySQL prompt with the command: quit.
  6. Initialize the database with the command: mysql -uroot -p<PASSWORD> vboxadm < /usr/share/doc/vboxadm-common/examples/mysql/schema.sql (where PASSWORD is the actual password).

Next, you need to create the database accounts with the following commands:

  1. Access the MySQL prompt with the command: mysql -u root -p <MYSQL_ROOT_PW> (where MYSQL_ROOT_PW is the actual password of the MySQL admin user).
  2. Issue the command: GRANT ALL ON vboxadm.* TO 'vboxadm'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  3. Issue the command: mysql> GRANT SELECT ON vboxadm.* TO 'postfix'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  4. Issue the command: mysql> GRANT SELECT ON vboxadm.mailboxes TO 'dovecot'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  5. Issue the command: mysql> GRANT SELECT ON vboxadm.domains TO 'dovecot'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  6. Issue the command: mysql> GRANT ALL ON roundcube.* TO 'roundcube'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  7. Issue the command: mysql> GRANT SELECT,UPDATE ON vboxadm.mailboxes TO 'vboxadm_user'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  8. Issue the command: GRANT SELECT ON vboxadm.domains TO 'vboxadm_user'@'localhost' IDENTIFIED BY '<PASSWORD>';.
  9. Issue the command: FLUSH PRIVILEGES;.

In the above commands where <PASSWORD> is used, it will be necessary to use the passwords used when creating those users. In the Debian installation, both the Dovecot and Postfix users will be created upon install of those softwares.

Configuring Postfix

  1. Copy all files and subdirectories from /usr/share/doc/vboxadm-common/examples/postfix to /etc/postfix.
  2. Go to /etc/postfix/maps/ and edit each of the virtual_*.cf files, changing the password for the MySQL postfix user.
  3. Change to the /etc/postfix directory and build the database maps with the command: sudo make maps.
  4. Install postgrey and policyd-weight with the command: sudo aptitude install postgrey policyd-weight.
  5. Change the port in /etc/default/postgrey/ to 60000 and restart with the command: sudo /etc/init.d/postgrey restart.
  6. Open the file /etc/postfix/main.cf and change the virtual_minimum_uid, virtual_uid_maps, and virtual_gid_maps variables to the uid and gid of the user vmail.

Configuring Dovecot

  1. Copy all files and subdirectories from /usr/share/doc/vboxadm-common/examples/dovecot to /etc/dovecot.
  2. Open the file /etc/dovecot/dovecot-sql.conf and change the admin password to the one set for MySQL.
  3. Open the file /etc/dovecot/dovecot.conf and change the variables first_valid_uid and first_valid_gid to reflect the uid and gid of the user vmail.
  4. Open the /etc/vboxadm/vboxadm.conf file and insert the following below the [Default] section:

dbuser=vboxadm
dbpass=<PASSWORD>
dbdb=vboxadm
dbhost=localhost

In this same file, there will be a section for the web-based front-end that looks like:

[cgi]
pwscheme=ssha256
no_ssl=1
base_url=/cgi-bin/vboxadm.pl
media_prefix=

The Base url should give you an indication as to where your login will occur.

Creating the site admin user

In order to create the site wide administrator, issue the command: sudo bin/vboxadm.pl mailbox add admin@email.addy --bootstrap -a 1 -siteadmin=1 (where admin@email.addy is the email address of the administrative user).

Trying VBoxAdm

You are ready to give VBoxAdm a go. Remember, this software is very much in the Alpha stages, and therefore might not work for you. The developer is hard at work at solidifying the code/features, as well as creating better documentation for the installation and usage of the tool.

When VBoxAdm is finally production ready, I believe it will be just the ticket for Postfix administrators. Until then, however, you might want to work with this tool on a non-production level machine.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

0 comments

Editor's Picks