-
Notifications
You must be signed in to change notification settings - Fork 138
OCPBUGS-6661: Manage mTLS CRLs #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/bash | ||
| # Generate a placeholder CRL, like the one included in pkg/router/crl/crl.go as dummyCRL. In order to create an already | ||
| # expired CRL, this script requires the utility faketime, which is provided by libfaketime on fedora. | ||
| set -e | ||
| cwd=$(dirname $0) | ||
| tmpdir=$(mktemp -d) | ||
| sed -e "s@%%tmpdir%%@${tmpdir}@" ${cwd}/placeholder-ca.cnf.template > ${tmpdir}/placeholder-ca.cnf | ||
| openssl genrsa -out ${tmpdir}/placeholder-ca.key 2048 | ||
| openssl req -new -key ${tmpdir}/placeholder-ca.key -out ${tmpdir}/placeholder-ca.csr -subj "/C=US/ST=NC/L=Raleigh/O=OS4/OU=Eng/CN=Placeholder CA" | ||
| openssl x509 -req -in ${tmpdir}/placeholder-ca.csr -out ${tmpdir}/placeholder-ca.crt -days 3650 -signkey ${tmpdir}/placeholder-ca.key -extfile ${tmpdir}/placeholder-ca.cnf | ||
| cat /dev/null > ${tmpdir}/placeholder-crl-index.txt | ||
| faketime 'Jan 1, 2000 12:00AM GMT' openssl ca -gencrl -crlhours 1 -out ${tmpdir}/placeholder-ca.crl -config ${tmpdir}/placeholder-ca.cnf | ||
|
|
||
| echo "new placeholder crl at ${tmpdir}/placeholder-ca.crl" >&2 | ||
| cat ${tmpdir}/placeholder-ca.crl |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| subjectKeyIdentifier=hash | ||
| authorityKeyIdentifier=keyid, issuer | ||
| basicConstraints=CA:TRUE | ||
|
|
||
| [ca] | ||
| default_ca=placeholder_ca | ||
|
|
||
| [placeholder_ca] | ||
| authorityKeyIdentifier=keyid,issuer | ||
| certificate=%%tmpdir%%/placeholder-ca.crt | ||
| database=%%tmpdir%%/placeholder-crl-index.txt | ||
| default_crl_hours=1 | ||
| default_md=sha256 | ||
| private_key=%%tmpdir%%/placeholder-ca.key | ||
| crl_extensions=crl_exts | ||
|
|
||
| [crl_exts] | ||
| authorityKeyIdentifier=keyid, issuer |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |||||||||||||||||||||||||
| {{- $dynamicConfigManager := .DynamicConfigManager }} | ||||||||||||||||||||||||||
| {{- $router_ip_v4_v6_mode := env "ROUTER_IP_V4_V6_MODE" "v4" }} | ||||||||||||||||||||||||||
| {{- $router_disable_http2 := env "ROUTER_DISABLE_HTTP2" "false" }} | ||||||||||||||||||||||||||
| {{- $haveClientCA := .HaveClientCA }} | ||||||||||||||||||||||||||
| {{- $haveCRLs := .HaveCRLs }} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| {{- /* A bunch of regular expressions. Each should be wrapped in (?:) so that it is safe to include bare */}} | ||||||||||||||||||||||||||
|
|
@@ -290,8 +292,8 @@ frontend fe_sni | |||||||||||||||||||||||||
| {{- "" }} crt-list /var/lib/haproxy/conf/cert_config.map accept-proxy | ||||||||||||||||||||||||||
| {{- with (env "ROUTER_MUTUAL_TLS_AUTH") }} | ||||||||||||||||||||||||||
| {{- "" }} verify {{. }} | ||||||||||||||||||||||||||
| {{- with (env "ROUTER_MUTUAL_TLS_AUTH_CA") }} ca-file {{. }} {{ else }} ca-file /etc/ssl/certs/ca-bundle.trust.crt {{ end }} | ||||||||||||||||||||||||||
| {{- with (env "ROUTER_MUTUAL_TLS_AUTH_CRL") }} crl-file {{. }} {{ end }} | ||||||||||||||||||||||||||
| {{- if $haveClientCA }} ca-file /var/lib/haproxy/mtls/latest/ca-bundle.pem {{ else }} ca-file /etc/ssl/certs/ca-bundle.trust.crt {{ end }} | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a thought, |
||||||||||||||||||||||||||
| {{- if $haveCRLs }} crl-file /var/lib/haproxy/mtls/latest/crls.pem {{ end }} | ||||||||||||||||||||||||||
|
Comment on lines
+295
to
+296
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You replaced spaces with tabs. Please use spaces for consistency with the rest of the template. I'm wary of breaking OKD users, or people using custom router deployments (unsupported, but better not to break them if we don't need to). If
Suggested change
Likewise for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My router changes still use What do you think of something like this?
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That could work (though I think you also need to re-add
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fix I proposed does include
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've included a clearer version of this fix in #472. |
||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||
| mode http | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -376,8 +378,8 @@ frontend fe_no_sni | |||||||||||||||||||||||||
| bind unix@/var/lib/haproxy/run/haproxy-no-sni.sock ssl crt {{ firstMatch ".+" .DefaultCertificate "/var/lib/haproxy/conf/default_pub_keys.pem" }} accept-proxy | ||||||||||||||||||||||||||
| {{- with (env "ROUTER_MUTUAL_TLS_AUTH") }} | ||||||||||||||||||||||||||
| {{- "" }} verify {{. }} | ||||||||||||||||||||||||||
| {{- with (env "ROUTER_MUTUAL_TLS_AUTH_CA") }} ca-file {{. }} {{ else }} ca-file /etc/ssl/certs/ca-bundle.trust.crt {{ end }} | ||||||||||||||||||||||||||
| {{- with (env "ROUTER_MUTUAL_TLS_AUTH_CRL") }} crl-file {{. }} {{ end }} | ||||||||||||||||||||||||||
| {{- if $haveClientCA }} ca-file /var/lib/haproxy/mtls/latest/ca-bundle.pem {{ else }} ca-file /etc/ssl/certs/ca-bundle.trust.crt {{ end }} | ||||||||||||||||||||||||||
| {{- if $haveCRLs }} crl-file /var/lib/haproxy/mtls/latest/crls.pem {{ end }} | ||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||
| mode http | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.