2015-04-24 04:46:21 +00:00
|
|
|
package cert
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/vault/logical"
|
|
|
|
"github.com/hashicorp/vault/logical/framework"
|
|
|
|
)
|
|
|
|
|
2015-07-01 00:45:20 +00:00
|
|
|
func Factory(conf *logical.BackendConfig) (logical.Backend, error) {
|
|
|
|
return Backend().Setup(conf)
|
2015-04-24 04:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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-10-06 01:10:20 +00:00
|
|
|
"crlsets/*",
|
2015-04-24 17:31:57 +00:00
|
|
|
},
|
|
|
|
|
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-10-08 01:50:57 +00:00
|
|
|
pathCRLs(&b),
|
2015-04-24 17:31:57 +00:00
|
|
|
}),
|
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
|
|
|
`
|