2015-04-24 04:46:21 +00:00
|
|
|
package cert
|
|
|
|
|
|
|
|
import (
|
|
|
|
"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: backendHelp,
|
|
|
|
|
|
|
|
PathsSpecial: &logical.Paths{
|
2015-04-24 17:31:57 +00:00
|
|
|
Root: []string{
|
|
|
|
"certs/*",
|
|
|
|
},
|
|
|
|
|
2015-04-24 04:46:21 +00:00
|
|
|
Unauthenticated: []string{
|
|
|
|
"login",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2015-04-24 17:31:57 +00:00
|
|
|
Paths: append([]*framework.Path{
|
2015-04-24 04:46:21 +00:00
|
|
|
pathLogin(&b),
|
2015-04-24 17:31:57 +00:00
|
|
|
pathCerts(&b),
|
|
|
|
}),
|
2015-04-24 19:58:39 +00:00
|
|
|
|
|
|
|
AuthRenew: b.pathLoginRenew,
|
2015-04-24 04:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return b.Backend
|
|
|
|
}
|
|
|
|
|
|
|
|
type backend struct {
|
|
|
|
*framework.Backend
|
2015-04-24 17:31:57 +00:00
|
|
|
MapCertId *framework.PathMap
|
2015-04-24 04:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const backendHelp = `
|
2015-04-24 17:31:57 +00:00
|
|
|
The "cert" credential provider allows authentication using
|
|
|
|
TLS client certificates. A client connects to Vault and uses
|
|
|
|
the "login" endpoint to generate a client token.
|
|
|
|
|
|
|
|
Trusted certificates are configured using the "certs/" endpoint
|
|
|
|
by a user with root access. A certificate authority can be trusted,
|
|
|
|
which permits all keys signed by it. Alternatively, self-signed
|
|
|
|
certificates can be trusted avoiding the need for a CA.
|
2015-04-24 04:46:21 +00:00
|
|
|
`
|