3

I'd like to write a simple web content filter with flexible filtering rules that are written in Python. The filter is to be used as a forward proxy.

Now, I have trouble choosing the right tools for this. What do you think would be a good set of tools? So far, I've been considering Apache HTTP server with mod_proxy and mod_python or mod_wsgi, but I got stuck with the setup (mod_python is poorly documentated, IMO).

Btw, I am aware of and have experience with existing content filters such as squid and dansguardian. I am trying to write my own because the filtering capabilities of these content filters aren't sophisticated enough for my case.

python dude
  • 7,980
  • 11
  • 40
  • 53

1 Answers1

1

You can use django middleware to intercept HTTP request/response traffic before it reaches your application (which might be in this case your graphical interface to fine tune your filter and/or database handling for storing your configurations or preset rules).

My initial imagination for your application, is that you will have a web interface for easy configuration and tuning for your system, store those configurations and rules in the database. In the middleware, put code logic that will read the configurations and rules form the database and apply them on the outgoing/incoming traffic.

I much prefer this model than doing this in django's application itself (views).

You can also put all sorts of logging and monitoring in your middleware script, and don't forget to enable it of course to make it functional :-).

securecurve
  • 5,589
  • 5
  • 45
  • 80