Addition/Install.PostfixAdmin.For.MySQL.Backend

From iRedMail

(Difference between revisions)
Jump to: navigation, search
(Make PostfixAdmin can be accessed via HTTPS only)
Line 1: Line 1:
-
iRedMail-0.7.0 removed PostfixAdmin, but you can install it to work with MySQL backend manually.
+
__TOC__
 +
 
 +
= 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:'''
 +
* [http://www.iredmail.org/forum/topic1735-why-we-remove-postfixadmin-in-iredmail070.html Why we remove PostfixAdmin in iRedMail]
 +
* [http://www.iredmail.org/iredadmin-pro-mysql-vs-postfixadmin.html Compare iRedAdmin-Pro-MySQL with PostfixAdmin]
 +
 
 +
 
 +
'''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:
-
=Download and configure PostfixAdmin =
 
{{cmd|<pre>
{{cmd|<pre>
 +
#
# ---- On RHEL/CentOS ----
# ---- On RHEL/CentOS ----
-
cd /var/www
+
#
 +
# 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 ----
# ---- On Debian/Ubuntu ----
-
cd /usr/share/apache2
+
#
 +
# 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 ----
# ---- On OpenSuSE ----
-
cd /srv/www/
+
#
 +
# 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
-
wget  http://www.iredmail.org/yum/misc/postfixadmin-2.3.2.tar.gz
+
#
-
tar zxvf postfixadmin-2.3.2.tar.gz
+
# ---- On FreeBSD ----
-
ln -s postfixadmin-2.3.2 postfixadmin
+
#
-
chown -R root:root postfixadmin
+
# tar zxf /root/postfixadmin-2.3.2.tar.gz -C /usr/local/www/        # <- Uncomress source tarball.
-
chmod -R 755 postfixadmin
+
# cd /usr/local/www/
-
cd postfixadmin
+
# ln -s postfixadmin-2.3.2 postfixadmin       # <- Create a symbol link.
-
wget http://iredmail.googlecode.com/hg/tags/0.6.1/patches/postfixadmin/create_mailbox.patch
+
# chown -R root:wheel postfixadmin       # <- Set correct owner and permission.
-
patch -p0 < create_mailbox.patch
+
# chmod -R 0755 postfixadmin
-
mv setup.php setup.php.save
+
# cd postfixadmin
-
echo '' > motd.txt
+
# mv setup.php setup.php.save
-
echo '' > motd-users.txt
+
# echo '' > motd.txt
 +
# echo '' > motd-users.txt
 +
</pre>}}
 +
= 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.
-
</pre>}}
+
'''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
-
Create config.local.php file for PostfixAdmin, you can find the vmailadmin password form iRedMail.tips or iRedadmin/ssettings.ini
 
{{cfg|config.local.php|<pre>
{{cfg|config.local.php|<pre>
<?php
<?php
 +
// Basic configuration.
$CONF['configured'] = true;
$CONF['configured'] = true;
$CONF['postfix_admin_url'] = "/postfixadmin";
$CONF['postfix_admin_url'] = "/postfixadmin";
Line 36: Line 91:
$CONF['database_host'] = "localhost";
$CONF['database_host'] = "localhost";
$CONF['database_user'] = "vmailadmin";
$CONF['database_user'] = "vmailadmin";
-
$CONF['database_password'] = "SoElbUfarkAAzYXQVHNbNkaE9h5oY4";
+
$CONF['database_password'] = "SoElbUfarkAAzYXQVHNbNkaE9h5oY4";                     # <- REPLACE THIS PASSWORD.
$CONF['database_name'] = "vmail";
$CONF['database_name'] = "vmail";
$CONF['smtp_server'] = "127.0.0.1";
$CONF['smtp_server'] = "127.0.0.1";
Line 48: Line 103:
$CONF['transport_default'] = "dovecot";
$CONF['transport_default'] = "dovecot";
-
# Enable alias domain.
+
// Enable alias domain.
$CONF['alias_domain'] = 'YES';
$CONF['alias_domain'] = 'YES';
 +
// Disable features we don't have.
$CONF['backup'] = "NO";
$CONF['backup'] = "NO";
$CONF['fetchmail'] = "NO";
$CONF['fetchmail'] = "NO";
Line 57: Line 113:
$CONF['emailcheck_resolve_domain'] = "NO";
$CONF['emailcheck_resolve_domain'] = "NO";
-
# Disable vacation.
+
// Disable PostfixAdmin style vacation. We use managesieve service instead.
$CONF['vacation_control'] = "NO";
$CONF['vacation_control'] = "NO";
$CONF['vacation_control_admin'] = "NO";
$CONF['vacation_control_admin'] = "NO";
Line 64: Line 120:
</pre>}}
</pre>}}
-
=Make PostfixAdmin can be accessed via HTTPS only=
+
= Configure Apache web server =
-
 
+
We need to make PostfixAdmin accessable in your web browser. For security reason, we enable HTTPS only for PostfixAdmin.
-
Create PostfixAdmin Apache config file:
+
-
<pre>
+
-
# ---- On RHEL/CentOS ----
+
-
# Create  /etc/httpd/conf.d/postfixadmin.conf
+
 +
* 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):
 +
{{cfg|/etc/httpd/conf.d/postfixadmin.conf|<pre>
<Directory "/var/www/postfixadmin/">
<Directory "/var/www/postfixadmin/">
     Options -Indexes
     Options -Indexes
</Directory>
</Directory>
 +
</pre>}}
-
# ---- On Debian/Ubuntu ----
+
{{cfg|/etc/httpd/conf.d/ssl.conf|<pre>
-
#Create /etc/apache2/conf.d/postfixadmin.conf
+
# Add below lines before </VirtualHost>
 +
Alias /postfixadmin "/var/www/postfixadmin/"
 +
</pre>}}
-
<Directory "/usrshare/apache2/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):
 +
{{cfg|/etc/apache2/conf.d/postfixadmin.conf|<pre>
 +
<Directory "/usr/share/apache2/postfixadmin/">
     Options -Indexes
     Options -Indexes
</Directory>
</Directory>
 +
</pre>}}
 +
 +
{{cfg|/etc/apache2/sites-enabled/default-ssl|<pre>
 +
# Add below lines before </VirtualHost>
 +
Alias /postfixadmin "/usr/share/apache2/postfixadmin/"
 +
</pre>}}
-
# ---- On OpenSuSE ----
 
-
#Create/etc/apache2/conf.d/postfixadmin.conf
 
 +
* 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):
 +
{{cfg|/etc/apache2/conf.d/postfixadmin.conf|<pre>
<Directory "/srv/www/postfixadmin/">
<Directory "/srv/www/postfixadmin/">
     Options -Indexes
     Options -Indexes
</Directory>
</Directory>
 +
</pre>}}
-
</pre>
+
{{cfg|/etc/apache2/vhosts.d/vhost-ssl.conf|<pre>
 +
# Add below lines before </VirtualHost>
 +
Alias /postfixadmin "/srv/www/postfixadmin/"
 +
</pre>}}
-
Setting SSL access. Add the line  
+
* 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):
-
<pre>
+
{{cfg|/usr/local/etc/apache22/Includes/postfixadmin.conf|<pre>
-
# ---- On RHEL/CentOS ----  /etc/httpd/conf.d/ssl.conf
+
<Directory "/usr/local/www/postfixadmin/">
 +
    Options -Indexes
 +
</Directory>
 +
</pre>}}
-
Alias /postfixadmin "/var/www/postfixadmin/"
+
{{cfg|/usr/local/etc/apache22/Includes/extra/httpd-ssl.conf|<pre>
 +
# Add below lines before </VirtualHost>
 +
Alias /postfixadmin "/usr/local/www/postfixadmin/"
 +
</pre>}}
-
# ---- On Debian/Ubuntu ----  /etc/apache2/sites-enabled/default-ssl
+
= Restart Apache web server to make it work =
-
Alias /postfixadmin "/usr/share/apache2/postfixadmin/"
+
* On RHEL/CentOS:
 +
{{cmd|<pre># /etc/init.d/httpd restart</pre>}}
-
# ---- On OpenSuSE ----  /etc/apache2/vhosts.d/vhost-ssl.conf
+
* On Debian/Ubuntu/openSUSE:
 +
{{cmd|<pre># /etc/init.d/apache2 restart</pre>}}
-
Alias /postfixadmin "/srv/www/postfixadmin/"
+
* On FreeBSD:
 +
{{cmd|<pre># /usr/local/etc/rc.d/apache22 restart</pre>}}
</pre>
</pre>
-
Restart the Apache
+
Now you can access PostfixAdmin in web browser with URL: httpS://your_server_hostname_or_IP/postfixadmin/
-
 
+
-
<pre>
+
-
/etc/init.d/httpd restart
+
-
or
+
-
/etc/init.d/apache restart
+
-
</pre>
+

Revision as of 13:30, 4 April 2011

Contents


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

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

  • On RHEL/CentOS:
Terminal:
# /etc/init.d/httpd restart
  • On Debian/Ubuntu/openSUSE:
Terminal:
# /etc/init.d/apache2 restart
  • On FreeBSD:
Terminal:
# /usr/local/etc/rc.d/apache22 restart

</pre>

Now you can access PostfixAdmin in web browser with URL: httpS://your_server_hostname_or_IP/postfixadmin/

Personal tools