WhileNetworking

  • Home
  • CCNA
  • Cisco Packet Tracer Download
    • Cisco packet tracer 6.3
    • cisco packet tracer 6.2
    • Cisco Packet Tracer 7
  • Linux Server Management
  • About Us
  • Privacy Policy
  • Contact Us

Configuring Proxy server in Linux (CentOS / Red Hat)

You are most welcome to this post.
Proxy server
Really thanks to you for your interest in this topics. :)

Hope that from the previous post, you’ve gain some basic knowledge about the proxy server. Now lets configure, the proxy server as web filter.

Configuring Proxy server in Linux (CentOS / Red Hat)

First, Update yum repositories and packages by typing the below command:

[root@localhost ~]# yum update

 

After that install squid proxy, which is a proxy server software package.

[root@localhost ~]# yum install squid

Now we need to configure the configuration file. Generally the configuration file stays in “/etc/squid/squid.conf ”

After that lets start the squid service.

[root@localhost ~]# service squid start

 

Now implement the proxy IP into your browser, For example, if you are using firefox browser, then you can change the proxy setting as :

options>> advanced >>network >> setting (connection)>> input your desire IP.

 

Hope that other browsers has similar types of options.

Now check the browsing from the  proxy server access log by using the command:

[root@localhost ~]# cat /var/log/squid/access.log

 

Sometimes you may face problems of browsing or configuring the proxy server. So if you face this type of problem, then just disable the firewall (IP tables) and SELinux

By the following command you can disable the firewall (IP tables)

[root@localhost ~]# service iptables stop

[root@localhost ~]# chkconfig iptables off

 

To disable the SELinux, just follow the steps:

Open the “/etc/selinux/config ”

Here you can see ” SELINUX=enforcing ” .

Just replace the enforcing word with ” disabled “.

After that reboot the system. That means reboot the server.

 

now we’ll see how to configure proxy server as web filter. That means, in this section, we’ll see how to block specific website of specific keyword with the help of the proxy server.

Step 1: At first create a file in the directory ” /etc/squid/blockedsites.squid “.

[root@localhost ~]# nano /etc/squid/blockedsites.squid

Then write :

#blocked sites

www.example.com

www.example-mail.com

 

Step 2: Open the ” /etc/squid/squid.conf ” and create  ACL as “block_sites” and give the type as ” dstdomain ”

 

 

acl Safe_ports port 488         # gss-http

acl Safe_ports port 591         # filemaker

acl Safe_ports port 777         # multiling http

ACL CONNECT method CONNECT

# ACL blocksites

 

 

After that using nano open ” /etc/squid/blockedsites.squid ” and add the following lines.

 

# 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

 

 

Now restart the proxy service, that is the squid proxy service.

[root@localhost ~]# service squid restart

 

So we’ve filtered the specific websites. Now open your browser and try to access www.example.com

See, if the configuration is ok, then you can’t access the web site.

Now we’ll block specific keyword. If anyone search with specific keyword, then he/she will can’t access the site containing that word.

 

At first Create a file using nano in the location ” /etc/squid/blockkeywords.squid “.

[root@localhost ~]# nano /etc/squid/blockkeywords.squid

#blocked keywords

Cricket

game

joy

 

 

 

Again open the ” /etc/squid/squid.conf ” and create a new ACL ” block_key_words ” and ACL type ” URL_REGEX ” in the ACL section.

acl Safe_ports port 488         # gss-http

acl Safe_ports port 591         # filemaker

acl Safe_ports port 777         # multiling http

acl CONNECT method CONNECT

# ACL blocksites

acl blocksites dstdomain “/etc/squid/blockedsites.squid”

# ACL blockkeywords

acl blockkeywords url_regex -i “/etc/squid/blockkeywords.squid”

 

# 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

 

 

SO we’ve learn how to block specific website and specific keyword, now we’ll see how to block specific IP address, just as previous create a file in the same location using nano  and place the IP address which you want to block.

[root@localhost ~]# nano /etc/squid/blockedip.squid

#blocked ips
192.168.2.125
192.168.2.126

 

And now as previous create a new file by using nano in the location ” /etc/squid.conf ” and write:

acl Safe_ports port 488         # gss-http

acl Safe_ports port 591         # filemaker

acl Safe_ports port 777         # multiling http

acl CONNECT method CONNECT

# ACL blocksites

acl blocksites dstdomain “/etc/squid/blockedsites.squid”

# ACL blockkeywords

acl blockkeywords url_regex -i “/etc/squid/blockkeywords.squid”

# ACL blockip

acl blockip src “/etc/squid/blockip.squid”

 

Now add these lines to the http section:

# Recommended minimum Access Permission configuration:

#

# Only allow cachemgr access from localhost

http_access allow manager localhost

# Deny access to blockip ACL

http_access deny blockip

# Deny access to blocksites ACL

http_access deny blocksites

# Deny access to blockkeywords ACL

http_access deny blockkeywords

 

Till then we have used the default port no. which is 3128. If you want you can change this port no. Just follow the cmand.

 

[root@localhost ~]# nano /etc/squid/squid.conf

here you may see http_port 3128

You can replace the port no with : http_port 9201 <Or your desired port no.>

 

 

Jul 6, 2016Himadri
 

Share with friends :

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to email a link to a friend (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to print (Opens in new window)

Related

Basic discussion of proxy server of Linux (CentOS / Red Hat)How to set up Proxy server in CentOS / Red Hat ?

Leave a Reply Cancel reply

seven − 5 =

Himadri

Hi, I'm Himadri. I love blogging with tech topics, specially computer networking. We'll have more fun in the upcoming day. Stay with me. :)

July 6, 2016 12 Comments Linux installation and server managementproxy server configuration, proxy server in Linux714
Feel Free to Share :)
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Find Us on Facebook
Choose a category !!
  • CCNA
  • Cisco Certification Exam
  • cisco packet tracer 6.2
  • Cisco packet tracer 6.3
  • Cisco Packet Tracer 7
  • Cisco Packet Tracer 7.1
  • Cisco Packet Tracer 7.2.1
  • Cisco Packet Tracer 7.3
  • Cyber Security
  • Engineering Ebooks
  • Excel
  • IELTS Ebook
  • Internet
  • Know computer
  • Know your computer
  • Laser Processing of Material
  • Linux installation and server management
  • PDF
  • Technology
  • Uncategorized
Top posts
  • Free download Cisco Packet Tracer 7 for linux (64 bit)
  • Packet tracer 6.2 student version for Linux - Free download
  • Know about Host-Based Intrusion Prevention System
Archieves
Get latest updates by Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 19 other subscribers
W
SC
wordpress counter
Analytics
Recent Comments
    Browse by categories
    Cyber SecurityLinux installation and server managementCCNAKnow your computerKnow computerCisco Packet Tracer 7UncategorizedCisco Certification ExamInternetPDFCisco Packet Tracer 7.3Engineering EbooksCisco packet tracer 6.3cisco packet tracer 6.2Cisco Packet Tracer 7.1TechnologyExcelLaser Processing of MaterialCisco Packet Tracer 7.2.1IELTS Ebook
    Feel free to contact with us

    Hi, any kind of comment or suggestion is valuable to us. So feel free to contact with us.

    Email: himadri.shekhar.bd@gmail.com

    Name: WhileNetworking.com

    2021 © WhileNetworking