用于管理MFA令牌和AWS会话令牌的Python脚本和库。
AutoAWSMFA的Python项目详细描述
自动AWS MFA
Auto-AWS-MFA(autoawsmfa)是一个用于管理启用了MFA的AWS会话令牌的脚本,它还可以用于为其他在配置MFA时提供密钥的应用程序生成MFA令牌。在
安装
要求
autoawsmfa是使用botocore & boto3
库和python3.5+构建的。不支持Python2。自动AWSMFA
还需要keyring, pyotp and pyperclip
(在pip
上可用)。在
Pip安装
pip install AutoAWSMFA
从源代码安装
克隆存储库:
^{pr2}$然后用Pip安装:
cd autoawsmfa
pip install .
使用
usage: autoawsmfa [-h][-v][-p PROFILE][--credential-path CREDENTIAL_PATH][--arn ARN]{mfa,session} ... Auto update your AWS CLI MFA session token optional arguments: -h, --help show this help message and exit -v, --version show the version number and exit -p PROFILE, --profile PROFILE AWS profile to store the session token. Default looks for"AWS_PROFILE" --credential-path CREDENTIAL_PATH path to the aws credentials file --arn ARN AWS ARN from the IAM console (Security credentials -> Assigned MFA device). This is saved to your .aws/credentials file subcommand: The subcommand to use among this suite of tools {mfa,session} Select a subcommand to execute mfa Add MFA secret configuration key or get a token for registered MFA secret session Start AWS CLI MFA session, use stored token or provide custom token "--custom-token"
管理MFA
添加秘密
向特定的AWS配置文件添加新的MFA机密
autoawsmfa --profile <profile name> mfa --add-secrete
配置文件名应存在于posix的“~/.aws/credentials”中,或存在于NT/windows的“%UserProfile%.aws\credentials”中
获取秘密
从前面添加的secret获取MFA令牌,令牌复制到剪贴板,用于登录AWS控制台
autoawsmfa --profile <profile name> mfa --get-token
如果先前没有为指定的配置文件添加密码,则会提示添加密码
删除机密
从密钥环中删除秘密
autoawsmfa --profile <profile name> mfa --del-secret
可使用的可选参数
usage: autoawsmfa mfa [-h](--add-secret | --get-token | --del-secret)[--non-aws] Manage MFA optional arguments: -h, --help show this help message and exit --add-secret Add MFA secret configuration key and genereate session tokens --get-token Display token, valid for30 sec. Token added to clipboard to be used for GUI console login --del-secret Delete stored secret --non-aws Store non aws secret and generate MFA token
非AWS MFA
这可用于注册非AWS机密,如OKTA或任何第三方支持MFA的应用程序。 此选项提示输入应用程序名和用户名以注册和检索令牌。你应该在注册时记下应用程序名和用户名,因为目前没有选项可以列出查看存储的机密。在
autoawsmfa mfa --non-aws --get-token
管理AWS会话
开始会话
已为MFA启动配置文件注册秘密会话
autoawsmfa --profile <profile name> session --start
对于持续时间以及是否应使用第三方MFA设备令牌,可以给出可选参数
usage: autoawsmfa session [-h] --start [--duration DURATION][--custom-token CUSTOM_TOKEN] Manage AMS CLI MFA session optional arguments: -h, --help show this help message and exit --start Start AWS MFA session for the selected profile --duration DURATION Specify session token duration in minutes before it expires. Duration limitation as per AWS is minimum 15 and maximum 720 minutes, default is 720 minutes/12 Hrs --custom-token CUSTOM_TOKEN Provide 6 digit token from your MFA devices
- 项目
标签: