Skip to content
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

MFA enforcement should remain as opt-in feature in IAM groups, as such enable_mfa_enforcement should default to false. #509

Closed
claytonchew opened this issue Aug 13, 2024 · 5 comments · May be fixed by #510

Comments

@claytonchew
Copy link

claytonchew commented Aug 13, 2024

Description

#313 introduces undocumented change to force MFA for all console and API user. A similar issue #332 was created, and a supposed fix #333 was released in version 5.14.3, introduces new enable_mfa_enforcement variable which defaults to true, which causes IAM groups with attach_iam_self_management_policy set to true still inadvertently opts in to MFA enforcement due to this line:

for_each = var.enable_mfa_enforcement ? [1] : []

In my opinion, MFA enforcement should be an opt in feature. Users migrating from older version (example version 5.3.1) to current version may find that IAM groups users with attach_iam_self_management_policy set to true suddenly lose access to their consoles, which can cause more harm than good.

If the maintainers agree, I am willing to submit a PR along with clear documentation to ensure that the implications of enabling MFA enforcement are made clear.

Versions

  • Module version [Required]: 5.43.0

  • Terraform version: 1.3+

  • Provider version(s): 5.x.x

Reproduction Code [Required]

module "iam_group_test" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-group-with-policies"
  version = "5.43.0"

  name                              = "test-group"
  attach_iam_self_management_policy = true

  group_users = [
    module.iam_testuser.iam_user_name,
  ]

  custom_group_policy_arns = [
    "arn:aws:iam::aws:policy/AdministratorAccess",
  ]
}

module "iam_testuser" {
  source  = "terraform-aws-modules/iam/aws//modules/iam-user"
  version = "5.43.0"

  name                          = "testuser"
  create_iam_user_login_profile = true
}

Steps to reproduce the behavior:

  1. Create iam-group-with-policies, with attach_iam_self_management_policy set to true, without specifying enable_mfa_enforcement (left as default)
  2. Attach user to the group.
  3. Login as user via console and try access any services.

Result:

  • AccessDenied error due to MFA being enforced

Expected behavior

enable_mfa_enforcement should be default to false

Actual behavior

enable_mfa_enforcement is currrently defaults to true, as shown in this line

Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Sep 13, 2024
@claytonchew
Copy link
Author

/keepalive

@github-actions github-actions bot removed the stale label Sep 14, 2024
Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Oct 14, 2024
Copy link

This issue was automatically closed because of stale in 10 days

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant