From 33b18c3509f4b2083d6f31ef576538c2e7a8ea44 Mon Sep 17 00:00:00 2001 From: Marco Boss Date: Mon, 4 Mar 2024 13:41:03 +0100 Subject: [PATCH] [mTLS] Fix acme verfication when mTLS and Client CN verification is enabled --- rootfs/etc/nginx/template/nginx.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index d58be2880..381fc134c 100644 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -985,8 +985,10 @@ stream { {{ if not ( empty $server.CertificateAuth.MatchCN ) }} {{ if gt (len $server.CertificateAuth.MatchCN) 0 }} - if ( $ssl_client_s_dn !~ {{ $server.CertificateAuth.MatchCN }} ) { - return 403 "client certificate unauthorized"; + location ~ ^/(?!(\.well-known/acme-challenge)) { + if ( $ssl_client_s_dn !~ {{ $server.CertificateAuth.MatchCN }} ) { + return 403 "client certificate unauthorized"; + } } {{ end }} {{ end }}