Skip to content

Instantly share code, notes, and snippets.

@NotTheDr01ds
Created December 28, 2019 05:06
Show Gist options
  • Save NotTheDr01ds/f00e2436825fc25a1f86826f6eed6733 to your computer and use it in GitHub Desktop.
Save NotTheDr01ds/f00e2436825fc25a1f86826f6eed6733 to your computer and use it in GitHub Desktop.
AWS IAM Policy for requiring MFA token for CLI/Programmatic Access
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyAllWhenMFAIsNotPresent",
"Effect": "Deny",
"NotAction": [
"iam:ListMFADevices",
"sts:GetSessionToken"
],
"Resource": "*",
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent": false
}
}
},
{
"Sid": "DenyAllWhenMFAIsOlderThanFourHours",
"Effect": "Deny",
"NotAction": [
"iam:ListMFADevices",
"sts:GetSessionToken"
],
"Resource": "*",
"Condition": {
"NumericGreaterThanIfExists": {
"aws:MultiFactorAuthAge": "14400"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment