diff options
| author | Lasse Haugen <haugen.lasse@gmail.com> | 2016-12-16 13:02:26 +0100 | 
|---|---|---|
| committer | Lasse Haugen <haugen.lasse@gmail.com> | 2016-12-16 13:02:26 +0100 | 
| commit | 8c4fe3a787a1f95e81cdd3e36d66f45115d3322f (patch) | |
| tree | b8b3ed907ff634fae047c010d2233cba5598e829 /extras/misc/varnish-auth.vcl | |
| parent | 64e91a665adc3eef4692db80ca98c4f6de29895a (diff) | |
| parent | fdfb87ee3fe4166f49aae9349e57ab007bbe0932 (diff) | |
Merge branch 'master' of github.com:tech-server/gondul
Diffstat (limited to 'extras/misc/varnish-auth.vcl')
| -rw-r--r-- | extras/misc/varnish-auth.vcl | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/extras/misc/varnish-auth.vcl b/extras/misc/varnish-auth.vcl new file mode 100644 index 0000000..c73e3ad --- /dev/null +++ b/extras/misc/varnish-auth.vcl @@ -0,0 +1,26 @@ +# Example auth-config for varnish + gondul +# Stick this in the data/ directory and Varnish will use it. +# Unless you set X-Webauth-User, grafana will not work. +# The username/password can be generated with echo -n foo:bar | base64 +  +acl white { +	"127.0.0.0"/8; +	"172.16.0.0"/12; +	"192.168.0.0"/16; +	"10.0.0.0"/8; +} + +sub vcl_recv { +	if (client.ip !~ white && req.http.Authorization != "Basic Zm9vOmJhcg==") { +		return(synth(401)); +	} else { +		unset req.http.Authorization; +		set req.http.X-Webauth-User = "admin"; +	} +} + +sub vcl_synth { +	if (resp.status == 401) { +		set resp.http.WWW-Authenticate = {"Basic realm="WHAT .... is your favorite color?""}; +	} +} | 
