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(kms): call GetKeyRotationStatus only for Customer Keys #1842

Conversation

MrCloudSec
Copy link
Member

Description

Regarding #1838, solve the following error:

2023-02-03 15:35:54,753 [File: kms_service.py:75] [Module: kms_service] ERROR: us-west-2 -- ClientError:71 -- An error occurred (AccessDeniedException) when calling the GetKeyRotationStatus operation: User: [redacted] is not authorized to perform: kms:GetKeyRotationStatus on resource: [redacted] because no resource-based policy allows the kms:GetKeyRotationStatus action

License

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

@@ -73,7 +73,7 @@ def __get_key_rotation_status__(self):
logger.info("KMS - Get Key Rotation Status...")
for key in self.keys:
try:
if "EXTERNAL" not in key.origin:
if "EXTERNAL" not in key.origin and "AWS" not in key.manager:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if "EXTERNAL" not in key.origin and "AWS" not in key.manager:
if "EXTERNAL" not in key.origin and key.manager == "CUSTOMER":

I prefer to set CUSTOMER. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output would be the same, so I prefer leaving it as it is.

@MrCloudSec MrCloudSec requested a review from jfagoagas February 6, 2023 16:00
@MrCloudSec MrCloudSec merged commit 6c16e2b into master Feb 6, 2023
@MrCloudSec MrCloudSec deleted the 1838-bug-kms_cmk_rotation_enabled-check-fails-for-aws-managed-kms-keys-used-by-acm branch February 6, 2023 16:07
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.

[Bug]: kms_cmk_rotation_enabled check fails for AWS managed KMS keys used by ACM
2 participants