GithubHelp home page GithubHelp logo

isabella232 / vsf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lyft/vsf

0.0 0.0 0.0 341 KB

Varnish Security Firewall

License: Other

Makefile 0.76% Shell 0.50% M4 0.30% C 8.56% Perl 2.01% Awk 0.13% Python 0.71% JavaScript 72.93% CSS 1.43% Smarty 0.35% VCL 12.34%

vsf's Introduction

Varnish Security Firewall

The Varnish Security Firewall is a Web Application Firewall written using the Varnish Control Language and a varnish module.

This is work in progress just like any security app should be. Use at your own discretion.

VSF aims to provide:
  • A standardized framework for security-related filters
  • Several core rule-sets
  • A limited set of default 'handlers', for instance CGI scripts to call upon when Bad Stuff happens.

This is done mainly by using clever VCL, and with as little impact on normal cache operation as possible. The incident handlers can be CGI-like scripts on a backend.

https://travis-ci.org/comotion/VSF.svg?branch=6.0

Quick Start

To use VSF you will need the vsf vmod, as well as Varnish 6.x. Start by installing Varnish 6.0 as per https://varnish-cache.org/releases/rel6.0.0.html

Install instructions vary by OS and distro, but are roughly:

# install build dependencies, ubuntu/debian edition
apt-get install libvarnishapi-dev autoconf libtool pkgconfig python-docutils

# install build dependencies, centos/rhel6 edition
yum install varnish-libs-devel autoconf libtool pkgconfig python-docutils

# build vmods
make

# install vmods & vcl
make install

then you edit your default.vcl and add this line near the top:

include "/etc/varnish/security/vsf.vcl";

If you want to add VCL before VSF does its magic but after imports and backends, add it to security/local.vcl,

At this point, you should only need to reload your varnish configuration.

You may want to modify config.vcl to fit your needs.

The Architecture

VSF works by including all rulesets, then defining a number of standard functions. Each rule will set X-VSF-Severity = "N", where N is the severity, and call sec_handler which in turn typically calls error or some other handler.

Handlers

The general concept is that VSF either throws an error of some kind, which can return a redirect the client, or do any other synthetic response, or VSF can log, rewrite the original request and send it to a backend designed to do more clever things, like:

  • Block the client in a firewall
  • Log the event
  • Test-run the code.
  • Paint you a pretty picture...

There are several handlers defined and you can set the default handler in handlers.vcl. The default handler rejects detected malicious traffic.

Also you may write your own handler, see handlers.vcl

Known Issues

VSF uses the workspace to store the request, and the default is 64k, for request headers and body.

If you are receiving large POST or PUT requests you will probably need to set your workspace_client to some large value; typical values range from 1MB to tens of megabytes depending on the max size of your requests.

If you find any issues let us know! http://github.com/comotion/VSF/issues

Versions

Because we are closely tied to Varnish, VSF versions track Varnish versions.

We have a four-numbered system like so: VSF V.X.Y.Z where:

V is the major Varnish version, so for Varnish 4.x this is 4
X is the minor Varnish version, so for Varnish 4.1 this is 1
Y is the VSF major version, which changes when there are changes
  that require recompiling the VSF vmod.
Z is the VSF minor release version, for minor changes and bugfixes.

We also have a 3.0-branch of VSF, which is code compatible with Varnish 3.0. There are several new features in Varnish 4.1 that make the current VSF possible, There will be no further developments on the 3.0 branch.

Media

Future Work

Write a handler to redirect triggered requests to a honeypot rather than bugging out. A handler could also do signature-based recognition of the client/attacker.

See doc/ROADMAP for immediate plans.

Contributing

Bugs and feature requests are welcome, and contributors are much obliged. Make us a pull request.

Credits

This work is based on the work of:

  • by Eduardo S. Scarpellini
  • by Kristian Lyngstøl, Edward B. Fjellskål and Kacper Wysocki
  • libvmod-vsf
  • by Federico G. Schwindt

As well as the authors of the following VMODs:

and the Varnish Cache by Poul-Henning Kamp, of course ;-)

vsf's People

Contributors

anazia avatar blindpet avatar buffcode avatar comotion avatar fgsch avatar gboddin avatar huayra avatar jnk0 avatar michbsd avatar mmagdy88 avatar rod-gomes avatar ssm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.