如果用户有两个访问键,我该如何检查AWS,如何确定其中一个已禁用的日期?

发布于 2025-02-06 08:13:29 字数 292 浏览 0 评论 0原文

我正在尝试检查AWS如果用户有两个访问键,我想知道何时禁用其中一个密钥。

我已经尝试过:

import boto3
iam = boto3.client('iam')

        
  for user in iam.list_users()['Users']:
      print(user)
      res = iam.list_access_keys(UserName=user['UserName'])
      print(res)

但这并没有向我展示我需要的信息。

I'm trying to check in AWS if a user has two access keys, and I'd like to know when one of the keys was disabled.

I've tried:

import boto3
iam = boto3.client('iam')

        
  for user in iam.list_users()['Users']:
      print(user)
      res = iam.list_access_keys(UserName=user['UserName'])
      print(res)

But it doesn't show me the information I need.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷情 2025-02-13 08:13:29

您可以尝试运行这些awscli命令:

aws iam generate-credential-report | jq -r '.State'

然后,

aws iam get-credential-report \
  | jq -r '.Content' \
  | base64 --decode > your_report.csv

这将为您提供有关用户键的完整报告(上次访问,发行,旋转等)等等。

这是 report 的概述。

You could try running these awscli commands:

aws iam generate-credential-report | jq -r '.State'

And then

aws iam get-credential-report \
  | jq -r '.Content' \
  | base64 --decode > your_report.csv

This will give you the full report on your user's keys (last accessed, issued, rotated etc.) and a lot more.

Here's an overview of what's in the report.

甜柠檬 2025-02-13 08:13:29

还有一个选项可以通过下载IAM凭据报告使用给定AWS帐户中所有用户的控制台查看信息。
该报告是您的IAM用户和根帐户的快照,其中包含有关安全凭据的详细信息,例如是否激活了MFA,直到最后旋转密码时,访问密钥1 /访问密钥2(如果有)。

参考文章
https://aws.amazon.com/blogs/security/new-inew-iam-quickly-isendify-when-an-an-access-key-was-was-last-used/

There is also an option to view the information using the console for all the users in a given AWS account by downloading the IAM credential report.
This report is a snapshot of your IAM users and root account, contains details about security credentials, such as whether MFA is activated, when passwords were last rotated, access key 1 / access key 2 if any.

Reference article
https://aws.amazon.com/blogs/security/new-in-iam-quickly-identify-when-an-access-key-was-last-used/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文