Block Porn Sites at Certain Hours Using Squid Proxy Server & SquidGuard

Must read:

Ferdian Alfianto

Ferdian Alfianto

Ferdian Alfianto is an Internet enthusiast, Mac Lover; likes using Wordpress, experimenting with Linux (especially Debian and Ubuntu), tinkering with pfSense routers, happy experimenting with LEMP (Linux, Nginx, MariaDB, PHP) and Redis. You can contact me here.

I have an internet cafe with 3 branches in Surabaya. Where in the morning to evening / evening, many underage children come to play games or browse. What makes me concerned, there are those who try to open adult sites, even though we have warned them repeatedly. There's no way we have to monitor 60 computers simultaneously. Therefore, I decided to block these adult sites.

But on the other hand, adult customers, protested why the site was blocked. They argued that they were old enough to be able to access it & that was their right.

For that I decided to block adult sites during the hours when a lot of children were playing, between 7 am and 9 pm. And from 9 p.m. to 7 a.m., adult sites can be accessed freely. In order for this mission to be accomplished, I used SquidGuard to block, which was installed onto the Squid Proxy Server. NOTE: I assume you already have an active Squid Proxy Server. If you want to know how to install it, please visit the tutorial 5 Minutes Install Squid Proxy Server which I have previously published.

SquidGuard Installation Steps

Please login to your proxy server as root, and enter the command:

# apt-get install squidguard

then we will install the blacklist file from Shalla. Previously we first download with the command:

# cd / tmp # wget -c https://www.shallalist.de/Downloads/shallalist.tar.gz

Then extract the shallalist.tar.gz file with the following command:

# tar -zxvf shallalist.tar.gz

Because we will only block adult sites, we will only install the adult site blacklist. Run the command:

# cp -avr BL / porn / / var / lib / squidguard / db /

the command above will produce output like this

`` BL / porn / '-> `` / var / lib / squidguard / db / porn' 'BL / porn / domains' -> `` / var / lib / squidguard / db / porn / domains'' BL / porn / urls' -> `` / var / lib / squidguard / db / porn / urls'

then we will create a database file from a text file with the command:

# cd / var / lib / squidguard / db / porn # squidGuard -b -C domains # squidGuard -b -C urls

the command above will produce output like this

Processing file and database / var / lib / squidguard / db / porn / domains [================================= =================] 100 % done Processing file and database / var / lib / squidguard / db / porn / urls [============ ======================================] 100 % done

set so that Squid can read the file with the command:

# chown proxy: proxy -R / var / lib / squidguard / db /

Next, we will configure the squid.conf file so that Squid can interact with SquidGuard. Open the squid.conf file with the command:

# nano /etc/squid3/squid.conf

enter the following configuration at the very bottom of squid.conf

url_rewrite_program / usr / bin / squidGuard redirect_children 20

save the new configuration. Next we will change the SquidGuard configuration, open the squidGuard.conf file with the command:

# nano /etc/squid/squidGuard.conf

Change it so that it looks like this:

dbhome / var / lib / squidguard / db logdir / var / log / squid time morning {weekly * 07:00 - 21:00} client src {ip 192.168.0.0/24} dest good {} dest local {} dest porn { domainlist porn / domains urllist porn / urls redirect https://www.website-anda.com/blockporn/ log anonymous porn.log} acl {clients within morning {pass! porn all} else {pass all} default {pass none redirect https://www.website-anda.com/blockporn/}}

time morning - is the configuration time you want to block adult sites. I set it every day from 7 am to 9 pm. Please change according to your wishes. For guidance on setting times, please refer to https://www.squidguard.org/Doc/extended.html#times

client src - is the local ip address of the cafe client computer. Please adjust it to your needs.

redirect - If someone tries to access an adult site during blocked hours, they will be redirected to the site mentioned here. Please change it according to your wishes. The last step is to reload Squid so that it reads the configuration changes above, with the following command:

# squid -k reconfigure

Already completed. Your network has been protected from accessing pornographic sites according to the time you want. :)

Share on facebook
Facebook
Share on twitter
Twitter
Share on whatsapp
WhatsApp
Share on telegram
Telegram
Share on email
E-mail

Latest articles:

MongoDB logo
Linux

Easy to Install MongoDB on Ubuntu 20.04

This tutorial explains how to install and configure MongoDB Community Edition on Ubuntu 20.04. MongoDB is a free, open-source document database. Belongs to the so-called database family

Related article:

MongoDB logo

Easy to Install MongoDB on Ubuntu 20.04

This tutorial explains how to install and configure MongoDB Community Edition on Ubuntu 20.04. MongoDB is a free, open-source document database. Belongs to the so-called database family