[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Webalizer Stats security



Add a .htaccess file like this one to the directory named stats
order allow,deny
allow from all
require group sitexx (where x is the site number)
Authname Stats
Authtype Basic

The script webalizer.pl adds a stats directory and .htaccess for each new site when run from cron each week or month

#!/usr/bin/perl -w
#
# first we run webazolver to build the dns cache
# then do the webalizer magic again

use strict;
use Cobalt::Product;
use Cobalt::Vsite;

my @domains;
my @groups;

my $verbose = 0;        # Set to 1 to see garbage, doesn't harm -Q

foreach (vsite_list()) {        # build list of sites and the groups
        push @domains, $$_[1];
        push @groups, $$_[2];
}

for my $dom (@domains) {        # build the dns cache
        if ($verbose) {
                print("Building dnscache from: $Htgroup_dir/$dom/$Logdir/web.log
\n");
        }
        system("/usr/bin/webazolver -Q -N 10 $Htgroup_dir/$dom/$Logdir/web.log")
;
}

for (my $i =0; $i <= $#domains; $i++) {
        if ($verbose) {
                print("Webalizing $domains[$i]...\n");
        }
        if (! -e "$Htgroup_dir/$domains[$i]/$Webdir/stats") {
                if ($verbose) {
                        print ("  Adding stats dir & htaccess\n");
                }
                mkdir "$Htgroup_dir/$domains[$i]/$Webdir/stats", 0755;
                open HTXS, ">$Htgroup_dir/$domains[$i]/$Webdir/stats/.htaccess";
                print HTXS <<EOF;
order allow,deny
allow from all
require group $groups[$i] admin
Authname Stats
Authtype Basic
EOF
                close HTXS;
        }

        my $in = "$Htgroup_dir/$domains[$i]/$Logdir/web.log";
        my $out = "$Htgroup_dir/$domains[$i]/$Webdir/stats";
        if ($verbose) {
                print("  in:  $in ($groups[$i])\n");
                print("  out: $out\n\n");
        }
        system("/usr/bin/webalizer -Q -s $domains[$i] -r $domains[$i] -n $domain
s[$i] -o $out $in");
        system("chown -R httpd:$groups[$i] $out");
}


exit;

# default setup in /etc/webalizer.conf
# siteconfig: /home/sites/__namethingy__/webalizer.conf (unused)
# input: /home/sites/__namethingy__/log/web.log
# output: /home/sites/__namethingy__/web/stats

# -Q really quiet
# -r hide our own site as referrer

# webalizer -Q -r name -n name -o output input


phampton@xxxxxxxxxxxxxxxx wrote:

> Hello list,
>
> I have added the Webalizer to my RAQ3, but the stats directories are wide open to the world.  Is there a way to have the admin ID and PW placed on the stats directory whenever a new domain is added to the RAQ?
>
> Thanks for your help.
>
> Paul
>
> _________________________________________________
> The simple way to read all your emails at ThatWeb
> http://www.thatweb.com
>
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users

--
Cordialement / Best regards
Eric DECHELLE
+33 (0)4 76 18 32 21
------------------------------------------------------------
The only people for me are the mad ones -- the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn,
burn like fabulous yellow Roman candles. -- Jack Kerouac, "On the Road"
------------------------------------------------------------