Closed izgeri closed 3 years ago
We may want to learn from the recent lessons of the Python CLI project - you can see some details on their approach in https://github.com/cyberark/conjur-api-python3/issues/198
I propose that clients should:
If this is the guidance we provide to end-users who use our clients, then we would need to provide instructions to retrieve the Conjur CA certificate in case self-signed certificates are being used. This is not trivial, but:
We could just make some assumptions. Since we know we don't have an intermediate CA, then we can safely assume that the last certificate in the output from
openssl s_client -showcerts
is going to be the root CA and just cut that bit out.
Here is an example flow some vendors use to explain to customers how to get the root CA cert:
openssl s_client -connect your.name.com:8443 –showcerts
“-----BEGIN CERTIFICATE-----”
and the “-----END CERTIFICATE -----“
) is the certificate of interest.Note that this may not always work, see for example this SO thread.
Created a gist with example Golang implementation for fetching certificate, see https://gist.github.com/doodlesbykumbi/33130af98c94f28aabab60206206cc70.
Also noted from the python CLI issue that
The tricky part about fetching the cert is that it's possible that the server is (mis)configured to not advertise the whole chain, and so trying to use the fetched certificate for verification results in an error like SSL Error: unable to get local issuer certificate. I believe the way to circumvent this is to get the missing part of the chain to the root CA certificate (likely from a person or some other service) and use that for cert_file: "/path/to/cert". The cool thing is we can check for this after fetching the certificate by trying to verify the endpoint using the fetched certificate.
So we'll want to attempt verification after fetching the cert to ensure that it's enough.
Updated the gist to include detecting incomplete certs by attempting to verify the endpoint using the fetched certificate, see https://gist.github.com/doodlesbykumbi/33130af98c94f28aabab60206206cc70.
At current, we recommend users retrieve the Conjur PEM-encoded x509 CA certificate chain using a complicated OpenSSL command:
We would like to provide clear instructions for retrieving the Conjur PEM-encoded x509 CA certificate chain when:
However the certificate is retrieved, it will be added to the Kubernetes cluster in a ConfigMap during the cluster setup designed in #2039.
We should consider whether Conjur / DAP certificates are being signed by a known / trusted CA or if they are self-signed.
In devising a proposed solution, we should review the options with the security architect to ensure the proposed solution is secure.
The outcome of this spike will inform the rest of the work planned to complete #2026.
AC:
openssl