Created
August 22, 2022 18:14
-
-
Save WhatsARanjit/bdad6992da5a9a41bd73120bf6442d05 to your computer and use it in GitHub Desktop.
Vault EGP Sentinel for no wildcard AWS IAM permissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup AWS secrets | |
vault secrets enable aws | |
vault write aws/config/root \ | |
access_key=$AWS_ACCESS_KEY_ID \ | |
secret_key=$AWS_SECRET_ACCESS_KEY \ | |
region=us-east-1 | |
# Write the Actions policy | |
# https://github.com/hashicorp/vault-guides/blob/master/governance/sentinel/inline-iam-actions.sentinel | |
POLICY=$(base64 inline_iam_actions.sentinel) | |
vault write sys/policies/egp/inline_iam_actions \ | |
policy="${POLICY}" \ | |
paths="aws/roles/*" \ | |
enforcement_level="hard-mandatory" | |
# Bad test | |
# https://github.com/hashicorp/vault-guides/tree/master/governance/sentinel/test/inline-iam-actions | |
vault write aws/roles/all_iam \ | |
credential_type=iam_user \ | |
policy_document=@test/inline_iam_actions/fail.json | |
# Good test | |
# https://github.com/hashicorp/vault-guides/tree/master/governance/sentinel/test/inline-iam-actions | |
vault write aws/roles/all_iam \ | |
credential_type=iam_user \ | |
policy_document=@test/inline_iam_actions/success.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment