내용으로 건너뛰기

Force existing user to use MFA

0

Hello!
I have multiple users on IAM and I want to force them to use MFA.
Is there any policy I can create so that at the next login time AWS will force the MFA? I have already based on the following documentation and it does not have a positive result.

https://aws.amazon.com/pt/blogs/security/how-to-delegate-management-of-multi-factor-authentication-to-aws-iam-users/
https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_users-self-manage-mfa-and-creds.html

질문됨 5년 전1.5천회 조회
2개 답변
1

You can force IAM users have to enable MFA by using the following policy (e.g. named as "AllowOnlyMFA"):

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "BlockMostAccessUnlessSignedInWithMFA",
            "Effect": "Deny",
            "NotAction": [
                "iam:CreateVirtualMFADevice",
                "iam:DeleteVirtualMFADevice",
                "iam:ListVirtualMFADevices",
                "iam:EnableMFADevice",
                "iam:ResyncMFADevice",
                "iam:ListAccountAliases",
                "iam:ListUsers",
                "iam:ListSSHPublicKeys",
                "iam:ListAccessKeys",
                "iam:ListServiceSpecificCredentials",
                "iam:ListMFADevices",
                "iam:GetAccountSummary",
                "sts:GetSessionToken"
            ],
            "Resource": "*",
            "Condition": {
                "Bool": {
                    "aws:MultiFactorAuthPresent": "false",
                    "aws:ViaAWSService": "false"
                }
            }
        }
    ]
}

Then, you can attach this policy to a Group. After that, all the users (including existing or new) will be bound to this policy. You can also explicitly attach this policy to an existing user or specify it when creating a user.

Note that the user should have other normal policies attached as usual. For example, an IAM admin user will have "AdministratorAccess" attached plus this one.

Then, this new user logs in without MFA. He will not be able to do anything, e.g. shown with a lot of API errors when trying to access EC2 console.

Enter image description here

After that, the user can choose to enable MFA himself. After that, the user logs in again with MFA this time, and then the user will be able to perform all the admin functionalities.

Reference: https://aws.amazon.com/premiumsupport/knowledge-center/mfa-iam-user-aws-cli/

AWS
답변함 3년 전
0

Resolved

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠