-
Notifications
You must be signed in to change notification settings - Fork 25
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
(rules): RDS Cluster Instances fail RDS Instance Rules #216
Comments
Minor update, DB_INSTANCE_BACKUP_ENABLED is not applicable for clusters because the I think RDS_SNAPSHOT_ENCRYPTED is redundant because it checks for the same property as RDS_STORAGE_ENCRYPTED. For RDS_STORAGE_ENCRYPTED, here is the change I made to rds_storage_encrypted.guard to make it applicable to clusters as well as instances.
|
Thank you @mattvanstone |
Regarding the exclusion if the db cluster identifier is present, would it break anything if we had both the values present? What I am asking is: would the explicit setting of that value on the DB instance even though the DB Cluster has that set as well, break anything on the deployment if both were set to true? Many times it is better to be explicit than implicit and as your configurations serves as documentation for your environment, it is better to be explicit what what you are doing. Then there is no question about your intent or desired outcome. |
That's a good point. My CloudFormation is synthesized from CDK, and CDK does not put those properties on the instances. So I forgot to consider a scenario where someone creates a CloudFormation template manually. I guess in this scenario I will need to create my own rule. |
Yes, the documentation says:
If there was a rule that checks the cluster, you could explicitly ignore it on the Instance, and mention that it is enabled on the cluster level.
I'm not sure if I agree with the 1:1 mapping (as a long term goal); but I also think that isn't a problem here: Or better; doing the cluster-level check is probably a better mapping to what Config does, than only checking the DbInstances. This is because I believe not setting it on the Instance; but setting it on the Cluster should not trigger the Config rule (as the actual deployed instance will be encrypted). |
Given the issue with specifying it, we should do that check to be clear and not force someone to try to meet compliance when it is actually breaking something. We should put that in as a fix. |
@mattvanstone |
@grolston that code I added to the end of my first post was generated by CDK (with some stuff redacted). If you want to see more I'd be happy to share it with you directly. With CDK, every resource has an "Metadata": {
"aws:cdk:path": "redacted"
} I'm happy to help with this and contribute if there is anything I can do. |
General Issue
RDS Instances that are part of a cluster will always fail DB_INSTANCE_BACKUP_ENABLED, RDS_SNAPSHOT_ENCRYPTED, and RDS_STORAGE_ENCRYPTED rules.
The Question
When there are RDS clusters, the cluster resource has the
StorageEncrypted
andBackupRetentionPeriod
properties instead of the individual instances, which results in DB_INSTANCE_BACKUP_ENABLED, RDS_SNAPSHOT_ENCRYPTED, and RDS_STORAGE_ENCRYPTED rules failing.aws-guard-rules-registry/rules/aws/amazon_rds/rds_storage_encrypted.guard
Lines 31 to 34 in 828f505
I think the resource selection on these rules should exclude
AWS::RDS::DBInstance
resources when theDBClusterIdentifier
property exists. Then we would need separate rules for clusters.Either that, or we should include
AWS::RDS::DBCluster
in these rules and check for the properties on those resources as well.Thoughts? I'm happy to implement the changes and submit a PR after your feedback.
CloudFormation Guard Version
2.1.0
OS
Ubuntu
OS Version
No response
Other information
Here is some sample CloudFormation
The text was updated successfully, but these errors were encountered: