@@ -233,8 +233,11 @@ frontend fe_sni
233233
234234 {{- if ne (env "ROUTER_MUTUAL_TLS_AUTH" "none") "none" }}
235235 {{- 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.
238241 acl cert_cn_matches ssl_c_s_dn(CN) -m sub {{.}}
239242 http-request deny unless cert_cn_matches
240243 {{- end }}
@@ -250,6 +253,7 @@ frontend fe_sni
250253 http-request set-header X-SSL-Issuer %{+Q}[ssl_c_i_dn]
251254 http-request set-header X-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore]
252255 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]
253257 {{- end }}
254258
255259 # map to backend
@@ -292,8 +296,11 @@ frontend fe_no_sni
292296
293297 {{- if ne (env "ROUTER_MUTUAL_TLS_AUTH" "none") "none" }}
294298 {{- 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.
297304 acl cert_cn_matches ssl_c_s_dn(CN) -m sub {{.}}
298305 http-request deny unless cert_cn_matches
299306 {{- end }}
@@ -309,6 +316,7 @@ frontend fe_no_sni
309316 http-request set-header X-SSL-Issuer %{+Q}[ssl_c_i_dn]
310317 http-request set-header X-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore]
311318 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]
312320 {{- end }}
313321
314322 # map to backend
0 commit comments