Twitter
RSS

Restriction Web Access by Time and IP address through Squid Proxy in Linux Version 7,9,10

vi /etc/squid/squid.conf
#Sample configuration of squid proxy below:

http_port 192.168.0.1:3128
cache_mem 20MB
cache_dir_ufs /var/spool/squid 2000 16 256
chae_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
acl our_host src 192.168.0.10 192.168.0.100
acl our_host1 src 10.10.10.10 10.10.10.50
http_access allow our_host
http_access allow our_host1
http_access deny all

#Port 80 is block by default, isp provide forces of proxy:
cache_peer (server ip) (port) 0 default no-query
never_direct allow all
#Direct connection with auto proxy: Transparent Proxy
httpd_accel_host virtual
httpd_accel_port 80
gttpd_accel_single_host on
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

Restriction Web Access By Time:
# Add this to the bottom of the ACL section of squid.conf
acl home_network src 192.168.1.0/24
acl business_hours time M T W H F 9:00-17:00
# Add this at the top of the http_access section of squid.conf
http_access allow home_network business_hours
Or, you can allow morning access only:
# Add this to the bottom of the ACL section of squid.conf
acl mornings time 08:00-12:00
# Add this at the top of the http_access section of squid.conf
http_access allow mornings

Restricting Web Access By IP Address:
You can create an access control list that restricts Web access to users on certain networks. In this case, it's an ACL that defines a home network of 192.168.1.0.
# Add this to the bottom of the ACL section of squid.conf
acl home_network src 192.168.1.0/255.255.255.0

You also have to add a corresponding http_access statement that allows traffic that matches the ACL:
# Add this at the top of the http_access section of squid.conf
http_access allow home_network

Comments (0)

Post a Comment