1 (edited by djfake 2014-05-18 22:22:32)

Topic: Awstats 500 error

==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version: 0.8.4
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MYSQL
- Linux/BSD distribution name and version: Ubuntu 14.04
- Related log if you're reporting an issue: /var/log/apache2/error.log
====

When trying to run awstats.pl from http, I get a 500 Internal server error after being prompted for authentication. This is the corresponding log error (AFAIKT)

Sun May 18 08:43:39.276039 2014] [authn_core:error] [pid 14747] [client MyIP] AH01796: AuthType Basic configured without corresponding module



Any ideas?

2

Re: Awstats 500 error

Note, that it does run from the command line

/usr/lib/cgi-bin$ sudo ./awstats.pl -config=mysite.com
Create/Update database for config "/etc/awstats/awstats.conf" by AWStats version 7.2 (build 1.992)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 981)
Jumped lines in file: 981
Found 981 already parsed records.
Parsed lines in file: 10
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 1 corrupted records,
Found 0 old records,
Found 9 new qualified records.

3

Re: Awstats 500 error

Could you please show me full file of /etc/apache2/conf-available/awstats.conf? Please remove/replace password and sensitive info before pasting.

4

Re: Awstats 500 error

Problem after upgrading to Ubuntu 14.04. Had to reinstall libapache2-mod-auth-mysql. Found problem with Awstats and 500 error, AuthMysql was off in awstats.conf).

Both Cluebringer and Awstats both display 401 Unauthorized.

Unauthorized
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

All other services (Roundcubemail, iRedAdmin) work fine. Can restart Cluebringer, and as above Awstats.pl runs from command line.

5

Re: Awstats 500 error

ZhangHuangbin wrote:

Could you please show me full file of /etc/apache2/conf-available/awstats.conf? Please remove/replace password and sensitive info before pasting.

File does not exist. Here is /etc/apache2/conf.d/awstats.conf

# File generated by iRedMail (2013.06.16.13.21.26):
#
# Version:  0.8.4
# Project:  http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#

# Note: Please refer to /etc/apache2/sites-available/default-ssl for SSL/TLS set
ting.
#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
    Order allow,deny
    allow from all
    #allow from 127.0.0.1

    AuthName "Authorization Required"
    AuthType Basic

    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 "isadmin=1 AND isglobaladmin=1"
   
    Require valid-user
</Directory>

6

Re: Awstats 500 error

djfake wrote:

Problem after upgrading to Ubuntu 14.04. Had to reinstall libapache2-mod-auth-mysql. Found problem with Awstats and 500 error, AuthMysql was off in awstats.conf).

Does it work now?
According to the config file, if you input correct mail user name and password, it will allow you to login.
Its recommended to enable below line to restrict access to global admin:

AuthMySQLUserCondition "isglobaladmin=1"

7 (edited by djfake 2014-05-20 02:40:47)

Re: Awstats 500 error

ZhangHuangbin wrote:
djfake wrote:

Problem after upgrading to Ubuntu 14.04. Had to reinstall libapache2-mod-auth-mysql. Found problem with Awstats and 500 error, AuthMysql was off in awstats.conf).

Does it work now?
According to the config file, if you input correct mail user name and password, it will allow you to login.
Its recommended to enable below line to restrict access to global admin:

AuthMySQLUserCondition "isglobaladmin=1"

No, now I have 401 error. Awstats will prompt for user/password and will authenticate, but comes back with 401. Cluebringer just goes directly to 401.

Unauthorized
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

this is what /var/log/apache2/error.log reports

[Mon May 19 13:39:25.112942 2014] [:error] [pid 23354] No requires line available

8

Re: Awstats 500 error

The basic problem is that mod_auth_mysql is not supported in Apache 2.4.x. Is there a way to configure awstats.conf and cluebringer.conf to use another authentication provider, like listed here.

http://httpd.apache.org/docs/2.4/howto/auth.html

9

Re: Awstats 500 error

You can try to use dbd module (it requires package apr-utils) for authentication.

10 (edited by djfake 2014-05-20 09:56:07)

Re: Awstats 500 error

Any idea on how to do that?

Also, does Awstats and Cluebringer work on a clean Apache 2.4? If so, there should be a fix.

At least, is there a way to disable mod_auth_mysql for Awstats and Cluebringer? Disable the password?

11

Re: Awstats 500 error

Sample:
https://bitbucket.org/zhb/iredmail/comm … 0be57e2870
https://bitbucket.org/zhb/iredmail/src/ … bringer.sh

12

Re: Awstats 500 error

Sorry, don't quite understand. Sample of what?

13

Re: Awstats 500 error

As mentioned in my reply, you can use Apache module 'dbd' as addition user authentication module to replace mod_auth_mysql. If you search "dbd" in the links i gave in previous reply, you can find sample config:

DBDriver mysql
DBDParams "host=127.0.0.1 port=3306 dbname=vmail user=vmail pass=xxxx"

<Directory /xxxx/>
AuthType Basic
AuthName "Authentication required"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s"
Require valid-user
</Directory>

Refer to Apache document for more details: http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html

14

Re: Awstats 500 error

Getting there, thank you. Now have this error:

Syntax error in apache2.conf
Can't load driver apr.dbd.mysql.so

Any ideas?

15

Re: Awstats 500 error

Do you have required packages "libaprutil1-dbd-mysql" installed? Also, make sure you have Apache module 'dbd' enabled.

16

Re: Awstats 500 error

ZhangHuangbin wrote:

Do you have required packages "libaprutil1-dbd-mysql" installed? Also, make sure you have Apache module 'dbd' enabled.

Yes, just found that , thank you
sudo apt-get install libaprutil1-dbd-mysql

17 (edited by djfake 2014-05-21 00:38:42)

Re: Awstats 500 error

Awstats is now working, thank you Zhang.