Introduction To Squid Proxy Tutorial with Examples – POFTUT

Introduction To Squid Proxy Tutorial with Examples


Proxy is an intermediate system that manages communication between two systems. In web applications, an HTTP proxy is mostly used type. The client makes a request to the proxy and then proxy makes the request to the server behalf of the client. So we may think that why we need an intermediary system for this communication.

This article is actually an introduction and there will be more articles looking for more details and implementation of the squid features. As you know HTTP is the protocol used to get web resources from servers. HTTP is developed the early 1990s by the CERN. And the HTTP protocol makes the web very powerful and overcrowded. Today there are billions of people use web especially HTTP web resources. As you know this high load is transmitted over networks like LAN, MAN, WAN. LAN’s are generally fast network because of the area and technologies used but MAN and especially WAN is more expensive than LAN. Home and enterprise users access to the web through WAN and consume a lot of network resources. These resources are generally the same for each user. So the same resource is consumed separately by each user and gets distinct network resources. For example, think of google.com. Google is a very popular portal for today and accessed more than once at the same time. If we cache the web resources Google sends to the client we can use the same resource cache for another client and there will be no need to request cached resources from Google. Here web proxies come to the scene. These proxies stay between client and server and accept request from clients and get theses to request from the server and then served to the client. After getting the resources web proxy caches than for further requests from the same or different client. And then if a client requests the same resources it answers the cached resources without going to the server. But keep in mind that there are a lot of mechanisms and configuration to make things work accordingly which we will look. But the simple workflow is this. Now let start

LEARN MORE  What Is Windows Sysinternal?

There is a lot of reasons for this. First one is content control where enterprise network owner wants to control the web access according to its access policy. The second one is to filter encrypted data so unwanted data streams can be avoided. On the other side, normal home internet users may want to bypass filters and blocks. Enterprises may want to improve web access performance by caching content in the proxy. The enterprise application may be accessed through a proxy in the enterprise LAN.

Install

Here we can add more use scenarios but those are enough. Let start practice. Our proxy system is Ubuntu 14.10 x64. Firstly we install squid3 packets.

Ubuntu, Debian, Mint, Kali

$ sudo apt-get install squid3
Install Squid3
Install Squid3

And then start the squid service and look the status if there is an error.

Fedora, CentOS, RedHat

$ sudo yum install squid3

Start Squid Daemon

We can start the Squid daemon named squid with the systemctl command like below. We will also provide the start for action.

$ sudo systemctl start squid

Print Squid3 Service Status

We can check whether squid daemon or service work properly with the following command.

$ sudo systemctl start squid3
Print Squid3 Service Status
Print Squid3 Service Status

Go to the squid3 configuration directory. Here errorpage.css is the visual configuration of the error page which is shown to the user. msntauth.conf is a configuration for MS-based authentication. and squid.conf file which is the very long configuration file for squid but it can be divided into separate files and included into the main config file.

$ cd /etc/squid3/ 
$ ls 
errorpage.css msntauth.conf squid.conf

Start Squid3

In Ubuntu, squid3 binary resides /usr/sbin/squid3 and we can use it with parameters without a service command. For example, start squid with command

$ /usr/sbin/squid3 -f /etc/squid3/squid.conf

Print Squid3 Version and Information

To see what is the compile options of the current binary and see supported futures and modules

$ /usr/sbin/squid3 -v

In order to log to the Syslog use this command and specify HTTP port explicitly

$ /usr/sbin/squid3 -s  -a 1234

After starting squid we look at processes related to squid. As you can see one process for daemon one process for worker and one process for logging

$ ps aux | grep squ

Leave a Comment