简体   繁体   English

如何在没有浏览器支持的情况下批准 aws sso 登录

[英]How to Approve aws sso login without Browser Support

aws sso login --profile //profile name// is usually open browser and ask for approval is there any other way we can do this without browser. aws sso login --profile //profile name//通常是打开浏览器并请求批准是否有任何其他方式我们可以在没有浏览器的情况下执行此操作。 I have a situation where I need to setup aws cli in my docker container and I can only use aws sso login and I don't want to use any selenium to handle browser approval since its looks complex so I want to do all in cli itself…我有一种情况,我需要在我的 docker 容器中设置 aws cli,我只能使用 aws sso 登录,我不想使用任何 selenium 来处理浏览器批准,因为它看起来很复杂,所以我想在 cli 中完成所有操作……

aws sso login takes a --no-browser flag which suppresses the browser launch aws sso login采用--no-browser标志,该标志禁止浏览器启动

From there you can control the sso verification url via a browser automation library eg puppeteer.从那里您可以通过浏览器自动化库(例如 puppeteer)控制 sso 验证 url。

You can also get the verification url via aws sso-oidc actions/commands.您还可以通过 aws sso-oidc 操作/命令获得验证 url。

An example in golang using go-rod is available on github here although this won't work with a non-mfa process flow, which is what you want here.使用go-rod的 golang 示例在 github 上可用尽管这不适用于非 mfa 流程,这是您想要的。 The code at the link can be modded or updated to support that use-case with not a whole lot of effort.可以修改或更新链接上的代码以支持该用例,而不需要付出太多努力。

Generally using aws sso isn't recommedended for this type of use-case .通常不建议将 aws sso 用于此类用例 Instead, you're better off using IAM user credentials (while outside VPC for example) or if in a VPC - instance profiles if they're available.相反,您最好使用 IAM 用户凭证(例如在 VPC 外部),或者如果在 VPC 中 - 实例配置文件(如果它们可用)。

Yes that's a common scenario and AWS has lot of documentation on AWS SSO using CLI.是的,这是一个常见的场景,AWS 有很多关于使用 CLI 的 AWS SSO 的文档。 You have to setup AWS SSO Config and after that commands will work with defaults or command line arguments you'll pass.您必须设置 AWS SSO Config,然后命令将使用默认值或命令行 arguments 您将通过。

Reference docs with step by step details带有分步详细信息的参考文档

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM