Squid Proxy Server
Squid is a proxy server for caching and filtering web content. Squid proxy is used by various organizations and internet providers to reduce bandwidth and to increase response time. It will cache request web content and re-use it for the further request of same request.
Using Proxy Server we can:
Step1: Update all repository using update command
Using Proxy Server we can:
- Restrict access to a specific web site
- Restrict access to a specific keywords
- Restricting access to specific IP address
- Allow full access to specific IP address
- Restricting Download Size
- Change Squid Proxy port Number
- Configure squid as a transparent proxy.
Step1: Update all repository using update command
[root@]#yum update
Step2: Install squid proxy server packages from repository
[root@]#yum install squid
Default
configuration file for proxy server is /etc/squid/squid.conf. You can start proxy server without changing any configuration. By default it is recommended configuration stored in the file.
[root@]service squid start.
Setup
Server to start proxy server at boot up
[root@]chkconfig squid on.
Now setup web browser to access internet through proxy server through 3128. Also, troubleshooting with proxy server. And if, your browser will unable to connect with internet using proxy server then allow proxy server from the firewall to access the internet or stop the firewall.
[root@] service IP tables stop.
Disable the Selinux
Open
the file /etc/selinux/config and change the configuration
SELINUX=disabled.
And
now reboot the server.
Configure Squid Proxy as Web filter
Restricting access to specific websites:
Let's assume we have to block facebook.com and google.com
Step1: Create a file
/etc/squid/blocksites.squid and add the
sited names to be blocked as follow.
#block following sites
Step2: Now configure the blocksites.squid
document in the /etc/squid/squid.conf. Create
a new acl ” blocksites” and acl type “dstdomain” in the acl section.
#ACL Blocksites
acl blocksites dstdomain “/etc/squid/blocksites.squid”.
add the following line “http_access deny
blocksites” to http_section to deny the access to the acl “blocksites”.
#
Recommended minimum Access Permission configuration:
#
#
Only allow cachemgr access from localhost
http_access
allow manager localhost
#
Deny access to blocksites ACL
http_access
deny blocksites
Step3:
Restart the server using below command
[root@] service squid restart.
Now
you can try Facebook and Gmail, you will get access denied in the web browser.
Restrict access to a specific
keywords:
We will block keywords in the
proxy server
Step1: Create a file
/etc/squid/blockkeywords.squid and add the sited names to be blocked as follow.
#block following keywords
Facebook
Gmail
Step2: Now configure the
blockkeywords.squid document in the /etc/squid/squid.conf. Create a new acl ” blockkeywords” and acl type “dstdomain” in the acl
section.
#ACL Blockkeywords
acl blockkeywords url_regex -i
"/etc/squid/blockkeywords.squid".
Add the following line “http_access deny blockkeywords” to
http_section to deny the access to the acl “blocksites”.
#
Recommended minimum Access Permission configuration:
#
#
Only allow cachemgr access from localhost
http_access
allow manager localhost
#
Deny access to blocksites ACL
http_access
deny blocksites
#
Deny access to blockkeywords ACL
http_access
deny blockkeywords
Step3:
Restart the server using below command
[root@] service squid restart.
Comments