2015-03-20 16:59:48 +00:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
2015-04-04 03:36:47 +00:00
|
|
|
"strings"
|
2015-03-21 10:18:46 +00:00
|
|
|
"time"
|
|
|
|
|
2015-03-20 18:32:18 +00:00
|
|
|
"github.com/hashicorp/vault/logical"
|
2015-03-20 16:59:48 +00:00
|
|
|
"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-03-20 18:32:18 +00:00
|
|
|
}
|
|
|
|
|
2016-06-10 19:53:02 +00:00
|
|
|
func Backend() *backend {
|
2015-03-20 16:59:48 +00:00
|
|
|
var b backend
|
|
|
|
b.Backend = &framework.Backend{
|
2015-04-04 03:36:47 +00:00
|
|
|
Help: strings.TrimSpace(backendHelp),
|
|
|
|
|
2017-02-16 21:29:30 +00:00
|
|
|
PathsSpecial: &logical.Paths{
|
|
|
|
LocalStorage: []string{
|
|
|
|
framework.WALPrefix,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2015-03-20 16:59:48 +00:00
|
|
|
Paths: []*framework.Path{
|
2015-04-19 05:21:31 +00:00
|
|
|
pathConfigRoot(),
|
2015-04-19 05:25:37 +00:00
|
|
|
pathConfigLease(&b),
|
2015-04-27 21:20:28 +00:00
|
|
|
pathRoles(),
|
2016-06-20 23:51:04 +00:00
|
|
|
pathListRoles(&b),
|
2015-03-20 16:59:48 +00:00
|
|
|
pathUser(&b),
|
2015-12-08 04:32:49 +00:00
|
|
|
pathSTS(&b),
|
2015-03-20 16:59:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Secrets: []*framework.Secret{
|
2015-04-19 05:25:37 +00:00
|
|
|
secretAccessKeys(&b),
|
2015-03-20 16:59:48 +00:00
|
|
|
},
|
2015-03-21 10:18:46 +00:00
|
|
|
|
2016-04-19 01:06:26 +00:00
|
|
|
WALRollback: walRollback,
|
|
|
|
WALRollbackMinAge: 5 * time.Minute,
|
2015-03-20 16:59:48 +00:00
|
|
|
}
|
|
|
|
|
2016-06-10 19:53:02 +00:00
|
|
|
return &b
|
2015-03-20 16:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type backend struct {
|
|
|
|
*framework.Backend
|
|
|
|
}
|
2015-04-04 03:36:47 +00:00
|
|
|
|
|
|
|
const backendHelp = `
|
|
|
|
The AWS backend dynamically generates AWS access keys for a set of
|
|
|
|
IAM policies. The AWS access keys have a configurable lease set and
|
|
|
|
are automatically revoked at the end of the lease.
|
2015-04-04 04:10:54 +00:00
|
|
|
|
|
|
|
After mounting this backend, credentials to generate IAM keys must
|
|
|
|
be configured with the "root" path and policies must be written using
|
2015-04-27 21:20:28 +00:00
|
|
|
the "roles/" endpoints before any access keys can be generated.
|
2015-04-04 03:36:47 +00:00
|
|
|
`
|