LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-08-2012, 09:28 AM   #1
balu1010
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
squid config for restricting websites


Hi,
How can I block particular IP from connecting to particular sites.
Squid.conf file is as follows.
For example , please help me to block 192.168.0.10 from accessing gmail.com


********************************************************
/etc/squid/squid.conf
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl mynetwork src 192.168.0.0/24
#acl block_site dstdomain "/etc/squid/blocked"
acl allow_sites dstdomain "etc/squid/allowed"
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
#
acl localnet src 192.168.0.0/24
#
acl SSL_ports port 443 #https
acl SSL_ports port 563 #snews
acl SSL_ports port 873 #rsync
acl Safe_ports port 80 #http
acl Safe_ports port 21
acl Safe_ports port 443
acl Safe_ports port 70
acl Safe_ports port 210
acl Safe_ports port 1025-65535
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777
acl Safe_ports port 631
acl Safe_ports port 873
acl Safe_ports port 901
acl purge method PURGE
acl CONNECT method CONNECT
#
http_access allow manager localhost
http_access deny manager
#
http_access allow purge localhost
http_access deny purge
#
http_access deny !Safe_ports
#
http_access deny CONNECT !SSL_ports
#
http_access allow localhost
#http_access deny block_site
http_access deny !allowed_sites
http_access allow mynetwork
http_access deny all
#
http_port 3128
#
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 20% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
#
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
#
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
#
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
********************************************************

thanks in advance

Balu
 
Old 10-08-2012, 11:11 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,916

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by balu1010 View Post
Hi,
How can I block particular IP from connecting to particular sites. Squid.conf file is as follows. For example , please help me to block 192.168.0.10 from accessing gmail.com
A very brief search turns up solutions. For example:
https://www.linuxquestions.org/quest...ar-url-906310/

And the complete how-to/FAQ can be found on Squids website, regarding ACL's....have you looked?
http://wiki.squid-cache.org/SquidFaq/SquidAcl

The link on this site has an example, and even shows you how to block it for everyone, but allow some people.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting Access to websites with 8.04 jus71n742 Linux - Desktop 3 01-27-2010 11:57 AM
restricting internet access with squid... mia_tech Linux - Newbie 3 01-02-2008 04:19 PM
Restricting URLs on desktop - squid? pete_bogg Slackware 6 06-20-2006 09:47 AM
Squid - restricting usage by time 7 IP cic Linux - Networking 0 10-28-2002 04:41 AM
Restricting access to site by IP with squid hagenuk Linux - Software 0 12-06-2001 12:22 AM


All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration