How to restrict Web Access by Time using Squid Proxy Server on Debian 11.3
To Restrict Web Access By Time Using Squid Proxy Server On Debian 11.3.
Introduction:
A proxy server acts as a gateway in the middle of the user and the internet. It is used to restrict websites and browsers from particular users.
Procedure :
Step 1: Check the version of the OS by using the below command.
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Step 2: Once the OS version is checked, now install the squid server by using the below command.
root@linuxhelp:~# apt-get install squid
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
The following NEW packages will be installed:
After this operation, 15.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Processing triggers for ufw (0.36-7.1) ...
Rules updated for profile 'OpenSSH'
Firewall reloaded
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
Step 3: After the squid is installed, now start the squid service by using the below command.
root@linuxhelp:~# systemctl start squid
Step 4: After the squid service is started. Check the status of the squid service by using the below command.
root@linuxhelp:~# systemctl status squid
● squid.service - Squid Web Proxy Server
Loaded: loaded (/lib/systemd/system/squid.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-06-23 23:40:24 IST; 5s ago
Docs: man:squid(8)
Process: 35570 ExecStartPre=/usr/sbin/squid --foreground -z (code=exited, status=0/SUCCESS)
Main PID: 35573 (squid)
Tasks: 4 (limit: 6156)
Memory: 15.8M
CPU: 228ms
CGroup: /system.slice/squid.service
├─35573 /usr/sbin/squid --foreground -sYC
├─35575 (squid-1) --kid squid-1 --foreground -sYC
├─35576 (logfile-daemon) /var/log/squid/access.log
└─35577 (pinger)
Jun 23 23:40:24 linuxhelp squid[35575]: Adaptation support is off.
Jun 23 23:40:24 linuxhelp squid[35575]: Accepting HTTP Socket connections at local=[::]:3128 remote=[::] F>
Jun 23 23:40:24 linuxhelp systemd[1]: Started Squid Web Proxy Server.
Jun 23 23:40:25 linuxhelp squid[35575]: storeLateRelease: released 0 objects.
Step 5: After the squid server status is checked. Open the squid.conf configuration file by using the below command.
root@linuxhelp:~# vim /etc/squid/squid.conf
Step 6: The setup just allow surfing_hour’s access from the Google.com network, while always restricting access to Google.com network other than surfing hour.
Step 7: After the configuration is complete, now reload the squid service by using the following command.
root@linuxhelp:~# service squid reload
Step 8: Open the setting on browser and Click the network setting option as shown in the below images.
Step 9: After Configure go to the browser search the Google.com site, it shows is Not working as shown in the below image.
Step 10: Then Reach the restricting time while again search google.com is working for site access as shown in the below image.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required How to Restrict Web Access by Time using Squid Proxy Server on Debian 11.3. Your feedback is much welcome.