install SquidGuard! at debian 9

Install SquidGuard!
1. sudo apt-get install squidguard
2. sudo mkdir /opt/3rdparty
3. cd /opt/3rdparty    
We are going to use the list from shalalist.de for “testing”, since it’s 100% free for non-commerical.  For a bigger and much more through blacklist, I use http://urlblacklist.com/. It’s free to try once, and has different pricing tiers for person/school/business.
3. sudo wget http://www.shallalist.de/Downloads/shallalist.tar.gz
4. sudo tar xzf shallalist.tar.gz
5. sudo cp -a /opt/3rdparty/BL/porn /var/lib/squidguard/db
    sudo cp -a /opt/3rdparty/BL/adv /var/lib/squidguard/db
    sudo cp -a /opt/3rdparty/BL/spyware /var/lib/squidguard/db

6. Add this to  /etc/squid3/squid.conf , type “sudo nano /etc/squid3/squid.conf”
url_rewrite_program /usr/bin/squidGuard –c /etc/squidguard/squidGuard.conf
7. sudo squidGuard -C all
8. chown -R proxy:proxy /var/lib/squidguard/db

Edit the squidGuard.conf

Backup of your squidGuard.conf then making a new one..
1. sudo cp /etc/squidguard/squidGuard.conf /etc/squidGuard.conf.bak
2. sudo rm /etc/squidguard/squidGuard.conf
3.sudo nano /etc/suqidgurd/squidGuard.conf
Copy and paste this,

#—————————–squidGuard.conf—————————————————————
#
# CONFIG FILE FOR SQUIDGUARD
#
dbhome /var/lib/squidguard/db
logdir /usr/local/squidGuard/logs
    dest porn {
    domainlist porn/domains
    urllist porn/urls
}
dest adv {
    domainlist adv/domains    
    urllist adv/urls
}
dest spyware {
    domainlist spyware/domains
    urllist spyware/urls
}
acl {
    default {
        pass !porn !adv !spyware all
        redirect http://localhost/block.html
        }
}

#————————————————————————————————————

You can test your squidguard by doing a dry run
sudo echo "http://www.pornhub.com 10.50.55.10/- – GET" | squidGuard -c /etc/squidguard/squidGuard.conf –d

You should see,
squidGuard ready for requests
squidGuard stopped
If there are errors, it will tell you.. The most likely errors you’ll run into are permission issues.. If it gives you permission issues with your database, make sure that you set the user and group named “proxy” ownership. You can tell that by “sudo ls -l /var/lib/squidguard/db*”

You can now use the Firefox browser you setup to use with your proxy server to make sure you are blocking porn and ads. For better protection, I recommend using the blacklist from,  http://urlblacklist.com/

Finish with:
cd /var/lib/squidguard/db/; squidGuard -C all ; chown proxy:proxy -R /var/lib/squidguard/db/ ; squid -k reconfigure;  service squid restart

Credits

Leave a Reply

Your email address will not be published. Required fields are marked *