Documentation ¶
Index ¶
- Constants
- Variables
- func STSEndpointResolver(nextResolver endpoints.Resolver) endpoints.Resolver
- func VaultSessionCacheKey(vault *Vault) string
- type AWSCredentials
- func (c *AWSCredentials) AssumeRole(arn string, duration time.Duration) (*AWSCredentials, error)
- func (c *AWSCredentials) Expired() bool
- func (c *AWSCredentials) GetCallerIdentity() (arn.ARN, error)
- func (c *AWSCredentials) GetSessionToken(duration time.Duration) (*AWSCredentials, error)
- func (c *AWSCredentials) GetSessionTokenWithMFA(serialNumber, token string, duration time.Duration) (*AWSCredentials, error)
- func (c *AWSCredentials) Valid() bool
- func (c *AWSCredentials) ValidSession() bool
- type AWSKey
- type Details
- func (d Details) Bytes(name string) []byte
- func (d Details) Clone() Details
- func (d Details) Int(name string) int
- func (d Details) SetBytes(name string, value []byte)
- func (d Details) SetInt(name string, value int)
- func (d Details) SetString(name string, value string)
- func (d Details) String(name string) string
- type Operation
- type SSHOptions
- type Session
- func (s *Session) AssumeRole(roleArn string) (*Session, error)
- func (s *Session) AssumeSessionRole() (*Session, error)
- func (s *Session) Clone() *Session
- func (s *Session) Expired(tolerance time.Duration) bool
- func (s *Session) Spawn(cmd []string) (*int, error)
- func (s *Session) Variables() *Variables
- type SessionCache
- type SessionFile
- type StaticSteward
- type Steward
- type StewardMaxTries
- type Store
- type Variables
- type Vault
- type VaultFile
- type VaultKey
Constants ¶
const ( BaseIterations = 1 << 17 AdditionIterationsRange = 1 << 18 )
const (
DefaultSessionName = "VaultedSession"
)
const (
NoTolerance time.Duration = 0
)
Variables ¶
var ( ErrIncorrectPassword = errors.New("Incorrect password") ErrInvalidKeyConfig = errors.New("Invalid key configuration") ErrInvalidEncryptionConfig = errors.New("Invalid encryption configuration") )
var ( ErrInvalidCommand = errors.New("Invalid command") ErrNoTokenEntered = errors.New("Could not get MFA code") )
var ( // ErrVaultSessionNotFound occurs when attempting to locate a vault session // in a SessionCache that isn't present. ErrVaultSessionNotFound = errors.New("Vault session not found") )
var STSDurationDefault = time.Hour
var ( // SessionCacheVersion indicates the current version of the cache format. // // Any cache loaded that does not match this version is ignored. This // causes all caches written for previous versions to be invalidated. SessionCacheVersion = "3" )
Functions ¶
func STSEndpointResolver ¶
The default endpoint resolver uses the global STS endpoint for all standard AWS regions, regardless of what region the client is configured to use. This resolver always uses the locally configured region instead.
func VaultSessionCacheKey ¶
VaultSessionCacheKey computes a stable key based on the contents of a vault.
The computed key is intended to be used for things such as a session cache.
Types ¶
type AWSCredentials ¶
type AWSCredentials struct { ID string `json:"id"` Secret string `json:"secret"` Token string `json:"token,omitempty"` Expiration *time.Time `json:"expiration,omitempty"` Region *string `json:"region,omitempty"` }
func AWSCredentialsFromSTSCredentials ¶
func AWSCredentialsFromSTSCredentials(creds *sts.Credentials, region *string) *AWSCredentials
func (*AWSCredentials) AssumeRole ¶
func (c *AWSCredentials) AssumeRole(arn string, duration time.Duration) (*AWSCredentials, error)
func (*AWSCredentials) Expired ¶
func (c *AWSCredentials) Expired() bool
func (*AWSCredentials) GetCallerIdentity ¶
func (c *AWSCredentials) GetCallerIdentity() (arn.ARN, error)
func (*AWSCredentials) GetSessionToken ¶
func (c *AWSCredentials) GetSessionToken(duration time.Duration) (*AWSCredentials, error)
func (*AWSCredentials) GetSessionTokenWithMFA ¶
func (c *AWSCredentials) GetSessionTokenWithMFA(serialNumber, token string, duration time.Duration) (*AWSCredentials, error)
func (*AWSCredentials) Valid ¶
func (c *AWSCredentials) Valid() bool
func (*AWSCredentials) ValidSession ¶
func (c *AWSCredentials) ValidSession() bool
type AWSKey ¶
type AWSKey struct { AWSCredentials MFA string `json:"mfa,omitempty"` Role string `json:"role,omitempty"` ForgoTempCredGeneration bool `json:"forgoTempCredGeneration"` }
func (*AWSKey) GetAWSCredentials ¶
func (k *AWSKey) GetAWSCredentials(duration time.Duration) (*AWSCredentials, error)
func (*AWSKey) GetAWSCredentialsWithMFA ¶
func (*AWSKey) RequiresMFA ¶
type SSHOptions ¶
type Session ¶
type Session struct { Name string `json:"name"` Expiration time.Time `json:"expiration"` ActiveRole string `json:"active_role,omitempty"` AWSCreds *AWSCredentials `json:"aws_creds,omitempty"` GeneratedSSHKey string `json:"generated_ssh_key,omitempty"` Role string `json:"role,omitempty"` Vars map[string]string `json:"vars,omitempty"` SSHKeys map[string]string `json:"ssh_keys,omitempty"` SSHOptions *SSHOptions `json:"ssh_options,omitempty"` }
func (*Session) AssumeSessionRole ¶
type SessionCache ¶
type SessionCache struct { SessionCacheVersion string `json:"version"` Sessions map[string]*Session `json:"sessions"` }
SessionCache stores sessions keyed based on the contents of the vault that spawned the session.
See VaultSessionCacheKey for details on how the key is generated.
func (*SessionCache) GetVaultSession ¶
func (sc *SessionCache) GetVaultSession(vault *Vault) (*Session, error)
GetVaultSession retrieves a copy of a session in the cache.
The retrieved session is keyed using the contents of the provided vault.
func (*SessionCache) PutVaultSession ¶
func (sc *SessionCache) PutVaultSession(vault *Vault, session *Session)
PutVaultSession stores a copy of a session in the cache.
The stored session is keyed using the contents of the provided vault.
func (*SessionCache) RemoveExpiredSessions ¶
func (sc *SessionCache) RemoveExpiredSessions()
RemoveExpiredSessions removes sessions from the cache that have expired.
type SessionFile ¶
type StaticSteward ¶
func NewStaticSteward ¶
func NewStaticSteward(password string) *StaticSteward
func NewStaticStewardWithMFA ¶
func NewStaticStewardWithMFA(password, mfaToken string) *StaticSteward
func (*StaticSteward) GetMFAToken ¶
func (s *StaticSteward) GetMFAToken(name string) (string, error)
func (*StaticSteward) GetPassword ¶
func (s *StaticSteward) GetPassword(operation Operation, name string) (string, error)
type StewardMaxTries ¶
type StewardMaxTries interface {
GetMaxOpenTries() int
}
type Store ¶
type Store interface { Steward() Steward ListVaults() ([]string, error) VaultExists(name string) bool OpenVault(name string) (*Vault, string, error) OpenVaultWithPassword(name, password string) (*Vault, string, error) SealVault(vault *Vault, name string) error SealVaultWithPassword(vault *Vault, name, password string) error RemoveVault(name string) error CreateSession(vault *Vault, name, password string) (*Session, error) GetSession(vault *Vault, name, password string) (*Session, error) }