Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type CreateAccessKeyInput
- type GetAccessKeyLastUsedOutput
- type InternalStore
- func (s *InternalStore) AddClientIDToOIDCProvider(_ context.Context, arn, clientID string) error
- func (s *InternalStore) CreateAccessKey(_ context.Context, input CreateAccessKeyInput) (*types.AccessKey, error)
- func (s *InternalStore) CreateOIDCProvider(_ context.Context, provider types.OIDCProvider) (*types.OIDCProvider, error)
- func (s *InternalStore) CreateRole(_ context.Context, role types.Role) (*types.Role, error)
- func (s *InternalStore) CreateSession(_ context.Context, session types.Session) (*types.Session, error)
- func (s *InternalStore) CreateUser(_ context.Context, user types.User) (*types.User, error)
- func (s *InternalStore) DeleteAccessKey(_ context.Context, username, accessKeyID string) error
- func (s *InternalStore) DeleteOIDCProvider(_ context.Context, arn string) error
- func (s *InternalStore) DeleteRole(_ context.Context, roleName string) error
- func (s *InternalStore) DeleteRolePolicy(_ context.Context, roleName, policyName string) error
- func (s *InternalStore) DeleteUser(_ context.Context, username string) error
- func (s *InternalStore) DeleteUserPolicy(_ context.Context, userName, policyName string) error
- func (s *InternalStore) GetAccessKeyLastUsed(_ context.Context, accessKeyID string) (*GetAccessKeyLastUsedOutput, error)
- func (s *InternalStore) GetOIDCProvider(_ context.Context, arn string) (*types.OIDCProvider, error)
- func (s *InternalStore) GetRole(_ context.Context, roleName string) (*types.Role, error)
- func (s *InternalStore) GetRolePolicy(_ context.Context, roleName, policyName string) (*types.PolicyEntry, error)
- func (s *InternalStore) GetSession(_ context.Context, accessKeyID string) (*types.Session, error)
- func (s *InternalStore) GetUser(_ context.Context, username string) (*types.User, error)
- func (s *InternalStore) GetUserByAccessKeyID(ctx context.Context, accessKeyID string) (*types.User, error)
- func (s *InternalStore) GetUserPolicy(_ context.Context, userName, policyName string) (*types.PolicyEntry, error)
- func (s *InternalStore) ListAccessKeys(_ context.Context, input ListAccessKeysInput) (*ListAccessKeysOutput, error)
- func (s *InternalStore) ListOIDCProviderTags(_ context.Context, input ListOIDCProviderTagsInput) (*ListTagsOutput, error)
- func (s *InternalStore) ListOIDCProviders(_ context.Context) (*ListOIDCProvidersOutput, error)
- func (s *InternalStore) ListRolePolicies(_ context.Context, input ListRolePoliciesInput) (*ListRolePoliciesOutput, error)
- func (s *InternalStore) ListRoleTags(_ context.Context, input ListRoleTagsInput) (*ListTagsOutput, error)
- func (s *InternalStore) ListRoles(_ context.Context, input ListRolesInput) (*ListRolesOutput, error)
- func (s *InternalStore) ListUserPolicies(_ context.Context, input ListUserPoliciesInput) (*ListUserPoliciesOutput, error)
- func (s *InternalStore) ListUserTags(_ context.Context, input ListUserTagsInput) (*ListTagsOutput, error)
- func (s *InternalStore) ListUsers(_ context.Context, input ListUsersInput) (*ListUsersOutput, error)
- func (s *InternalStore) PutRolePolicy(_ context.Context, input PutRolePolicyInput) error
- func (s *InternalStore) PutUserPolicy(_ context.Context, input PutUserPolicyInput) error
- func (s *InternalStore) RecordAccessKeyUsage(_ context.Context, accessKeyID, service, region string, when time.Time) error
- func (s *InternalStore) RecordRoleUsage(_ context.Context, roleName, region string, when time.Time) error
- func (s *InternalStore) RemoveClientIDFromOIDCProvider(_ context.Context, arn, clientID string) error
- func (s *InternalStore) TagOIDCProvider(_ context.Context, arn string, tags []types.Tag) error
- func (s *InternalStore) TagRole(_ context.Context, roleName string, tags []types.Tag) error
- func (s *InternalStore) TagUser(_ context.Context, userName string, tags []types.Tag) error
- func (s *InternalStore) UntagOIDCProvider(_ context.Context, arn string, tagKeys []string) error
- func (s *InternalStore) UntagRole(_ context.Context, roleName string, tagKeys []string) error
- func (s *InternalStore) UntagUser(_ context.Context, userName string, tagKeys []string) error
- func (s *InternalStore) UpdateAccessKey(_ context.Context, input UpdateAccessKeyInput) error
- func (s *InternalStore) UpdateAssumeRolePolicy(_ context.Context, input UpdateAssumeRolePolicyInput) (*types.Role, error)
- func (s *InternalStore) UpdateOIDCProviderThumbprint(_ context.Context, arn string, thumbprints []string) error
- func (s *InternalStore) UpdateUser(_ context.Context, input UpdateUserInput) (*types.User, error)
- type ListAccessKeysInput
- type ListAccessKeysOutput
- type ListOIDCProviderTagsInput
- type ListOIDCProvidersOutput
- type ListRolePoliciesInput
- type ListRolePoliciesOutput
- type ListRoleTagsInput
- type ListRolesInput
- type ListRolesOutput
- type ListTagsOutput
- type ListUserPoliciesInput
- type ListUserPoliciesOutput
- type ListUserTagsInput
- type ListUsersInput
- type ListUsersOutput
- type PutRolePolicyInput
- type PutUserPolicyInput
- type Storer
- type UpdateAccessKeyInput
- type UpdateAssumeRolePolicyInput
- type UpdateUserInput
- type VaultConfig
- type VaultStore
- func (s *VaultStore) AddClientIDToOIDCProvider(ctx context.Context, arn, clientID string) error
- func (s *VaultStore) CreateAccessKey(ctx context.Context, input CreateAccessKeyInput) (*types.AccessKey, error)
- func (s *VaultStore) CreateOIDCProvider(_ context.Context, provider types.OIDCProvider) (*types.OIDCProvider, error)
- func (s *VaultStore) CreateRole(_ context.Context, role types.Role) (*types.Role, error)
- func (s *VaultStore) CreateSession(ctx context.Context, session types.Session) (*types.Session, error)
- func (s *VaultStore) CreateUser(_ context.Context, user types.User) (*types.User, error)
- func (s *VaultStore) DeleteAccessKey(ctx context.Context, username, accessKeyID string) error
- func (s *VaultStore) DeleteOIDCProvider(_ context.Context, arn string) error
- func (s *VaultStore) DeleteRole(ctx context.Context, roleName string) error
- func (s *VaultStore) DeleteRolePolicy(ctx context.Context, roleName, policyName string) error
- func (s *VaultStore) DeleteUser(ctx context.Context, username string) error
- func (s *VaultStore) DeleteUserPolicy(ctx context.Context, userName, policyName string) error
- func (s *VaultStore) GetAccessKeyLastUsed(ctx context.Context, accessKeyID string) (*GetAccessKeyLastUsedOutput, error)
- func (s *VaultStore) GetOIDCProvider(_ context.Context, arn string) (*types.OIDCProvider, error)
- func (s *VaultStore) GetRole(_ context.Context, roleName string) (*types.Role, error)
- func (s *VaultStore) GetRolePolicy(ctx context.Context, roleName, policyName string) (*types.PolicyEntry, error)
- func (s *VaultStore) GetSession(_ context.Context, accessKeyID string) (*types.Session, error)
- func (s *VaultStore) GetUser(_ context.Context, username string) (*types.User, error)
- func (s *VaultStore) GetUserByAccessKeyID(ctx context.Context, accessKeyID string) (*types.User, error)
- func (s *VaultStore) GetUserPolicy(ctx context.Context, userName, policyName string) (*types.PolicyEntry, error)
- func (s *VaultStore) ListAccessKeys(ctx context.Context, input ListAccessKeysInput) (*ListAccessKeysOutput, error)
- func (s *VaultStore) ListOIDCProviderTags(_ context.Context, input ListOIDCProviderTagsInput) (*ListTagsOutput, error)
- func (s *VaultStore) ListOIDCProviders(_ context.Context) (*ListOIDCProvidersOutput, error)
- func (s *VaultStore) ListRolePolicies(ctx context.Context, input ListRolePoliciesInput) (*ListRolePoliciesOutput, error)
- func (s *VaultStore) ListRoleTags(ctx context.Context, input ListRoleTagsInput) (*ListTagsOutput, error)
- func (s *VaultStore) ListRoles(ctx context.Context, input ListRolesInput) (*ListRolesOutput, error)
- func (s *VaultStore) ListUserPolicies(ctx context.Context, input ListUserPoliciesInput) (*ListUserPoliciesOutput, error)
- func (s *VaultStore) ListUserTags(ctx context.Context, input ListUserTagsInput) (*ListTagsOutput, error)
- func (s *VaultStore) ListUsers(ctx context.Context, input ListUsersInput) (*ListUsersOutput, error)
- func (s *VaultStore) PutRolePolicy(ctx context.Context, input PutRolePolicyInput) error
- func (s *VaultStore) PutUserPolicy(ctx context.Context, input PutUserPolicyInput) error
- func (s *VaultStore) RecordAccessKeyUsage(_ context.Context, accessKeyID, service, region string, when time.Time) error
- func (s *VaultStore) RecordRoleUsage(_ context.Context, roleName, region string, when time.Time) error
- func (s *VaultStore) RemoveClientIDFromOIDCProvider(ctx context.Context, arn, clientID string) error
- func (s *VaultStore) TagOIDCProvider(ctx context.Context, arn string, tags []types.Tag) error
- func (s *VaultStore) TagRole(ctx context.Context, roleName string, tags []types.Tag) error
- func (s *VaultStore) TagUser(ctx context.Context, userName string, tags []types.Tag) error
- func (s *VaultStore) UntagOIDCProvider(ctx context.Context, arn string, tagKeys []string) error
- func (s *VaultStore) UntagRole(ctx context.Context, roleName string, tagKeys []string) error
- func (s *VaultStore) UntagUser(ctx context.Context, userName string, tagKeys []string) error
- func (s *VaultStore) UpdateAccessKey(ctx context.Context, input UpdateAccessKeyInput) error
- func (s *VaultStore) UpdateAssumeRolePolicy(ctx context.Context, input UpdateAssumeRolePolicyInput) (*types.Role, error)
- func (s *VaultStore) UpdateOIDCProviderThumbprint(ctx context.Context, arn string, thumbprints []string) error
- func (s *VaultStore) UpdateUser(ctx context.Context, input UpdateUserInput) (*types.User, error)
Constants ¶
const MaxAccessKeysPerUser = 2
MaxAccessKeysPerUser is the maximum number of access keys a single IAM user may hold at once, matching the AWS IAM quota.
const MaxClientIDsPerOIDCProvider = 100
MaxClientIDsPerOIDCProvider is the maximum number of client IDs a single OIDC provider may hold at once
const MaxInlinePolicyBytesPerRole = 10240
MaxInlinePolicyBytesPerRole is the maximum aggregate size, in bytes, of all of a single IAM role's inline policy documents combined
const MaxInlinePolicyBytesPerUser = 2048
MaxInlinePolicyBytesPerUser is the maximum aggregate size, in bytes, of all of a single IAM user's inline policy documents combined
const MaxOIDCProvidersPerAccount = 100
MaxOIDCProvidersPerAccount is the maximum number of OIDC providers a single account may hold
const MaxTagsPerResource = 50
MaxTagsPerResource is the maximum number of tags a single IAM user, role or OIDC provider may carry at once, matching the AWS IAM quota.
const UsageRecordCoalesceWindow = time.Minute
UsageRecordCoalesceWindow is how long a last-used record is left alone after a write that already reported the same service and region. Every authenticated S3 data-plane request records a use, so without this the internal storer would rewrite the whole IAM file (twice — it keeps a backup) on every GET, and the Vault storer would issue a read-modify-write per request. Real IAM's own last-used data is coarse for the same reason, so nothing observable is lost.
A change of service or region is never coalesced: that is the part of the record an operator reads to answer "what is this credential being used for", and it must be able to change the moment the answer does.
Variables ¶
var ( ErrUserIDAlreadyExists = errors.New("iamapi: user id already exists") ErrAccessKeyIDAlreadyExists = errors.New("iamapi: access key id already exists") ErrRoleIDAlreadyExists = errors.New("iamapi: role id already exists") // ErrSessionNotFound is returned by GetSession when accessKeyID names no // session, or names one whose Expiration has already passed. ErrSessionNotFound = errors.New("iamapi: session not found") )
var MaxActiveSessionsPerRole = 1000
MaxActiveSessionsPerRole bounds how many currently-unexpired AssumeRoleWithWebIdentity sessions a single role may have at once. AWS manages and rate-limits STS as a hosted service with no customer-visible equivalent quota to match for fidelity; this exists purely as local resource protection, since without it a single valid federated token can be replayed indefinitely to grow the session store — every InternalStore rewrite, or Vault KV path/metadata entry — without bound. Chosen generously enough to not constrain any legitimate workload's concurrent session count.
A var, not a const, so tests can temporarily lower it rather than paying the cost of actually creating 1000 sessions to exercise the cap.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Dir string
Vault VaultConfig
}
type CreateAccessKeyInput ¶
type InternalStore ¶
func (*InternalStore) AddClientIDToOIDCProvider ¶
func (s *InternalStore) AddClientIDToOIDCProvider(_ context.Context, arn, clientID string) error
func (*InternalStore) CreateAccessKey ¶
func (s *InternalStore) CreateAccessKey(_ context.Context, input CreateAccessKeyInput) (*types.AccessKey, error)
func (*InternalStore) CreateOIDCProvider ¶
func (s *InternalStore) CreateOIDCProvider(_ context.Context, provider types.OIDCProvider) (*types.OIDCProvider, error)
func (*InternalStore) CreateRole ¶
func (*InternalStore) CreateSession ¶
func (*InternalStore) CreateUser ¶
func (*InternalStore) DeleteAccessKey ¶
func (s *InternalStore) DeleteAccessKey(_ context.Context, username, accessKeyID string) error
func (*InternalStore) DeleteOIDCProvider ¶
func (s *InternalStore) DeleteOIDCProvider(_ context.Context, arn string) error
func (*InternalStore) DeleteRole ¶
func (s *InternalStore) DeleteRole(_ context.Context, roleName string) error
func (*InternalStore) DeleteRolePolicy ¶
func (s *InternalStore) DeleteRolePolicy(_ context.Context, roleName, policyName string) error
func (*InternalStore) DeleteUser ¶
func (s *InternalStore) DeleteUser(_ context.Context, username string) error
func (*InternalStore) DeleteUserPolicy ¶
func (s *InternalStore) DeleteUserPolicy(_ context.Context, userName, policyName string) error
func (*InternalStore) GetAccessKeyLastUsed ¶
func (s *InternalStore) GetAccessKeyLastUsed(_ context.Context, accessKeyID string) (*GetAccessKeyLastUsedOutput, error)
func (*InternalStore) GetOIDCProvider ¶
func (s *InternalStore) GetOIDCProvider(_ context.Context, arn string) (*types.OIDCProvider, error)
func (*InternalStore) GetRolePolicy ¶
func (s *InternalStore) GetRolePolicy(_ context.Context, roleName, policyName string) (*types.PolicyEntry, error)
func (*InternalStore) GetSession ¶
func (*InternalStore) GetUserByAccessKeyID ¶
func (*InternalStore) GetUserPolicy ¶
func (s *InternalStore) GetUserPolicy(_ context.Context, userName, policyName string) (*types.PolicyEntry, error)
func (*InternalStore) ListAccessKeys ¶
func (s *InternalStore) ListAccessKeys(_ context.Context, input ListAccessKeysInput) (*ListAccessKeysOutput, error)
func (*InternalStore) ListOIDCProviderTags ¶
func (s *InternalStore) ListOIDCProviderTags(_ context.Context, input ListOIDCProviderTagsInput) (*ListTagsOutput, error)
func (*InternalStore) ListOIDCProviders ¶
func (s *InternalStore) ListOIDCProviders(_ context.Context) (*ListOIDCProvidersOutput, error)
func (*InternalStore) ListRolePolicies ¶
func (s *InternalStore) ListRolePolicies(_ context.Context, input ListRolePoliciesInput) (*ListRolePoliciesOutput, error)
func (*InternalStore) ListRoleTags ¶
func (s *InternalStore) ListRoleTags(_ context.Context, input ListRoleTagsInput) (*ListTagsOutput, error)
func (*InternalStore) ListRoles ¶
func (s *InternalStore) ListRoles(_ context.Context, input ListRolesInput) (*ListRolesOutput, error)
func (*InternalStore) ListUserPolicies ¶
func (s *InternalStore) ListUserPolicies(_ context.Context, input ListUserPoliciesInput) (*ListUserPoliciesOutput, error)
func (*InternalStore) ListUserTags ¶
func (s *InternalStore) ListUserTags(_ context.Context, input ListUserTagsInput) (*ListTagsOutput, error)
func (*InternalStore) ListUsers ¶
func (s *InternalStore) ListUsers(_ context.Context, input ListUsersInput) (*ListUsersOutput, error)
func (*InternalStore) PutRolePolicy ¶
func (s *InternalStore) PutRolePolicy(_ context.Context, input PutRolePolicyInput) error
func (*InternalStore) PutUserPolicy ¶
func (s *InternalStore) PutUserPolicy(_ context.Context, input PutUserPolicyInput) error
func (*InternalStore) RecordAccessKeyUsage ¶
func (s *InternalStore) RecordAccessKeyUsage(_ context.Context, accessKeyID, service, region string, when time.Time) error
RecordAccessKeyUsage rewrites the whole IAM file, so it first reads the stored record and returns without writing anything when the update would be redundant — a read per request instead of a file rewrite per request, which is what makes recording every S3 data-plane request affordable here.
func (*InternalStore) RecordRoleUsage ¶
func (s *InternalStore) RecordRoleUsage(_ context.Context, roleName, region string, when time.Time) error
RecordRoleUsage is RecordAccessKeyUsage's role counterpart, including its read-first check: a redundant update writes nothing at all, and an update worth keeping rewrites the whole IAM file.
func (*InternalStore) RemoveClientIDFromOIDCProvider ¶
func (s *InternalStore) RemoveClientIDFromOIDCProvider(_ context.Context, arn, clientID string) error
func (*InternalStore) TagOIDCProvider ¶
func (*InternalStore) UntagOIDCProvider ¶
func (*InternalStore) UpdateAccessKey ¶
func (s *InternalStore) UpdateAccessKey(_ context.Context, input UpdateAccessKeyInput) error
func (*InternalStore) UpdateAssumeRolePolicy ¶
func (s *InternalStore) UpdateAssumeRolePolicy(_ context.Context, input UpdateAssumeRolePolicyInput) (*types.Role, error)
func (*InternalStore) UpdateOIDCProviderThumbprint ¶
func (*InternalStore) UpdateUser ¶
func (s *InternalStore) UpdateUser(_ context.Context, input UpdateUserInput) (*types.User, error)
type ListAccessKeysInput ¶
type ListAccessKeysOutput ¶
type ListAccessKeysOutput struct {
AccessKeys []types.AccessKeyMetadata
IsTruncated bool
Marker string
}
type ListOIDCProvidersOutput ¶
type ListOIDCProvidersOutput struct {
Providers []types.OpenIDConnectProviderListEntry
}
type ListRolePoliciesInput ¶
type ListRolePoliciesOutput ¶
type ListRoleTagsInput ¶
type ListRolesInput ¶
type ListRolesOutput ¶
type ListTagsOutput ¶
ListTagsOutput is the paginated tag window ListUserTags and ListRoleTags both return.
type ListUserPoliciesInput ¶
type ListUserPoliciesOutput ¶
type ListUserTagsInput ¶
type ListUsersInput ¶
type ListUsersOutput ¶
type PutRolePolicyInput ¶
type PutUserPolicyInput ¶
type Storer ¶
type Storer interface {
CreateUser(ctx context.Context, user types.User) (*types.User, error)
DeleteUser(ctx context.Context, username string) error
GetUser(ctx context.Context, username string) (*types.User, error)
GetUserByAccessKeyID(ctx context.Context, accessKeyID string) (*types.User, error)
ListUsers(ctx context.Context, input ListUsersInput) (*ListUsersOutput, error)
UpdateUser(ctx context.Context, input UpdateUserInput) (*types.User, error)
TagUser(ctx context.Context, userName string, tags []types.Tag) error
UntagUser(ctx context.Context, userName string, tagKeys []string) error
ListUserTags(ctx context.Context, input ListUserTagsInput) (*ListTagsOutput, error)
CreateAccessKey(ctx context.Context, input CreateAccessKeyInput) (*types.AccessKey, error)
UpdateAccessKey(ctx context.Context, input UpdateAccessKeyInput) error
DeleteAccessKey(ctx context.Context, username, accessKeyID string) error
GetAccessKeyLastUsed(ctx context.Context, accessKeyID string) (*GetAccessKeyLastUsedOutput, error)
ListAccessKeys(ctx context.Context, input ListAccessKeysInput) (*ListAccessKeysOutput, error)
// RecordAccessKeyUsage updates accessKeyID's GetAccessKeyLastUsed
// metadata (service, region, and timestamp) to reflect a successful
// authentication at when. Called best-effort/asynchronously by the auth
// middleware, so implementations should treat a lost update under
// concurrent use as acceptable rather than something worth retrying hard.
RecordAccessKeyUsage(ctx context.Context, accessKeyID, service, region string, when time.Time) error
PutUserPolicy(ctx context.Context, input PutUserPolicyInput) error
GetUserPolicy(ctx context.Context, userName, policyName string) (*types.PolicyEntry, error)
DeleteUserPolicy(ctx context.Context, userName, policyName string) error
ListUserPolicies(ctx context.Context, input ListUserPoliciesInput) (*ListUserPoliciesOutput, error)
CreateRole(ctx context.Context, role types.Role) (*types.Role, error)
GetRole(ctx context.Context, roleName string) (*types.Role, error)
ListRoles(ctx context.Context, input ListRolesInput) (*ListRolesOutput, error)
DeleteRole(ctx context.Context, roleName string) error
UpdateAssumeRolePolicy(ctx context.Context, input UpdateAssumeRolePolicyInput) (*types.Role, error)
// RecordRoleUsage updates roleName's RoleLastUsed metadata (region and
// timestamp) to reflect a use of the role at when — GetRole's
// counterpart to RecordAccessKeyUsage, and best-effort in exactly the
// same way.
RecordRoleUsage(ctx context.Context, roleName, region string, when time.Time) error
TagRole(ctx context.Context, roleName string, tags []types.Tag) error
UntagRole(ctx context.Context, roleName string, tagKeys []string) error
ListRoleTags(ctx context.Context, input ListRoleTagsInput) (*ListTagsOutput, error)
PutRolePolicy(ctx context.Context, input PutRolePolicyInput) error
GetRolePolicy(ctx context.Context, roleName, policyName string) (*types.PolicyEntry, error)
DeleteRolePolicy(ctx context.Context, roleName, policyName string) error
ListRolePolicies(ctx context.Context, input ListRolePoliciesInput) (*ListRolePoliciesOutput, error)
// OIDC Provider CRUD
CreateOIDCProvider(ctx context.Context, provider types.OIDCProvider) (*types.OIDCProvider, error)
GetOIDCProvider(ctx context.Context, arn string) (*types.OIDCProvider, error)
ListOIDCProviders(ctx context.Context) (*ListOIDCProvidersOutput, error)
DeleteOIDCProvider(ctx context.Context, arn string) error
AddClientIDToOIDCProvider(ctx context.Context, arn, clientID string) error
RemoveClientIDFromOIDCProvider(ctx context.Context, arn, clientID string) error
UpdateOIDCProviderThumbprint(ctx context.Context, arn string, thumbprints []string) error
TagOIDCProvider(ctx context.Context, arn string, tags []types.Tag) error
UntagOIDCProvider(ctx context.Context, arn string, tagKeys []string) error
ListOIDCProviderTags(ctx context.Context, input ListOIDCProviderTagsInput) (*ListTagsOutput, error)
CreateSession(ctx context.Context, session types.Session) (*types.Session, error)
GetSession(ctx context.Context, accessKeyID string) (*types.Session, error)
}
Storer is the IAM API storage backend contract.
func NewInternal ¶
func NewVault ¶
func NewVault(cfg VaultConfig) (Storer, error)
type UpdateAccessKeyInput ¶
type UpdateUserInput ¶
type VaultConfig ¶
type VaultConfig struct {
EndpointURL string
Namespace string
SecretStoragePath string
SecretStorageNamespace string
AuthMethod string
AuthNamespace string
MountPath string
RootToken string
RoleID string
RoleSecret string
ServerCert string
ClientCert string
ClientCertKey string
}
VaultConfig holds all configuration options for the Vault-backed IAM storer.
type VaultStore ¶
type VaultStore struct {
// contains filtered or unexported fields
}
VaultStore is a Vault KV v2-backed implementation of Storer.
func (*VaultStore) AddClientIDToOIDCProvider ¶
func (s *VaultStore) AddClientIDToOIDCProvider(ctx context.Context, arn, clientID string) error
func (*VaultStore) CreateAccessKey ¶
func (s *VaultStore) CreateAccessKey(ctx context.Context, input CreateAccessKeyInput) (*types.AccessKey, error)
func (*VaultStore) CreateOIDCProvider ¶
func (s *VaultStore) CreateOIDCProvider(_ context.Context, provider types.OIDCProvider) (*types.OIDCProvider, error)
func (*VaultStore) CreateRole ¶
func (*VaultStore) CreateSession ¶
func (*VaultStore) CreateUser ¶
func (*VaultStore) DeleteAccessKey ¶
func (s *VaultStore) DeleteAccessKey(ctx context.Context, username, accessKeyID string) error
func (*VaultStore) DeleteOIDCProvider ¶
func (s *VaultStore) DeleteOIDCProvider(_ context.Context, arn string) error
func (*VaultStore) DeleteRole ¶
func (s *VaultStore) DeleteRole(ctx context.Context, roleName string) error
DeleteRole is DeleteUser's counterpart for roles - see its doc comment for why the dependency check (no inline policies) is confirmed via a same-data CAS write (replaceRole) immediately before the actual delete, instead of an unconditional delete straight after the check.
func (*VaultStore) DeleteRolePolicy ¶
func (s *VaultStore) DeleteRolePolicy(ctx context.Context, roleName, policyName string) error
func (*VaultStore) DeleteUser ¶
func (s *VaultStore) DeleteUser(ctx context.Context, username string) error
DeleteUser checks user against its dependency preconditions (no inline policies, no access keys) and then deletes it. The metadata-delete call Vault exposes has no CAS parameter of its own (unlike a KV write), so a plain read-check-then-delete would leave a window where a concurrent CreateAccessKey or PutUserPolicy lands between the check and the delete, and the delete proceeds anyway, orphaning the new key/policy against a user that no longer exists. Closing that window: after the dependency check, replaceUser writes the same (unchanged) record back with a CAS matching the version just read — succeeding only if nothing else has modified the record since — immediately before the actual delete, shrinking the race to the gap between two back-to-back Vault calls instead of the whole request lifecycle. A CAS conflict there means something changed after the check, so the whole check is retried (bounded by maxCASRetries) rather than deleting against stale information.
func (*VaultStore) DeleteUserPolicy ¶
func (s *VaultStore) DeleteUserPolicy(ctx context.Context, userName, policyName string) error
func (*VaultStore) GetAccessKeyLastUsed ¶
func (s *VaultStore) GetAccessKeyLastUsed(ctx context.Context, accessKeyID string) (*GetAccessKeyLastUsedOutput, error)
func (*VaultStore) GetOIDCProvider ¶
func (s *VaultStore) GetOIDCProvider(_ context.Context, arn string) (*types.OIDCProvider, error)
func (*VaultStore) GetRolePolicy ¶
func (s *VaultStore) GetRolePolicy(ctx context.Context, roleName, policyName string) (*types.PolicyEntry, error)
func (*VaultStore) GetSession ¶
func (*VaultStore) GetUserByAccessKeyID ¶
func (s *VaultStore) GetUserByAccessKeyID(ctx context.Context, accessKeyID string) (*types.User, error)
GetUserByAccessKeyID has no index to consult (unlike InternalStore's AccessKeyIndex) so it scans every user's access keys, mirroring GetAccessKeyLastUsed's existing linear scan.
func (*VaultStore) GetUserPolicy ¶
func (s *VaultStore) GetUserPolicy(ctx context.Context, userName, policyName string) (*types.PolicyEntry, error)
func (*VaultStore) ListAccessKeys ¶
func (s *VaultStore) ListAccessKeys(ctx context.Context, input ListAccessKeysInput) (*ListAccessKeysOutput, error)
func (*VaultStore) ListOIDCProviderTags ¶
func (s *VaultStore) ListOIDCProviderTags(_ context.Context, input ListOIDCProviderTagsInput) (*ListTagsOutput, error)
func (*VaultStore) ListOIDCProviders ¶
func (s *VaultStore) ListOIDCProviders(_ context.Context) (*ListOIDCProvidersOutput, error)
func (*VaultStore) ListRolePolicies ¶
func (s *VaultStore) ListRolePolicies(ctx context.Context, input ListRolePoliciesInput) (*ListRolePoliciesOutput, error)
func (*VaultStore) ListRoleTags ¶
func (s *VaultStore) ListRoleTags(ctx context.Context, input ListRoleTagsInput) (*ListTagsOutput, error)
func (*VaultStore) ListRoles ¶
func (s *VaultStore) ListRoles(ctx context.Context, input ListRolesInput) (*ListRolesOutput, error)
func (*VaultStore) ListUserPolicies ¶
func (s *VaultStore) ListUserPolicies(ctx context.Context, input ListUserPoliciesInput) (*ListUserPoliciesOutput, error)
func (*VaultStore) ListUserTags ¶
func (s *VaultStore) ListUserTags(ctx context.Context, input ListUserTagsInput) (*ListTagsOutput, error)
func (*VaultStore) ListUsers ¶
func (s *VaultStore) ListUsers(ctx context.Context, input ListUsersInput) (*ListUsersOutput, error)
func (*VaultStore) PutRolePolicy ¶
func (s *VaultStore) PutRolePolicy(ctx context.Context, input PutRolePolicyInput) error
func (*VaultStore) PutUserPolicy ¶
func (s *VaultStore) PutUserPolicy(ctx context.Context, input PutUserPolicyInput) error
func (*VaultStore) RecordAccessKeyUsage ¶
func (s *VaultStore) RecordAccessKeyUsage(_ context.Context, accessKeyID, service, region string, when time.Time) error
RecordAccessKeyUsage updates accessKeyID's GetAccessKeyLastUsed metadata in its own background goroutine, detached from ctx, and always returns nil immediately: this runs on the hot path of every authenticated request, and a Vault round trip — plus, on a CAS conflict, withUserCAS's retry loop — is too expensive to add synchronously to every one of them. A failure (including one that exhausts those retries) is only logged, never surfaced: this is purely informational metadata, and a lost update under concurrent use is immaterial.
func (*VaultStore) RecordRoleUsage ¶
func (s *VaultStore) RecordRoleUsage(_ context.Context, roleName, region string, when time.Time) error
RecordRoleUsage updates roleName's RoleLastUsed metadata in its own background goroutine, detached from ctx, and always returns nil immediately — for the same reasons RecordAccessKeyUsage does: it runs on the hot path of every request authenticated with a session credential, and the metadata is purely informational, so a Vault round trip (plus a CAS retry loop) must not be charged to the request, and a lost or failed update is only logged.
func (*VaultStore) RemoveClientIDFromOIDCProvider ¶
func (s *VaultStore) RemoveClientIDFromOIDCProvider(ctx context.Context, arn, clientID string) error
func (*VaultStore) TagOIDCProvider ¶
func (*VaultStore) UntagOIDCProvider ¶
func (*VaultStore) UpdateAccessKey ¶
func (s *VaultStore) UpdateAccessKey(ctx context.Context, input UpdateAccessKeyInput) error
func (*VaultStore) UpdateAssumeRolePolicy ¶
func (s *VaultStore) UpdateAssumeRolePolicy(ctx context.Context, input UpdateAssumeRolePolicyInput) (*types.Role, error)
func (*VaultStore) UpdateOIDCProviderThumbprint ¶
func (*VaultStore) UpdateUser ¶
func (s *VaultStore) UpdateUser(ctx context.Context, input UpdateUserInput) (*types.User, error)