Documentation
¶
Overview ¶
Package awsaccess asks AWS which identity the credentials in the environment are, and which actions that identity's policies allow.
The first question is asked by two callers: `draugr doctor`, to say whether a declared account is the one the credentials reach, and the prowler scanner, before Prowler runs. Prowler's output names the account it read and not the identity that read it, and credentials for another account produce a complete, plausible report about the wrong account. The second is the scanner's, to learn before the scan which services' reads will be denied.
The credentials are the ones Prowler and every AWS SDK read: the AWS_* environment variables, AWS_PROFILE and the shared config and credentials files, an SSO session, or the role of the machine the scan runs on. Asking with the same chain is what makes the answer about the scan rather than about this process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoCredentials = errors.New("no AWS credentials found: set AWS_PROFILE, sign in with " +
"`aws sso login`, or run where an instance or task role is attached")
ErrNoCredentials is a machine with no AWS credentials to ask with.
var ErrNotSimulated = errors.New("the policy simulator answers for IAM users and roles only")
ErrNotSimulated is a caller IAM's policy simulator cannot be asked about: the account's root, or a federated user, whose permissions no IAM principal holds.
Functions ¶
func Denied ¶
Denied asks the simulator which of actions caller's policies do not allow, in the order given. An error is a question IAM did not answer, most often because the caller may not ask it.
Types ¶
type Caller ¶
type Caller struct {
// Account is the 12-digit ID of the account the identity belongs to.
Account string
// ARN names the identity: a user, a role session or the account's root.
ARN string
}
Caller is the identity the credentials resolve to.
type IAM ¶
type IAM struct {
// contains filtered or unexported fields
}
IAM asks AWS Identity and Access Management what the credentials' policies allow. Both of its calls need a permission of their own, iam:GetRole and iam:SimulatePrincipalPolicy, which a read-only role commonly lacks.
func (*IAM) Allowed ¶
Allowed asks iam:SimulatePrincipalPolicy whether principal's policies allow each action on any resource. The simulation weighs the principal's identity policies, its permissions boundary and the organization's service control policies; a resource's own policy and a session policy are outside it.
type Identifier ¶
Identifier asks AWS who the credentials are.
type STS ¶
type STS struct {
// contains filtered or unexported fields
}
STS asks AWS Security Token Service who the credentials are.
type Simulator ¶
type Simulator interface {
// RoleARN is the ARN of the role named name, with its path, as iam:GetRole returns it.
RoleARN(ctx context.Context, name string) (string, error)
// Allowed simulates the policies of principal, a user's or a role's ARN, for each action, with
// iam:SimulatePrincipalPolicy, and returns the actions they allow.
Allowed(ctx context.Context, principal string, actions []string) ([]string, error)
}
Simulator asks IAM what an identity's policies allow.