Created
December 28, 2019 05:06
-
-
Save NotTheDr01ds/f00e2436825fc25a1f86826f6eed6733 to your computer and use it in GitHub Desktop.
AWS IAM Policy for requiring MFA token for CLI/Programmatic Access
This file contains 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
{ | |
"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