List user policies and actions

Reply
L1 Bithead

List user policies and actions

Hi,

 

Can someone help me with an RQL to display the list of Users, policies attached, and the actions allowed in the policies.

 

I want to be able to export this into a CSV. Any help here is much appreciated.

 

Thanks,

Sultan 

L3 Networker

Re: List user policies and actions

Hi Sultan,

What cloud provider are you trying to pull a list of users for?

Thanks,

Eddie

L1 Bithead

Re: List user policies and actions

Hi Eddie,

 

I would like to output the list of AWS IAM users, the policies attached to each user, and the list of Actions that they're allowed. If this could be displayed in three different columns, that would be great!

 

Thanks in advance,

Sultan 

 

L3 Networker

Re: List user policies and actions

So users can have inline policies as well as attached policies.  It would be difficult to show it all in one pane due to the joins that would need to be used.  Do you only want to list users that have inline or attached policies? Or a complete list of users regardless of policies?

 

Thanks,

Eddie

L1 Bithead

Re: List user policies and actions

If space is a constraint, we can do it two iterations. First one shows all the users with attached policies and the actions allowed. Second shows all the users with inline policies and actions allowed.

 

How's this to begin with?.. but no luck though..  

 

config where api.name = 'aws-iam-list-attached-user-policies' as X; config where api.name = 'aws-iam-get-policy-version' as Y; filter "$.X.attachedPolicies.policyArn==$.Y.policyArn and $.Y.document.Statement[?(@.Effect == 'Allow' && @.Action is not empty]; show Y;

 

 

L3 Networker

Re: List user policies and actions

This should get you what you are looking for (you were missing the brackets for the array (attachedPolicies):

config where api.name = 'aws-iam-list-attached-user-policies' as X; config where api.name = 'aws-iam-get-policy-version' as Y; filter "$.X.attachedPolicies[*].policyArn==$.Y.policyArn and $.Y.document.Statement[?(@.Effect=='Allow')].Action is not empty"; show Y;
L1 Bithead

Re: List user policies and actions

Eddie,

 

Thank you, this is helpful. But how can I list all the allowed actions in the form of a column. My end goal is to export this to a CSV which shows all the user policies and actions it allows. Currently, if I were to export it, the output doesn't display the list of actions allowed. 

L3 Networker

Re: List user policies and actions

You won't be able to do that within the UI due to the sheer number of actions that could be returned.  I would suggest using our API to pull the data you want and export it into CSV format.

 

Thanks,

Eddie

L1 Bithead

Re: List user policies and actions

Thanks Eddie. That makes sense!

L2 Linker

Re: List user policies and actions

Hi ,

 

I believe it will show only the first case that attached policies with action only.Not inline policy details with action.Also please help me to understand where it's showing list of user names and respective policy details and action details.The report is showing only list of policy details not even action??

 

Please correct me if i am wrong??

 

Thank you.

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!