protect your websites with varnish rules
Please use the Varnish Security Firewall: - https://github.com/comotion/VSF
================================= 1. About Security.VCL 2. Basic usage 3. The Architecture
This is work in progress just like any security app should be. Use at your own discretion.
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.
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:
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.
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: https://www.owasp.org/index.php/Category:OWASPModSecurityCoreRuleSet_Project#tab=Home
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.
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:
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
Let us know! http://github.com/comotion/security.vcl/issues