Manage your email accounts

ISPwebAdmin (web interface)

I have created a simple web tool (although the installation is not trivial - sorry for that) for administering domains, users and aliases called ISPwebAdmin. Further interesting projects like this are:

Screenshots

Just a few impressions how the ISPwebAdmin's interface looks like:

Download

Scroll down to the attachments section for the download link.

Installation instructions

User authentication

In addition to the SQL tables as described in the ISPmail tutorial you will need to create an additional table to store usernames and passwords for the administrators that are allowed to manage email accounts. So please run this SQL query to create the table:

		CREATE TABLE IF NOT EXISTS `admins` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(40) NOT NULL,
  `pwhash` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

Create an admin user here who can login to the web interface. The pwhash field stores an MD5 hash of the password to avoid storing it as plain text.

Example SQL:

		INSERT INTO mailserver.admins (username,pwhash) VALUES ('john', MD5('doe'));

Note that you will need to create a MySQL user who has write access to the 'mailserver' database.

Installation on the destination (mail) server

As user root:

  • aptitude install python-virtualenv
  • apt-get build-dep python-mysqldb

Become the user vmail:

  • su -s /bin/bash vmail

Prepare the application:

  • cd /var/vmail
  • mkdir ispwebadmin
  • cd ispwebadmin
  • virtualenv .
  • . bin/activate
  • easy_install ispwebadmin*.tar.gz
  • paster make-config ispwebadmin run.ini (this creates a 'run.ini' file that contains setting that are specific to your installation - see below for settings you need to customize)
  • vi run.ini
  • paster serve run.ini

As a quick-and-dirty solution this can be used to run the web application. But to keep the service running in the background and start up automatically when the system boots the daemontools mechanism is recommended:

Starting automatically using runit (Debian Lenny)

As user root:

  • aptitude install runit
  • mkdir /etc/sv/ispwebadmin
  • cd /etc/sv/ispwebadmin

Create a file "/etc/sv/ispwebadmin/run" there containing:

		#!/bin/sh
exec 2>&1
echo 'ISPwebAdmin starting.'
cd /var/vmail/ispwebadmin
sudo -u vmail PYTHON_EGG_CACHE=/var/vmail/ispwebadmin/.python-eggs bin/paster serve run.ini

Make this script executable:

  • chmod u+x /etc/sv/ispwebadmin/run

Create a symlink to tell runit you want to use this service:

  • ln -s /etc/sv/ispwebadmin /etc/service/

The service should start up automatically. To see if it works:

		$> sv status /etc/service/ispwebadmin
run: ispwebadmin: (pid 3335) 0s; run: log: (pid 3326) 4s

To stop it:

		$> sv stop /etc/service/ispwebadmin
ok: down: ispwebadmin: 1s, normally up

To start it:

		$> sv start /etc/service/ispwebadmin
ok: run: ispwebadmin: (pid 3956) 1s

If you want to get a logfile for this web service you can create a "/etc/sv/ispwebadmin/log/run" file containing:

		#!/bin/sh -e
LOG=/var/log/runit-ispwebadmin
test -d "$LOG" || mkdir -p -m2750 "$LOG"
exec svlogd -tt "$LOG"

Then you should get output in the "/var/log/runit-ispwebadmin" file.

INI file settings

The ini file that you created with "paster make-config something.ini" contains settings that are specific to your mail server installation. Before you run the web interface please check these settings:

[server:main] -> host

The IP address the web server listens on. "0.0.0.0" can be used for all interfaces

[server:main] -> port

The TCP port the web server listens on.

[app:main] -> ispwebadmin.maildir_location

The path to your directory where the users' virtual mailboxes are stored. If you followed the Lenny ISPmail tutorial then this will be "/var/vmail".

[app:main] -> ispwebadmin.postmaster

The email address that is used as an abuse@ and postmaster@ address for newly created domains. You are required to have those accounts for each domain.

This setting is optional.

[app:main] -> sqlalchemy.url

The access string that defines how to access your database. Example:

mysql://root:seoroct3@mailserver.example.com/mailserver?charset=utf8

AttachmentSize
ispwebadmin-1.0.tar.gz21.34 KB
ispwebadmin-1.0.1.tar.gz21.38 KB
ispwebadmin-1.0.2.tar.gz21.38 KB