+ Post New Thread
Results 1 to 7 of 7
Internet Related/Filtering/Firewall Thread, Basic website blocking in Technical; Ok this is rather a hacked way of doing it, but it does work.Basically, this will allow you to block ...
  1. #1

    matt40k's Avatar
    Join Date
    Jun 2008
    Location
    Ipswich
    Posts
    4,434
    Thank Post
    368
    Thanked 646 Times in 528 Posts
    Rep Power
    159

    Basic website blocking

    Ok this is rather a hacked way of doing it, but it does work.Basically, this will allow you to block websites and allow users to use there laptops at home and at work with out any major work.

    To start with, you'll need access to an external webserver, an internal webserver, internal DNS, ideally Group Policy. The internal webserver will need to be IP-based Virtual Hosts rather then Name-based.

    First, on you need to create a PAC file, open notepad then type the bit below, remember to replace with your settings.

    Replace 192.168.1.1:8080 with your proxy server address (with port)
    Replace block.school.co.uk:80 with your local webserver (with port)
    Replace 10.168.1.0 with your IP range
    Replace 255.255.255.0 with your subnet

    Note you can add additional URL you want blocking:
    if (shExpMatch(url, "http://*.ebay.com*")) { return block; }

    Code:
    function FindProxyForURL(url, host)
    {
    // variable strings to return
    var proxy_yes = "PROXY 192.168.1.1:8080";
    var proxy_no = "DIRECT";
    var block = "PROXY proxy.school.county.sch.uk:80";
    // Put any websites you want to block (will redirect you your webserver)
    if (shExpMatch(url, "http://*.facebook.com*")) { return block; }
    // Put any local websites
    if (shExpMatch(url, "http://192.168.1.100*")) { return proxy_no; }
    // Proxy if PC is on local LAN
    if (isInNet(myIpAddress(), "10.168.1.0", "255.255.255.0"))
    return "PROXY 192.168.1.1:8080";
    else
    return "DIRECT";
    }
    Save the file as proxy.pac, you'll need to upload this to your external webserver. Ideally create a subdomain called proxy. For example proxy.school.county.sch.uk

    Now create the SAME FQDN on your internal DNS then point it to your internal webserver. So when your on your network, for example, when you ping proxy.school.county.sch.uk it will resolve to your local webserver (private IP address). Save the proxy.pac file to the internal webserver as well.

    Now set your web browser to use the new PAC file,

    For example,
    Tools > Internet Options > Connections > LAN settings
    Use automatic configuration script
    proxy.school.county.sch.uk
    (Untick use proxy server and automatically detect)
    Ok

    Assuming you've done this right, you should now be sent to your local webserver whenever, for example, you visit facebook.com! Enter your fancy block webpage and your sorted.

    I did setup this up on UNIX box and had the proxy.pac redirected to proxy.php which pull the url list from a MySQL database... but that's for another day

    Anyway, hopefully that will with do until your Smoothwall gets deliveried

  2. Thanks to matt40k from:

    nephilim (18th June 2009)

  3. #2

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    12,100
    Thank Post
    1,640
    Thanked 1,961 Times in 1,435 Posts
    Blog Entries
    2
    Rep Power
    441
    Hasnt worked our end. I tried it on a test laptop and it failed although I am unsure as to why, I did everything as said in the post. Good attempt though!

  4. #3

    matt40k's Avatar
    Join Date
    Jun 2008
    Location
    Ipswich
    Posts
    4,434
    Thank Post
    368
    Thanked 646 Times in 528 Posts
    Rep Power
    159
    Doesn't block or doesn't proxy?

  5. #4

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    12,100
    Thank Post
    1,640
    Thanked 1,961 Times in 1,435 Posts
    Blog Entries
    2
    Rep Power
    441
    doesnt proxy.

  6. #5

    matt40k's Avatar
    Join Date
    Jun 2008
    Location
    Ipswich
    Posts
    4,434
    Thank Post
    368
    Thanked 646 Times in 528 Posts
    Rep Power
    159
    What did you put in for your proxy server, ip range and subnet?

  7. #6

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    12,100
    Thank Post
    1,640
    Thanked 1,961 Times in 1,435 Posts
    Blog Entries
    2
    Rep Power
    441
    County proxy, schools IP range, and subnet range.

    *update* it partially works, it blocked ebay and facebook, but only on a handful of PC's and laptops.
    Last edited by nephilim; 18th June 2009 at 07:23 PM.

  8. #7


    tom_newton's Avatar
    Join Date
    Sep 2006
    Location
    Leeds
    Posts
    4,475
    Thank Post
    867
    Thanked 850 Times in 672 Posts
    Rep Power
    196
    Bear in mind that IE does cache proxy.pac results (irritating as hell in certain scenarios - can be hacked off in registry). Reboot the PC (yeah, that old chestnut) before giving up the ghost

SHARE:
+ Post New Thread

Similar Threads

  1. BASIC Interpreter
    By laserblazer in forum Windows
    Replies: 6
    Last Post: 12th June 2009, 01:28 PM
  2. basic maintenance
    By bishopsgarthstockton in forum How do you do....it?
    Replies: 29
    Last Post: 24th November 2007, 06:55 PM
  3. Visual basic 6
    By Halfmad in forum Windows
    Replies: 9
    Last Post: 11th June 2007, 02:57 PM
  4. 'Secure' area on basic website
    By crc-ict in forum Web Development
    Replies: 16
    Last Post: 11th May 2007, 12:03 PM
  5. Some basic info.
    By mrforgetful in forum Thin Client and Virtual Machines
    Replies: 8
    Last Post: 12th January 2007, 10:04 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •