matt40k Posted June 18, 2009 Posted June 18, 2009 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 1
featured_spectre Posted June 18, 2009 Posted June 18, 2009 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!
matt40k Posted June 18, 2009 Author Posted June 18, 2009 What did you put in for your proxy server, ip range and subnet?
featured_spectre Posted June 18, 2009 Posted June 18, 2009 (edited) 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. Edited June 18, 2009 by featured_spectre
tom_newton Posted June 18, 2009 Posted June 18, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now