MatrixMails - Get paid Restricting Access in Squid
Informal Linux Group Namibia
February 07, 2012, 01:37:28 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Restricting Access in Squid  (Read 3309 times)
lancelot
Moderator
Member
*****

Karma: 0
Posts: 48


« on: April 03, 2007, 10:34:29 AM »

Hi!

I have a Suse server which is running a squid. I need to restrict certain clients from accessing the internet. I have an ip range 192.168.0.3 - 192.168.0.52. Within this range I need to reestrict the following clients 192.168.0.8 192.168.0.17 192.168.0.23. What ACL rules should I put in the squid.conf file? At the moment it looks like this:

#acls
acl localhost src "/etc/squid/acl_localhost"
acl all src "/etc/squid/acl_all"
acl safe_ports port "/etc/squid/acl_safe_ports"
acl connect method "/etc/squid/acl_connect"
acl ssl_ports port "/etc/squid/acl_ssl_ports"
acl manager proto "/etc/squid/acl_manager"
acl internal_net src "/etc/squid/acl_internal_net"
#acl RestrictedHost src 192.168.1.16/255.255.255.255 192.168.0.9/255.255.255.255 192.168.0.7/255.255.255.255 192.168.0.18/255.255.255.255
#acl RestrictedHost src 192.168.1.9
acl restrictedhost src 192.168.0.18/255.255.255.255
acl FAS_FTP proto 21
acl FAS_HTTPS proto 443 563
#globals
cache_mgr administrator@quantum.com.na
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
client_netmask 255.255.0.0
ftp_user Squid@quantum.com.na
append_domain .quantum.com.na
error_directory /etc/squid/errors
authenticate_program /usr/sbin/squid_ldapauth
refresh_pattern         ^ftp:           1440    20%     10080
refresh_pattern         ^gopher:        1440    0%      1440
refresh_pattern         .               0       20%     4320
icp_access allow all
miss_access allow all
cache_effective_user squid
cache_effective_group nogroup
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
logfile_rotate 0
forwarded_for off
cachemgr_passwd disable all
always_direct allow FAS_HTTPS
always_direct allow FAS_FTP
http_port 192.168.0.2:3128
http_port 192.168.0.2:8080
http_port 127.0.0.1:3128
http_port 127.0.0.1:8080
cache_dir ufs /var/cache/squid 2000 16 256
#access_lists
http_access allow localhost manager
http_access deny manager
http_access deny !safe_ports
http_access deny connect !ssl_ports
http_access allow internal_net
#http_access deny restrictedhost
Logged
uwe
Global Moderator
Sr. Member
*****

Karma: 3
Posts: 261


WWW
« Reply #1 on: April 05, 2007, 09:38:14 AM »

This should do the trick:

acl restricted_hosts 192.168.0.8 192.168.0.17 192.168.0.23
http_access deny restricted_hosts

NB: The order of the "acl" statements doesn't matter but the statement "http_access deny" must occur before  any "http_access allow". It's first match wins.
Logged
lancelot
Moderator
Member
*****

Karma: 0
Posts: 48


« Reply #2 on: April 05, 2007, 11:05:12 AM »

Thanks that took care of it.

Quote
NB: The order of the "acl" statements doesn't matter but the statement "http_access deny" must occur before  any "http_access allow". It's first match wins

That's were i was messing up. I had placed the "http_access deny" after an "http_access allow" whose ip range encompassed the the restricted hosts.
Logged
Informal Linux Group Namibia
   

 Logged
Pages: [1]
  Print  
 
Jump to:  

Untitled Document

Unique Hits: 722309
Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Check PageRank