Skip to content
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

fix: policies bundle insecure #2100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: policies bundle insecure
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan committed May 26, 2024
commit 13969481d587ce9e54e9ee7734a3704206417cbb
1 change: 1 addition & 0 deletions deploy/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Keeps security report resources updated
| podAnnotations | object | `{}` | podAnnotations annotations added to the operator's pod |
| podSecurityContext | object | `{}` | |
| policiesBundle.existingSecret | bool | `false` | existingSecret if a secret containing registry credentials that have been created outside the chart (e.g external-secrets, sops, etc...). Keys must be at least one of the following: policies.bundle.oci.user, policies.bundle.oci.password Overrides policiesBundle.registryUser, policiesBundle.registryPassword values. Note: The secret has to be named "trivy-operator". |
| policiesBundle.insecure | bool | `false` | insecure is the flag to enable insecure connection to the policy bundle registry |
| policiesBundle.registry | string | `"ghcr.io"` | registry of the policies bundle |
| policiesBundle.registryPassword | string | `nil` | registryPassword is the password for the registry |
| policiesBundle.registryUser | string | `nil` | registryUser is the user for the registry |
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/configmaps/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ data:
{{- end }}
node.collector.imageRef: "{{ include "global.imageRegistry" . | default .Values.nodeCollector.registry }}/{{ .Values.nodeCollector.repository }}:{{ .Values.nodeCollector.tag }}"
policies.bundle.oci.ref: "{{ .Values.policiesBundle.registry }}/{{ .Values.policiesBundle.repository }}:{{ .Values.policiesBundle.tag }}"
policies.bundle.insecure: {{ .Values.policiesBundle.insecure | quote }}
{{- with .Values.nodeCollector.imagePullSecret }}
node.collector.imagePullSecret: "{{ . }}"
{{- end }}

node.collector.nodeSelector: {{ .Values.nodeCollector.useNodeSelector | quote }}
2 changes: 2 additions & 0 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ policiesBundle:
# Overrides policiesBundle.registryUser, policiesBundle.registryPassword values.
# Note: The secret has to be named "trivy-operator".
existingSecret: false
# -- insecure is the flag to enable insecure connection to the policy bundle registry
insecure: false


nodeCollector:
Expand Down
2 changes: 2 additions & 0 deletions deploy/static/trivy-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,8 @@ data:
report.recordFailedChecksOnly: "true"
node.collector.imageRef: "ghcr.io/aquasecurity/node-collector:0.2.1"
policies.bundle.oci.ref: "ghcr.io/aquasecurity/trivy-checks:0"
policies.bundle.insecure: "false"

node.collector.nodeSelector: "true"
---
# Source: trivy-operator/templates/configmaps/policies.yaml
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ func buildPolicyLoader(tc trivyoperator.ConfigData) (policy.Loader, error) {
Password: registryPassword,
},
},
Insecure: tc.PolicyBundleInsecure(),
}
artifact.RegistryOptions = ro
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/trivyoperator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const (
KeyTrivyServerURL = "trivy.serverURL"
KeyNodeCollectorImageRef = "node.collector.imageRef"
KeyPoliciesBundleOciRef = "policies.bundle.oci.ref"
KeyPoliciesBundleInsecure = "policies.bundle.insecure"
KeyPoliciesBundleOciUser = "policies.bundle.oci.user"
KeyPoliciesBundleOciPassword = "policies.bundle.oci.password"
KeyNodeCollectorImagePullSecret = "node.collector.imagePullSecret"
Expand Down Expand Up @@ -440,6 +441,9 @@ func (c ConfigData) NodeCollectorImageRef() string {
func (c ConfigData) PolicyBundleOciRef() string {
return c[KeyPoliciesBundleOciRef]
}
func (c ConfigData) PolicyBundleInsecure() bool {
return c.getBoolKey(KeyPoliciesBundleInsecure)
}

func (c ConfigData) PolicyBundleOciUser() string {
return c[KeyPoliciesBundleOciUser]
Expand Down
Loading