How to configure ACL rule for Timing by Squid proxy server in Ubuntu 16.04

To configure ACL rule for Timing by Squid proxy server in Ubuntu 16.04

A proxy server is acts as an intermediary between an end user and the internet and allows a end user to make an indirect connection to network servers and services. A proxy server can help you take control of how users reach the internet. Squid Proxy is mainly used for caching the frequently requested web content in order to speed up response time and also save network bandwidth. It supports many different protocols such as HTTP, FTP, TLS, SSL, Internet Gopher and HTTPS. This tutorial explains the configuration procedure ACL rule for Timing by Squid Proxy server in Ubuntu 16.04.

Configuration procedure

To proceed with the configuration procedure, execute the following command to install Squid and press y to continue with the installation process.

root@linuxhelp11:~# apt-get install squid -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gnome-software-common libgtkspell3-3-0
Use ' sudo apt autoremove'  to remove them.
Suggested packages:
  squidclient squid-cgi squid-purge smbclient winbindd
.
.
Processing triggers for man-db (2.7.5-1) ...
Setting up squid (3.5.12-1ubuntu7.4) ...
Skipping profile in /etc/apparmor.d/disable: usr.sbin.squid

The Squid has been installed in the system. Next update the machine by running the apt-get update command.

root@linuxhelp11:~# apt-get update
Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [60.4 kB]
.
.
Get:19 http://in.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [4,584 B]
Fetched 3,778 kB in 14s (258 kB/s)                                                     
Reading package lists... Done

Start the Squid service by running the following command.

root@linuxhelp11:~# systemctl start squid

Edit the Squid configuration file using vim editor and make the following changes in the file. Save and exit the file.

root@linuxhelp11:~# vim /etc/squid/squid.conf

acl test src 192.168.7.218 192.168.7.103
acl down_time time " /etc/squid/down_time.txt" 
http_access deny test down_time
http_access allow test

Create a file inside this path named down_time.txt and enter the time required for the system to be down (i.e) the time set where the internet cannot be accessed by the user. Save and exit the file.

linuxhelp:~ # vim /etc/squid/down_time.txt

00:00-09:00
11:00-11:30
13:00-13:45
18:00-24:00

Restart the Squid proxy server after doing the above changes.

root@linuxhelp11:~# systemctl restart squid

Switch over a client machine and open internet properties window and select the connections tab in the window to set the proxy.

Click on the LAN settings in the connections tab.

Set the required proxy address and port and click ok to save the changes.

Open the browser and check whether the internet connections are working fine by accessing any site that you want. The proxy server will grant the access.

During the time mentioned inside the configuration file. the internet connection for the browser won' t work and proxy server will refuse to access any site.

Thus we conclude the configuration procedure of using ACL rule for Timing using Squid Proxy using Ubuntu 16.04.

FAQ
Q
What are the feature available in the Squid?
A
The following features will available in the Squid,

/SquidLogs: writing and most important reading the various squid log files



/SquidMemory describes how squid uses RAM and how to optimize its usage



/SquidAcl (or Authorization): controlling squid's powerful access control features



/ContentAdaptation how to analyze, capture, block, replace, or modify the messages being proxied



/CacheDigests or ICP on steroids



/MiscFeatures: Squid 2.X miscellaneous features
Q
How to install SARG on Ubuntu?
A
For the installation of SARG on Ubuntu, use the following link as given below "https://www.linuxhelp.com/how-to-install-sarg-on-ubuntu-16-04/ "
Q
Which Protocols will support on squid?
A
The HTTP and FTP protocol will supported where squid proxy.
Q
Where to specify a hostname for Squid?
A
For specify the Hostname for squid, configure the following line in the Squid configuration "visible_hostname"
Q
What is default port number of Squid?
A
3128 is a default port number for the Squid proxy server.