• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

AWStats!!!

Odd, not letting me attach the script either, let me try posting it this way:

#!/bin/bash
echo "Enter the username:"
read WUSERNAME

ACCESS_FILE="/etc/awstats/awstats.pwd"

echo "Enter the password:"
read PASSWORD

echo "Enter the main domain:"
read DOMAIN

STAT_DIR="/home/httpd/vhosts/$DOMAIN/httpdocs/awstats"
ACCESSLOGDIR="/home/httpd/vhosts/$DOMAIN/statistics/logs/access_log"

#echo "Enter aliases separated by space:"
#read ALIASES

# Create the statistics directory
if [ -d $STAT_DIR ]; then
echo "Statistics dir already exist"
else
mkdir $STAT_DIR
chown apache:apache $STAT_DIR
chmod 770 $STAT_DIR
fi

# Create the virtual host awstats.conf
cat /etc/awstats/awstats.model.conf | \
sed -e "s/\\\$DOMAIN/$DOMAIN/g" | sed -e "s/\\\$USERNAME/$WUSERNAME/g" | sed -e "s/\\\$ALIASES/$ALIASES/g" > \
"/etc/awstats/awstats.www.$DOMAIN.conf"

# Add user/password to password file
if [ -e $ACCESS_FILE ]; then
/usr/bin/htpasswd -bm $ACCESS_FILE $WUSERNAME $PASSWORD
else
/usr/bin/htpasswd -bm -c $ACCESS_FILE $WUSERNAME $PASSWORD
fi
 
BTW, if anyone is thinking of running awstats, the latest version in 6.3 which solves a security bug.

To upgrade your current version, just unpack the archive over the top of your existing directory.
 
Originally posted by gbjbaanb
BTW, if anyone is thinking of running awstats, the latest version in 6.3 which solves a security bug.

To upgrade your current version, just unpack the archive over the top of your existing directory.

I was considering it. I too saw the same exploit. But my current use of Awstats is very limited. Maybe when I pack on a few more accounts.

It's stated it's a simple install over the current, right? Have you tried it yet?

BTW; Excellent instructional on the script, I applied the same concept. And it's working wonderfully.

I havent' done it yet, but you could also apply a subdomain using Plesk's vhost manager, and a redirect. I do it manually now creating http://stats.domain.nnn/ , vhost.conf, reconfig vhosts, and add an Apache redirect. It's just another little value-added for my clients and makes it easier for them to remember. ;)
 
Yes, I have installed 6.3 - its difficult to untar the archive over the top (as it creates a dir called 'awstats-6.3'), but untar it to temp, then copy the contents over.

No problems, that I didn't have with 6.2 (I get a lot of corrupted records as the timestamp sometimes has 12:00:00 +0000, followed by 07:00:00 +0500). I figure that's just an apache config though, and I havn't got round to investigating properly.
 
Originally posted by gbjbaanb
Yes, I have installed 6.3 - its difficult to untar the archive over the top (as it creates a dir called 'awstats-6.3'), but untar it to temp, then copy the contents over.


Yuck.

Originally posted by gbjbaanb
No problems, that I didn't have with 6.2 (I get a lot of corrupted records as the timestamp sometimes has 12:00:00 +0000, followed by 07:00:00 +0500). I figure that's just an apache config though, and I havn't got round to investigating properly.

Thanks for the answer!

I haven't seen this in the awstats.pl update output. I also have the awstats_updateall.pl run on a cron and the results emailed to me. Is this were you have seen the error? It's a great summary to read and watch daily activity. ;)

Personally I'm using Plesk's/Fedora's/Apache's (not sure who's default) default log format and from what I can tell, Awstats is handling it well.

Have you changed your log format?
What output is showing you the corruption message?
 
Well, after some investigation, it seems that with safe_mode off, PHP can rewrite the timezone environment variable.. which will put the wrong TZ in the logs.

Pain in the bum as I run osCommerce, so need safe_mode off. Anyway, awstats doesn't cope well with timestamps that have a different timezone.

That said, the only php files that have putenv in them are in the horde directory, so I'm going to have to look further,. If anyone has any ideas, I'd love to hear them
 
quick followup: it was PHP after all, a forum that I run on a hobby site was using putenv, and it was that that changed the TZ environment variable.
 
Btw, osCommerce does not requre safe mode to be off, just register globals to be on (for the time being, they are working on eliminating this).
 
Originally posted by gbjbaanb
Yes, I have installed 6.3 - its difficult to untar the archive over the top (as it creates a dir called 'awstats-6.3'), but untar it to temp, then copy the contents over. <snip>

Yeah, I thought I was smart by using rpm -U, forgetting that the original rpm I used was a fedora build and the 6.3 rpm I used was not. So everything was installed in a different awstats root.

At first I simply reconfigured the awstats.conf in /etc/httpd/conf.d/ to point to the new locations, but then I realized that I had some heavy customizations to the awstats.domain.conf files that made this messy and a pain to reconfigure. So I ended up resetting awstats.conf and moving all the upgrade to the orginal awstats root. Oh well. But, it's working fine now.

All and all it took me about 10 minutes.
Sorry if I just bored anyone.
 
I finally figured out how to roll out awstats on each domain I deploy now. I used the skeleton structure that is part of plesk. What they don't tell you is that the entire skelton structure is parsed and any time it comes across the @domain_name@ tag it just replaces it with the domain name being installed.

Basically I just created a domain in plesk and installed awstats, once that was installed I just tared up the dirs and uploaded it to plesk, now all domains have awstats enabled by default. The only thing left to do is manually add a cron job that will parse the files for you, and update the stats. This I believe could be automated with the help of the event manager, but I haven't got there yet.
Here is a rundown of what I did.

1.) download awstats
2.) tar zxf awstats
3.) mkdir /home/httpd/vhosts/domain/httpdocs/stats
4.) cp awstats/wwwroot/* /home/httpd/vhosts/domain/httpdocs/stats/
5.) mv /home/httpd/vhosts/domain/httpdocs/stats/cgi-bin/* /home/httpd/vhosts/domain/cgi-bin/
6.) rm /home/httpd/vhosts/domain/httpdocs/stats/cgi-bin/ -rf
7.) cd /home/httpd/vhosts/domain/cgi-bin
8.) edit awstats.model.conf place your domain name in the correct places, tell it where to find the access_log etc. Update the location of icon css, and js to /stats/js/ or where ever you put them. Save it as awstats.conf
9.) chown user.psacln * -R where user is the domain user
10.) create an /stats/index.html that will redirect to cgi-bin/awstats.pl this was your users have an easy way to get to their stats.
11.) Test your install make sure that awstats works, then edit your index.html and awstats.conf file replace any instance of your domain name with @domain_name@ this will fix all the paths etc.
12.) cd /home/httpd/vhosts/domain/
13.) tar xcz skel.tgz cgi-bin httpdocs
14.) upload the new skel.tgz to plesk,
15.) create a domain
16.) add /home/httpd/vhosts/domain/cgi-bin/awstats.pl -config=/home/httpd/vhosts/domain/cgi-bin/awstats.conf -update >/dev/null 2>&1 to your cron have it run 55 * * * * for every hour and 55 to catch it before plesk does it’s nightly hiding of logs.


hope that helps you out all. I will post a generic skel file confirmed all the bugs are worked out.

exothermic

PS if anyone figures the eventmanager script to add a cron please post it. then this process will be fully automated.
 
That is excellent!! I havnt tried it myself yet, but this is great stuff, why dont SW supply us with this sort of thing.

Thank you exothermic, I will look forward to skel file to try out.
 
Fantastic exothermic!

But, if I understand it correctly, we'd get a seperate copy of the awstats scripts for each domain?

Currently I have it centralized. You way is probally more secure If I understand it correctly.
 
I don't know if it is any more secure, it was the only way I could get it to work. Could you post your config for single location with a single vhost setup? Single location makes it easier to maintain etc. I would really like it if someone could take a shot at the event manager script.

What do you use to add your crons, and what do you use for the config for each vhost?
 
Originally posted by exothermic
<snip> Could you post your config </snip> I would really like it if someone could take a shot at the event manager script.
What do you use to add your crons, and what do you use for the config for each vhost?

Yes, I will do this. Unfortunately at the moment I'm on a big project. If I forget and don't get to in within the week, just post a "reminder" here. I'll get it.

For now, do a search on my posts and look for my reference to the publication I used for my configs. Or do a search on "Awstats" (in these forums) and you will find it the latest posts. It may even be in this thread... not sure though.

I use awstatsupdateall script, but it only works with a centralized configuration.
 
I have been pulling my hair out all night long. I'm looking for a way to centralize my awstats files, and still roll them out with vhosts. I thought I could get away with using symbolic links, but I can't get it to work. The thing is that it needs to run a local awstats.conf file to **** in the perdomain settings. I setup the dir, make the conf, and linked in the .pl files, and I get permision problems. I double checked all the perms and the owner/group and it is all correct, I just seems you can link the script themselves.

The real kicker is that if I link the whole dir in then it works just fine, only problem is then it is pulling a generic conf file which I don't want.

anyone know enough about suexc to help me out here? as far I as I know it follows all the rules as setout in:

http://httpd.apache.org/docs-2.0/suexec.html#model

I really don't know what else to do, as I would like to centralize the awstats scripts, and roll out config files on creation, and I don't know of any other way to do this. I could just create static pages via cron, but I don't want to do that.
 
Well it turns out I never did figureout the whole linking thing, but I found out that suexec requires the user and group to match so it would have worked for one domain only. I'm pretty much out of ideas for clean automated deployment of awstats, with a central location for scripts.

What does work is if suexec isn't turned on for a vhost. This would work for a subdomain since it could be a seperate vhost, but other than that I can't think of any solutions.

If anyone can think of anything let me know and I'll try it out. Remember I'm looking for a fully automated solution, not put your files here and manually create each config file. What I have is automated but it makes upgrading a big pain in the ***. It could be scripted I guess so that isn't such a pain, but still I'm open to hear what you guys think.
 
awstats

Any luck on awstats?
Im new to plesk and need to install awstats
I dont need it on a server wide basis just on a single domain will do for now.
Im pretty much technically challenged when it somes to linux so be gentle
I have read the docs for awstats and am not sure of the directories are to be set up inside httpdocs or quite where etc
please excuse my ineptitude
be gentle !
 
suexec and Awstats

Upgrading Plesk to 7.5.2 corrupts suexec and disables your ability to execute any cgi/pl scripts outside of the vhosts httpdocs.

Several support tickets are out through my server's provider about this issue.

I had to create a seperate copy of awstats.pl for each client in their httpdocs and still there are issues... until I completely install Awstats seperately for each client.

currenlty the seperate copies of awstats.pl are pulling the config files from the /etc/httpd/conf.d/awstats.conf using Alias for:
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"

This only works intermittently, when it breaks --- awstats.pl doesn't parse the logs correctly (and corrupts awstats.pl log files) with the web "Update Now" option and I have to reparse the logs from the CLI, when it gets corrupted.

What a headache!

Can anyone tell me if I can safely temporary disable suexec, and if so, how to do so? At least until Plesk corrects the problem.
 
Back
Top