provocation

package module
v0.0.0-...-df79ff2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: Apache-2.0 Imports: 5 Imported by: 1

README

Provocation

Provocation is a library for the provisioning and revocation of secrets/credentials.

Supported secrets engines:

  • Consul
  • Password
  • PostgreSQL
  • RabbitMQ

Examples:

// Postgres secrets engine
import (
	"fmt"

	"github.com/secretsengine/provocation/engines/postgresql"
)

func main() {
	engine := postgresql.Engine{
		URI: "postgres://localhost:5432/database",
		Username: "postgres",
		Password: "secret",
		Creation: []string{
			`CREATE ROLE "{{name}}" WITH LOGIN PASSWORD '{{password}}'`,
			`GRANT SELECT ON ALL TABLES IN SCHEMA public TO "{{name}}"`,
		},
	}

	revocation, credentials, err := engine.Provision(context.TODO(), "foo", "bar")
	if err != nil {
		panic(err)
	}

	fmt.Printf("Generated credentials: %v:%v\n", credentials["username"], credentials["password"])
	// Use credentials
	// ...

	// Revoke credentials
	if err = engine.Revoke(context.TODO(), revocation); err != nil {
		panic(err)
	}
}
// Password secrets engine
import (
    "fmt"

    "github.com/secretsengine/provocation/engines/password"
)

func main() {
    engine := password.Engine{
	    Length: 16,
    }

    _, credentials, err := engine.Provision(context.TODO(), "", "")
    if err != nil {
        panic(err)
    }

    fmt.Printf("Generated password: %v\n", credentials["password"])
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	Provision(ctx context.Context, namespace, name string) ([]byte, map[string][]byte, error)
	Revoke(ctx context.Context, revocation []byte) error
}

Engine is a secrets engine that can provision and revoke credentials.

Directories

Path Synopsis
engines

Jump to

Keyboard shortcuts

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