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

Support for self-signed certificates #1609

Open
LauKr opened this issue Oct 30, 2024 · 1 comment
Open

Support for self-signed certificates #1609

LauKr opened this issue Oct 30, 2024 · 1 comment
Labels
⌛ pending author's response Requested additional information from the reporter ✨ enhancement New feature or request

Comments

@LauKr
Copy link

LauKr commented Oct 30, 2024

Is your feature request related to a problem? Please describe.
To my understanding the project doesn't support self-signed certificates.
The only support for TLS on the node side I know of is insecure = false, i.e. verifying the certificate against the normal root chains, or insecure = true, i.e. not verifying the certificate at all. Furthermore, I found no documentation on that matter and all examples just use insecure = true.

Describe the solution you'd like
Ideally, when setting up the provider, on the same level as insecure another optional argument should exist which takes either a path to a certificate or the certificate itself. The corresponding certificate should be used to verify the node's identity.

Describe alternatives you've considered
Only providing the SHA256sum of the certificate might be enough, however, I'm not sure if the TLS library can handle that input.

Additional context

The relevant place in the code:

var transport http.RoundTripper = &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{
// deepcode ignore InsecureTLSConfig: the min TLS version is configurable
MinVersion: version,
InsecureSkipVerify: insecure, //nolint:gosec
},
}

To my understanding, this only sets true or false according to the value given here:

conn, err = api.NewConnection(endpoint, insecure, minTLS)

I think it's important to be able to use TLS, especially outside of purely testing environments.
As a default Proxmox install comes with a self-signed certificate, this should, in my opinion, be the first point to start.
Especially, as not everyone set's up a proper certificate chain with an approved root certificate.

@LauKr LauKr added the ✨ enhancement New feature or request label Oct 30, 2024
@LauKr LauKr changed the title Provider doesn't support self-signed certificates Support for self-signed certificates Oct 30, 2024
@bpg bpg moved this to 🕚 Sometime in terraform-provider-proxmox Dec 8, 2024
@bpg
Copy link
Owner

bpg commented Dec 14, 2024

Hey @LauKr 👋🏼

Ideally, when setting up the provider, on the same level as insecure, another optional argument should exist which takes either a path to a certificate or the certificate itself. The corresponding certificate should be used to verify the node's identity.

Thanks for your suggestion! While I understand the convenience of directly specifying a certificate, the more robust approach would be to add the self-signed root CA to the host's certificate store and mark it as trusted.

In case of PVE, you'd need to add pve-root-ca.pem:
Screenshot 2024-12-13 at 7 52 33 PM

By doing so, all existing TLS mechanisms can operate seamlessly without requiring additional configuration or custom code changes in the provider. This approach aligns with standard practices for managing self-signed certificates and ensures better maintainability and security.

Let me know your thoughts or if you'd like further clarification!

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label Dec 14, 2024
@bpg bpg moved this from 🕚 Sometime to ⏳ On-Hold in terraform-provider-proxmox Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌛ pending author's response Requested additional information from the reporter ✨ enhancement New feature or request
Projects
Status: ⏳ On-Hold
Development

No branches or pull requests

2 participants