Skip to content

Commit 1827df5

Browse files
committed
trivy-operator integration with kube-enforcer
With this change, we are replacing starboard operator with trivy operator 1. We have updated kube_enforcer,kube_enforcer_advanced manifest files with Trivy Operator Resources 2. Moved starboard manifest files to kube_enforcer_starbaord and kube_enforcer_advanced_starboard 3. Updated relevant gen_ke_certs.sh and readme files Reference PR: aquasecurity#566 4. Upgraded trivy-operator version to latest (0.20.1)as the existing version has critical vulnerabilities 5. Upgraded kube-bench version with latest (v0.7.3) Reference PR: aquasecurity#567 6. Added keys for Admission Control when the GW is disconnected, Enable workload discovery, Register discovered pod images, and Add discovered registries. 7. Removed the AQUA_WATCH_CONFIG_AUDIT_REPORT key as it is no longer supported. Reference PR: aquasecurity#565
1 parent f287ae9 commit 1827df5

24 files changed

+3418
-3390
lines changed

enforcers/kube_enforcer/kubernetes_and_openshift/manifests/kube_enforcer/001_kube_enforcer_config.yaml

Lines changed: 918 additions & 174 deletions
Large diffs are not rendered by default.

enforcers/kube_enforcer/kubernetes_and_openshift/manifests/kube_enforcer/003_kube_enforcer_deploy.yaml

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -93,63 +93,100 @@ spec:
9393
apiVersion: apps/v1
9494
kind: Deployment
9595
metadata:
96-
name: starboard-operator
96+
name: trivy-operator
9797
namespace: aqua
9898
labels:
99-
app: starboard-operator
99+
app.kubernetes.io/name: trivy-operator
100+
app.kubernetes.io/instance: trivy-operator
101+
app.kubernetes.io/version: "0.20.1"
102+
app.kubernetes.io/managed-by: kubectl
100103
spec:
101104
replicas: 1
102105
strategy:
103106
type: Recreate
104107
selector:
105108
matchLabels:
106-
app: starboard-operator
109+
app.kubernetes.io/name: trivy-operator
110+
app.kubernetes.io/instance: trivy-operator
107111
template:
108112
metadata:
109113
labels:
110-
app: starboard-operator
114+
app.kubernetes.io/name: trivy-operator
115+
app.kubernetes.io/instance: trivy-operator
111116
spec:
112-
serviceAccountName: starboard-operator
117+
serviceAccountName: trivy-operator
113118
automountServiceAccountToken: true
114-
securityContext: {}
115119
containers:
116-
- name: operator
117-
image: docker.io/aquasec/starboard-operator:0.15.20
120+
- name: "trivy-operator"
121+
image: "docker.io/aquasec/trivy-operator:0.20.1"
118122
imagePullPolicy: IfNotPresent
119-
securityContext:
120-
privileged: false
121-
readOnlyRootFilesystem: true
122-
allowPrivilegeEscalation: false
123-
capabilities:
124-
drop:
125-
- ALL
126123
env:
127124
- name: OPERATOR_NAMESPACE
128125
value: aqua
129126
- name: OPERATOR_TARGET_NAMESPACES
130127
value: ""
128+
- name: OPERATOR_EXCLUDE_NAMESPACES
129+
value: ""
130+
- name: OPERATOR_TARGET_WORKLOADS
131+
value: "pod,replicaset,replicationcontroller,statefulset,daemonset,cronjob,job"
132+
- name: OPERATOR_SERVICE_ACCOUNT
133+
value: "trivy-operator"
131134
- name: OPERATOR_LOG_DEV_MODE
132-
value: "false"
135+
value: "true"
136+
- name: OPERATOR_SCAN_JOB_TIMEOUT
137+
value: "5m"
133138
- name: OPERATOR_CONCURRENT_SCAN_JOBS_LIMIT
134139
value: "10"
135140
- name: OPERATOR_SCAN_JOB_RETRY_AFTER
136-
value: 30s
141+
value: "30s"
142+
- name: OPERATOR_BATCH_DELETE_LIMIT
143+
value: "10"
144+
- name: OPERATOR_BATCH_DELETE_DELAY
145+
value: "10s"
137146
- name: OPERATOR_METRICS_BIND_ADDRESS
138-
value: :8080
139-
- name: OPERATOR_HEALTH_PROBE_BIND_ADDRESS
140-
value: :9090
141-
- name: OPERATOR_CIS_KUBERNETES_BENCHMARK_ENABLED
147+
value: ":8080"
148+
- name: OPERATOR_METRICS_FINDINGS_ENABLED
149+
value: "true"
150+
- name: OPERATOR_METRICS_VULN_ID_ENABLED
142151
value: "false"
152+
- name: OPERATOR_HEALTH_PROBE_BIND_ADDRESS
153+
value: ":9090"
143154
- name: OPERATOR_VULNERABILITY_SCANNER_ENABLED
144155
value: "false"
145-
- name: OPERATOR_CONFIG_AUDIT_SCANNER_SCAN_ONLY_CURRENT_REVISIONS
156+
- name: OPERATOR_VULNERABILITY_SCANNER_SCAN_ONLY_CURRENT_REVISIONS
157+
value: "true"
158+
- name: OPERATOR_SCANNER_REPORT_TTL
159+
value: "24h"
160+
- name: OPERATOR_SBOM_GENERATION_ENABLED
161+
value: "false"
162+
- name: OPERATOR_CONFIG_AUDIT_SCANNER_ENABLED
146163
value: "true"
147-
- name: OPERATOR_BATCH_DELETE_LIMIT
148-
value: "10"
149-
- name: OPERATOR_BATCH_DELETE_DELAY
150-
value: "10s"
151164
- name: OPERATOR_CLUSTER_COMPLIANCE_ENABLED
152165
value: "false"
166+
- name: OPERATOR_RBAC_ASSESSMENT_SCANNER_ENABLED
167+
value: "true"
168+
- name: OPERATOR_INFRA_ASSESSMENT_SCANNER_ENABLED
169+
value: "false"
170+
- name: OPERATOR_CONFIG_AUDIT_SCANNER_SCAN_ONLY_CURRENT_REVISIONS
171+
value: "true"
172+
- name: OPERATOR_EXPOSED_SECRET_SCANNER_ENABLED
173+
value: "false"
174+
- name: OPERATOR_WEBHOOK_BROADCAST_URL
175+
value: ""
176+
- name: OPERATOR_WEBHOOK_BROADCAST_TIMEOUT
177+
value: "30s"
178+
- name: OPERATOR_PRIVATE_REGISTRY_SCAN_SECRETS_NAMES
179+
value: "{}"
180+
- name: OPERATOR_ACCESS_GLOBAL_SECRETS_SERVICE_ACCOUNTS
181+
value: "true"
182+
- name: OPERATOR_BUILT_IN_TRIVY_SERVER
183+
value: "false"
184+
- name: TRIVY_SERVER_HEALTH_CHECK_CACHE_EXPIRATION
185+
value: "10h"
186+
- name: OPERATOR_MERGE_RBAC_FINDING_WITH_CONFIG_AUDIT
187+
value: "true"
188+
- name: CONTROLLER_CACHE_SYNC_TIMEOUT
189+
value: "5m"
153190
ports:
154191
- name: metrics
155192
containerPort: 8080
@@ -171,3 +208,14 @@ spec:
171208
periodSeconds: 10
172209
successThreshold: 1
173210
failureThreshold: 10
211+
resources:
212+
{}
213+
securityContext:
214+
allowPrivilegeEscalation: false
215+
capabilities:
216+
drop:
217+
- ALL
218+
privileged: false
219+
readOnlyRootFilesystem: true
220+
securityContext:
221+
{}

enforcers/kube_enforcer/kubernetes_and_openshift/manifests/kube_enforcer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This repository shows the manifest yaml files required to deploy Aqua KubeEnforc
77
* OpenShift
88
* Kubernetes engines: EKS, GKE, ICP, AKS, TKG, and TKGI
99

10-
Starboard is deployed with the KubeEnforcer to increase the effectiveness of Kubernetes security.
10+
Trivy Operator is deployed with the KubeEnforcer to increase the effectiveness of Kubernetes security.
1111

12-
Starboard assesses workload compliance throughout the lifecycle of the workloads. This enables the KubeEnforcer to:
12+
Trivy Operator assesses workload compliance throughout the lifecycle of the workloads. This enables the KubeEnforcer to:
1313
* Re-evaluate workload compliance during workload runtime, taking any workload and policy changes into account
1414
* Reflect the results of compliance evaluation in the Aqua UI at all times, not only when workloads are created
1515

enforcers/kube_enforcer/kubernetes_and_openshift/manifests/kube_enforcer/gen_ke_certs.sh

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,39 +100,30 @@ EOF
100100
fi
101101
}
102102

103-
# for using custom namespace instead of AQUA NS download the 001_kube_enforcer_config.yaml, make changes to it and keep it in current directory where this script is running
104-
_prepare_ke() {
103+
_prepare_ke() {
105104
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
106105
_rootCA=$(cat rootCA.crt | base64 | tr -d '\n' | tr -d '\r')
107-
local_config_file="./001_kube_enforcer_config.yaml" # path of local 001_kube_enforcer_config.yaml file
108-
109-
if test -f "$local_config_file"; then
110-
# Add CA bundle to the local KubeEnforcer config file
106+
githubBranch="2022.4"
107+
if test -f "$script_dir/001_kube_enforcer_config.yaml"; then
111108
_addCABundle=$(sed -i'.original' "s/caBundle.*/caBundle\:\ $_rootCA/g" "$script_dir/001_kube_enforcer_config.yaml")
112109
if eval "$_addCABundle"; then
113-
printf "\nInfo: Successfully prepared config.yaml manifest file.\n"
110+
printf "\nInfo: Successfully prepared 001_kube_enforcer_config.yaml manifest file.\n"
114111
_deploy_ke_admin
115112
else
116113
printf "\nError: Failed to prepare KubeEnforcer config file from local"
117114
exit 1
118115
fi
119-
else # for deploying kube enforcer in default namespace, i.e., AQUA.
120-
printf "\nInfo: Local config file not found, attempting to download from GitHub\n"
121-
githubBranch="2022.4"
122-
if curl https://raw.githubusercontent.com/aquasecurity/deployments/$githubBranch/enforcers/kube_enforcer/kubernetes_and_openshift/manifests/kube_enforcer/001_kube_enforcer_config.yaml -o "$local_config_file"; then
123-
# Add CA bundle to the downloaded KubeEnforcer config file
124-
_addCABundle=$(sed -i'.original' "s/caBundle.*/caBundle\:\ $_rootCA/g" "$local_config_file")
125-
if eval "$_addCABundle"; then
126-
printf "\nInfo: Successfully prepared config.yaml manifest file.\n"
127-
_deploy_ke_admin
128-
else
129-
printf "\nError: Failed to prepare KubeEnforcer config file from GitHub"
130-
exit 1
131-
fi
116+
elif curl https://raw.githubusercontent.com/aquasecurity/deployments/$githubBranch/enforcers/kube_enforcer/kubernetes_and_openshift/manifests/kube_enforcer/001_kube_enforcer_config.yaml -o "001_kube_enforcer_config.yaml"; then
117+
_addCABundle=$(sed -i'.original' "s/caBundle.*/caBundle\:\ $_rootCA/g" "$script_dir/001_kube_enforcer_config.yaml")
118+
if eval "$_addCABundle"; then
119+
printf "\nInfo: Successfully prepared 001_kube_enforcer_config.yaml manifest file.\n"
120+
_deploy_ke_admin
132121
else
133-
printf "\nError: Failed to download config.yaml manifest file from GitHub"
122+
printf "\nError: Failed to prepare KubeEnforcer config file from github"
134123
exit 1
135124
fi
125+
else
126+
printf "\nError: Failed to download 001_kube_enforcer_config.yaml manifest file"
136127
fi
137128
}
138129

0 commit comments

Comments
 (0)