ICAPrb::Filter

ICAPrb::Filter is a content filter based on ICAPrb::Server. The goal is to develop a framework which allows to create any custom filtering of any content you would not like to have in your network. This could be ads, trackers, malware, adult content and so on.

The way to defile rules should feel like configuring a firewall ruleset.

Plug ins are automatically detected when they reside in the correct namespace and are available to use.

Installation

Add this line to your application's Gemfile:

gem 'icaprb-filter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install icaprb-filter

Usage

First of all, you will need a server which is serving your content filter.

require "icaprb/server"
require "icaprb/filter"

s = ICAPServer.new
# url: echo ist der Service - rechts ist der zu verwendende Service
s.services['filter'] = ICAPrb::Server::FilterService.new('/path/to/filterconfig')
s.run

You will need to replace the path by the path you use on your local machine.

Next you will have to write your ruleset:

request_filter do
end

response_filter do
  block 'Block pages may contain samples',content_includes: ['sample']
  block 'Block invalid domains', url_contains: ['.invalid']
  block 'Block hashes of bad file', :check_hashes => ['~/hashes']
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fabianfrz/icaprb-filter.