Public domain
cd /usr/src
wget -c "http://www.squidguard.org/Downloads/squidGuard-1.4.tar.gz"
wget -c "http://www.squidguard.org/Downloads/Patches/1.4/squidGuard-1.4-patch-20091015.tar.gz"
wget -c "http://www.squidguard.org/Downloads/Patches/1.4/squidGuard-1.4-patch-20091019.tar.gz"
tar zxf squidGuard-1.4.tar.gz
tar zxf squidGuard-1.4-patch-20091015.tar.gz
/bin/mv squidGuard-1.4-patch-20091015/sgLog.c squidGuard-1.4/src/
tar zxf squidGuard-1.4-patch-20091019.tar.gz
/bin/mv squidGuard-1.4-20091019/*.in squidGuard-1.4/src/
cd squidGuard-1.4
./configure --with-squiduser=nobody
make && make install
mv /usr/local/squidGuard/squidGuard.conf{,.bak}
# First line of squidGuard.conf should not be empty!
dbhome /usr/local/squidGuard/db
logdir /usr/local/squidGuard/log
dest blocked {
urllist blocked/urls
domainlist blocked/domains
expressionlist blocked/expressions
log blocked.log
}
acl {
default {
pass !blocked all
redirect http://172.16.20.1/filter.html
}
}
#!/bin/sh
#
# /etc/rc.d/rc.squidGuard
#
case "$1" in
'start'|'reload')
echo 'Reloading squidGuard ...'
/usr/local/bin/squidGuard -C all
chown -R nobody:nobody /usr/local/squidGuard/db
chown -R nobody:nobody /usr/local/squidGuard/log
/usr/local/squid/sbin/squid -k reconfigure
;;
'stop')
echo 'Stopping squidGuard ...'
chown -R root:root /usr/local/squidGuard/db
/usr/local/squid/sbin/squid -k reconfigure
;;
*)
echo "Usage: $0 [reload|stop]"
;;
esac
chmod +x /etc/rc.d/rc.squidGuard
mkdir /usr/local/squidGuard/db/blocked
chown nobody:nobody /usr/local/squidGuard/db/blocked
farsnews.com/newstext.php
mehrnews.com/en
irib.ir
iran-newspaper.com
irna.com
(^|[-\?+=/_])(bondage|boobs?|busty?|hardcore|porno?|sex|xxx+)([-\?+=/_]|$)
/usr/local/bin/squidGuard -C all
chown -R nobody:nobody /usr/local/squidGuard/db
chown -R nobody:nobody /usr/local/squidGuard/log
echo "http://www.irna.com 10.0.0.1/ - - GET" | squidGuard -c /usr/local/squidGuard/squidGuard.conf -d
# will show something like this : Request(default/blocked/-) http://www.irna.com 10.0.0.1/- - - REDIRECT http://172.16.20.1/filter.html 10.0.0.1/- - -
.
.
url_rewrite_program /usr/local/bin/squidGuard -c /usr/local/squidGuard/squidGuard.conf
.
.
#!/bin/bash
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"
TMP=$(mktemp)
LINES="10000"
for F in /usr/local/squidGuard/log/blocked.log /usr/local/squidGuard/log/squidGuard.log; do
tail -n ${LINES} ${F} > ${TMP}
mv ${TMP} ${F}
chown -R nobody:nobody /usr/local/squidGuard/log
chown -R nobody:nobody /usr/local/squidGuard/db
done
[ -e ${TMP} ] && rm ${TMP}
chmod +x /usr/local/squidGuard/squidGuard-logrotate.sh
/etc/rc.d/rc.squidGuard start
00 0 * * * /usr/local/squidGuard/squidGuard-logrotate.sh &> /dev/null
tail -f /usr/local/squidGuard/log/*
BY: Pejman Moghadam
TAG: squid, squidguard
DATE: 2010-07-27 13:11:05