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-03-20 18:32:18 +00:00
|
|
|
func Factory(map[string]string) (logical.Backend, error) {
|
|
|
|
return Backend(), nil
|
|
|
|
}
|
|
|
|
|
2015-03-20 16:59:48 +00:00
|
|
|
func Backend() *framework.Backend {
|
|
|
|
var b backend
|
|
|
|
b.Backend = &framework.Backend{
|
2015-04-04 03:36:47 +00:00
|
|
|
Help: strings.TrimSpace(backendHelp),
|
|
|
|
|
2015-03-31 03:30:07 +00:00
|
|
|
PathsSpecial: &logical.Paths{
|
|
|
|
Root: []string{
|
|
|
|
"root",
|
|
|
|
"policy/*",
|
|
|
|
},
|
2015-03-20 16:59:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Paths: []*framework.Path{
|
|
|
|
pathRoot(),
|
|
|
|
pathPolicy(),
|
|
|
|
pathUser(&b),
|
|
|
|
},
|
|
|
|
|
|
|
|
Secrets: []*framework.Secret{
|
|
|
|
secretAccessKeys(),
|
|
|
|
},
|
2015-03-21 10:18:46 +00:00
|
|
|
|
|
|
|
Rollback: rollback,
|
|
|
|
RollbackMinAge: 5 * time.Minute,
|
2015-03-20 16:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return b.Backend
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
the "policy/" endpoints before any access keys can be generated.
|
2015-04-04 03:36:47 +00:00
|
|
|
`
|