2016年8月9日 星期二

Install sarg on ClearOS Version 6.x or Version 7.x for great proxy reports

0votes
Installation of SARG on ClearOS 6.x or ClearOS 7.x Reports for your web proxy i.e. squid...

First you need to understand this...
It is your responsibility to determine the suitability of any information
and/or software you receive from this site.If they happen to break
something, that's solely your own problem and you get to keep any and all
of the pieces :-) Also, as this program generates web pages, it is your
responsibility to validate the security of your web-site against attacks
etc. The rpm version below is current as of the time of writing.

The access security for the install below is more suitable if you use
static address(s) for your workstations that will be used to access the sarg
reports. A better alternative method may be available in the future for
using dynamic addresses...

A pre-requisite for this install is squid (web proxy) running, in use
generating records and the webserver (httpd/apache) running... If this is
NOT the case - then fix and come back later... Another pre-requisite is that
you are comfortable using the cli, familiar with rpms, repositories and
yum and lastly, editing configuration files.

1) Install SARG

Currently could find no rpm for ClearOS7, CentOS7 or rhel7 so have build one
using the latest source code from https://sourceforge.net/projects/sarg/

To add get the rpm file we require wget, and for SARG a pre-requisite is gd.
If not already installed install them...

to check if wget installed...
# rpm -q wget

to check if gd installed...
# rpm -q gd

ClearOS 7.x to install wget and gd...

# yum install wget gd --enablerepo=clearos-centos,clearos-epel,clearos-centos-updates

ClearOS 6.x to install wget and gd...

# yum install wget gd --enablerepo=clearos*

Now download the rpm...

ClearOS Version 7.x
# wget http://danda.poweredbyclear.com/sarg7/sarg-2.3.10-3.v7.x86_64.rpm

ClearOS Version 6.x
# wget http://danda.poweredbyclear.com/kmod-clearos/sarg-2.3.10-3.v6.x86_64.rpm

# then install it...

ClearOS Version 7.x
# yum localinstall sarg-2.3.10-3.v7.x86_64.rpm

Clear)S Version 6.x
# yum localinstall sarg-2.3.10-3.v6.x86_64.rpm

If you are using CleaOS 6.x 32 bit then substitute "sarg-2.3.10-3.v6.i686.rpm"

2) Configure SARG

Edit "/etc/sarg/sarg.conf" and make changes as necessary, e.g.

search for "#date_format u" and change if necessary to your local
format e.g. "date_format e" for European (remove the comment or #).

That should do for now as the defaults are reasonable, but by all means
check them all for suitability :-) (especially if you have changed some
of the squid or https/apache defaults).

3) Fix problem sub-directory locations...

# mkdir /usr/share/sarg/
# ln -s /etc/sarg/fonts/ /usr/share/sarg/
# ln -s /etc/sarg/languages/ /usr/share/sarg/
# ln -s /etc/sarg/images/ /usr/share/sarg/

4) Now we check that we can generate a report

# sarg -x

We now need to allow access to the sarg pages from your workstation.

edit "/etc/httpd/conf.d/sarg.conf" and add the ip address(s) you will
use (quad decimal format is OK if you prefer that). Add extra lines 
for more workstations if required. An example :-


Alias /sarg /var/www/sarg

<Directory /var/www/sarg>
        DirectoryIndex index.html
        Order deny,allow
        Deny from all   
        Allow from 127.0.0.1
        Allow from ::1
#       Allow from your-workstation.com
        Allow from 192.168.2.28
        Allow from 192.168.1.17
        Allow from 192.168.3.27
</Directory>

Restart the webserver using the following command...

ClearOS 7.x
# systemctl restart httpd.service

ClearOS 6.x
# service httpd restart

Run the following to check the cron scripts, there should be no output on
the command line...

# /etc/cron.daily/sarg
# /etc/cron.weekly/sarg
# /etc/cron.monthly/sarg

5) Testing SARG - bliss :-) or despair :-( ?

Now go to http://your_webserver_ip/sarg and you should see the sarg home
page...

Click on "ONE-SHOT" and some data should appear, assuming squid has data
available, the rest will get populated as when the data from squid is 
created and the various cron jobs run to create the reports (daily, weekly
and monthly). Note these cron jobs to update the reports run during the early
hours of the morning, so if you shut of the server over-night you will need 
to make changes to ensure your reports are generated.

Access is limited to the name(s) or address(s) you enabled above. However,
if you use dynamic dhcp addresses, a different security method would be more
appropriate... This may be the subject of another "How-To" as and when time 
permits...

Good Luck!

Home Page for sarg - http://sarg.sourceforge.net/

see https://www.clearos.com/clearfoundation/social/community/install-sarg-on-clearos-version-6-x-or-version-7-x-for-great-proxy-reports#reply-121561
for Andy Godber's tip for SARG Realtime, and a few posts above for more details regarding the logs

沒有留言:

張貼留言