Squid

All posts in the Squid category

LightSquid installation Steps – Squid Graphical Report Viewer

Published June 26, 2010 by Siva

Installation Instructions:

Required software:

  1. Perl
  2. http server (Apache, lighthttpd, etc)
  3. Squid
  4. Cron

or equivalent

in example i use Apache

1. Extract lightsquid.tgz into any folder

cd /var/www/htdocs/
mkdir lightsquid
cd lightsquid
tar -xzf lightsquid.tgz

set ‘executable’ flag for scrip

chmod +x *.cgi
chmod +x *.pl

change owner

chown -R apache:apache *
(where apache = httpd user)

2. Configure your Apache server

.cgi files must execute as CGI scrip

<Directory "/var/www/html/lightsquid">
   AddHandler cgi-script .cgi
   AllowOverride All
</Directory>

Restart apache

3. Edit lightsquid.cfg

4. If you want GROUP reports – edit group.cfg

format:

esl           01            SysAdmin
karlos       01            SysAdmin
thy           01            SysAdmin
Ivanov     02            Developer
Ivanov2    02            Developer
Petrov      03            Commerial
Petrova    03            Commerial
vasyav     04            room 312
petyava    04            room 312

5. If you want use REALNAME – edit realname.cfg

format:

esl           Sergey Erokhin
karlos       Super User1
thy           Tech Good
Ivanov     Developer numer one
Ivanov2    Developer numbe two
Petrov      Good Commerial
Petrova    Bad Commerial
vasyav     Some User1
petyava    Some User2

6. if you want graphics report

check graph report

7. run check-setup.pl

if all done try next step
else check config file.

8. Try run lightparser.pl

if everything is ok no messages will be produced

parse old statistic
./lightparser.pl access.log.1.{gz|bz2}
./lightparser.pl access.log.2.{gz|bz2}
./lightparser.pl access.log.3.{gz|bz2}

9. Try to use lightsquid

Using your favorite browser enter http://<host where we live>/lightsquid/

10. Setup crontab to run lightparser once per hour

crontab -e
This example will execute parser every 20 minutes

*/20 * * * * /var/www/htdocs/lightsquid/lightparser.pl today

if you have small log and fast machine, you may run lightparser with smaller delay
warning not set interval less 10 min

11. All done!

You Can Access Via :

http://Youripaddresshere/lightsquid

Squid Server Configuration Step By Step on Centos 5

Published June 26, 2010 by Siva

I recently configured squid server in Centos 5. I have shared my documentation with you all. Feedback’s are welcome.

Squid Configuration File:

/etc/squid/squid.conf

Squid Access File Location:

/var/log/squid/access.log

Squid Error File Location:

/var/log/squid/cache.log

Viewing online Access log

tail -f /var/log/squid/access.log |grep  192.168.1.124

Configuration File

acl all src 0.0.0.0/0.0.0.0

acl manager proto cache_object

acl localhost src 127.0.0.1/255.255.255.255

acl to_localhost dst 127.0.0.0/8

acl SSL_ports port 443

acl Safe_ports port 80 # http

acl Safe_ports port 81 # Apache_new

acl Safe_ports port 21 # ftp

acl Safe_ports port 443 # https

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 488 # gss-http

acl Safe_ports port 591 # filemaker

acl Safe_ports port 777 # multiling http

acl CONNECT method CONNECT

http_access allow manager localhost

http_access deny manager

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

acl Allow_url dstdomain  “/etc/squid/custom/allowedurls”

acl goodsites dstdomain  “/etc/squid/custom/goodsites”

acl goodsites_ips src “/etc/squid/custom/goodsites_dst_ips”

acl jobsites_ips src “/etc/squid/custom/jobsites_dst_ips”

acl download_ips src “/etc/squid/custom/download_dst_ips”

acl emailallowip src  “/etc/squid/custom/emailallowips_dst_ips” # for Geetha_System

acl allallowip src  “/etc/squid/custom/allallowips_dst_ips”

acl dlds urlpath_regex -i \.gz \.msi \.rm \.asf \.mp4 \.mpa \.cab \.mp3 \.rm \.ram \.mepg \.mpg \.exe \.dll \.chm \.iso \.rar \.zip  \.flv \.torrent

acl jobs dstdomain “/etc/squid/custom/job-sites.acl”

acl social dstdomain “/etc/squid/custom/social-sites.acl”

acl porn dstdomain “/etc/squid/custom/porn-sites.acl”

acl proxy1 dstdomain “/etc/squid/custom/proxy-sites.acl”

acl hack dstdomain “/etc/squid/custom/hack-sites.acl”

acl fileupload dstdomain “/etc/squid/custom/file-upload.acl”

acl email1 dstdomain “/etc/squid/custom/email-sites.acl”

http_access allow localhost

#http_access deny GeneralSites

http_access deny jobs !jobsites_ips

http_access deny social !allallowip

http_access deny porn

http_access deny proxy1

http_access deny hack

http_access deny fileupload !allallowip

http_access deny email1 !emailallowip

http_access deny dlds !download_ips

http_access allow Allow_url

http_access allow goodsites goodsites_ips

http_access allow all

http_access deny all

http_port 3128 transparent

icp_port 3130

cache_mem 16 MB

cache_dir ufs /var/spool/squid 100 16 256

access_log /var/log/squid/access.log squid

cache_log /var/log/squid/cache.log

cache_store_log /var/log/squid/store.log

visible_hostname net.minthomes.server

Restarting squid Service

# Service squid restart or /etc/init.d/squid restart

# Service squid reload or /etc/init.d/squid reload

Please contact me, if you facing any issues or clarifications. Thanks