From 23cadd2fe043467c5bf0f721081f90a8f0c64812 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sun, 11 Dec 2022 02:07:54 +0200 Subject: [PATCH] fix(apps): decode keys before reencode (#5258) * fix(meshcentral): decode sessionkey before reencode * fix(netbox): decode key before reencoding and fix UI issues * couple more fixes --- charts/incubator/docspell/Chart.yaml | 2 +- .../incubator/docspell/templates/_secret.tpl | 6 +- charts/incubator/euterpe/Chart.yaml | 2 +- .../incubator/euterpe/templates/_secret.tpl | 6 +- charts/incubator/fireshare/Chart.yaml | 2 +- .../fireshare/templates/_secrets.tpl | 9 +- charts/incubator/netbox/Chart.yaml | 2 +- charts/incubator/netbox/questions.yaml | 89 ++++++++++--------- charts/incubator/netbox/templates/_secret.tpl | 6 +- charts/stable/meshcentral/Chart.yaml | 2 +- .../stable/meshcentral/templates/_secret.tpl | 6 +- charts/stable/meshcentral/values.yaml | 4 +- 12 files changed, 67 insertions(+), 69 deletions(-) diff --git a/charts/incubator/docspell/Chart.yaml b/charts/incubator/docspell/Chart.yaml index 9d003acf5e3..7f064dc292c 100644 --- a/charts/incubator/docspell/Chart.yaml +++ b/charts/incubator/docspell/Chart.yaml @@ -28,7 +28,7 @@ sources: - https://github.com/eikek/docspell - https://docspell.org/docs/install/docker/ - https://docspell.org/docs/configure/defaults/ -version: 3.0.10 +version: 3.0.11 annotations: truecharts.org/catagories: | - productivity diff --git a/charts/incubator/docspell/templates/_secret.tpl b/charts/incubator/docspell/templates/_secret.tpl index 4b88cb6e9f4..55677c54ee3 100644 --- a/charts/incubator/docspell/templates/_secret.tpl +++ b/charts/incubator/docspell/templates/_secret.tpl @@ -14,8 +14,8 @@ {{- $server_secret := "" }} {{- with (lookup "v1" "Secret" .Release.Namespace $storeSecretName) }} {{- $server_secret = (index .data "server_secret") }} -{{- else }} -{{- $server_secret = printf "b64:%v" (randAlphaNum 32 | b64enc) }} +{{- else }} {{/* Real content must be also b64 encoded */}} +{{- $server_secret = (printf "b64:%v" (randAlphaNum 32 | b64enc)) | b64enc }} {{- end }} {{- $new_invite_password := "" }} @@ -34,7 +34,7 @@ metadata: name: {{ $storeSecretName }} labels: {{- include "tc.common.labels" . | nindent 4 }} -stringData: +data: server_secret: {{ $server_secret }} new_invite_password: {{ $new_invite_password }} --- diff --git a/charts/incubator/euterpe/Chart.yaml b/charts/incubator/euterpe/Chart.yaml index 8fd14f5bf28..6b222fa23af 100644 --- a/charts/incubator/euterpe/Chart.yaml +++ b/charts/incubator/euterpe/Chart.yaml @@ -25,7 +25,7 @@ sources: - https://github.com/ironsmile/euterpe - https://hub.docker.com/r/ironsmile/euterpe type: application -version: 3.0.0 +version: 3.0.1 annotations: truecharts.org/catagories: | - Productivity diff --git a/charts/incubator/euterpe/templates/_secret.tpl b/charts/incubator/euterpe/templates/_secret.tpl index d0e54ff1604..1cc8f2cc8e0 100644 --- a/charts/incubator/euterpe/templates/_secret.tpl +++ b/charts/incubator/euterpe/templates/_secret.tpl @@ -8,7 +8,7 @@ {{- with (lookup "v1" "Secret" .Release.Namespace $secretStorageName) }} {{- $secretKey = (index .data "secret") }} {{- else }} - {{- $secretKey = randAlphaNum 32 }} + {{- $secretKey = randAlphaNum 32 | b64enc }} {{- end }} --- apiVersion: v1 @@ -32,7 +32,7 @@ stringData: {{- with .Values.euterpe.authentication.password }} "password": {{ . | quote }}, {{- end }} - "secret": {{ $secretKey | quote }} + "secret": {{ $secretKey | b64dec | quote }} }, {{- $libraries := .Values.euterpe.libraries -}} @@ -74,5 +74,5 @@ metadata: {{- include "tc.common.labels" . | nindent 4 }} data: {{/* Store secretKey to reuse */}} - secret: {{ $secretKey | b64enc }} + secret: {{ $secretKey }} {{- end }} diff --git a/charts/incubator/fireshare/Chart.yaml b/charts/incubator/fireshare/Chart.yaml index 02397a09cb4..b3b20fafec4 100644 --- a/charts/incubator/fireshare/Chart.yaml +++ b/charts/incubator/fireshare/Chart.yaml @@ -6,7 +6,7 @@ dependencies: repository: https://library-charts.truecharts.org version: 11.0.4 description: "Share your game clips, videos, or other media via unique links." -version: 2.0.2 +version: 2.0.3 deprecated: false home: https://truecharts.org/docs/charts/incubator/fireshare icon: https://truecharts.org/img/hotlink-ok/chart-icons/fireshare.png diff --git a/charts/incubator/fireshare/templates/_secrets.tpl b/charts/incubator/fireshare/templates/_secrets.tpl index c65f141571e..b97c3b288ba 100644 --- a/charts/incubator/fireshare/templates/_secrets.tpl +++ b/charts/incubator/fireshare/templates/_secrets.tpl @@ -7,14 +7,11 @@ kind: Secret type: Opaque metadata: name: fireshare-secrets -{{- $fireshareprevious := lookup "v1" "Secret" .Release.Namespace "fireshare-secrets" }} -{{- $secret_key := "" }} data: - {{- if $fireshareprevious}} - SECRET_KEY: {{ index $fireshareprevious.data "SECRET_KEY" }} + {{- with (lookup "v1" "Secret" .Release.Namespace "fireshare-secrets") }} + SECRET_KEY: {{ index .data "SECRET_KEY" }} {{- else }} - {{- $secret_key := randAlphaNum 32 }} - SECRET_KEY: {{ $secret_key | b64enc }} + SECRET_KEY: {{ randAlphaNum 32 | b64enc }} {{- end }} {{- end -}} diff --git a/charts/incubator/netbox/Chart.yaml b/charts/incubator/netbox/Chart.yaml index 6c5c8e3b754..ec614a34689 100644 --- a/charts/incubator/netbox/Chart.yaml +++ b/charts/incubator/netbox/Chart.yaml @@ -27,7 +27,7 @@ name: netbox sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/netbox - https://github.com/netbox-community/netbox-docker -version: 3.0.9 +version: 3.0.10 annotations: truecharts.org/catagories: | - network diff --git a/charts/incubator/netbox/questions.yaml b/charts/incubator/netbox/questions.yaml index f82e457c965..8bbe1c0287c 100644 --- a/charts/incubator/netbox/questions.yaml +++ b/charts/incubator/netbox/questions.yaml @@ -450,7 +450,6 @@ questions: description: By default uploaded media is stored on the local filesystem. Using Django-storages is also supported. Provide the class path of the storage driver in storage_backend and any configuration options in storage_config. schema: type: string - required: true default: "" - variable: storage_config label: Storage Config @@ -496,59 +495,61 @@ questions: schema: type: boolean default: false - - variable: backend - label: Backend - schema: - type: string - required: true - default: "" - - variable: header - label: Header - schema: - type: string - required: true - default: "" - - variable: auto_create_user - label: Auto Create User - schema: - type: boolean - default: false - - variable: default_groups - label: Default Groups - schema: - type: list - default: [] - items: - - variable: default_group_entry - label: Default Group + show_subquestions_if: true + subquestions: + - variable: backend + label: Backend schema: type: string required: true default: "" - - variable: default_permissions - label: Default Permissions - schema: - type: list - default: [] - items: - - variable: default_permissions_entry - label: Default Permission Entry + - variable: header + label: Header schema: - type: dict - additional_attrs: true - attrs: - - variable: key - label: Key + type: string + required: true + default: "" + - variable: auto_create_user + label: Auto Create User + schema: + type: boolean + default: false + - variable: default_groups + label: Default Groups + schema: + type: list + default: [] + items: + - variable: default_group_entry + label: Default Group schema: type: string required: true default: "" - - variable: value - label: Value + - variable: default_permissions + label: Default Permissions + schema: + type: list + default: [] + items: + - variable: default_permissions_entry + label: Default Permission Entry schema: - type: string - required: true - default: "" + type: dict + additional_attrs: true + attrs: + - variable: key + label: Key + schema: + type: string + required: true + default: "" + - variable: value + label: Value + schema: + type: string + required: true + default: "" - variable: date_time label: Date Time description: Date/time formatting. See the following link for supported formats https://docs.djangoproject.com/en/stable/ref/templates/builtins/#date diff --git a/charts/incubator/netbox/templates/_secret.tpl b/charts/incubator/netbox/templates/_secret.tpl index 6d53f94fded..12b2c97f506 100644 --- a/charts/incubator/netbox/templates/_secret.tpl +++ b/charts/incubator/netbox/templates/_secret.tpl @@ -7,7 +7,7 @@ {{- with (lookup "v1" "Secret" .Release.Namespace $secretName) }} {{- $secret_key = (index .data "secret_key") }} {{- else }} - {{- $secret_key = randAlphaNum 64 }} + {{- $secret_key = randAlphaNum 64 | b64enc }} {{- end }} --- @@ -20,7 +20,7 @@ metadata: labels: {{- include "tc.common.labels" . | nindent 4 }} data: - secret_key: {{ $secret_key | b64enc }} + secret_key: {{ $secret_key }} stringData: config.py: | ALLOWED_HOSTS = [ @@ -57,7 +57,7 @@ stringData: } } - SECRET_KEY = '{{ $secret_key }}' + SECRET_KEY = '{{ $secret_key | b64dec }}' {{- with .Values.netbox.admins }} ADMINS = [ diff --git a/charts/stable/meshcentral/Chart.yaml b/charts/stable/meshcentral/Chart.yaml index c782314c458..288b75db7cc 100644 --- a/charts/stable/meshcentral/Chart.yaml +++ b/charts/stable/meshcentral/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 kubeVersion: ">=1.16.0-0" name: meshcentral -version: 9.0.11 +version: 9.0.12 appVersion: "1.1.1" description: MeshCentral is a full computer management web site type: application diff --git a/charts/stable/meshcentral/templates/_secret.tpl b/charts/stable/meshcentral/templates/_secret.tpl index 0659d069889..7d18b0867f6 100644 --- a/charts/stable/meshcentral/templates/_secret.tpl +++ b/charts/stable/meshcentral/templates/_secret.tpl @@ -32,7 +32,7 @@ {{- with (lookup "v1" "Secret" .Release.Namespace $secretStorageName) }} {{- $sessionKey = (index .data "session_key") }} {{- else }} - {{- $sessionKey = randAlphaNum 32 }} + {{- $sessionKey = randAlphaNum 32 | b64enc}} {{- end }} {{/* Inject some values */}} @@ -44,7 +44,7 @@ {{- $_ := set $config.settings "mongoDB" (.Values.mongodb.url.complete | trimAll "\"") }} {{- $_ := set $config.settings "mongoDbName" .Values.mongodb.mongodbDatabase }} -{{- $_ := set $config.settings "sessionKey" $sessionKey }} +{{- $_ := set $config.settings "sessionKey" ($sessionKey | b64dec) }} {{- $_ := set $config.settings "port" .Values.service.main.ports.main.port }} {{/* Force disable some functions that are not appliable in docker */}} @@ -77,7 +77,7 @@ metadata: {{- include "tc.common.labels" . | nindent 4 }} data: {{/* Store session_key to reuse */}} - session_key: {{ $sessionKey | b64enc }} + session_key: {{ $sessionKey }} --- diff --git a/charts/stable/meshcentral/values.yaml b/charts/stable/meshcentral/values.yaml index 1f2badf1d41..a6bacc04987 100644 --- a/charts/stable/meshcentral/values.yaml +++ b/charts/stable/meshcentral/values.yaml @@ -1,7 +1,7 @@ image: - repository: ghcr.io/ylianst/meshcentral + repository: tccr.io/truecharts/meshcentral pullPolicy: IfNotPresent - tag: 1.1.1@sha256:fc31e9430fbbbc4cbebb8a008133468d9f2ebde37afe8d67fe47f42038cc687b + tag: 1.1.1@sha256:1719ae34bfec743049d5e415d9a89a472e707fb9dfb1f64c33df70141db09032 command: - node