Multi-Factor Authentication (MFA) helps to protect your AWS resources. You can enable MFA for IAM users or the AWS account root user. When you enable MFA for the root user, it affects only the root user credentials and does not affect the IAM user, IAM users contain their own credentials means each identity has its own MFA configuration. This Multi-Factor Authentication works as an extra layer of protection on top of a user name and password and we know that the root account is the most privileged user in an AWS account. This extra layer protection enabled, when a user signs in to an AWS website, they will be prompted for their user name and password as well as for an authentication code from their AWS MFA device.
Note: When virtual MFA is used for root accounts, it is recommended that the device used is NOT a personal device, but rather a dedicated mobile device(tablet or phone) that is managed to be kept charged and secured independently of any individual personal devices. (“non-personal virtual MFA”) This lessens the risks of losing access to the MFA due to device loss, device trade-in, or if the individual owning the device is no longer employed at the company.
MFA increased security, It helps to protect AWS resources, it requires the authenticating principal to possess a device that emits a time-sensitive key and has knowledge of a credential.
MFA adds an extra security layer because it requires users to provide unique authentication from an AWS-supported MFA mechanism in addition to their regu sign-in credentials when they access AWS websites or services. If Hacker finds out the password, it needs to pass through one extra layer: MFA needs a device for authentication.
By Default, MFA is not activated for any users if you want to activate MFA for the root user you need to login into the root user account.
Perform the following to determine if the root account has an MFA setup:
Perform the following to determine if the root account has MFA setup in CLI:
Perform the following to establish MFA for the root account:
- Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/
Note: to manage MFA devices for the root AWS account, you must use your root account credentials to sign in to AWS. You cannot manage MFA devices for the root account using other credentials.
- In the Identity and Access Management under security alerts click on “Enable MFA”
- Under “Your Security Credentials “ click on Activate MFA in Multi-Factor Authentication
- In the wizard “Manage MFA device” we have three options Virtual(software-based) MFA device, U2F security key (USB device-based), the last one is another hardware MFA device. From there you can choose any of the options. (Note: Here we are going with the Virtual MFA device for implementation).
Select Virtual MFA device
We see steps to set up a virtual MFA device as below
1. Install a compatible app on your mobile device or computer
2. Use your virtual MFA app and your device’s camera to scan the QR code.
Using the compatible application through a mobile device we scan the QR code or we can type the secret key
3. Open your virtual MFA application here We use Microsoft Authenticator you can use anyone from the list which hosting virtual MFA devices, If the virtual MFA application supports multiple accounts( multiple virtual MFA devices), choose to create a new account (a new virtual MFA device). 4. Determine whether the MFA app supports QR codes, and then do one of the following:
- Use the app to scan the QR code.
- In the Manage MFA Device wizard, choose the secret key for manual configuration and then type the secret configuration key into your MFA application.
5. When you finished the virtual MFA device starts generating one-time passwords.
6. In the Manage MFA Device wizard, in the Authentication Code 1 box, type the one-time password that currently appears in the virtual MFA device and then wait up to 30 seconds for the device to generate a new one-time password. Then type the second one-time password into the Authentication Code 2 box. then click on Assing MFA
If your AWS account root user MFA device is lost, damaged, or not working, you can recover access to your account by following the below steps.
Recovering a root user MFA device:
- Sign in to the AWS Management Console ( https://console.aws.amazon.com/console/home?nc2=h_ct&src=header-signin ) and select root user and entering your AWS account email address. On the next page, fill in the captcha and then enter the password after the captcha page.
- Click on Troubleshoot MFA
- In the Troubleshoot your authentication device page you click on Sign in using alternative factors
- To authenticate your account by verifying the email address, and click on Send verification email.
- Check the email that is associated with your AWS account for a message from AWS([email protected]). Follow the direction in the email. If you don’t see the email in your account, check your spam folder, or return to your browser and choose to resend the email
- After verifying your email address, the next to choose to call me now option is the next step for the authentication of your account. AWS call on your registered mobile and enter the 6-digit number from the AWS website on your phone keypad.
If you don’t receive a call from AWS, choose Sign in to the console again and start over. Or choose AWS Support
After verifying your phone number, you can sign in to your account by choosing Sign in to the console.
The next step varies depending on the type of MFA you are using:
For a virtual MFA device, remove the account from your device. Then go to the AWS Security Credentials( https://console.aws.amazon.com/console/home?nc2=h_ct&src=header-signin) page and delete the old MFA virtual device.
For the U2F security key, go to the AWS Security Credentials( https://console.aws.amazon.com/console/home?nc2=h_ct&src=header-signin) page and deactivate the old U2F.
For a hardware MFA device, go to the AWS Security Credentials page and delete the old MFA hardware device entity.