简体   繁体   English

如何列出假定的AWS IAM角色的可用策略

[英]How to list available policies for an assumed AWS IAM role

I am using python and boto to assume an AWS IAM role. 我正在使用python和boto担任AWS IAM角色。 I want to see what policies are attached to the role so i can loop through them and determine what actions are available for the role. 我想查看该角色附加了哪些策略,以便我可以遍历它们并确定对该角色可用的操作。 I want to do this so I can know if some actions are available instead of doing this by calling them and checking if i get an error. 我想这样做,这样我就可以知道是否有一些可用的动作,而不是通过调用它们并检查是否收到错误来做到这一点。 However I cannot find a way to list the policies for the role after assuming it as the role is not authorised to perform IAM actions. 但是,在假定角色无权执行IAM操作之后,我找不到找到列出角色策略的方法。

Is there anyone who knows how this is done or is this perhaps something i should not be doing. 有谁知道这是怎么做的,或者这也许是我不应该做的事情。

To obtain policies, your AWS credentials require permissions to retrieve the policies. 要获取策略,您的AWS凭证需要权限来检索策略。

If such permissions are not associated with the assumed role, you could use another set of credentials to retrieve the permissions (but those credentials would need appropriate IAM permissions). 如果此类权限与假定角色没有关联,则可以使用另一组凭据来检索权限(但是这些凭据将需要适当的IAM权限)。

There is no way to ask "What policies do I have?" 无法询问“我有什么政策?” without having the necessary permissions. 没有必要的权限。 This is an intentional part of AWS security because seeing policies can reveal some security information (eg "Oh, why am I specifically denied access to the Top-Secret-XYZ S3 bucket?"). 这是AWS安全性故意组成部分,因为看到策略可以泄露一些安全性信息(例如“哦,为什么我特地拒绝访问Top-Secret-XYZ S3存储桶?”)。

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

相关问题 代入角色 python 错误未授权执行:sts:AssumeRole on resource: arn:aws:iam::xxxxxxxxx - Assumed role python error is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::xxxxxxxxx boto3 list_role_policies 返回空数组,或者我如何分离所有策略? - boto3 list_role_policies returning empty array, or how do I just detach all policies? 如何在不设置 aws configure 的情况下使用 IAM 角色获得临时 IAM 编程访问? - How to get temporary IAM programmatic access using IAM role without setting up aws configure? 如何使用 python boto3 将新角色权限附加到 aws 中的 iam_role? - How to attach new role permissions to iam_role in aws using python boto3? AWS Sagemaker 不允许我使用代入角色? - AWS Sagemaker won't let me use an assumed role? AWS CDK Python 中的 IAM 角色条件 - IAM Role Conditions in AWS CDK Python aws iam 角色从 CloudFormation 转移到 CDK - aws iam role move from CloudFormation to CDK 我们如何获取IAM用户,他们的群组和政策? - How can we fetch IAM users, their groups and policies? 如何使用 boto3 列出附加到 IAM 角色的所有资源? - How can I list the all the resources attached to a IAM role using boto3? 试图在aws中创建一个iam角色并在assumeRolePolicyDocument上获取错误 - Trying to create an iam role in aws and getting an error on the assumeRolePolicyDocument
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM