-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bitnami/kubeapps] feat!: 🔒 💥 Improve security defaults (#24809)
* [bitnami/kubeapps] feat!: 🔒 💥 Improve security defaults Signed-off-by: Javier Salmeron Garcia <[email protected]> * chore: 🔥 Remove unnecessary section in netpols Signed-off-by: Javier Salmeron Garcia <[email protected]> --------- Signed-off-by: Javier Salmeron Garcia <[email protected]>
- Loading branch information
Showing
27 changed files
with
756 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
dependencies: | ||
- name: redis | ||
repository: oci://registry-1.docker.io/bitnamicharts | ||
version: 18.19.2 | ||
version: 19.0.2 | ||
- name: postgresql | ||
repository: oci://registry-1.docker.io/bitnamicharts | ||
version: 13.4.6 | ||
version: 15.2.1 | ||
- name: common | ||
repository: oci://registry-1.docker.io/bitnamicharts | ||
version: 2.19.0 | ||
digest: sha256:b4965a22517e61212e78abb8d1cbe86e800c8664b3139e2047f4bd62b3e55b24 | ||
generated: "2024-03-13T11:51:34.216594+01:00" | ||
version: 2.19.1 | ||
digest: sha256:d64105d1430715a1fb7d70d0374d41d3e89060a673e97ed9eb8d6e2737826f2e | ||
generated: "2024-04-02T12:29:24.392238637+02:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
bitnami/kubeapps/templates/apprepository/networkpolicy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{{- /* | ||
Copyright VMware, Inc. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{- if and .Values.packaging.helm.enabled .Values.apprepository.networkPolicy.enabled }} | ||
kind: NetworkPolicy | ||
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} | ||
metadata: | ||
name: {{ include "kubeapps.apprepository.fullname" . }} | ||
namespace: {{ include "common.names.namespace" . | quote }} | ||
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.apprepository.image "chart" .Chart ) ) }} | ||
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} | ||
app.kubernetes.io/component: apprepository | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.apprepository.podLabels .Values.commonLabels ) "context" . ) }} | ||
podSelector: | ||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} | ||
app.kubernetes.io/component: apprepository | ||
{{- if .Values.apprepository.networkPolicy.allowExternalEgress }} | ||
egress: | ||
- {} | ||
{{- else }} | ||
egress: | ||
# Allow dns resolution | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
- port: 53 | ||
protocol: TCP | ||
{{- range $port := .Values.apprepository.networkPolicy.kubeAPIServerPorts }} | ||
- port: {{ $port }} | ||
{{- end }} | ||
# Allow connection to PostgreSQL | ||
- ports: | ||
- port: {{ include "kubeapps.postgresql.port" . }} | ||
{{- if .Values.postgresql.enabled }} | ||
to: | ||
- podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: postgresql | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
{{- if .Values.apprepository.networkPolicy.extraEgress }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.apprepository.networkPolicy.extraEgress "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
ingress: | ||
{{- if .Values.apprepository.networkPolicy.extraIngress }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.apprepository.networkPolicy.extraIngress "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{{- /* | ||
Copyright VMware, Inc. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{- if and .Values.dashboard.enabled .Values.dashboard.networkPolicy.enabled }} | ||
kind: NetworkPolicy | ||
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} | ||
metadata: | ||
name: {{ include "kubeapps.dashboard.fullname" . }} | ||
namespace: {{ include "common.names.namespace" . | quote }} | ||
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.dashboard.image "chart" .Chart ) ) }} | ||
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} | ||
app.kubernetes.io/component: dashboard | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.dashboard.podLabels .Values.commonLabels $versionLabel ) "context" . ) }} | ||
podSelector: | ||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} | ||
app.kubernetes.io/component: dashboard | ||
{{- if .Values.dashboard.networkPolicy.allowExternalEgress }} | ||
egress: | ||
- {} | ||
{{- else }} | ||
egress: | ||
# Allow dns resolution | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
- port: 53 | ||
protocol: TCP | ||
{{- range $port := .Values.dashboard.networkPolicy.kubeAPIServerPorts }} | ||
- port: {{ $port }} | ||
{{- end }} | ||
{{- if .Values.dashboard.networkPolicy.extraEgress }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.dashboard.networkPolicy.extraEgress "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
ingress: | ||
# Allow inbound connections | ||
- ports: | ||
- port: {{ .Values.dashboard.containerPorts.http }} | ||
{{- if not .Values.dashboard.networkPolicy.allowExternal }} | ||
from: | ||
- podSelector: | ||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }} | ||
{{- if .Values.dashboard.networkPolicy.ingressNSMatchLabels }} | ||
- namespaceSelector: | ||
matchLabels: | ||
{{- range $key, $value := .Values.dashboard.networkPolicy.ingressNSMatchLabels }} | ||
{{ $key | quote }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- if .Values.dashboard.networkPolicy.ingressNSPodMatchLabels }} | ||
podSelector: | ||
matchLabels: | ||
{{- range $key, $value := .Values.dashboard.networkPolicy.ingressNSPodMatchLabels }} | ||
{{ $key | quote }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.dashboard.networkPolicy.extraIngress }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.dashboard.networkPolicy.extraIngress "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{{- /* | ||
Copyright VMware, Inc. | ||
SPDX-License-Identifier: APACHE-2.0 | ||
*/}} | ||
|
||
{{- if .Values.frontend.networkPolicy.enabled }} | ||
kind: NetworkPolicy | ||
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} | ||
metadata: | ||
name: {{ include "common.names.fullname" . }} | ||
namespace: {{ include "common.names.namespace" . | quote }} | ||
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.frontend.image "chart" .Chart ) ) }} | ||
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} | ||
app.kubernetes.io/component: frontend | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.frontend.podLabels .Values.commonLabels $versionLabel ) "context" . ) }} | ||
podSelector: | ||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} | ||
app.kubernetes.io/component: frontend | ||
{{- if .Values.frontend.networkPolicy.allowExternalEgress }} | ||
egress: | ||
- {} | ||
{{- else }} | ||
egress: | ||
# Allow dns resolution | ||
- ports: | ||
- port: 53 | ||
protocol: UDP | ||
- port: 53 | ||
protocol: TCP | ||
{{- range $port := .Values.frontend.networkPolicy.kubeAPIServerPorts }} | ||
- port: {{ $port }} | ||
{{- end }} | ||
{{- if .Values.frontend.networkPolicy.extraEgress }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.frontend.networkPolicy.extraEgress "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
ingress: | ||
# Allow inbound connections | ||
- ports: | ||
- port: {{ .Values.frontend.containerPorts.http }} | ||
{{- if and .Values.authProxy.enabled (not .Values.authProxy.external) }} | ||
- port: {{ .Values.authProxy.containerPorts.proxy }} | ||
{{- end }} | ||
{{- if .Values.pinnipedProxy.enabled }} | ||
- port: {{ .Values.pinnipedProxy.containerPorts.pinnipedProxy }} | ||
{{- end }} | ||
{{- if not .Values.frontend.networkPolicy.allowExternal }} | ||
from: | ||
- podSelector: | ||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }} | ||
{{- if .Values.frontend.networkPolicy.ingressNSMatchLabels }} | ||
- namespaceSelector: | ||
matchLabels: | ||
{{- range $key, $value := .Values.frontend.networkPolicy.ingressNSMatchLabels }} | ||
{{ $key | quote }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- if .Values.frontend.networkPolicy.ingressNSPodMatchLabels }} | ||
podSelector: | ||
matchLabels: | ||
{{- range $key, $value := .Values.frontend.networkPolicy.ingressNSPodMatchLabels }} | ||
{{ $key | quote }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.frontend.networkPolicy.extraIngress }} | ||
{{- include "common.tplvalues.render" ( dict "value" .Values.frontend.networkPolicy.extraIngress "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.