2015-08-27 15:51:35 +00:00
|
|
|
package logical
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
2015-08-27 17:36:44 +00:00
|
|
|
// SystemView exposes system configuration information in a safe way
|
|
|
|
// for logical backends to consume
|
|
|
|
type SystemView interface {
|
2015-08-27 16:14:03 +00:00
|
|
|
// DefaultLeaseTTL returns the default lease TTL set in Vault configuration
|
2015-09-10 19:09:34 +00:00
|
|
|
DefaultLeaseTTL() time.Duration
|
2015-08-27 16:14:03 +00:00
|
|
|
|
|
|
|
// MaxLeaseTTL returns the max lease TTL set in Vault configuration; backend
|
|
|
|
// authors should take care not to issue credentials that last longer than
|
|
|
|
// this value, as Vault will revoke them
|
2015-09-10 19:09:34 +00:00
|
|
|
MaxLeaseTTL() time.Duration
|
2015-09-18 23:59:06 +00:00
|
|
|
|
|
|
|
// SudoPrivilege returns true if given policy name contains sudo policy
|
|
|
|
// for the given path
|
|
|
|
SudoPrivilege(path, policy string) bool
|
2015-08-27 17:36:44 +00:00
|
|
|
}
|
|
|
|
|
2015-08-27 18:25:07 +00:00
|
|
|
type StaticSystemView struct {
|
2015-09-01 22:29:30 +00:00
|
|
|
DefaultLeaseTTLVal time.Duration
|
|
|
|
MaxLeaseTTLVal time.Duration
|
2015-08-27 17:36:44 +00:00
|
|
|
}
|
|
|
|
|
2015-09-10 19:09:34 +00:00
|
|
|
func (d StaticSystemView) DefaultLeaseTTL() time.Duration {
|
|
|
|
return d.DefaultLeaseTTLVal
|
2015-08-27 17:36:44 +00:00
|
|
|
}
|
|
|
|
|
2015-09-10 19:09:34 +00:00
|
|
|
func (d StaticSystemView) MaxLeaseTTL() time.Duration {
|
|
|
|
return d.MaxLeaseTTLVal
|
2015-08-27 15:51:35 +00:00
|
|
|
}
|
2015-09-18 23:59:06 +00:00
|
|
|
|
|
|
|
func (d StaticSystemView) SudoPrivilege(path, policy string) bool {
|
2015-09-19 16:33:52 +00:00
|
|
|
return policy == "root"
|
2015-09-18 23:59:06 +00:00
|
|
|
}
|