-
Notifications
You must be signed in to change notification settings - Fork 290
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
Review and Identify Unnecessary Config Rules to Reduce Security Hub Alerts #8961
Comments
Beginning the review with this - https://github.com/ministryofjustice/modernisation-platform-terraform-baselines/blob/main/modules/config/main.tf. This contains the config rules applied via the baselines module. No other MP-related config rules are listed in a search of the ministryofjustice github org using "aws_config_config_rule". |
Will noncompliant resources issue a securityhub alert. Also note: |
Initial pass over the custom rules (using MP account as reference) - https://docs.google.com/spreadsheets/d/1LfAvUiKYMvM_yJbb2VrzLIVQ2kUNy3Not0YPAd07K4o/edit?usp=sharing This afternoon will look at those custom rules (i.e. no SH equivalent) are being shared or not. Note these are only subscribed to by a PagerDuty sub. There is no native / out-of-the-box means for SecurityHub to subscribe to these config rule events. |
Looking at the SH alert that is generating the bulk of the alerts to slack: "AWS Config should be enabled and use the service-linked role for resource recording" https://docs.aws.amazon.com/securityhub/latest/userguide/config-controls.html#config-1 The ConfigurationRecorders detail is as follows: ~ » aws configservice describe-configuration-recorders --output json { I am investigating whether instead of the custom role, that we use the aws-service-role - AWSServiceRoleForConfig https://docs.aws.amazon.com/config/latest/developerguide/using-service-linked-roles.html Certainly in modernisation-platform this service-linked-role has not been created. (aws iam create-service-linked-role --aws-service-name config.amazonaws.com) Or via terraform
|
So in summary:
|
Update for today:
a. sechub_high_and_critical_findings which is an Event rule that alerts to pagerduty for NEW & CRITICAL issues only. So events outside of this will not have a slack alert. b. securityhub_alarms which is defined in this module - https://github.com/ministryofjustice/modernisation-platform-terraform-baselines/blob/main/modules/securityhub-alarms that contains a number of cloudwatch alarms to cover events such as s3 bucket policy changes and sign-in failures. These do not appear to be routed to security hub. The significant issue is that due to the linked regions across which SecurityHub will issue notifications, so where a critical issue occurs that are global (e.g. concerning an IAM user) then we will have an alert for each region. This goes some way to explain the large number of continued Config.1 rule alerts for the service-linked-role. |
Terraform plan in the sprinkler bootstrap for the amended config resources to use the service-linked role - https://github.com/ministryofjustice/modernisation-platform/actions/runs/13073077815/job/36478790311?pr=9146 |
Baselines branch containing the changes: https://github.com/ministryofjustice/modernisation-platform-terraform-baselines/blob/issue/8961/config.tf So the apply into sprinkler bootstrap of the above failed with the following error:
Though attempts to use a depends_on generated a significant number of plan errors due to the arn of the new service-linked-role not being known until after apply. The changes to the Config recorder were applied and to undo that change the recorders in the various regions where config is also added, the recorder had to be manually amended to use the old role (which had been recreated by the above apply). Once that was done, the rollback could be applied. Further investigation is needed to understand the above terraform error. Edit: So a possible solution is for the policy to be recreated as a bucket policy with AWS Config as the principal. I will look into this on Tuesday. |
Testing the changes in sprinkler, the default scope of the service-linked role does not have the required permissions needed to write to the s3 bucket. To demonstrate this, using the IAM simulator feature of the cli:
has the result:
Additionally, it was noted that the role is unable to write using secure transport as the deny statement in the bucket module's policy prevents it. Investigating how we can add these additional permissions. Can also confirm that the Config service is no longer publishing messages over SNS. Investigating it shows that the topic is using the default policy. A new policy will need to be added to the module. |
Tracked the issue to this error:
|
Will be raising a further ticket today to resolve the ongoing SNS message send failures. As context, according to the attached policy, the service-linked role (AWSServiceRoleForConfig) does not have the required sns:Publish permissions needed.
|
Call with AWS. The issue is due to the service-linked role not having permissions to use the default SNS key for the topic. Instead we need to add a CMK and a policy for it. Create a multi-region CMK & policy and added it to the topic. No success. Note the following permissions the service-linked role has - it's missing encrypt and decrypt:
This doc contains the policy scope and the reasoning for it - https://docs.aws.amazon.com/config/latest/developerguide/s3-kms-key-policy.html#granting-access-s3-kms-key SNS Issue Resolved. |
Baselines PR containing the final set of changes - ministryofjustice/modernisation-platform-terraform-baselines#726 |
User Story
As a Security Engineer,
I want to review the existing config rules and identify which ones are unnecessary, so that we can discuss and decide on actions to reduce the number of alerts sent to Security Hub.
Value / Purpose
By identifying unnecessary config rules, we can reduce the volume of alerts in Security Hub, which will help improve the efficiency of alert management and prioritization of critical findings.
Context / Background
It has been observed that several config rules were created a long time ago, and many of them may no longer be relevant or necessary. These rules are generating a high number of security findings, which are sent to Security Hub. Reviewing and identifying which rules are unnecessary will help us streamline the process and address alert overload.
Useful Contacts
No response
Additional Information
No response
Definition of Done
The text was updated successfully, but these errors were encountered: