@@ -233,8 +233,11 @@ frontend fe_sni
233
233
234
234
{{- if ne (env "ROUTER_MUTUAL_TLS_AUTH" "none") "none" }}
235
235
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CN") }}
236
- # If a mutual TLS auth CN is set, we deny requests if the common name doesn't
237
- # match. A custom template can change this behavior (e.g. set custom headers).
236
+ # If a mutual TLS auth CN environment variable is set, we deny requests if the
237
+ # common name field in the client certificate doesn't match that environment
238
+ # variable value. Please note this match is a subset (substring) match.
239
+ # A custom template can customize this behavior as desired - as an example,
240
+ # it may want to set custom headers rather than deny requests.
238
241
acl cert_cn_matches ssl_c_s_dn(CN) -m sub {{.}}
239
242
http-request deny unless cert_cn_matches
240
243
{{- end }}
@@ -250,6 +253,7 @@ frontend fe_sni
250
253
http-request set-header X-SSL-Issuer %{+Q}[ssl_c_i_dn]
251
254
http-request set-header X-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore]
252
255
http-request set-header X-SSL-Client-NotAfter %{+Q}[ssl_c_notafter]
256
+ http-request set-header X-SSL-Client-DER %{+Q}[ssl_c_der,base64]
253
257
{{- end }}
254
258
255
259
# map to backend
@@ -292,8 +296,11 @@ frontend fe_no_sni
292
296
293
297
{{- if ne (env "ROUTER_MUTUAL_TLS_AUTH" "none") "none" }}
294
298
{{- with (env "ROUTER_MUTUAL_TLS_AUTH_CN") }}
295
- # If a mutual TLS auth CN is set, we deny requests if the common name doesn't
296
- # match. A custom template can change this behavior (e.g. set custom headers).
299
+ # If a mutual TLS auth CN environment variable is set, we deny requests if the
300
+ # common name field in the client certificate doesn't match that environment
301
+ # variable value. Please note this match is a subset (substring) match.
302
+ # A custom template can customize this behavior as desired - as an example,
303
+ # it may want to set custom headers rather than deny requests.
297
304
acl cert_cn_matches ssl_c_s_dn(CN) -m sub {{.}}
298
305
http-request deny unless cert_cn_matches
299
306
{{- end }}
@@ -309,6 +316,7 @@ frontend fe_no_sni
309
316
http-request set-header X-SSL-Issuer %{+Q}[ssl_c_i_dn]
310
317
http-request set-header X-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore]
311
318
http-request set-header X-SSL-Client-NotAfter %{+Q}[ssl_c_notafter]
319
+ http-request set-header X-SSL-Client-DER %{+Q}[ssl_c_der,base64]
312
320
{{- end }}
313
321
314
322
# map to backend
0 commit comments