Configure trivy-operator to use single ImagePullSecret from operator namespace without enabling global secret access #2053
-
Hey there, I have a question about private registries. We are running a private registry for all of our docker images (there are gatekeeper policies in place to enforce that only internal images can be deployed into the cluster). Therefore every deployment/namespace contains an Using the default The problem is that the default configuration comes with highly privileged permissions. Because - apiGroups:
- ""
resources:
- secrets
verbs:
- create
- get
- update Based on this discussion instead of using the operator:
# Do not allow access to everything (to increase security)
accessGlobalSecretsAndServiceAccount: false
# Instead configure operator to read ImagePullSecret from its own namespace
privateRegistryScanSecretsNames: {"trivy-operator":"internal-pullsecret"} But this does not work - and all scan jobs fail with Looking at the code the reason seems to be that trivy-operator/pkg/vulnerabilityreport/controller/workload.go Lines 255 to 269 in 4b1c6c3 And - in general - I can understand this requirement - because if you reference a workload namespace as the secret source that cluster-wide access is required to read the data. But if the namespace is the operator namespace this is not needed - because the default role already contains the required permissions to read kubernetes secrets: trivy-operator/deploy/helm/templates/rbac/role.yaml Lines 18 to 25 in 4b1c6c3 Question
Kind Regard Malte |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @chen-keinan, any thoughts on this? 🙂 |
Beta Was this translation helpful? Give feedback.
-
please open issue for it. btw: contributions are welcome! |
Beta Was this translation helpful? Give feedback.
please open issue for it.
btw: contributions are welcome!