From iRedMail
Summary
iRedMail doesn't ship PostfixAdmin since iRedMail-0.7.0, but the core columns in iRedMail SQL structure are almost same as PostfixAdmin, so you can install PostfixAdmin manually for MySQL backend to manage mail accounts.
References:
Note:
- There's no guarantee to keep iRedMail compatible with PostfixAdmin SQL structure in the future.
- This tutorial is wrote for iRedMail-0.7.0, it probably need some adjustments for later versions.
Download and uncompress PostfixAdmin
- You can download PostfixAdmin from official site here: http://sourceforge.net/projects/postfixadmin/files/ , we use PostfixAdmin-2.3.2 for example: postfixadmin-2.3.2.tar.gz, and we assume you already download it under /root/ directory.
- Uncompress PostfixAdmin to Apache server root and set correct file permission:
| Terminal:
|
#
# ---- On RHEL/CentOS ----
#
# tar zxf /root/postfixadmin-2.3.2.tar.gz -C /var/www/ # <- Uncomress source tarball.
# cd /var/www/
# ln -s postfixadmin-2.3.2 postfixadmin # <- Create a symbol link.
# chown -R root:root postfixadmin # <- Set correct owner and permission.
# chmod -R 755 postfixadmin
# cd postfixadmin
# mv setup.php setup.php.save
# echo '' > motd.txt
# echo '' > motd-users.txt
#
# ---- On Debian/Ubuntu ----
#
# tar zxf /root/postfixadmin-2.3.2.tar.gz -C /usr/share/apache2/ # <- Uncomress source tarball.
# cd /usr/share/apache2/
# ln -s postfixadmin-2.3.2 postfixadmin # <- Create a symbol link.
# chown -R root:root postfixadmin # <- Set correct owner and permission.
# chmod -R 755 postfixadmin
# cd postfixadmin
# mv setup.php setup.php.save
# echo '' > motd.txt
# echo '' > motd-users.txt
#
# ---- On OpenSuSE ----
#
# tar zxf /root/postfixadmin-2.3.2.tar.gz -C /srv/www/ # <- Uncomress source tarball.
# cd /srv/www/
# ln -s postfixadmin-2.3.2 postfixadmin # <- Create a symbol link.
# chown -R root:root postfixadmin # <- Set correct owner and permission.
# chmod -R 0755 postfixadmin
# cd postfixadmin
# mv setup.php setup.php.save
# echo '' > motd.txt
# echo '' > motd-users.txt
#
# ---- On FreeBSD ----
#
# tar zxf /root/postfixadmin-2.3.2.tar.gz -C /usr/local/www/ # <- Uncomress source tarball.
# cd /usr/local/www/
# ln -s postfixadmin-2.3.2 postfixadmin # <- Create a symbol link.
# chown -R root:wheel postfixadmin # <- Set correct owner and permission.
# chmod -R 0755 postfixadmin
# cd postfixadmin
# mv setup.php setup.php.save
# echo '' > motd.txt
# echo '' > motd-users.txt
|
PostfixAdmin will send a welcome message to newly created mail users, but it will be failed since iRedMail requires sender login. Here's a patch to disable welcome message:
Configure PostfixAdmin
PostfixAdmin will read custom settings from config file "config.local.php" by default, it's great for upgrading in the futher. So we will create it under postfixadmin directory.
NOTE::
- You can find password of MySQL user "vmailadmin" in iRedMail installation directory, e.g. /root/iRedMail-0.7.0/iRedMail.tips.
- If you choose to install iRedAdmin open source edition during iRedMail installation, you can find password of MySQL user "vmailadmin" in iRedAdmin config file:
- on RHEL/CentOS: /var/www/iredadmin/ssettings.ini
- on Debian/Ubuntu: /usr/share/apache2/iredadmin/settings.ini
- on openSUSE: /srv/www/iredadmin/settings.ini
- on FreeBSD: /usr/local/www/iredadmin/settings.ini
| File: config.local.php
|
<?php
// Basic configuration.
$CONF['configured'] = true;
$CONF['postfix_admin_url'] = "/postfixadmin";
$CONF['default_language'] = "en";
$CONF['database_type'] = "mysqli";
$CONF['database_host'] = "localhost";
$CONF['database_user'] = "vmailadmin";
$CONF['database_password'] = "SoElbUfarkAAzYXQVHNbNkaE9h5oY4"; # <- REPLACE THIS PASSWORD.
$CONF['database_name'] = "vmail";
$CONF['smtp_server'] = "127.0.0.1";
$CONF['domain_path'] = "YES";
$CONF['domain_in_mailbox'] = "NO";
$CONF['quota'] = "YES";
$CONF['quota_multiplier'] = 1;
$CONF['transport'] = "YES";
$CONF['transport_options'] = array ('dovecot', 'virtual', 'local', 'relay');
$CONF['transport_default'] = "dovecot";
// Enable alias domain.
$CONF['alias_domain'] = 'YES';
// Disable features we don't have.
$CONF['backup'] = "NO";
$CONF['fetchmail'] = "NO";
$CONF['sendmail'] = "NO";
$CONF['show_footer_text'] = "NO";
$CONF['emailcheck_resolve_domain'] = "NO";
// Disable PostfixAdmin style vacation. We use managesieve service instead.
$CONF['vacation_control'] = "NO";
$CONF['vacation_control_admin'] = "NO";
$CONF['admin_email'] = "www@example.com";
?>
|
Configure Apache web server
We need to make PostfixAdmin accessable in your web browser. For security reason, we enable HTTPS only for PostfixAdmin.
- On RHEL/CentOS, we need to create a new file: "/etc/httpd/conf.d/postfixadmin.conf", and modify "/etc/httpd/conf.d/ssl.conf" (Add one line):
| File: /etc/httpd/conf.d/postfixadmin.conf
|
<Directory "/var/www/postfixadmin/">
Options -Indexes
</Directory>
|
| File: /etc/httpd/conf.d/ssl.conf
|
# Add below lines before </VirtualHost>
Alias /postfixadmin "/var/www/postfixadmin/"
|
- On Debian/Ubuntu, we need to create a new file "/etc/apache2/conf.d/postfixadmin.conf", and modify "/etc/apache2/sites-enabled/default-ssl" (Add one line):
| File: /etc/apache2/conf.d/postfixadmin.conf
|
<Directory "/usr/share/apache2/postfixadmin/">
Options -Indexes
</Directory>
|
| File: /etc/apache2/sites-enabled/default-ssl
|
# Add below lines before </VirtualHost>
Alias /postfixadmin "/usr/share/apache2/postfixadmin/"
|
- On openSUSE, we need to create a new file "/etc/apache2/conf.d/postfixadmin.conf", and modify "/etc/apache2/vhosts.d/vhost-ssl.conf" (Add one line):
| File: /etc/apache2/conf.d/postfixadmin.conf
|
<Directory "/srv/www/postfixadmin/">
Options -Indexes
</Directory>
|
| File: /etc/apache2/vhosts.d/vhost-ssl.conf
|
# Add below lines before </VirtualHost>
Alias /postfixadmin "/srv/www/postfixadmin/"
|
- On FreeBSD, we need to create a new file "/usr/local/etc/apache22/Includes/postfixadmin.conf", and modify "/usr/local/etc/apache22/Includes/extra/httpd-ssl.conf" (Add one line):
| File: /usr/local/etc/apache22/Includes/postfixadmin.conf
|
<Directory "/usr/local/www/postfixadmin/">
Options -Indexes
</Directory>
|
| File: /usr/local/etc/apache22/Includes/extra/httpd-ssl.conf
|
# Add below lines before </VirtualHost>
Alias /postfixadmin "/usr/local/www/postfixadmin/"
|
Restart Apache web server to make it work
| Terminal:
|
# /etc/init.d/httpd restart
|
- On Debian/Ubuntu/openSUSE:
| Terminal:
|
# /etc/init.d/apache2 restart
|
| Terminal:
|
# /usr/local/etc/rc.d/apache22 restart
|
Now you can access PostfixAdmin in web browser with URL: httpS://your_server_hostname_or_IP/postfixadmin/
Important Notes
- Default SQL structure in iRedMail-0.7.0 are slightly changed. In "vmail.mailbox", transport is set to (empty, not a SPACE character) by default, like below:
CREATE TABLE IF NOT EXISTS mailbox (
[...]
transport VARCHAR(255) NOT NULL DEFAULT '',
[...]
You can simply change postfix lookup file "/etc/postfix/mysql/transport_maps_user.cf", append "AND transport<>" in "query" setting.
In iRedMail-0.7.0, it's set to:
| File: /etc/postfix/mysql/transport_maps_user.cf
|
query = SELECT mailbox.transport FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.domain='%d' AND mailbox.domain=domain.domain AND mailbox.transport<>'' AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.backupmx=0 AND domain.active=1
|