VideoCache

How To Install Videocache on Pfsense

by Kulbir Saini on 22 Mar 2014

This howto covers the videocache installation process on PFsense. We'll proceed assuming that you have squid already installed on PFsense.

Install Python

Use PFsense console or ssh to PFsense and use the following command

# pkg_add -r python

Install the additional needed libraries.

# pkg_add -r py25-bsddb
# pkg_add -r py25-gdbm
# pkg_add -r py25-sqlite3
# pkg_add -r py25-tkinter

Install URLGrabber

Download the latest version of urlgrabber from URLGrabber Download Archive.

# fetch http:/linux.duke.edu/projects/urlgrabber/download/urlgrabber-x.x.x.tar.gz
# tar -xzf urlgrabber-x.x.x.tar.gz
# cd urlgrabber-x.x.x
# python setup.py bdist_rpm
# python setup.py install

Install Iniparse

Download the latest version of python-iniparse from Iniparse Project Website.

# fetch http:/iniparse.googlecode.com/files/iniparse-x.x.x.tar.gz
# tar -xzf iniparse-x.x.x.tar.gz
# cd iniparse-x.x.x
# python setup.py bdist_rpm
# python setup.py install

Install VideoCache

# fetch http:/cachevideos.com/sites/default/files/pub/videocache/videocache-x.x.tar.gz
# tar -xvzf videocache-x.x.tar.gz
# python setup.py install

Configure VideoCache

Using VI edit the /etc/videocache.conf file and edit the following options in the file

proxy
Set the IP address and port on which squid is listening on PFsense.
cache_host
The IP address of PFsense.
Configure Squid

Now add the following lines to /usr/local/pkg/squid.inc . Add the lines after acls.

# --BEGIN-- videocache config for squid
url_rewrite_program /usr/bin/python /usr/share/videocache/videocache.py
url_rewrite_children 10
acl videocache_allow_url url_regex -i \.youtube\.com\/get_video
acl videocache_allow_url url_regex -i \.cache[a-z0-9]?[a-z0-9]?[a-z0-9]?\.googlevideo\.com\/videoplayback
acl videocache_allow_url url_regex -i \.cache[a-z0-9]?[a-z0-9]?[a-z0-9]?\.googlevideo\.com\/get_video
acl videocache_allow_url url_regex -i proxy\-[0-9][0-9]\.dailymotion\.com\/
acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv
acl videocache_allow_url url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/
acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]?
acl videocache_allow_url url_regex -i \.files\.youporn\.com\/(.*)\/flv\/
acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv
acl videocache_allow_dom dstdomain v.mccont.com vp.video.google.com dl.redtube.com
acl videocache_deny_url url_regex -i http:\/\/[a-z][a-z]\.youtube\.com http:\/\/www\.youtube\.com
url_rewrite_access deny videocache_deny_url
url_rewrite_access allow videocache_allow_url
url_rewrite_access allow videocache_allow_dom
redirector_bypass on
# --END-- videocache config for squid

Save and restart squid service and you have videocache running on your PFsense. Enjoy caching :)

Note : In PFsense you need disable the https option in the General Setup Settings.

Good Luck.

If you want to comment on this howto, go to this forum topic.

Thanks to Juan Carlos Huerta C. for writing the wonderful howto :)

0 Answers

You need to sign in. Please sign in to add answer to this question.