open-vault/builtin/logical/ssh/backend.go

52 lines
1.1 KiB
Go

package ssh
import (
"strings"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
return Backend(), nil
}
func Backend() *framework.Backend {
var b backend
b.Backend = &framework.Backend{
Help: strings.TrimSpace(backendHelp),
PathsSpecial: &logical.Paths{
Root: []string{"config/*"},
},
Paths: []*framework.Path{
pathConfigLease(&b),
pathKeys(&b),
pathRoles(&b),
pathRoleCreate(&b),
pathLookup(&b),
},
Secrets: []*framework.Secret{
secretSshKey(&b),
},
}
return b.Backend
}
type backend struct {
*framework.Backend
}
const backendHelp = `
The SSH backend dynamically generates SSH private keys for remote hosts.
The key generated has a configurable lease set and are automatically
revoked at the end of the lease.
After mounting this backend, configure the lease using the 'config/lease'
endpoint. The shared SSH key belonging to any infrastructure should be
registered with the 'roles/' endpoint before dynamic keys for remote hosts
can be generated.
`