50 lines
907 B
Go
50 lines
907 B
Go
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),
|
|
pathConfigAddHostKey(&b),
|
|
pathConfigRemoveHostKey(&b),
|
|
pathRoles(&b),
|
|
sshConnect(&b),
|
|
},
|
|
|
|
Secrets: []*framework.Secret{
|
|
secretOneTimeKey(&b),
|
|
},
|
|
}
|
|
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.
|
|
`
|