1

Topic: awstats

======== Required information ====
- iRedMail version: 0.9.0
- Store mail accounts in which backend (MySQL):
- Linux/BSD distribution name and version: FreeBSD 10.1  Apache 24
- Related log if you're reporting an issue:

When trying to run awstats ...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.

[Fri Dec 12 16:04:42.486566 2014] [auth_basic:error] [pid 1837] [client 192.168.72.1:2379] AH01617: user postmaster@test.km: authentication failure for "/awstats/awstats.pl": Password Mismatch

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: awstats

"Password mismatch" means incorrect password.

3

Re: awstats

Details of this iRedMail installation.....

Awstats:
    * Configuration files:
        - /usr/local/www/awstats/cgi-bin
        - /usr/local/www/awstats/cgi-bin/awstats.web.conf
        - /usr/local/www/awstats/cgi-bin/awstats.smtp.conf
        - /usr/local/etc/apache24/Includes/awstats.conf
    * Login account:
        - Username: postmaster@test.km, password: 123
    * URL:
        - https://test.ua/awstats/awstats.pl
        - https://test.ua/awstats/awstats.pl?config=web
        - https://test.ua/awstats/awstats.pl?config=smtp
    * Crontab job:
        shell> crontab -l root

The password is correct! it from the message that is generated after installation!!!
- Username: postmaster@test.km, password: 123.  I think the problem in the authentication mechanism.

4

Re: awstats

*) Can you login to webmail with this credential?
*) Show me content of /usr/local/etc/apache24/Includes/awstats.conf

5

Re: awstats

No!
When trying to run awstats ...
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.

/usr/local/etc/apache24/Includes/awstats.conf

DBDriver mysql
# Important note: use 'pass=' for MySQL, 'password=' for PostgreSQL.
DBDParams "host=127.0.0.1 port=3306 dbname=vmail user=vmail pass=DJ28uqQzk7cgzV1QbWNTFR5y51hBna"

<Directory /usr/local/www/awstats/cgi-bin>
    DirectoryIndex awstats.pl
    Options ExecCGI

    AuthType Basic
    AuthName "Authentication required"
    AuthBasicProvider dbd
    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username = %s AND isglobaladmin=1 LIMIT 1"

    Require valid-user
</Directory>

6

Re: awstats

It's mentioned in iRedMail-0.9.0-rc2 release notes, default password is SSHA512 hash in MySQL/PostgreSQL backend, but Apache doesn't support it. If you reset password to MD5, it works.

7 (edited by 3m 2014-12-17 18:25:13)

Re: awstats

I reset password to MD5, in file /usr/local/etc/apache24/Includes/awstats.conf
DBDParams "host=127.0.0.1 port=3306 dbname=vmail user=vmail pass=202cb962ac59075b964b07152d234b70 #/MD5/
don't works!

8

Re: awstats

I mean reset mail user's password, not SQL user "vmail".

9

Re: awstats

I'm stupid tell me how to do it!

10

Re: awstats

Generate a MD5 password hash, for example:

# openssl passwd -1 '123'
$1$kbqKunlJ$/0ywrRCQTelT91hk5pNDx.

Then update password for mail user in SQL table 'vmail.mailbox' like below:

sql> USE vmail;
sql> UPDATE mailbox SET password='$1$kbqKunlJ$/0ywrRCQTelT91hk5pNDx.' WHERE username='your-user@domain.com';

11

Re: awstats

as a result I got!

#!/usr/local/bin/perl
#------------------------------------------------------------------------------
# Free realtime web server logfile analyzer to show advanced web statistics.
# Works from command line or as a CGI. You must use this script as often as
# necessary from your scheduler to update your statistics and from command
# line or a browser to read report results.
# See AWStats documentation (in docs/ directory) for all setup instructions.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------------
require 5.007;

#$|=1;
#use warnings;        # Must be used in test mode only. This reduce a little process speed
#use diagnostics;    # Must be used in test mode only. This reduce a lot of process speed
use strict;
no strict "refs";
use Time::Local
  ; # use Time::Local 'timelocal_nocheck' is faster but not supported by all Time::Local modules
use Socket;
use Encode;
use File::Spec;..............

12

Re: awstats

Looks like CGI script doesn't work. Did you try any solution to make it work? Don't just wait for me.