Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit a5fdd4f

Browse files
authored
[kibana] optionally disable SA token automount (#1301)
Kibana has no direct interaction with the Kubernetes API, and as such, it does not need a mounted service account token in its pods. By disabling this automount, potential attackers cannot access the API on behalf/through the Pod. This commit allows users to opt out on SA token automount, but leaves leaves current behaviour untouched to avoid breaking things. Signed-off-by: Jorik Jonker <[email protected]>
1 parent 97c0e58 commit a5fdd4f

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

kibana/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ as a reference. They are also used in the automated testing of this chart.
8080
| Parameter | Description | Default |
8181
|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
8282
| `affinity` | Configurable [affinity][] | `{}` |
83+
| `automountToken` | Whether or not to automount the service account token in the Pod | `true` |
8384
| `elasticsearchHosts` | The URLs used to connect to Elasticsearch | `http://elasticsearch-master:9200` |
8485
| `envFrom` | Templatable string to be passed to the [environment from variables][] which will be appended to the `envFrom:` definition for the container | `[]` |
8586
| `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` |

kibana/templates/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ spec:
2828
configchecksum: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }}
2929
{{- end }}
3030
spec:
31+
automountServiceAccountToken: {{ .Values.automountToken }}
3132
{{- if .Values.priorityClassName }}
3233
priorityClassName: {{ .Values.priorityClassName }}
3334
{{- end }}

kibana/tests/kibana_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,3 +756,28 @@ def test_hostaliases():
756756
r = helm_template(config)
757757
hostAliases = r["deployment"][name]["spec"]["template"]["spec"]["hostAliases"]
758758
assert {"ip": "127.0.0.1", "hostnames": ["foo.local", "bar.local"]} in hostAliases
759+
760+
761+
def test_default_automount_sa_token():
762+
config = """
763+
"""
764+
r = helm_template(config)
765+
assert (
766+
r["deployment"][name]["spec"]["template"]["spec"][
767+
"automountServiceAccountToken"
768+
]
769+
== True
770+
)
771+
772+
773+
def test_disable_automount_sa_token():
774+
config = """
775+
automountToken: false
776+
"""
777+
r = helm_template(config)
778+
assert (
779+
r["deployment"][name]["spec"]["template"]["spec"][
780+
"automountServiceAccountToken"
781+
]
782+
== False
783+
)

kibana/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ securityContext:
8080

8181
serviceAccount: ""
8282

83+
# Whether or not to automount the service account token in the pod. Normally, Kibana does not need this
84+
automountToken: true
85+
8386
# This is the PriorityClass settings as defined in
8487
# https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
8588
priorityClassName: ""

0 commit comments

Comments
 (0)