Replies: 4 comments
-
hi @darrendao, a couple of thoughts.
are there other examples you have beyond alb? |
Beta Was this translation helpful? Give feedback.
-
Thanks @kapilt for the detail reply. My responses are below
I'll have to go through the list of policies we have but here are two other resources/filters that have similar issue with ALB and listeners
|
Beta Was this translation helpful? Give feedback.
-
@kapilt Looking through the code, I think I understand what you mean by filter annotation now. However, correct me if I'm wrong, those annotations are saved in the resource manager cache so if I'm not using cache, then they won't be available in subsequent "get resources" calls. Furthermore, for certain policy mode like ConfigRuleMode, resources are load via the source class (ConfigSource) rather than the resource manager, which then bypasses the cache so the filter annotations won't be available either. |
Beta Was this translation helpful? Give feedback.
-
re followup, the filter annotation has nothing todo with the cache, it has to do with the output of resources into blob store, annotations are not in cache. wrt to config mode and cache, cache happens regardless of source. I'm not sure how this part is relevant re cache, it feel like this is getting lost in the weeds instead of focusing on the use case. |
Beta Was this translation helpful? Give feedback.
-
Our company is using Cloud Custodian for compliance checks. We have a “security hub” similar to AWS security hub. The code for doing that is very similar to the code for c7n securityhub. What is different about our security hub is that we want to show evidence of why the checks PASSED or FAILED. For example, we have a policy that checks for whether or not ALBs are using weak TLS listeners by using the listener filter. We noticed that Cloud Custodian would include the matched listeners in the finding, which is good for evidence, but when there is no match, the listeners info is not included in the finding. We need to have evidence for both cases and we're not sure how to support such functionality. I know some folks have suggested writing 2 policies for each compliance check, one for PASSED and one for FAILED. This approach is rather cumbersome and not the long term state we desire. Furthermore, that approach might also not work because certain filters don’t have matched annotation set to true and so the matched values won’t be included in the finding.
Looking at the code, I believe the problem here is due to the fact that the evidence we’re looking for is not inherently a part of the targeted resource (i.e. listener is its own AWS resource and is not a property of the ALB resource. It just happens that the ALB resource has a filter for listeners). I can think of a two ways we can solve the problem:
Update the Describe functionality of each resource to include all of the necessary information via the “augment” method when loading the resource. I notice we already have code like this for resources like s3. So for my example of ALB and weak TLS listeners, we would need to augment the ALB Describe to include the listeners information. The problem I see with this approach is that we would have to go through and do that for any resources with such issue.
We were thinking if there’s a way to change how filtering works at the base level so that we always annotate the properties being evaluated so that in either case of match or not match, we would have the evidence of what was being evaluated. I imagine this would be a big change to how filtering works but it might be the most practical route.
Do you have any suggestions on which approach is better? Or is there something else we can do? Is this even something we want to support in Cloud Custodian?
Beta Was this translation helpful? Give feedback.
All reactions