redhat-cop / disconnectedinfra

Ansible collection designed to support building a disconnected network in a connected world.
Apache License 2.0
7 stars 4 forks source link

Add valid certificates generated from Let's Encrypt on vSphere #1

Open hfenner opened 3 years ago

hfenner commented 3 years ago

As a vSphere user and administrator, I want to access the vSphere UI and API with widely trusted certificates (i.e. not obtaining/trust a CA first) so that the system can be used and managed by any authorized users without forcing Trust On First Use behavior that adds friction to the user experience.

*It is difficult to add third-party signed certificates to VCSA. There seems to be some unresolved issue with the certificate chains causing the certs to fail to be rolled over properly when the machine cert is provided and the certificate chain of intermediate and root CA is provided for the signing key.

Reset shell to root

chsh -s /bin/bash root


* The only automatable way to change the VCSA machine certificate seems to be a TUI provided by `/usr/lib/vmware-vmca/bin/certificate-manager`.  This would require use of a tool such as `pexpect` to automate answers.
* Allowing default self-signed certificates requires not only the vSphere UI to be trusted, but also the ESXi UI to be trusted as things like datastore uploads via the GUI will fail due to trust issues otherwise.  

Some potential solutions:
1. Run a reverse proxy that trust the certificate authority managed by VCSA.  VCSA seems to want to own the certificate process not only for itself, but also for ESXi hosts that it manages.  This means that even rotating the certificate on the VCSA server would require additional effort to maintain the ESXi host certificates properly.  Given that we can expect entire systems (ESXi + vSphere) to regularly be created and die for the purposes of hosting infrastructure that is cleanly provisioned from code end to end, a widely trusted certificate on the proxy (such as one from Let's Encrypt) could be used to proxy with reencryption to the actual endpoint via a certificate that the proxy and VCSA/ESXi hosts share trust on.  This would require automating the proxy and the hosts, but not all the clients.

In general, this seems be a thorny problem for a fairly simple end user experience desire.
hfenner commented 3 years ago

Initial research into this problem seemed to indicate that the best option available was to access the shell in order to perform this operation. However, it looks like vSphere 7 introduces some new API options that MAY be available in vSphere 6.7 (which is a very common infrastructure target). https://blogs.vmware.com/vsphere/2020/04/vsphere-7-certificate-management.html

Variations of the CLI technique popped up a lot in blog posts about Let's Encrypt and vSphere: https://blog.krogloth.de/vmware-vcenter-vcsa-ssl-certificates-using-lets-encrypt/ but may (hopefully!) will not be the most reliable option.