-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow multiple MFA devices and users to manage MFA devices #313
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ed42873
fix: MFA resource name in SelfManagement policy
778684c
Merge branch 'master' into master
rballan 0b4acb0
Merge branch 'terraform-aws-modules:master' into master
rballan 9d2e1f0
fix: revert changes and add statements for new MFA resource name
787fe02
Merge branch 'master' into master
bryantbiggs a191cb2
fix: rework iam self management policy
f96dae8
fix: typo
7088992
chore: terraform fmt
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make this a variable where the default is the current behavior, but users can override with a wildcard for multiple MFA devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take another look to confirm (create a new IAM user and try to add a virtual MFA device with current
IAMSelfManagement
policy).But it seems to me that since this new feature was released, the very first MFA device resource ARN take the name defined by user during his creation :
arn:aws:iam::<aws_account_id>:mfa/<virtual_mfa_device_name>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not getting back to you sooner, but after a new test, I can confirm the issue.
I have tested the following scenarios from a brand-new IAM user deployed with the module :
After modifying the
IAMSelfManagement
policy witharn:aws:iam::<aws_account_id>:mfa/*
:The day after the PR, I noticed that the AWS documentation was updated : see
AllowManageOwnVirtualMFADevice
statement.But this is not updated everywhere yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, thank you for investigating!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have a more scoped policy with no impacts, I made few changes :
AllowSelfManagement
&AllowDeactivateMFADevice
statements)AllowManageOwnVirtualMFADevice
=> to allow actioniam:CreateVirtualMFADevice
with the correct resource nameAllowDeleteVirtualMFADevice
=> to allow the action with the correct resource nameThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
I made few changes here, according to this AWS documentation .
The AWS policy allows IAM users that are authenticated using multi-factor authentication (MFA) to manage their own credentials on the My security credentials page. It also requires the user to set up and authenticate using MFA before performing any other operations in AWS !
In real terms, that enforce MFA utilization. Because the IAM user cannot do anything before his MFA is configured, and he is authenticated with.
This is a great security improvement but this is a big change too. Is it what we want ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bryantbiggs Are you OK with that ?
If you're not, I can try to add a new variable to allow the user to choose between the standard policy (which do not force MFA utilization) or the more secure (which force MFA).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think this looks great and a good improvement; thank you