Posts Tagged ‘squidGuard’
Install
Using repository
Configure
Edit squid configuration on /etc/squid/squid.conf to use squidguard as the redirector at the very bottom of the file.
## squidguard redirector
########################
url_rewrite_program /usr/bin/squidGuard -c /etc/squid/squidGuard.conf
url_rewrite_children 34
#url_rewrite_concurrency 0#######################################################################
# And finally deny all other access to this proxy
#######################################################################
http_access deny all
Edit squidguard configuration on /etc/squid/squidGuard.conf to enable ACL
domainlist porn/domains
urllist porn/urls
log pornaccesses
redirect 302:http://192.168.1.62/webzap/pornblock.html
}dest adv {
log advaccesses
domainlist adv/domains
urllist adv/urls
redirect 302:http://192.168.1.62/webzap/adblock.html
}
dest spyware {
log spywareaccesses
domainlist spyware/domains
urllist spyware/urls
redirect 302:http://192.168.1.62/webzap/spyware.html
}
dest warez {
log warezaccesses
domainlist warez/domains
urllist warez/urls
redirect 302:http://192.168.1.62/webzap/spyware.html
}
dest gamble {
log advaccesses
domainlist gamble/domains
urllist gamble/urls
redirect 302:http://192.168.1.62/webzap/adblock.html
}
acl {
default {
pass !porn !adv !gamble !spyware !warez all
}
}
Automated Maintain Script
Create little script like this then run it thru cron…
# author: anton suryawanSG_WORKDIR=/root/squidguard
SG_FILENAME=shallalist.tar.gz
SG_DL=http://squidguard.shalla.de/Downloads/${SG_FILENAME}
SG_DBPATH=/var/lib/squidguard/db
# download latest file – overwrite any existing file
echo ‘Downloading new blacklists …’
wget –proxy=off -N ${SG_DL} -O ${SG_WORKDIR}/${SG_FILENAME} -a /var/log/shalla.log
if [ ! -s "${SG_WORKDIR}/${SG_FILENAME}" ]; then
echo ‘Download failed!’
exit 1
fi
# extract blacklists
tar -xzf ${SG_WORKDIR}/${SG_FILENAME} -C ${SG_WORKDIR}/
echo ‘New list downloaded’
# remove old databases
rm -Rf /var/lib/squidguard/db/*
# copy blacklists to db home
cp -R ${SG_WORKDIR}/BL/* ${SG_DBPATH}
# copy porn expressions list and rename
cp ${SG_WORKDIR}/porn_expressions ${SG_DBPATH}/porn/expressions
# add more porn
cat ${SG_WORKDIR}/porn_domains_add >> ${SG_DBPATH}/porn/domains
# add more adv
cat ${SG_WORKDIR}/adv_domains_add >> ${SG_DBPATH}/adv/domains
# build domains + urls db, then change ownership to squid user
echo ‘Build databases …’
/usr/bin/squidGuard -C all
echo ‘Database builds complete’
chown -R proxy:proxy ${SG_DBPATH}
/usr/sbin/squid -k reconfigure
echo ‘Squid Proxy Server reconfigured’
rm -Rf ${SG_WORKDIR}/BL
# renice
#for pid in `pgrep -u proxy`; do renice 15 $pid; done
Voila! ACL is maintained autonomously. Now, I can sleep better.
