Skip to content
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

Need to create certificates signed by a generated CA #844

Closed
MikaelSmith opened this issue Jul 24, 2020 · 0 comments · Fixed by #845
Closed

Need to create certificates signed by a generated CA #844

MikaelSmith opened this issue Jul 24, 2020 · 0 comments · Fixed by #845

Comments

@MikaelSmith
Copy link
Contributor

This is primarily a requirement to work around openssl/openssl#1418. All current OpenSSL releases won't verify certificates when provided a self-signed certificate. It will only accept a self-signed certificate if the verifying certificate includes the KeyCertSign bit in KeyUsage. The simplest way to work around this is first generate a CA cert/key pair, then use that to generate a certificate. The application that needs to trust the generated certificate can verify against the generated CA certificate.

This can be approximately accomplished with

repl{{$ca := genCA "ca" 365}}repl{{$cert := genSignedCert "host" nil nil 365 $ca}}repl{{cat ($ca.Cert | b64enc) ($cert.Cert | b64enc) ($cert.Key | b64enc)}}

and then using split and indexing to access individual entries. However using this in a Config reliably is again difficult because you either regenerate it every time the config is evaluated (producing a different certificate), or generate it once and never change it (so the certs can't depend on other config inputs).

I'd like to have an equivalent of TLSCert/TLSKey that caches the generated certs and can access them again by name. This provides sufficient longevity to make them useful as an easy onboard tool.

MikaelSmith added a commit to MikaelSmith/kots that referenced this issue Jul 24, 2020
Adds `TLSCACert`, `TLSCertFromCA`, and `TLSKeyFromCA` to generate a
named CA cert/key pair and access the cert, as well as generate cert/key
pairs from that CA as needed (based on the combination of CA name, cert
name, and common name).

Useful when you need a separate CA certificate, such as working around
openssl/openssl#1418.

Fixes replicatedhq#844.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant