Linux / UNIX Tech Support Forum
This is a discussion on Squid Restriction within the Proxy Servers forums, part of the Mastering Servers category; Hi All, I am using Squid Proxy in my lan it's working fine. Now i want to restrict some ip's ...
|
|||||||
| Proxy Servers Discussion about UNIX / Linux caching proxy servers, web proxy, reverse / content filtering proxy server. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi All,
I am using Squid Proxy in my lan it's working fine. Now i want to restrict some ip's for particular websites is there any way to do this. I want to do following....... I want to give access to www.yahoo.com,www.gmail.com,www.hotmail.com, etc. to this ips 192.168.1.5 (6,8,10,25,55) only mentioned must be able to access this sites. All other ip must be restrict. Thanks In Advance VJ |
| Sponsored Links | ||
|
|
|
|||
|
acl yahoo dstdomain Yahoo!
acl allowip src 192.168.1.5 192.168.1.6 192.168.1.8 192.168.1.10 192.168.1.25 192.168.1.55 http_access allow allowip yahoo http_access deny yahoo all That should work, might not be lol. I found it easier in squidGuard to do it as it allows easier blocking for IP's |
|
|||
|
Quote:
Using Giri's idea we go one step further: Create a file in Code:
/usr/local/squid/etc Code:
allowed-ips Code:
bash# sudo touch allowed-ips # if you are in the directory or bash# sudo touch /usr/local/squid/etc/allowed-ips Code:
192.168.1.5 192.168.1.6 192.168.1.8 192.168.1.10 192.168.1.25 192.168.1.55 Code:
acl allowed-ips src 192.168.1.5 acl allowed-ips src 192.168.1.6 acl allowed-ips src 192.168.1.8 acl allowed-ips src 192.168.1.10 acl allowed-ips src 192.168.1.25 acl allowed-ips src 192.168.1.55 make sure that squid can read this file. at the command line type Code:
sudo chmod -R 644 Code:
allowed-sites Code:
/usr/local/squid/etc to this add each url one per line Code:
.google.com .yahoo.com .hotmail.com Now change the acl lines in your squid .conf to read Code:
acl weballow src "/usr/local/squid/etc/allowed-ips" acl myallow url_regex "/usr/local/squid/etc/allowed-sites" Code:
http_access allow weballow myallow Make sure that you put the above line above (before) any other http_access lines that may match one of the conditions and allow other users out to these sites. Also don't forget to have a http_access rule that allows these users to access other sites as well, if they are permitted, otherwise they will only ever be able to see these ones. Using compounded acls you can create pretty complex access rules. As you choose to add or remove permitted users and sites, you just edit the two files allowed-ips and allowed-sites to keep everything up-to-date. Oh, yeah don't forget to restart or reload your squid Code:
/etc/init.d/squid restart or /etc/init.d/squid reload Last edited by bandcoach; 03-01-2010 at 03:46 PM. Reason: restart/reload squid added |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Postfix Users Send Mail Restriction | caron_k2000 | Mail Servers | 2 | 25-08-2008 01:39 AM |
| vsftpd need restriction | kasimani | Networking, Firewalls and Security | 1 | 12-03-2007 03:35 AM |