AWS MFA Tools
Command-line tool for MFA authentication for the AWS CLI.
Manages the AWS credentials file to be used with the AWS CLI under MFA authentication and will, by default, ask for the MFA token for the default profile (you must add MFA serial to AWS config file).
You must have valid authentication for AWS CLI already set up to successfully call the AWS STS. The authentication file is similar to the AWS credentials file and must be located in the same folder.
The tool will generate temporary credential accesses and manage them on the AWS credentials file.
Usage
usage: awslogin [options]
AWS MFA Tool
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--profile PROFILE aws profile to get mfa serial. (default: default)
--token TOKEN mfa token to login. (default: None)
--config CONFIG_FILE path to aws config file. (default: <path to>/.aws/config)
--mfa MFA_FILE path to mfa credentials file. (default: <path to>/.aws/mfa_credentials)
--aws AWS_FILE path to aws credentials file. (default: <path to>/.aws/credentials)
--export show export command, does NOT update credentials file.(default: False)
--list list all profiles on AWS folder. (default: False)
Helping manage AWS Session tokens for MFA authentication.
AWS Files
The AWS CLI uses two files for configuration (config) and authentication (credentials), and they must be located under the path ~/.aws (Linux and MAC) or c:\~\.aws (Windows). The ~ indicates the path to the user's home folder.
The tool will create and maintain the credentials file with temporary access granted via MFA authentication. The expiration time for the session token will be the default one defined by AWS Security Token Service (to know more).
To use this tool, you will need to create a config file with your mfa_serial identification and a mfa_credentials file with your access keys to the AWS account where mfa_serial is configured.
The default path to all three files can be check using awslogin -h. If needed, it is possible to specify the path for each file, check the optional arguments.
Example for a config file with profiles:
[default]
region = us-east-1
output = json
[company]
mfa_serial = arn:aws:iam::000000000000:mfa/user.name
region = eu-west-1
output = json
[datalake]
mfa_serial = arn:aws:iam::888888888888:mfa/user.name
region = us-east-2
output = json
Example for a mfa_credentials file with profiles:
[default]
aws_access_key_id = *******
aws_secret_access_key = *******
[company]
aws_access_key_id = *******
aws_secret_access_key = *******
[datalake]
aws_access_key_id = *******
aws_secret_access_key = *******
The credentials file will be maintained by the tool and will have something similar to this:
[default]
aws_access_key_id = ********
aws_secret_access_key = *******
aws_session_token = *******
aws_session_token_expiration = <datetime>
[company]
aws_access_key_id = ********
aws_secret_access_key = *******
aws_session_token = *******
aws_session_token_expiration = <datetime>
[datalake]
aws_access_key_id = *******
aws_secret_access_key = *******
aws_session_token = *******
aws_session_token_expiration = <datetime>
Requirements
Python 3.7+AWS CLI installed(instructions)MFA enabled on AWS account(instructions)Access keys to AWS account(instructions)
Install
You can use pip to install:
pip3 install aws-mfa-tools
You can install directly from Github:
pip3 install --user git+https://github.com/FerrariDG/aws-mfa-tools.git
Or you can clone the repository:
pip3 install --user <full path to>/aws-mfa-tools
Metadata
Release files for aws-mfa-tools 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aws-mfa-tools-0.2.2.tar.gz | 6.7 kB | Without provenance | Details for aws-mfa-tools-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aws_mfa_tools-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for aws_mfa_tools-0.2.2-py3-none-any.whl |
Total release size: 14.3 kB
Release files / aws-mfa-tools-0.2.2.tar.gz
| Download URL | aws-mfa-tools-0.2.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a63ea5b5528b3a56ba330be997103ac3f6e7ce4389419a82dac2b5e3eabcf36
|
|
BLAKE2b-256 checksum How to use checksums |
56aec764e965415b14491dcbf10de0a709317ff06661635d8c7642b3eea75da5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
|
Release files / aws_mfa_tools-0.2.2-py3-none-any.whl
| Download URL | aws_mfa_tools-0.2.2-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05427914adbc01145b6b1ab0b595b6b382737736250a2341fd97cab8337fbcfa
|
|
BLAKE2b-256 checksum How to use checksums |
e82cc36369f1fe1fa6099ecf4bae4a2032a0f867090daa0b04f7df16af2d8f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
|
Security for aws-mfa-tools 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.