用于管理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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java什么数据库最类似于Map,每个用户/id存储无限多个“键”和“值”?   java仅使用super pom进行测试   内存不足如何解析java。OutOfMemoryError:Java堆空间在增加堆大小的情况下将意味着延迟OutOfMemoryError   来自另一个类的mysql和java jdbc调用[运行时应用程序]   java通过下拉菜单更改搜索框搜索的内容   JAVAlang.ClassNotFoundException:sun。jdbc。odbc。JdbcOdbcDriver   java Selenium点击链接   JavaSpringHibernate:从唯一值列表中获取对象列表   java Bing广告与桌面身份验证问题   java如何在没有任何外部SDK的情况下从安卓打印到收据打印机?   未调用java菜单片段类   java在IDEA和PyCharm中同时为同一个项目工作   java我们如何为同一个异常提供不同的海关信息   jakarta ee中是否预定义了“请求”和“响应”变量或值?   java更好地解决“之前和之后”难题?   尝试将数据从Excel添加到Java   发送电子邮件的Java代码只适用于一个电子邮件id?   java如何从资产解析XML?