[Security Hardened Shoot Cluster] Rule 1003 implementation#454
[Security Hardened Shoot Cluster] Rule 1003 implementation#454AleksandarSavchev merged 5 commits intogardener:mainfrom
Conversation
dimityrmirchev
left a comment
There was a problem hiding this comment.
Thanks. I have some suggestions
| version: <supported-version> | ||
| ``` | ||
|
|
||
| The supported versions can be found in the used `CloudProfile`. |
There was a problem hiding this comment.
Why is this line removed?
There was a problem hiding this comment.
Must have written on top of it 😅 my bad
| ``` | ||
|
|
||
| The supported versions can be found in the used `CloudProfile`. | ||
| ### 1003 - Shoot clusters should have Lakom extension configured correctly. <a id="1003"></a> |
There was a problem hiding this comment.
| ### 1003 - Shoot clusters should have Lakom extension configured correctly. <a id="1003"></a> | |
| ### 1003 - Shoot clusters should have the Lakom extension configured. <a id="1003"></a> |
There was a problem hiding this comment.
Would it be better to use must instead of should when severity is ranked HIGH?
| ### 1003 - Shoot clusters should have Lakom extension configured correctly. <a id="1003"></a> | ||
|
|
||
| #### Description | ||
| Shoot clusters should have Lakom extension configured correctly. Trusted public keys should be configured for the Lakom extension. |
There was a problem hiding this comment.
| Shoot clusters should have Lakom extension configured correctly. Trusted public keys should be configured for the Lakom extension. | |
| Lakom is an admission controller which implements image signature verification. Shoot clusters should have the Lakom extension configured with trusted public keys so that only trusted images are allowed in the cluster. |
| Shoot clusters should have Lakom extension configured correctly. Trusted public keys should be configured for the Lakom extension. | ||
|
|
||
| #### Fix | ||
| Follow the Lakom extension documentation on how to configure [TrustedKeysResourceName](https://github.com/gardener/gardener-extension-shoot-lakom-service/blob/v0.18.1/docs/usage/shoot-extension.md#trustedkeysresourcename) |
There was a problem hiding this comment.
| Follow the Lakom extension documentation on how to configure [TrustedKeysResourceName](https://github.com/gardener/gardener-extension-shoot-lakom-service/blob/v0.18.1/docs/usage/shoot-extension.md#trustedkeysresourcename) | |
| Follow the Lakom extension documentation on how to configure [TrustedKeysResourceName](https://github.com/gardener/gardener-extension-shoot-lakom-service/blob/v0.18.1/docs/usage/shoot-extension.md#trustedkeysresourcename). |
| } | ||
|
|
||
| func (r *Rule1003) Severity() rule.SeverityLevel { | ||
| return rule.SeverityMedium |
There was a problem hiding this comment.
You set this to MEDIUM, but the documentation says HIGH?
| } | ||
|
|
||
| if lakomConfig.TrustedKeysResourceName == nil || len(*lakomConfig.TrustedKeysResourceName) == 0 { | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not have TrustedKeysResourceName configured.", lakomExtensionType), rule.NewTarget())), nil |
There was a problem hiding this comment.
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not have TrustedKeysResourceName configured.", lakomExtensionType), rule.NewTarget())), nil | |
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not configure trusted keys.", lakomExtensionType), rule.NewTarget())), nil |
|
|
||
| if lakomConfig.TrustedKeysResourceName == nil || len(*lakomConfig.TrustedKeysResourceName) == 0 { | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not have TrustedKeysResourceName configured.", lakomExtensionType), rule.NewTarget())), nil | ||
| } else { |
There was a problem hiding this comment.
No need for the else. It causes not needed nesting
| return rule.Result(r, rule.PassedCheckResult(fmt.Sprintf("Extension %s is correctly configured for the shoot cluster.", lakomExtensionType), rule.NewTarget())), nil | ||
| } | ||
| case extensionLabelValue == "true" && !extensionDisabled: | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not have extension config configured for the shoot cluster.", lakomExtensionType), rule.NewTarget())), nil |
There was a problem hiding this comment.
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not have extension config configured for the shoot cluster.", lakomExtensionType), rule.NewTarget())), nil | |
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s is not configured for the shoot cluster.", lakomExtensionType), rule.NewTarget())), nil |
| case extensionLabelValue == "true" && !extensionDisabled: | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s does not have extension config configured for the shoot cluster.", lakomExtensionType), rule.NewTarget())), nil | ||
| case extensionLabelValue == "true" && extensionDisabled: | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s is disabled in the shoot spec and enabled in labels.", lakomExtensionType), rule.NewTarget())), nil |
There was a problem hiding this comment.
Should this be a warning? What can cause this behaviour?
There was a problem hiding this comment.
It does make sense for this to not be marked as failed as we should never enter this case.
| case extensionLabelValue == "true" && extensionDisabled: | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s is disabled in the shoot spec and enabled in labels.", lakomExtensionType), rule.NewTarget())), nil | ||
| default: | ||
| return rule.Result(r, rule.FailedCheckResult(fmt.Sprintf("Extension %s has unexpected label value: %s.", lakomExtensionType, extensionLabelValue), rule.NewTarget())), nil |
There was a problem hiding this comment.
Should this be a warning?
There was a problem hiding this comment.
I have changed this one to warning now and added the changes to rule 1000 as well.
1edd3eb to
ac3e652
Compare
ac3e652 to
2e8287a
Compare
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #431
Special notes for your reviewer:
Release note: