2

Is there a way of using cloud formation to enforce MFA on user accounts in AWS:

I have the following cloud-formation code:

{
    "AWSTemplateFormatVersion": "2010-09-09"

    "Description": "Security Cloud Formation Template",

{
  "Resources": {
      "Type": "AWS::IAM::Policy",
      "Properties": {
      "Users" : [*],
      "Action"   : [

      ]
      }
  }
}

I'm not able to find an action (in the AWS list) or able to work out a way of enforcing MFA on an account.

1
  • You may have better luck by contacting AWS support or posting on an AWS forum Jun 1, 2016 at 15:06

1 Answer 1

3

Yep, you can do this.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowUsersToCreateEnableResyncDeleteTheirOwnVirtualMFADevice",
      "Effect": "Allow",
      "Action": [
        "iam:CreateVirtualMFADevice",
        "iam:EnableMFADevice",
        "iam:ResyncMFADevice",
        "iam:DeleteVirtualMFADevice"
      ],
      "Resource": [
        "arn:aws:iam::account-id-without-hyphens:mfa/${aws:username}",
        "arn:aws:iam::account-id-without-hyphens:user/${aws:username}"
      ]
    },
    {
      "Sid": "AllowUsersToDeactivateTheirOwnVirtualMFADevice",
      "Effect": "Allow",
      "Action": [
        "iam:DeactivateMFADevice"
      ],
      "Resource": [
        "arn:aws:iam::account-id-without-hyphens:mfa/${aws:username}",
        "arn:aws:iam::account-id-without-hyphens:user/${aws:username}"
      ],
      "Condition": {
        "Bool": {
          "aws:MultiFactorAuthPresent": true
        }
      }
    },
    {
      "Sid": "AllowUsersToListMFADevicesandUsersForConsole",
      "Effect": "Allow",
      "Action": [
        "iam:ListMFADevices",
        "iam:ListVirtualMFADevices",
        "iam:ListUsers"
      ],
      "Resource": "*"
    }
  ]
}

http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_delegate-permissions_examples.html#creds-policies-mfa-console

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .