Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

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; }

 

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 :p

  • Thanks 1
Posted
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 :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...