Saturday 19 March 2011

Squid proxying for BBC iplayer and such...

Well this started as my friends will be moving back to their respective home countries.... they wanted to be able to stream bbc iplayer. This also enabled them to view BBC streams from Japan during the on going disaster...
First install squid (linux/win). Linux get the RPM or apt-get. Windows get the native port from http://squid.acmeconsulting.it/index.html

Ok... well on to the config!

Firstly, squid is being installed (2.7) compile or install the package

Despite what all the documentation says on the net - some of it is just plain god-damn wrong!

The important parts of the squid config are:
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_users
auth_param basic children 5
auth_param basic realm Phil's streaming proxy
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

acl auth_users proxy_auth REQUIRED
acl all src all
acl all_others dst 0.0.0.0/0.0.0.0
acl safe_sites dstdomain "/etc/squid/allowed_sites"
# Only allow cachemgr access from localhost
acl filetypes urlpath_regex -i "/etc/squid/denied_files"
http_access allow purge localhost
http_access allow safe_sites
http_access deny purge

http_access deny to_localhost
http_access deny all_others
cache_dir null /tmp
cache_deny all


with allowed_sites:
.bbc.co.uk
.bbcimg.co.uk
.edgefcs.net
.llnwd.net
.markiza.sk
.itv.co.uk
.itv.com
.national-lottery.co.uk
.securesuite.co.uk

and the squid_users file full of htpasswd entries
 e.g.
phil:xxxxxxx
bob:xxxxxx


with denied_files in regex format:
\.(mp4)$


No comments:

Post a Comment