Skip to content

Commit 5d21846

Browse files
committed
Fix router mutual tls bug if no ca is specified.
fixes bugz #1608759
1 parent 2c3585f commit 5d21846

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

images/router/haproxy/conf/haproxy-config.template

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,11 @@ frontend fe_sni
228228
{{- if isTrue (env "ROUTER_STRICT_SNI") }} strict-sni {{ end }}
229229
{{- ""}} crt {{firstMatch ".+" .DefaultCertificate "/var/lib/haproxy/conf/default_pub_keys.pem"}}
230230
{{- ""}} crt-list /var/lib/haproxy/conf/cert_config.map accept-proxy
231-
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CA") }} ca-file {{.}} {{ end }}
232-
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CRL") }} crl-file {{.}} {{ end }}
233-
{{- with (env "ROUTER_MUTUAL_TLS_AUTH") }} verify {{.}} {{ end }}
231+
{{- with (env "ROUTER_MUTUAL_TLS_AUTH") }}
232+
{{- ""}} verify {{.}}
233+
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CA") }} ca-file {{.}} {{ else }} ca-file /etc/ssl/certs/ca-bundle.trust.crt {{ end }}
234+
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CRL") }} crl-file {{.}} {{ end }}
235+
{{- end }}
234236
{{- if isTrue (env "ROUTER_ENABLE_HTTP2") }} alpn h2,http/1.1{{ end }}
235237
mode http
236238

@@ -298,9 +300,11 @@ backend be_no_sni
298300
frontend fe_no_sni
299301
# terminate ssl on edge
300302
bind 127.0.0.1:{{env "ROUTER_SERVICE_NO_SNI_PORT" "10443"}} ssl no-sslv3 crt {{firstMatch ".+" .DefaultCertificate "/var/lib/haproxy/conf/default_pub_keys.pem"}} accept-proxy
301-
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CA") }} ca-file {{.}} {{ end }}
302-
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CRL") }} crl-file {{.}} {{ end }}
303-
{{- with (env "ROUTER_MUTUAL_TLS_AUTH") }} verify {{.}} {{ end }}
303+
{{- with (env "ROUTER_MUTUAL_TLS_AUTH") }}
304+
{{- ""}} verify {{.}}
305+
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CA") }} ca-file {{.}} {{ else }} ca-file /etc/ssl/certs/ca-bundle.trust.crt {{ end }}
306+
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CRL") }} crl-file {{.}} {{ end }}
307+
{{- end }}
304308
mode http
305309

306310
# Strip off Proxy headers to prevent HTTpoxy (https://httpoxy.org/)

0 commit comments

Comments
 (0)