24 October, 2013

Squid and squidGuard Install

Install Squid3

root@Squid1:~# apt-get install squid3

Configure File Squid.conf  (/etc/squid3/squid.conf)

acl VLAN101 src 10.0.101.0/24 
http_access allow
http_port 8080 (listen Port)

Install SquidGuard

root@Squid1:# apt-get install squidguard

Create Blacklist Directory

root@Squid1:/etc/squidguard# mkdir blacklist

Create Log Directory

root@Squid1:/etc/squidguard# mkdir log

Download Blacklists 

(http://www.squidguard.org/blacklists.html)

root@Squid1:/etc/squidguard/blacklist# wget http://squidguard.mesd.k12.or.us/blacklists.tgz

Decompress Blacklist

root@Squid1:/etc/squidguard/blacklist# tar xvfz blacklists.tgz

Install Blacklist (Compilation  *.db)

root@Squid1:~# squidGuard -C all

Configure squidGuard.conf (/etc/squidguard/squidGuard.conf)

dbhome /etc/squidguard/blacklist/blacklists   (Note: Blacklist Directory)
logdir /etc/squidguard/log                    (Note: Log Directory)

dest porn {
domainlist porn/domains
urllist porn/urls
}

dest warez {
domainlist warez/domains
urllist warez/urls
}

dest ads {
domainlist ads/domains
urllist ads/urls
}

acl {
default {
pass    !porn  !warez  !ads  all
redirect http://admin.foo.bar.de/cgi-bin/blocked.cgi?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&targetgroup=%t&url=%u
}
}

(Were !porn = denegar porn)
Search where Squid is installed

root@Squid1:~# which squidGuard
/usr/bin/squidGuard

Search where is SquidGuard Configuration (squidGuard.conf)

root@Squid1:/etc/squidguard# ls -l

-rw-r----- 1 proxy proxy 1459 Oct 13 23:49 squidGuard.conf

Configure squid.conf to support squidGuard (/etc/squd3/squid.conf)

Add This lines in squid.conf 
url_rewrite_program /usr/bin/squidGuard -c /etc/squidguard/squidGuard.conf Restart Squid3 root@Squid1:~#service squid3 restart
Create ACLs to permit HTTP(8080) trafic and Deny HTTP (80) without Proxy
R1(config)#access-list 101 deny tcp 10.0.101.0 0.0.0.255 any eq 80
R1(config)#access-list 101 permit tcp 10.0.101.0 0.0.0.255 host 10.0.250.11 eq 8080

Now Change Your Proxy Settings In Your Browser 

Done !