From 68facb9c33581109e2629be8f2e1bcbdab30474a Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:46:16 +0300 Subject: [PATCH] fix(nextcloud): make sure no port is added in the trusted domains (#9731) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [x] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 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/incubator/nextcloud/Chart.yaml | 2 +- charts/incubator/nextcloud/questions.yaml | 5 +++-- charts/incubator/nextcloud/templates/_configmap.tpl | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/charts/incubator/nextcloud/Chart.yaml b/charts/incubator/nextcloud/Chart.yaml index dce908277b5..3e1fca5b7a3 100644 --- a/charts/incubator/nextcloud/Chart.yaml +++ b/charts/incubator/nextcloud/Chart.yaml @@ -29,7 +29,7 @@ sources: - https://github.com/nextcloud/docker - https://github.com/nextcloud/helm type: application -version: 20.0.1 +version: 20.0.2 annotations: truecharts.org/catagories: | - cloud diff --git a/charts/incubator/nextcloud/questions.yaml b/charts/incubator/nextcloud/questions.yaml index d4826cc97a1..f06d319b9c9 100644 --- a/charts/incubator/nextcloud/questions.yaml +++ b/charts/incubator/nextcloud/questions.yaml @@ -392,7 +392,8 @@ questions: label: Allow List schema: type: list - default: ["0.0.0.0/0"] + default: + - "0.0.0.0/0" items: - variable: allow_entry label: Allow Entry @@ -415,7 +416,7 @@ questions: You need to deploy it yourself. schema: type: boolean - default: true + default: false show_subquestions_if: true subquestions: - variable: url diff --git a/charts/incubator/nextcloud/templates/_configmap.tpl b/charts/incubator/nextcloud/templates/_configmap.tpl index 5502964f450..0132c1636c4 100644 --- a/charts/incubator/nextcloud/templates/_configmap.tpl +++ b/charts/incubator/nextcloud/templates/_configmap.tpl @@ -14,6 +14,8 @@ {{- $accessUrl = printf "%v://%v:%v" $prot $host $port -}} {{- end -}} {{- end -}} +{{- $accessHost := regexReplaceAll ".*://(.*)" $accessUrl "${1}" -}} +{{- $accessHost = regexReplaceAll "(.*):.*" $accessUrl "${1}" -}} {{- $accessHostPort := regexReplaceAll ".*://(.*)" $accessUrl "${1}" -}} {{- $accessProtocol := regexReplaceAll "(.*)://.*" $accessUrl "${1}" -}} {{- $redisHost := .Values.redis.creds.plainhost | trimAll "\"" -}} @@ -34,6 +36,7 @@ redis-session: enabled: true data: redis-session.ini: | + session.save_handler = redis session.save_path = {{ printf "tcp://%v:6379?auth=%v" $redisHost $redisPass | quote }} redis.session.locking_enabled = 1 redis.session.lock_retries = -1 @@ -175,8 +178,8 @@ nextcloud-config: {{ $fullname }} {{ printf "%v-*" $fullname }} {{ $healthHost }} - {{- if not (contains "127.0.0.1" $accessHostPort) }} - {{- $accessHostPort | nindent 6 }} + {{- if not (contains "127.0.0.1" $accessHost) }} + {{- $accessHost | nindent 6 }} {{- end -}} {{- with .Values.nextcloud.general.accessIP }} {{- . | nindent 6 }}