modernisation-platform icon indicating copy to clipboard operation
modernisation-platform copied to clipboard

Investigate SecurityHub policy that results in AccessDenied for config:GetComplianceDetailsByConfigRule

Open jakemulley opened this issue 4 years ago • 2 comments

AWS SecurityHub is enabled via the modernisation-platform-terraform-baselines Terraform module. It uses the AWSServiceRoleForSecurityHub service-linked role. It integrates with AWS Config to configure a standard set of rules.

When SecurityHub assumes the service-linked role, and tries to perform config:GetComplianceDetailsByConfigRule on its own standard set of rules, the resource throws an AccessDenied error. This only happens on the SecurityHub-created rules, not any that are configured manually.

The error it throws is: User: arn:aws:sts::${accountId}:assumed-role/AWSServiceRoleForSecurityHub/securityhub is not authorized to perform: config:GetComplianceDetailsByConfigRule on resource: securityhub-${rule-name}.

This full error stack is viewable in CloudWatch Logs if you search for AccessDenied.

jakemulley avatar Nov 03 '20 10:11 jakemulley

I have a similar issue, started in last week or so....out of nowhere. Is there a fix on this?

mikedanielcpt avatar Feb 25 '21 17:02 mikedanielcpt

I ran into the same error/symptom; the solution was to enable Config in the affected region. The region was specified in the CloudWatch Log error.

Config - like GuardDuty and SecurityHub - is Region based.

Note - I came to this error via CloudFormation not the Terraform module. In multiple accounts I turned on GuardDuty/SecurityHub but didn't turn on Config and got this error. Errors disappeared after turning on Config.

I found this issue when looking for a solution and assume others will as well.

bellbrothers avatar Apr 03 '21 21:04 bellbrothers

I can see evidence of this check succeeding, but no evidence of it failing. As mentioned by @bellbrothers there's a six month old AWS document that references the need for AWS Config here: https://aws.amazon.com/premiumsupport/knowledge-center/config-error-security-hub/

dms1981 avatar Jan 30 '23 08:01 dms1981