Skip to content

Commit 567e915

Browse files
committed
Fixes as per @simo5 review comments.
1 parent d3894ad commit 567e915

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Diff for: images/router/haproxy/conf/haproxy-config.template

+12-4
Original file line numberDiff line numberDiff line change
@@ -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

Diff for: pkg/oc/admin/router/router.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func generateMutualTLSSecretName(prefix string) string {
347347

348348
// generateSecretsConfig generates any Secret and Volume objects, such
349349
// as SSH private keys, that are necessary for the router container.
350-
func generateSecretsConfig(cfg *RouterConfig, namespace string, certName string, defaultCert, mtlsAuthCA, mtlsAuthCRL []byte) ([]*kapi.Secret, []kapi.Volume, []kapi.VolumeMount, error) {
350+
func generateSecretsConfig(cfg *RouterConfig, namespace, certName string, defaultCert, mtlsAuthCA, mtlsAuthCRL []byte) ([]*kapi.Secret, []kapi.Volume, []kapi.VolumeMount, error) {
351351
var secrets []*kapi.Secret
352352
var volumes []kapi.Volume
353353
var mounts []kapi.VolumeMount

0 commit comments

Comments
 (0)