Allow users to manually trust the server certificate on infra login
#1541
Labels
area/cli
Issue or PR related to the command-line interface.
kind/improvement
A report of a quality problem, or a change that addresses a quality problem.
Is your feature request related to a problem? Please describe.
Current
infra login
requires--skip-tls-verify
, or the user must accept the prompt for "The authenticity of the host can't be established.".Similar to how
ssh
works when you connect to a new host, we should be able to prompt the user to trust the certificate used by the server.Describe the solution you'd like
When the server starts we should print the certificate to the logs and/or to a file on the ephemeral filesystem. This will allow the admin to view the generated certificate using a
kubectl
command. I think we may already do this in some cases (~/.infra/cache/
seems to have certs).In the CLI we would need to make 2 changes:
x509.UnknownAuthorityError
, print the details of the certificate (they are available asx509.UnknownAuthorityError.Certificate
). Then prompt the user to see if they would like the trust the certificate. We can also suggest that they either ask their admin to confirm the details, or if they are an admin they can usekubectl exec ...
to print the expected cert. Once trusted we can save the certificate to the local filesystem.tls.Config
that populates theRootCAs
from the certs saved on disk. That way future calls to the API will continue to trust the certificate that was previously trusted by that user.The text was updated successfully, but these errors were encountered: