Ir para o conteúdo

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

feita há 5 anos1,5 mil visualizações
2 Respostas
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
respondido há 3 anos
0

Resolved

respondido há 4 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.