From aad6b18142ba67ea994627a600e09e4734caeb67 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:41:29 -0400 Subject: [PATCH] fix(anonaddy) fix secret and app key **BREAKING CHANGES** (#12189) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** A breaking change due to the secrets need to be larger due the issue Uncaught RuntimeException: Unsupported cipher or incorrect key length. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [X] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- charts/stable/anonaddy/Chart.yaml | 2 +- charts/stable/anonaddy/templates/_appkey.tpl | 21 ------------------- charts/stable/anonaddy/templates/_secrets.tpl | 16 ++++++++++++++ charts/stable/anonaddy/templates/common.yaml | 12 +++++------ charts/stable/anonaddy/values.yaml | 16 +++++++------- 5 files changed, 31 insertions(+), 36 deletions(-) delete mode 100644 charts/stable/anonaddy/templates/_appkey.tpl create mode 100644 charts/stable/anonaddy/templates/_secrets.tpl diff --git a/charts/stable/anonaddy/Chart.yaml b/charts/stable/anonaddy/Chart.yaml index 232ebafdec9..bdbecd5bbba 100644 --- a/charts/stable/anonaddy/Chart.yaml +++ b/charts/stable/anonaddy/Chart.yaml @@ -26,7 +26,7 @@ name: anonaddy sources: - https://github.com/truecharts/charts/tree/master/charts/stable/anonaddy - https://github.com/anonaddy/docker -version: 14.0.0 +version: 15.0.0 annotations: truecharts.org/catagories: | - email diff --git a/charts/stable/anonaddy/templates/_appkey.tpl b/charts/stable/anonaddy/templates/_appkey.tpl deleted file mode 100644 index 9f19b8c7185..00000000000 --- a/charts/stable/anonaddy/templates/_appkey.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{{/* -This template generates a random password and ensures it persists across updates/edits to the chart -*/}} -{{- define "anonaddy.appkey" -}} -enabled: true -{{- $keyprevious := lookup "v1" "Secret" .Release.Namespace "appkey" }} -{{- $appkey := "" }} -{{- $secret := "" }} -data: -{{- if $keyprevious }} - {{- $appkey = ( index $keyprevious.data "appkey" ) }} - {{- $secret = ( index $keyprevious.data "secret" ) }} - appkey: {{ ( index $keyprevious.data "appkey" ) }} - secret: {{ ( index $keyprevious.data "secret" ) }} -{{- else }} - {{- $appkey = randAlphaNum 32 }} - {{- $secret = randAlphaNum 32 }} - appkey: {{ $appkey | b64enc }} - secret: {{ $secret | b64enc }} -{{- end }} -{{- end -}} diff --git a/charts/stable/anonaddy/templates/_secrets.tpl b/charts/stable/anonaddy/templates/_secrets.tpl new file mode 100644 index 00000000000..39268761c34 --- /dev/null +++ b/charts/stable/anonaddy/templates/_secrets.tpl @@ -0,0 +1,16 @@ +{{/* Define the secrets */}} +{{- define "anonaddy.secrets" -}} +{{- $secretName := (printf "%s-anonaddy-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }} + +{{- $appKey := randAlphaNum 64 -}} +{{- $secretKey := randAlphaNum 64 -}} + + {{- with lookup "v1" "Secret" .Release.Namespace $secretName -}} + {{- $authKey = index .data "APP_KEY" | b64dec -}} + {{- $secretKey = index .data "ANONADDY_SECRET" | b64dec -}} + {{- end }} +enabled: true +data: + APP_KEY: {{ $appKey }} + ANONADDY_SECRET: {{ $secretKey }} +{{- end -}} diff --git a/charts/stable/anonaddy/templates/common.yaml b/charts/stable/anonaddy/templates/common.yaml index 886ce2dd56b..5481d6876f4 100644 --- a/charts/stable/anonaddy/templates/common.yaml +++ b/charts/stable/anonaddy/templates/common.yaml @@ -1,11 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.v1.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . -}} -{{/* Render appkey for anonaddy */}} -{{- $secret := include "anonaddy.appkey" . | fromYaml -}} -{{- if $secret -}} - {{- $_ := set .Values.secret "appkey" $secret -}} +{{/* Render secrets for anonaddy */}} +{{- $secrets := include "anonaddy.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "anonaddy-secrets" $secrets -}} {{- end -}} {{/* Render the templates */}} -{{ include "tc.v1.common.loader.apply" . }} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/anonaddy/values.yaml b/charts/stable/anonaddy/values.yaml index 0628b860bfd..a48bbc669bf 100644 --- a/charts/stable/anonaddy/values.yaml +++ b/charts/stable/anonaddy/values.yaml @@ -65,22 +65,18 @@ workload: key: redis-password APP_KEY: secretKeyRef: - name: appkey - key: appkey + name: anonaddy-secrets + key: APP_KEY ANONADDY_SECRET: secretKeyRef: - name: appkey - key: secret + name: anonaddy-secrets + key: ANONADDY_SECRET persistence: config: enabled: true mountPath: /config -portal: - open: - enabled: true - redis: enabled: true @@ -88,3 +84,7 @@ mariadb: enabled: true mariadbUsername: anonaddy mariadbDatabase: anonaddy + +portal: + open: + enabled: true