About Linux FAQ

Browse More FAQs:

Squid deny users accessing a website

Posted by Vivek on Tuesday January 2, 07 @5:13 pm

Q. How do I deny a user accessing particular website? For example block foo.com.

A. Squid cache is a popular open source web proxy server and web cache software.

It has a wide variety of uses, from speeding up a web server by caching repeated requests, to caching web, DNS and other network lookups for a group of people sharing network resources, to aiding security by filtering traffic.

Squid has powerful ACL (access control list). The primary use of the acl system is to implement simple access control.

How to deny a user from accessing particular site?

To block site called foo.com you need to add following two lines to your squid configuration file.
# vi /etc/squid/squid.conf

Search for `Access Controls' and append following two lines:
acl blocksites dstdomain .foo.com
http_access deny blocksites

Save and close the file. Restart Squid:
# /etc/init.d/squid restart

Let us say you would like to deny access for anyone who browses to a URL with the word "bar" in it. Append following ACL:
acl blockregexurl url_regex -i bar
http_access deny blockregexurl

Save and close the file.

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Discussion on This FAQ

  1. HackITLinux Says:

    Block Unwanted Traffic…

    If you are managing a network connected to the internet with limited bandwidth, sometimes it makes sense to block unwanted traffic. To corporate or academic networks, blocking audio and video files are not uncommon. If you are like me,……

  2. Maroon Says:

    it’s out of subject! but related to SQuid.

    I need to know what is the best filesystem compatilbe with storeio? to get the best perfomance ever…

    one more questions about refresh_pattern anyone explain more to me about it…

    any help would be highly appreciated

    this squid is for caching onlu purpose and I’m looking to fine-tune it to get the best caching server ever.. thank you

  3. Tek Bahadur Limbu Says:

    If you would like to experiment on Squid, the best file storage system for Squid would be COSS in my opinion. I am currently using ufs, aufs, diskd and coss in my squid servers. You have to compile Squid with the following options to enable all the storage systems: –enable-storeio=coss,ufs diskd null aufs

    Please see the great Squid FAQ at: http://wiki.squid-cache.org/SquidFaq/

    The default refresh-pattern should be good enough for almost any system:

    refresh_pattern ^ftp: 1440 20% 10080
    refresh_pattern ^gopher: 1440 0% 1440
    refresh_pattern . 0 20% 4320

    However if your needs are very specific, please see the default squid.conf for further details.

    Have a nice day !!

  4. elvis Says:

    hi,
    i setup squid on a win2003 server os.fine i got it working but my challenge now is getting it to do web filtering to restrict access to certain sites. my research on this brought me to this site and i have tried the methods described here with no success.pls can any one help me out with this? u could send ur reply to my email: uwa45@yahoo.com. if neccessary a squid conf file wld be appreciated so that i can cross check with what i did.
    Thanks for all ur help and support.

  5. size limitetion for attachment Says:

    hi,
    I setup the squid in linux intigration of windows. we are useing more then 20 users every thinking is working fine, but i think due to trafic squid is working only a day after it is dead. i want to improve the stability (mean i want to do fine fuining)

    and i what restrict the users while attching file size to 1M maximem.

    pls do the needful

  6. kulpreet Says:

    Qiestion: How to configure sarg and squidGuard for squid servers to improve performance ?

  7. Jv Says:

    What r the solution for many no. of sites/domain blocking using above method?

  8. Nandkishor Says:

    I have setup the transperant squid proxy to block some downloading & some urls.
    How to block or deny the online listening musics & videows. Like for url youtube.com

    Any Idea.

    Cheers,
    Nandkihosr

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

~ Last updated on: January 2, 2007

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.