The wiki is currently undergoing some major improvements. If you need some information and you don't know where to look, please come to #ecnet


From ECNet Wiki
Jump to: navigation, search

Use this hack to flip or blur all images that go through the squid proxy. This is for pfSence 1.2.3. It may work on other versions but this is the only version I tested it on.

1) Install the squid package from the web interface.
2) Install ImageMagik with "pkg_add -r ImageMagick" either via SSH or "Execute Command" tab in the web interface.
3) Create /var/squid/

#!/usr/bin/env python
import os, sys
import urllib, re, subprocess
outdir = '/usr/local/www/squidimages'
wwwpath = '';
img_regex = re.compile(r'(?i).(jpg|jpeg|png|gif)$')
operation = '-flip' # mogrify -help for more options
operation = operation.split()
count = 0
while True:
        l = raw_input().split(' ')
        url = l[0]
        m =
        if m:
                outname = '%d-%d.%s' % (os.getpid(), count,
                outpath = os.path.join(outdir, outname)
                count += 1
                        urllib.urlretrieve(url, outpath)
                        os.chmod(outpath, 0644)
              ['/usr/local/bin/mogrify'] + operation + [outpath])
                        print '/'.join([wwwpath, outname])
                except (IOError, urllib.ContentTooShortError):
                        print url

                print url

4) chmod 755 /var/squid/
5) mkdir /usr/local/www/squidimages
6) chmod 777 /usr/local/www/squidimages
7) Add to the Custom Options box in the squid package "url_rewrite_program /var/squid/" and Save.

Note: Change "-flip" to "-blur 4" to get blurred images that are not as intrusive as flipped ones. Change to your LAN IP address in to use the transparent proxy with this hack. Also /usr/local/www/squidimages can get very large depending on how many users/websites go through your squid proxy. Clear it out regularly or make a cron script to do so.