From 46ec1c293a4ca8a781dbb5e6851a4d5501067314 Mon Sep 17 00:00:00 2001 From: SBado <16034687+SBado@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:05:00 +0100 Subject: [PATCH] Authelia: Add domain_regex configuration option (#16871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Add _domain_regex_ configuration option (explained here: https://www.authelia.com/configuration/security/access-control/#domain_regex) ⚒️ Fixes nothing **⚙️ Type of change** - [X] ⚙️ Feature/App addition - [ ] 🪛 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?** I'm using this option on my TrueNas installation to bypass authentication for all my subdomains for all the clients that connect from an authorized network. Using a regular expression, I don't have to modify the Authelia application when I add a new application with its subdomain. **📃 Notes:** None. **✔️ 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 - [X] ⚠️ My changes generate no new warnings - [X] 🧪 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._ --------- Signed-off-by: SBado <16034687+SBado@users.noreply.github.com> Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/enterprise/authelia/Chart.yaml | 2 +- charts/enterprise/authelia/questions.yaml | 13 +++++++++++++ charts/enterprise/authelia/templates/_configmap.tpl | 10 ++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/charts/enterprise/authelia/Chart.yaml b/charts/enterprise/authelia/Chart.yaml index 99bf55376ec..91d97ca6ae6 100644 --- a/charts/enterprise/authelia/Chart.yaml +++ b/charts/enterprise/authelia/Chart.yaml @@ -1,7 +1,7 @@ kubeVersion: ">=1.24.0-0" apiVersion: v2 name: authelia -version: 22.2.0 +version: 22.2.1 appVersion: 4.37.5 description: Authelia is a Single Sign-On Multi-Factor portal for web apps home: https://truecharts.org/charts/enterprise/authelia diff --git a/charts/enterprise/authelia/questions.yaml b/charts/enterprise/authelia/questions.yaml index f812c996668..7db6d09a5e6 100644 --- a/charts/enterprise/authelia/questions.yaml +++ b/charts/enterprise/authelia/questions.yaml @@ -796,6 +796,19 @@ questions: type: string default: "" required: true + - variable: domain_regex + label: "Domains RegEx" + description: "defines which domain or set of domains the rule applies to using regular expressions." + schema: + type: list + default: [] + items: + - variable: domainRegexEntry + label: "Domain RegEx" + schema: + type: string + default: "" + required: true - variable: policy label: "Policy" description: | diff --git a/charts/enterprise/authelia/templates/_configmap.tpl b/charts/enterprise/authelia/templates/_configmap.tpl index c100da838fd..c2797c8aaaa 100644 --- a/charts/enterprise/authelia/templates/_configmap.tpl +++ b/charts/enterprise/authelia/templates/_configmap.tpl @@ -327,6 +327,16 @@ data: {{- end }} {{- end }} {{- end -}} + {{- if $rule.domain_regex }} + domain_regex: + {{- if kindIs "string" $rule.domain_regex }} + - {{ $rule.domain_regex | squote }} + {{- else -}} + {{- range $rule.domain_regex }} + - {{ . | squote }} + {{- end }} + {{- end }} + {{- end }} {{- with $rule.policy }} policy: {{ . }} {{- end -}}