Need help with security.vcl?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

197 Stars 37 Forks GNU General Public License v2.0 48 Commits 13 Opened issues


protect your websites with varnish rules

Services available


Need anything else?

Contributors list

# 451,770
26 commits
# 182,416
2 commits
# 439,285
1 commit



This project is mostly deprecated.


Please use the Varnish Security Firewall: -

================================= 1. About Security.VCL 2. Basic usage 3. The Architecture

4. Handlers

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

1. About Security.VCL

Security.VCL is a Web Application Firewall implemented in Varnish Control Language.

Security.VCL aims to provide: - A standardized framework for security-related filters - Several core rule-sets - A tool to generate Security.VCL modules from mod_security rules. - 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 operation as possible. The incident handlers are mainly CGI-like scripts on a backend.

2. Basic usage

To use Security.VCL, you currently have to:

Set up Varnish >= 3.0.x and then:

$ cd vcl/ $ make $ cd .. $ ln -s $PWD/vcl/ /etc/varnish/security/

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

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

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

You may have to or want to modify config.vcl to fit your needs. Remember that paths must be hardcoded and absolute.

3. The Architecture

Security.VCL currently have two categories of rules: rules generated from modsecurity, located in vcl/breach/ and our own rules, vcl/modules/. Ready-to-use modsecurity-Rules can be found here:

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

4. Handlers

The general concept is that security.VCL either throws an error (vcl_error) of some kind, which can return a redirect the client, or do any other synthetic response, or Security.VCL 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

5. Known Issues

Let us know!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.