Configuring Squid Proxy Server with Restricted Access and Setting Up Clients to Use Proxy


Are you looking to configure a Squid Proxy Server with restricted access and set up clients to use the proxy? Look no further! In this article, I will guide you through the steps to configure Squid Proxy Server and set up clients to use the proxy.

What is Squid Proxy Server?

Squid Proxy Server is a popular open-source proxy server that can be used to improve network performance and security by caching and filtering web content. It can also be used to control access to the internet, allowing you to block or allow specific websites or categories of websites.

Installing Squid Proxy Server

Before we begin, let's install Squid Proxy Server. You can install Squid Proxy Server on Ubuntu and other Debian-based systems by running the following command in your terminal −

sudo apt-get update
sudo apt-get install squid

Configuring Squid Proxy Server

Once Squid Proxy Server is installed, we need to configure it to restrict access and filter web content. The configuration file for Squid Proxy Server is located at /etc/squid/squid.conf.

Restricting Access

The first step is to restrict access to Squid Proxy Server. We can do this by adding the following lines to the configuration file −

http_access deny all
http_access allow your_ip_address

Replace "your_ip_address" with the IP address of the client that is allowed to access the proxy server. You can also allow access from multiple IP addresses by adding multiple "http_access allow" lines.

Filtering Web Content

Next, we can filter web content by adding the following lines to the configuration file −

acl block_websites dstdomain .example.com
http_access deny block_websites

Replace ".example.com" with the domain name of the website that you want to block. You can also block multiple websites by adding multiple "acl block_websites" lines.

Enabling Caching

Squid Proxy Server can cache web content to improve network performance. We can enable caching by adding the following lines to the configuration file −

cache_dir ufs /var/spool/squid 100 16 256
maximum_object_size 100 MB

These lines configure Squid Proxy Server to use the /var/spool/squid directory for caching and to limit the size of cached objects to 100 MB.

Setting Up Clients to Use Proxy

Now that Squid Proxy Server is configured, we need to set up clients to use the proxy. Clients can be set up to use the proxy manually or via a script.

Setting Up Clients Manually

To set up clients manually, follow these steps −

Google Chrome

  • Open the web browser's settings or preferences.

  • Look for the option to set up a proxy server or configure network settings.

  • Enter the IP address and port number of the Squid Proxy Server.

  • Save the settings and restart the web browser.

Mozilla Firefox

  • Open Chrome and click the three dots in the top right corner.

  • Select Settings from the drop-down menu.

  • Scroll down to the bottom and click on the Advanced button.

  • In the System section, click on Open proxy settings.

  • Click on the LAN settings button.

  • Check the box for Use a proxy server for your LAN.

  • Enter the IP address and port number of the Squid Proxy Server in the Address and Port fields respectively.

  • Click OK to save the settings and exit.

Microsoft Edge

  • Open Firefox and click the three lines in the top right corner.

  • Select Options from the drop-down menu.

  • Click on General on the left-hand side.

  • Scroll down to the Network Settings section and click on the Settings button.

  • Select Manual proxy configuration.

  • Enter the IP address and port number of the Squid Proxy Server in the HTTP Proxy and Port fields respectively.

  • Click OK to save the settings and exit.

Setting Up Clients via Script

Setting up clients via a script is a more efficient way to configure multiple clients at once. A script can be used to automatically configure the proxy settings on clients during deployment or updates.

Here is a sample script for setting up clients to use the Squid Proxy Server.

$RegKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$RegValue = "ProxyServer"
$RegType = "String"
$Proxy = "192.168.1.100:3128"

Set-ItemProperty -Path $RegKey -Name $RegValue -Value $Proxy -Type $RegType
Set-ItemProperty -Path $RegKey -Name "ProxyEnable" -Value 1 -Type DWORD

This script sets the proxy server to "192.168.1.100" and port to "3128" on Windows clients. The script can be run on each client to configure the proxy settings automatically.

Conclusion

Setting up a Squid Proxy Server with restricted access and configuring clients to use the proxy is a relatively simple process. The benefits of using a proxy server include improved network performance, increased security, and better control over internet access. By following the steps outlined in this article, you can set up and configure a Squid Proxy Server to meet your organization's needs. Remember to test the proxy server thoroughly before deploying it to production to ensure that it is working correctly.

Updated on: 26-Jun-2023

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements