Sarg.v7

From Access Information
Jump to: navigation, search


Installing New Server Mrepo smartd RAID Hardening YUM Crontabs LogWatch systemctl firewalld CentOS 7
Packages
Apache Bind Cacti DHCP mariadb Samba Sarg Sendmail Smokeping Rsync Work Apps
Problems VPN VPN Win Extras Bash MailScanner Horde Google CE Wake Up KVM
Other Computer Lab ISO2USB aiContact Google CE Android USB Live SRS XML

Squid

YUM

yum install squid

User

useradd -d /cache/ -r -s /dev/null squid >/dev/null 2>&1
chown -R squid.squid /cache/
ls -l /

squid.conf

This file is under development, June 28th, 2012.

/bin/rm /etc/squid/squid.conf
/bin/cat <<EOF>> /etc/squid/squid.conf
# -----------------------------------------------------------------------------
# NETWORK OPTIONS
# -----------------------------------------------------------------------------
#
# version=2005.07.15
http_port 8080

# -----------------------------------------------------------------------------
# LOGFILE PATHNAMES AND CACHE DIRECTORIES
# -----------------------------------------------------------------------------
#delete cache_effective_user squid
#delete cache_effetive_group squid
cache_dir ufs /cache 5000 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log 

# -----------------------------------------------------------------------------
# OPTIONS FOR TUNING THE CACHE
# -----------------------------------------------------------------------------
refresh_pattern         ^ftp:           1440    20%     10080
refresh_pattern         ^gopher:        1440    0%      1440
refresh_pattern         .               0       20%     4320 

# -----------------------------------------------------------------------------
# HTTPD-ACCELERATOR OPTIONS
# for transparent proxy and logging with SARG and forcing use of blacklists
# -----------------------------------------------------------------------------
#httpd_accel_host virtual
#httpd_accel_port 80
#httpd_accel_with_proxy  on
#httpd_accel_uses_host_header on 

# -----------------------------------------------------------------------------
# Squidguard Processes (blacklists)
# -----------------------------------------------------------------------------
#redirect_program /usr/local/bin/squidGuard -c /usr/local/squidGuard/squidGuard.conf
#redirect_children 4  

# -----------------------------------------------------------------------------
# Squidguard access exceptions
# -----------------------------------------------------------------------------
#acl KILL urlpath_regex \.[eE][xX][eE]
#acl KILL urlpath_regex \.[mM][pP][3]
#acl KILL urlpath_regex \.[sS][rR][cC]
#acl KILL urlpath_regex \.[cC][oO][mM]
#acl KILL urlpath_regex \.[bB][aA][tT]
#acl KILL urlpath_regex \.[dD][lL][lL]
#acl KILL urlpath_regex \.[dD][aA][tT]
#http_access deny KILL 

# -----------------------------------------------------------------------------
# For use of Watchdog proxying filtering
# -----------------------------------------------------------------------------
#cache_peer proxy1.watchdog.net.nz parent 8080 0 no-query default
#acl all src 0.0.0.0/0.0.0.0
#never_direct allow all 

# -----------------------------------------------------------------------------
# OPTIONS FOR EXTERNAL SUPPORT PROGRAMS
# -----------------------------------------------------------------------------
# ftp_user Squid@
# ftp_list_width 32
# ftp_passive on
# ftp_sanitycheck on 

# -----------------------------------------------------------------------------
# Authentication
# -----------------------------------------------------------------------------
#auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd
#auth_param basic children 10
#auth_param basic realm Matatoki School Web Filtering Service
#auth_param basic credentialsttl 2 hours 

# -----------------------------------------------------------------------------
# ACCESS CONTROLS
# -----------------------------------------------------------------------------
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
#acl localnet src 192.168.20.0/24
#acl localnet src 192.168.1.0/24
#acl localnet src 192.168.2.0/24
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
# -----------------------------------------------------------------------------
# ACL Section
# -----------------------------------------------------------------------------
acl SSL_ports port 443 563
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443 563     # https, snews
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 631         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl localnet src 192.168.20.0/24
#acl localnet src 192.168.1.0/24
#acl localnet src 192.168.2.0/24
acl CONNECT method CONNECT
#acl neo_pets dstdomain .neopets.com
#acl bad_mail dstdom_regex mail*
#acl super_users proxy_auth strider tony christine
#acl office_ips src 192.168.20.1  # New Gateway

#acl standard_users proxy_auth REQUIRED
#acl morning_hours time S M T W H F A 6:00-8:00
#acl afternoon_hours time S M T W H F A 15:00-18:00
# -----------------------------------------------------------------------------
# http_access Section
# The Rules that are entered here are processed in the order they apear.
# -----------------------------------------------------------------------------
#http_access allow office_ips
http_access allow localnet
#http_access allow super_users
#http_access allow local_mail
#http_access deny bad_mail
#http_access allow neo_pets morning_hours
#http_access allow neo_pets afternoon_hours
#http_access deny neo_pets
#http_access allow standard_users

# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
http_access deny to_localhost
http_access allow localhost
http_access deny all 

icp_access allow all
miss_access allow all
cache_effective_user squid
cache_effective_group squid 

EOF
systemctl start squid
systemctl enable squid
systemctl status squid

Cannot start squid?

Try

squid -z

Turn off SELinux

Turn off right now:

setenforce 0

Permanently

emacs /etc/selinux/config

Set to disabled

reboot

Sarg

http://sourceforge.net/projects/sarg

YUM

yum install –y gcc gd gd-devel make perl-GD wget httpd wget

SETUP

cd /home/strider/
mkdir installs/sarg -p
cd installs/sarg

Currently

wget http://sourceforge.net/projects/sarg/files/sarg/sarg-2.3.10/sarg-2.3.10.tar.gz
tar -xvzf sarg-2.3.10.tar.gz
cd sarg-2.3.10
./configure
make

before running make install:

emacs po/Makefile.in.in

Change

GETTEXT_MACRO_VERSION = 0.18

to

GETTEXT_MACRO_VERSION = 0.19

Then edit

emacs po/Makefile

Change line 45

mkdir_p = @ mkdir_p @

replaced with

mkdir_p = / usr / bin / mkdir -p

Now

make install

Configuration

emacs /usr/local/etc/sarg.conf

Change the following for comparability with a Centos 7 Server.

#access_log /usr/local/squid/var/logs/access.log

to

access_log /var/log/squid/access.log
output_dir /var/www/html/squid-reports

to

output_dir /var/www/html/sarg
#date_format u

to

date_format e

Rename http sarg area.

cd /var/www/html
mv sarg-php/ sarg

Before we can do a sarg -x to create a report, we need to have had some traffic.

  • Did you find this page useful?
  • Do you have an issue that you have not yet fixed?

We can do this for you.

I am available for technical support. Please follow this link. Tech Support Request.
+64-6-880-0000 : ++1-808-498-7146 : help@ai.net.nz
Getting us to help you