Skip to main content

AWS

Connection

Setup

1

Create an IAM user

Create an IAM user for Klef and give it an access key.
2

Allow the actions

Attach a policy allowing the actions under Permissions.
3

Reach the organization

Only needed for accounts the key was not issued in. Let the user assume a role in each account, and name that role on the connection.

Permissions

Klef checks the connection with iam:SimulatePrincipalPolicy. Allow it, and these actions:
  • Read the IAM roster: iam:GetAccountAuthorizationDetails, iam:ListUsers, iam:GetUser.
  • Create and update users: iam:CreateUser, iam:UpdateUser.
  • Tag users: iam:TagUser, iam:UntagUser.
  • Open and close console sign-in: iam:GetLoginProfile, iam:CreateLoginProfile, iam:DeleteLoginProfile, iam:GetAccountPasswordPolicy.
  • Reset console passwords: iam:UpdateLoginProfile.
  • Write inline policies and disable users: iam:ListUserPolicies, iam:GetUserPolicy, iam:PutUserPolicy, iam:DeleteUserPolicy.
  • Delete users: iam:DeleteUser, iam:ListAccessKeys, iam:DeleteAccessKey, iam:ListSigningCertificates, iam:DeleteSigningCertificate, iam:ListSSHPublicKeys, iam:DeleteSSHPublicKey, iam:ListServiceSpecificCredentials, iam:DeleteServiceSpecificCredential, iam:ListMFADevices, iam:DeactivateMFADevice. Optional. Without them, a policy can’t remove a user.
  • Manage group membership: iam:ListGroups, iam:ListGroupsForUser, iam:AddUserToGroup, iam:RemoveUserFromGroup.
  • Attach and detach managed policies: iam:ListPolicies, iam:ListAttachedUserPolicies, iam:AttachUserPolicy, iam:DetachUserPolicy.
  • Set a permissions boundary: iam:PutUserPermissionsBoundary, iam:DeleteUserPermissionsBoundary. Optional. Without them, Klef can’t manage the permissions boundary field.
  • Reach the organization: organizations:ListAccounts, and sts:AssumeRole on the organization role. Needed only when the connection names an organization role.

Disabling and deleting

IAM has no switch on a user. status = disabled puts the inline policy DenyAllWhileDisabled on the user, which denies every action, as AWS deactivates a user. The user keeps its credentials, and enabled takes the policy off. The user is not shown as holding that policy. status = removed deletes the user, after deleting its console password, access keys, signing certificates, SSH keys and service-specific credentials, deactivating its MFA devices, and taking off its policies and groups, since IAM refuses to delete a user that holds any of them. A deleted user cannot be restored. A virtual MFA device stays in the account, unassigned.

Settings

aws.iam_user

Fields

Credential: login_profile

Console sign-in. A login_profile { } block in a target issues it, and status = removed inside it revokes it.

Default Account Matching Rules

When Klef adopts an account that already exists in AWS, it works out whose it is by trying these in order. A connection can override them.

Examples

Contractor access

Unlicensed Microsoft, Slack and AWS access for contractors that expires on their end date, with a warning to their manager first.