RPM Based PostfixAdmin install
If you are using RHEL and would like to install PostfixAdmin then here are the steps.
The default RPM does not have mysql support, but you can use an RPM build for centos. I used wget to fetch from here:
I used this one which is built for PostgreSQL as well as MySQL since it's a newer version that the one built solely for MySQL.
If you do not have PostgreSQL installed, you will need to install it to satisfy the dependency, even though we will not use it, or you could try installing with the --nodeps flag.
rpm -e postfix
rpm -ivh postfix-2.2.10-1.RHEL4.2.mysql_pgsql.c4.i386.rpm
warning: postfix-2.2.10-1.RHEL4.2.mysql_pgsql.c4.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing… ########################################### [100%]
1:postfix ########################################### [100%]
postconf -m | grep mysql
mysql
The newer packages, now complain about some MySQL libraries:
[root@vps ~]# rpm -ivh postfix-2.2.10-1.1.el4.centos.mysql_pgsql.plus.i386.rpm
warning: postfix-2.2.10-1.1.el4.centos.mysql_pgsql.plus.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
error: Failed dependencies:
libmysqlclient.so.15 is needed by postfix-2.2.10-1.1.el4.centos.mysql_pgsql.plus.i386
libmysqlclient.so.15(libmysqlclient_15) is needed by postfix-2.2.10-1.1.el4.centos.mysql_pgsql.plus.i386
libpq.so.4 is needed by postfix-2.2.10-1.1.el4.centos.mysql_pgsql.plus.i386
postgresql is needed by postfix-2.2.10-1.1.el4.centos.mysql_pgsql.plus.i386I upgraded MySQL from 4.1.20 in this case to a 5.0.x version following our notes here:
http://bliki.rimuhosting.com/space/knowledgebase/linux/miscapplications/rpm+based+mysql5+installAnd then it installed ok.
I found that I could use the regular RHEL dovecot package, at least no problems reported yet
rpm -qa | grep dovecot
dovecot-0.99.11-4.EL4
Get postfixadmin, which is at sourceforge now:
wget http://optusnet.dl.sourceforge.net/sourceforge/postfixadmin/postfixadmin-2.1.0.tgz
Or the most recent version as of last time we installed:
wget http://easynews.dl.sourceforge.net/sourceforge/postfixadmin/postfixadmin-2.2.0-RC1.tar.gz
Red Hat specific fiddling:
mv postfixadmin-2.1.0.tgz /var/www/html/
tar -zxvf /var/www/html/postfixadmin-2.1.0.tgz
cd /var/www/html/postfixadmin-2.1.0
cp config.inc.php.sample config.inc.php
These next steps are blatantly copied from our Debian-based howto:
http://bliki.rimuhosting.com/space/knowledgebase/linux/mail/postfixadmin+on+debian+sargeConfigure Postfix Admin to match your setup (e.g. to make the database passwords match, set your default domain, etc)
Or to quickly change the default domain to your own:
replace "change-this-to-your.domain.tld" "yourdomain.com" -- config.inc.php
Also set these variables, to simplify things:
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';
$CONF['encrypt'] = 'cleartext';
Change the permissions on the postfixadmin directory if you don't want any local users accessing it:
chown -R apache:apache postfixadmin
chmod -R 700 postfixadmin
Then browse to
http://yourdomain.com/postfixadmin/ or
http://yourip/postfixadmin/. It will prompt you to run Setup. Make sure the Setup Checker says 'OK' for everything.
Remove the setup.php as it recommends.
Setup the .htaccess by changing the path of the .htpasswd file to /var/www/postfixadmin/admin/.htpasswd, and set an admin password
cd admin/
vi .htaccess
htpasswd .htpasswd admin
Then browse to
http://yourdomain.com/postfixadmin/admin. You should get prompted. Login as 'admin' with your newly created password.
From here you can add domains, mailboxes, etc. But Postfix won't see these yet. We need to install Postfix, and configure it.
Install Postfix, SASL2 with MySQL support
apt-get install postfix-mysql postfix-tls libsasl2-modules-sql libsasl2-modules
Add the following to /etc/postfix/main.cf<br />
Change the UID of 106 to that of your postfix user (89 on CentOS)
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:106
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 106
virtual_transport = virtual
virtual_uid_maps = static:106broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
Create the following files in /etc/postfix/:
mysql_virtual_alias_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address
mysql_virtual_domains_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'
mysql_virtual_mailbox_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
For SMTP AUTH, I have these cyrus-sasl packages installed, not sure I need all of them:
rpm -qa | grep sasl
cyrus-sasl-plain-2.1.19-5.EL4
cyrus-sasl-sql-2.1.19-5.EL4
cyrus-sasl-md5-2.1.19-5.EL4
cyrus-sasl-2.1.19-5.EL4
cyrus-sasl-devel-2.1.19-5.EL4
Setup the following in /usr/lib/sasl2/smtpd.conf:
pwcheck_method: auxprop
mech_list: PLAIN LOGIN
auxprop_plugin: sql
sql_verbose: yes
sql_engine: mysql
sql_hostnames: localhost
sql_user: postfix
sql_passwd: postfix
sql_database: postfix
sql_select: select password from mailbox where username = '%u@%r'
Create the Dovecot/MySQL setup in /etc/dovecot-mysql.conf using these settings:
db_host = 127.0.0.1
db_port = 3306
db = postfix
db_user = postfix
db_passwd = postfix
db_client_flags = 0
default_pass_scheme = PLAIN
password_query = SELECT password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, 106 AS uid, 106 AS gid FROM mailbox WHERE username = '%u'
Then configure Dovecot to use MySQL by setting these options in /etc/dovecot.conf:
auth_userdb = mysql /etc/dovecot-mysql.conf
auth_passdb = mysql /etc/dovecot-mysql.conf
first_valid_uid = 106
default_mail_env = maildir:/home/vmail/%d/%n
Also setup which protocols you want it to handle (you'll need regular IMAP for most webmail packages):
protocols = imaps imap pop3s pop3
Restart dovecot and postfix and check if it works.
Now login to postfixadmin/admin and setup a test account. You can send a test message from the server to test it:
echo "test postfixadmin" | mail -s test test@yourdomain.com