Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iam): change prowler additional policy json due errors in creation #1852

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

theist
Copy link
Contributor

@theist theist commented Feb 7, 2023

Context

I found a problem adding this policy to a dedicated user in IAM

Description

Hi!

I was test driving prowler and added this policy to its dedicated IAM user. When I create the policy in the editor It complained about s3:GetPublicAccessBlock not existing. I changed it for the one I think is required, but not sure about it.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetPublicAccessBlock.html

I think the problem is that while the API call is GetPublicAccessBlock the permission required according to the doc is s3:GetBucketPublicAccessBlock

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

I was test driving prowler and added this policy to its dedicated IAM user. When I create the policy in the editor It complained about `s3:GetBucketPublicAccessBlock` not existing. I changed it for the one I think is required, but not sure about it.
@theist theist requested review from a team, toniblyx, MrCloudSec and n4ch04 February 7, 2023 10:17
@MrCloudSec
Copy link
Member

Hi @theist, thank you for your contribution, but this policy was made to extend the permissions of the SecurityAudit and ViewOnlyAccess AWS Managed Policies. To use Prowler with a dedicated IAM user please, add the two mentioned policies which already have the "s3:GetBucket*" permissions.

@MrCloudSec MrCloudSec closed this Feb 7, 2023
@theist
Copy link
Contributor Author

theist commented Feb 7, 2023

Thanks @sergargar

I was following documentation in https://docs.prowler.cloud/en/latest/getting-started/requirements/

And it states:

Those credentials must be associated to a user or role with proper permissions to do all checks. To make sure, add the following AWS managed policies to the user or role being used:

arn:aws:iam::aws:policy/SecurityAudit
arn:aws:iam::aws:policy/job-function/ViewOnlyAccess

Moreover, some read-only additional permissions are needed for several checks, make sure you attach also the custom policy prowler-additions-policy.json to the role you are using.

If you want Prowler to send findings to AWS Security Hub, make sure you also attach the custom policy prowler-security-hub.json.

So I understood that I have to add the four policies to prowler user (thru a group in my case)

prowler-additions-policy.json includes an error for IAM and the editor complains

image

It is true that the SecurityAudit policy does include the s3:GetBucket* which covers the policy I corrected, but still, the line represents an error in the UI console (or tools like terraform that try to set that json) so either it should be corrected or removed because it causes an error to people following the documentation.

My contribution corrected it, but it is true that is better to remove it, as it is already covered by the other recommended policies. I leave it to you, but keeping the file with unknown permission can mislead users.

Cheers.

@MrCloudSec
Copy link
Member

Thank you for the info @theist !
You're right, the s3:GetPublicAccessBlock permission is incorrect. I reopen the PR so we can remove this permission from the policy.

@MrCloudSec MrCloudSec reopened this Feb 7, 2023
@MrCloudSec MrCloudSec self-requested a review February 7, 2023 11:39
@MrCloudSec MrCloudSec merged commit 0298ff9 into prowler-cloud:master Feb 7, 2023
@MrCloudSec MrCloudSec changed the title Change prowler additional policy json due errors in creation fix(iam): change prowler additional policy json due errors in creation Feb 7, 2023
MrCloudSec added a commit that referenced this pull request Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants