বৃহস্পতিবার, ২৮ মার্চ, ২০১৩

URL Redirection, SquidGuard, Squint, Sqstat


URL Redirection by squid.conf  :
-----------------------------------------------------
If I want to redirect URL telnet.com.bd to bol-online.com then edit squid.conf file by following information where 172.30.5.0/24 is src network and redirection for src network.
acl mynet src 172.30.5.0/24
acl badsites dstdomain .telnet.com.bd
deny_info http://bol-online.com mynet
http_reply_access deny badsites mynet
then save the squid.conf file and restart squid daemon. Then try by any browser and put telnet.com.bd to address bar output will be bol-online.com

SquidGuard (Web Filter plugin as URL Redirector used to use blacklists)
--------------------------------------------------------------------------------------------

1.       Install squidguard by Apt-get install squidguard
2.    Install blacklists by wget -c http://www.shallalist.de/Downloads/shallalist.tar.gz
3.    Extract shallalist.tar.gz
4.    Copy your required blacklists sush as porn by cp –avr BL/porn /var/lib/squidguard/db/
5.    Create databases from text files by squidGuard –b –C /var/lib/squidguard/db/porn/domains and squidGuard –b –C /var/lib/squidguard/db/porn/urls
6.    Set the permission for read by squid by chown proxy.proxy –R /var/lib/squidguard/db/
7.    Edit squid.conf file by adding url_rewrite_program /usr/bin/squidGuard
8.    Edit /etc/squid/squidGuard.conf file by adding
dest porn {
       domainlist      porn/domains
      
urllist         porn/urls
}
9.    And update acl section by
acl  {
    default {
              pass  !porn all
 redirect http://
}
           }

10. Reload squid by /etc/init.d/squid reload
11. Verify squid and squidGuard loading by viewing log tail -f /var/log/squid3/cache.log
12.  Verify configuration by echo "http://DOMAIN-NAME-HERE / - - GET" | squidGuard –d or browing restricted site from local.
13. Simply add additional restricted site by same as no 8 and 9 step and creating file , db file etc.


Squint (Squid log analyzer and viewer) installation:
--------------------------------------------------------------------

Prerequisites: Squid proxy server, apach2, php5.
 Download squint.tar.gz from internet.
Extract squint.tar.gz
Enter squint directory
cp squint.pl squint.cron.sh /usr/local/bin
cd /usr/local/bin
vim squint.cron.sh
edit to HTTPDCONF=/etc/apache2/apache.conf
execute “squint.cron.sh init” command
execute “squint.cron.sh all” command
edit crontab file and replace Monday to “1” without quote in the line weekly.
Then browse http:// server ip>/squint

Sqstat (To view realtime active user connections):
-----------------------------------------------------------------


prerequisites:
Active PHP Module in Apache:  a2enmod fcgid

apt-get install libapache2-mod-fcgid php5-cgi
extract sqstat-1.20.tar.gz
cp –r sqstat-1.20 /var/www/
cd /var/www/sqstat-1.20
then rename config.inc.php.defaults to config.inc.php
then edit config.inc.php put DEFINE(“SQSTAT_SHOWLEN”,100);
Make sure chachemgr protocol is allowed from localhost.
Browse http:// server ip>/sqstat-1.20/sqstat.php