aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-11-23 13:46:52 +0100
committerKristian Lyngstol <kly@kly.no>2016-11-23 13:46:52 +0100
commit1b44b20289dddd924fe79a042eec72b509ba025c (patch)
tree515e71489e8613fa51649b9ed1a06cd714e8000a /extras
parent5976e67e48b332ff2dd1b3471307c1503cdddb25 (diff)
Use proxy for grafana-authentication
Diffstat (limited to 'extras')
-rw-r--r--extras/misc/varnish-auth.vcl26
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?""};
+ }
+}