Squid is a full-featured web proxy cache server application which provides proxy and cache services for HyperText Transport Protocol (HTTP), File Transfer Protocol (FTP), and other popular network protocols.

Go to the Proxy server machine and install squid there.

Architecture

The architecture diagram is shown below:

Installation

At a terminal prompt, enter the following command to install the Squid server:

sudo apt install squid

Make these changes in the squid.conf file which is located in the path /etc/squid/squid.conf.

By default the http_port that is used in 3128. You can change the port if we wish.

Add visible_hostname in the conf file in the format

visible_hostname myproxyserver

Add these line just below the line “http_access allow localhost”

acl client src (ip of the client machine) for eg: acl client src 172.31.84.53

http_access allow client

After making changes to the /etc/squid/squid.conf file, save the file and restart the squid server application to effect the changes using the following command entered at a terminal prompt:

sudo systemctl restart squid.service.

Now switch to the client machine and in the proxy settings, enter the proxy server ip and the port specified( by default 3128). If you use chrome browser, we need to have these changes in the proxy settings of the system. If MOzilla browser is used to access the internet, these entries should be made in proxy settings of mozilla browser settings.

Server Monitoring

For Server Monitoring, Run the curl command as follows.

curl -s https://EUBJAOOIUHmFsMdl@api.copperegg.com/rc.sh | sudo bash

We can see in the logs of the proxy server that our client is trying to connect api.copperegg.com.

The dashboard in the copperegg will look like this.

Custom Metric

Run following command in client machine for enabling custom monitoring

curl -isk -u EUBJAOOIUHmFsMdl:U https://api.copperegg.com/v2/revealmetrics/samples/testsquidproxy.json -H “Content-Type: application/json” -d “{\”timestamp\”:`date +%s`, \”identifier\”:\”my_testsquidproxy_identifier\”,\”values\”:{\”total_access\”:2560}}”

Dashboard will look like this

Proxy logs will show the http connection is allowed.

Database Monitoring

For database monitoring run the following command on client machine

curl -s https://EUBJAOOIUHmFsMdl@api.copperegg.com/cm.sh > /tmp/install_cuegg_custom.sh;sudo bash -i /tmp/install_cuegg_custom.sh

Copperegg dashboard will look like this

And the access logs in the squid proxy server will reflect the traffic