2015-06-16 20:58:54 +00:00
|
|
|
package ssh
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"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 {
|
|
|
|
log.Printf("Vishal: ssh.Backend\n")
|
|
|
|
var b backend
|
|
|
|
b.Backend = &framework.Backend{
|
|
|
|
Help: strings.TrimSpace(backendHelp),
|
|
|
|
|
|
|
|
PathsSpecial: &logical.Paths{
|
|
|
|
Root: []string{"config/*"},
|
|
|
|
},
|
|
|
|
|
|
|
|
Paths: []*framework.Path{
|
|
|
|
pathConfigLease(&b),
|
2015-06-24 22:13:12 +00:00
|
|
|
pathKeys(&b),
|
2015-06-16 20:58:54 +00:00
|
|
|
pathRoles(&b),
|
2015-06-24 22:13:12 +00:00
|
|
|
pathRoleCreate(&b),
|
2015-06-16 20:58:54 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Secrets: []*framework.Secret{
|
2015-06-24 22:13:12 +00:00
|
|
|
secretSshKey(&b),
|
2015-06-16 20:58:54 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
return b.Backend
|
|
|
|
}
|
|
|
|
|
|
|
|
type backend struct {
|
|
|
|
*framework.Backend
|
|
|
|
}
|
|
|
|
|
|
|
|
const backendHelp = `
|
|
|
|
The ssh backend enables secure connections to remote hosts.
|
|
|
|
|
|
|
|
After mounting this backend, configure it using the endpoints within
|
|
|
|
the "config/" path.
|
|
|
|
`
|