==== Required information ====
- iRedMail version: 0.8.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Ubuntu server 14.04 (Trusty Tahr)
- Related log if you're reporting an issue: see below
====
Apache configuration for AWStats and Cluebringer uses "mod-auth-mysql", an apache module to authenticate users using an SQL database.
In Ubuntu server 14.04, there are that versions:
* apache2: 2.4.7-1ubuntu4
* libapache2-mod-auth-mysql: 4.3.9-13.1ubuntu3
User authentication on AWStats and Cluebringer webpage always fails with this error in apache error.log:
[Tue May 27] [:error] [pid 2582] No requires line available
"mod-auth-mysql" seems to not have updated since 2005 and it doesn't work with Apache 2.4. See these bug-reports:
* https://bugs.launchpad.net/ubuntu/+sour … ug/1278995
* http://osdir.com/ml/bugs-httpd/2014-04/msg00046.html
So, I change configuration of apache2.conf, awstats.conf, cluebringer.conf to use another apache module that handles user authentication using an SQL database: mod_authn_dbd.
To use it, you must enable two apache modules with this command:
root@my-iredmail-server:~# a2enmod dbd authn_dbd
Also, in Ubuntu, you must install package libaprutil1-dbd-mysql via apt-get:
root@my-iredmail-server:~# apt-get install libaprutil1-dbd-mysq
This is a snippet of my updated apache2.conf (see at the end of file):
# # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
# # MySQL auth (libapache2-mod-auth-apache2) - DEPRECATED!
# # Global config of MySQL server, username, password.
# Auth_MySQL_Info 127.0.0.1 vmail (SUBSTITUTE WITH YOUR PASSWORD: see in your iRedMail.tips file)
# Auth_MySQL_General_DB vmail
# MySQL auth (mod_dbd, libaprutil1-dbd-mysql).
<IfModule mod_dbd.c>
DBDriver mysql
DBDParams "host=127.0.0.1 dbname=vmail user=vmail pass=(SUBSTITUTE WITH YOUR PASSWORD: see in your iRedMail.tips file)"
DBDMin 1
DBDKeep 8
DBDMax 20
DBDExptime 300
</IfModule>
This is my updated awstats.conf:
#
# File generated by iRedMail:
#
# Version: 0.8.7
# Project: http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#
# Note: Please refer to /etc/apache2/sites-available/default-ssl.conf for SSL/TLS setting.
#Alias /awstats/icon "/usr/share/awstats/icon/"
#Alias /awstats/css "/usr/share/awstats/css/"
#Alias /awstats/js "/usr/share/awstats/js/"
#ScriptAlias /awstats "/usr/lib/cgi-bin/"
<Directory /usr/lib/cgi-bin/>
DirectoryIndex awstats.pl
Options ExecCGI
AuthType Basic
AuthName "Authorization Required"
##############################
# mod_auth_mysql (deprecated)#
##############################
# AuthMYSQL on
# AuthBasicAuthoritative Off
# AuthUserFile /dev/null
#
# # Database related.
# AuthMySQL_Password_Table mailbox
# Auth_MySQL_Username_Field username
# Auth_MySQL_Password_Field password
#
# # Password related.
# AuthMySQL_Empty_Passwords off
# AuthMySQL_Encryption_Types Crypt_MD5
# Auth_MySQL_Authoritative On
# #AuthMySQLUserCondition "isglobaladmin=1"
#################
# mod_authn_dbd #
#################
# Password related.
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE mailbox.username=%s"
Order allow,deny
Allow from all
Require valid-user
</Directory>
This is my updated my updated cluebringer.conf:
#
# File generated by iRedMail:
#
# Version: 0.8.7
# Project: http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#
#
# SECURITY WARNING:
#
# Since libapache2-mod-auth-mysql doesn't support advance SQL query, both
# global admins and normal domain admins are able to login to this webui.
# Note: Please refer to /etc/apache2/sites-available/default-ssl.conf for SSL/TLS setting.
<Directory /usr/share/postfix-cluebringer-webui/webui/>
DirectoryIndex index.php
AuthType basic
AuthName "Authorization Required"
##############################
# mod_auth_mysql (deprecated)#
##############################
# AuthMYSQL on
# AuthBasicAuthoritative Off
# AuthUserFile /dev/null
#
# # Database related.
# AuthMySQL_Password_Table mailbox
# Auth_MySQL_Username_Field username
# Auth_MySQL_Password_Field password
#
# # Password related.
# AuthMySQL_Empty_Passwords off
# AuthMySQL_Encryption_Types Crypt_MD5
# Auth_MySQL_Authoritative On
#################
# mod_authn_dbd #
#################
# Password related.
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE mailbox.username=%s"
Order allow,deny
Allow from all
Require valid-user
</Directory>
After editing these files, you must restart apache:
root@my-iredmail-server:~# service apache2 restart
et voilà... now authentication works for both AWStats and Cluebringer!
Now, you can safely remove package libapache2-mod-auth-mysql.