Current time: 05-01-2024, 06:10 PM Hello There, Guest! (LoginRegister)


Post Reply 
Awstats password protection
Author Message
linux-guru Offline
Junior Member
*

Posts: 27
Joined: Jul 2007
Reputation: 0
Post: #16
RE: Awstats password protection
I did a (quite dirty) hack for enabling authentication of stats in static mode.

At first, since mod_auth_mysql is not available on etch and dbd has no mysql-support, the only alternative is libapache2-mod-auth-pam which could be made using libpam-mysql. BUT: libpam-mysql has problems to support md5-password.
So another "hack" is needed. Please see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=373834
When the new package is built, install it, and configure as follows:

1. Install libapache2-mod-auth-pam
Code:
apt-get install libapache2-mod-auth-pam -y

2. Create .htaccess e.g. in /var/www/ispcp/engine/awstats/ with the following content:
Code:
AuthPAM_Enabled on
        AuthPAM_FallThrough off
        AuthType Basic
        AuthName "Restricted area"
        AuthUserFile /dev/null
        AuthBasicAuthoritative Off
        Require valid-user

3. Make /etc/pam.d/apache2 looking like this:
Code:
auth required pam_mysql.so user=root passwd=YOUR_PASS host=localhost db=ispcp table=admin usercolumn=admin_name passwdcolumn=admin_pass crypt=3
account required pam_mysql.so user=root passwd=YOUR_PASS host=localhost db=ispcp table=admin usercolumn=admin_name passwdcolumn=admin_pass crypt=3
#@include common-auth
#@include common-account

4. Edit /var/www/ispcp/engine/ispcp-dmn-mngr
after (currently lines 1911-1921)
Code:
if ($main::cfg{'AWSTATS_ACTIVE'} eq 'yes' && $main::cfg{'AWSTATS_MODE'} eq 1) {
                if (! -d "$www_dir/$dmn_name/statistics") {
                    $rs = make_dir(
                                    "$www_dir/$dmn_name/statistics",
                                    $sys_user,
                                    $sys_group,
                                    0755
                                    );

                return $rs if ($rs != 0);
        }
insert
Code:
if (! -e "$www_dir/$dmn_name/statistics/.htaccess") {

                $rs = sys_command("$main::cfg{'CMD_CP'} -p $root_dir/engine/awstats/.htaccess $www_dir/$dmn_name/statistics/");
                return $rs if ($rs != 0);
                $rs = setfmode("$www_dir/$dmn_name/statistics/.htaccess", $sys_user, $sys_group, 0644);
                return $rs if ($rs != 0);
            }
and the same again after
Code:
if ($main::cfg{'AWSTATS_ACTIVE'} eq 'yes' && $main::cfg{'AWSTATS_MODE'} eq 1) {
                if (! -d "$www_dir/$dmn_name/statistics") {
                    $rs = make_dir(
                                    "$www_dir/$dmn_name/statistics",
                                    $sys_user,
                                    $sys_group,
                                    0755
                                    );

                return $rs if ($rs != 0);
        }
(currently lines 2347-2357)

5. Tell ispcp that there are changes which are needed to be processed.
Code:
mysql -u root -p<password>
mysql>USE ispcp
mysql>UPDATE domain SET domain_status = 'change' WHERE domain_status = 'ok';
mysql>quit

6. Run the update
Code:
/var/www/ispcp/engine/ispcp-rqst-mngr

Now your users have protected stats which can only be seen through authentication with their ispcp-admin-login and the corresponding password.

Note: If one knows another hosting on this machine, he/she it is able to see the other users stats while entering his own credentials!

Feedback is welcome! :-)
(This post was last modified: 12-23-2007 04:04 AM by linux-guru.)
12-23-2007 02:25 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Awstats password protection - Cube - 10-18-2007, 06:05 AM
RE: Awstats password protection - RatS - 10-18-2007, 07:52 AM
RE: Awstats password protection - Cube - 10-18-2007, 08:32 AM
RE: Awstats password protection - raphael - 10-18-2007, 09:48 AM
RE: Awstats password protection - BioALIEN - 10-18-2007, 07:08 PM
RE: Awstats password protection - robmorin - 10-24-2007, 12:43 AM
RE: Awstats password protection - BeNe - 10-25-2007, 10:29 PM
RE: Awstats password protection - BeNe - 10-25-2007, 11:42 PM
RE: Awstats password protection - BeNe - 10-28-2007, 03:10 AM
RE: Awstats password protection - Cube - 11-01-2007, 01:42 AM
RE: Awstats password protection - jmeyerdo - 11-01-2007, 05:26 AM
RE: Awstats password protection - BeNe - 11-01-2007, 06:40 AM
RE: Awstats password protection - linux-guru - 12-23-2007 02:25 AM
RE: Awstats password protection - Mike - 12-26-2007, 07:35 AM
RE: Awstats password protection - divion - 01-09-2008, 03:21 PM
RE: Awstats password protection - BeNe - 01-23-2008, 05:50 AM
RE: Awstats password protection - BeNe - 01-24-2008, 12:12 AM
RE: Awstats password protection - BioALIEN - 01-24-2008, 12:27 AM
RE: Awstats password protection - BeNe - 01-24-2008, 06:10 AM
RE: Awstats password protection - Cube - 02-19-2008, 10:22 AM
RE: Awstats password protection - Kwik - 02-22-2008, 07:03 PM
RE: Awstats password protection - rauschr - 05-13-2008, 07:47 AM
RE: Awstats password protection - BeNe - 04-16-2008, 05:25 PM
RE: Awstats password protection - ghislain - 04-16-2008, 09:48 PM
RE: Awstats password protection - Eminos - 04-23-2008, 12:44 AM
RE: Awstats password protection - Eminos - 04-24-2008, 08:52 PM
RE: Awstats password protection - Cube - 04-25-2008, 05:29 AM
RE: Awstats password protection - momo - 06-14-2008, 12:46 AM
RE: Awstats password protection - BeNe - 06-16-2008, 03:34 AM
RE: Awstats password protection - Eminos - 06-16-2008, 03:36 AM
RE: Awstats password protection - Cube - 06-16-2008, 04:00 AM
RE: Awstats password protection - Eminos - 06-16-2008, 04:01 AM
RE: Awstats password protection - momo - 06-17-2008, 02:26 AM
RE: Awstats password protection - Eminos - 06-17-2008, 03:29 AM
RE: Awstats password protection - momo - 06-17-2008, 04:46 AM
RE: Awstats password protection - Eminos - 06-17-2008, 04:50 AM
RE: Awstats password protection - momo - 06-17-2008, 05:01 AM
RE: Awstats password protection - memic - 06-22-2008, 08:11 AM
RE: Awstats password protection - RatS - 08-09-2008, 07:39 PM
RE: Awstats password protection - obey - 08-12-2008, 07:18 PM
RE: Awstats password protection - RatS - 08-13-2008, 05:31 AM
RE: Awstats password protection - lbm - 09-09-2008, 04:04 AM
RE: Awstats password protection - BeNe - 09-09-2008, 06:07 AM
RE: Awstats password protection - lbm - 09-10-2008, 08:27 PM
RE: Awstats password protection - noel - 10-27-2008, 11:41 AM
RE: Awstats password protection - noel - 10-27-2008, 10:21 PM
RE: Awstats password protection - simple - 11-24-2008, 04:55 AM
RE: Awstats password protection - sci2tech - 11-24-2008, 05:15 AM
RE: Awstats password protection - simple - 11-25-2008, 06:57 PM
RE: Awstats password protection - sci2tech - 11-26-2008, 02:02 AM
RE: Awstats password protection - sci2tech - 11-27-2008, 09:21 AM
RE: Awstats password protection - Cube - 11-28-2008, 05:07 AM
RE: Awstats password protection - sci2tech - 11-28-2008, 06:25 AM
RE: Awstats password protection - momo - 01-16-2009, 06:36 AM
RE: Awstats password protection - momo - 01-20-2009, 08:38 AM
RE: Awstats password protection - simple - 01-20-2009, 08:44 AM
RE: Awstats password protection - bulforce - 01-29-2009, 04:31 PM
RE: Awstats password protection - BeNe - 01-29-2009, 04:46 PM
RE: Awstats password protection - sci2tech - 01-29-2009, 10:26 PM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)