197
3. Squid - Proxy Server
Squid is a full-featured web proxy cache server application which provides proxy and cache services for Hyper Text Transport Protocol HTTP, File Transfer Protocol FTP, and other popular network
protocols. Squid can implement caching and proxying of Secure Sockets Layer SSL requests and caching of Domain Name Server DNS lookups, and perform transparent caching. Squid also
supports a wide variety of caching protocols, such as Internet Cache Protocol, ICP the Hyper Text Caching Protocol, HTCP the Cache Array Routing Protocol CARP, and the Web Cache
Coordination Protocol. WCCP The Squid proxy cache server is an excellent solution to a variety of proxy and caching server
needs, and scales from the branch office to enterprise level networks while providing extensive, granular access control mechanisms and monitoring of critical parameters via the Simple Network
Management Protocol SNMP. When selecting a computer system for use as a dedicated Squid proxy, or caching servers, ensure your system is configured with a large amount of physical memory,
as Squid maintains an in-memory cache for increased performance.
3.1. Installation
At a terminal prompt, enter the following command to install the Squid server:
sudo apt-get install squid
3.2. Configuration
Squid is configured by editing the directives contained within the
etcsquidsquid.conf
configuration file. The following examples illustrate some of the directives which may be modified to affect the behavior of the Squid server. For more in-depth configuration of Squid, see the References
section. Prior to editing the configuration file, you should make a copy of the original file and
protect it from writing so you will have the original settings as a reference, and to re-use as necessary.
Copy the
etcsquidsquid.conf
file and protect it from writing with the following commands entered at a terminal prompt:
sudo cp etcsquidsquid.conf etcsquidsquid.conf.original sudo chmod a-w etcsquidsquid.conf.original
• To set your Squid server to listen on TCP port 8888 instead of the default TCP port 3128, change the http_port directive as such:
http_port 8888
198 • Change the visible_hostname directive in order to give the Squid server a specific hostname. This
hostname does not necessarily need to be the computers hostname. In this example it is set to weezie
visible_hostname weezie
• Using Squids access control, you may configure use of Internet services proxied by Squid to be available only users with certain Internet Protocol IP addresses. For example, we will illustrate
access by users of the 192.168.42.024 subnetwork only:
Add the following to the bottom of the ACL section of your
etcsquidsquid.conf
file:
acl fortytwo_network src 192.168.42.024
Then, add the following to the top of the http_access section of your
etcsquidsquid.conf
file:
http_access allow fortytwo_network
• Using the excellent access control features of Squid, you may configure use of Internet services proxied by Squid to be available only during normal business hours. For example, well illustrate
access by employees of a business which is operating between 9:00AM and 5:00PM, Monday through Friday, and which uses the 10.1.42.042 subnetwork:
Add the following to the bottom of the ACL section of your
etcsquidsquid.conf
file:
acl biz_network src 10.1.42.024 acl biz_hours time M T W T F 9:00-17:00
Then, add the following to the top of the http_access section of your
etcsquidsquid.conf
file:
http_access allow biz_network biz_hours
After making changes to the
etcsquidsquid.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 etcinit.dsquid restart
3.3. References
Squid Website
15
Ubuntu Wiki Squid
16
page.
15 http:www.squid-cache.org 16 https:help.ubuntu.comcommunitySquid
199
4. Ruby on Rails