vaban

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2014 License: MIT Imports: 10 Imported by: 0

README

Vaban

A quick and easy way to control groups of Varnish Cache hosts using a RESTful JSON API.

Build Status

This is still an early version but its fully functional and more features are planned. Now supports Varnish 3 and 4, with authentication.

Install Vaban:

Compile Vaban

go get github.com/ant0ine/go-json-rest/rest
go build vaban.go

Create config.json

{
    "group1": {
        "Hosts": [
            "a.example.com:6082",
            "b.example.com:6082",
            "c.example.com:6082"
        ],
        "Secret": "1111-2222-3333-aaaa-bbbb-cccc"
    },
    "group2":{
        "Hosts": [
            "x.example.com:6082",
            "y.example.com:6082",
            "z.example.com:6082"
        ],
        "Secret": "1111-2222-3333-aaaa-bbbb-cccc"
    }
}

Make sure that the varnish admin interface is available, listening on 0.0.0.0:6082

Start Vaban

./vaban

API Reference using curl

Get status of Vaban
curl -i http://127.0.0.1:4000/
Get all groups
curl -i http://127.0.0.1:4000/v1/services
Get all hosts in group
curl -i http://127.0.0.1:4000/v1/service/group1
Scan hosts to see if tcp port is open
curl -i http://127.0.0.1:4000/v1/service/group1/ping
Ban the root of your website.
curl -i http://127.0.0.1:4000/v1/service/group1/ban -d '{"Pattern":"/"}'
Ban all css files
curl -i http://127.0.0.1:4000/v1/service/group1/ban -d '{"Pattern":".*css"}'
Ban based on VCL, in this case all objects matching a host-header.
curl -i http://127.0.0.1:4000/v1/service/group1/ban -d '{"Vcl":"req.http.Host == 'example.com'"}'

Documentation

Overview

Vaban - The Simple Varnish Ban REST Api. <benjamin@martensson.io>

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL