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 passing certificate PEM string to API Client #11722

Closed
lawliet89 opened this issue May 28, 2021 · 8 comments · Fixed by #14753
Closed

Support passing certificate PEM string to API Client #11722

lawliet89 opened this issue May 28, 2021 · 8 comments · Fixed by #14753
Labels
clientapi devex Developer Experience tls

Comments

@lawliet89
Copy link
Contributor

lawliet89 commented May 28, 2021

Is your feature request related to a problem? Please describe.

The API Client makes use of go-rootcerts to configure TLS for HttpClient. go-rootcerts supports passing in a PEM encoded string.

This is useful for API client usage such as in the Terraform Vault provider where the CA string might be passed from other data/resources.

Describe the solution you'd like

Add a new CACertificate []byte attribute to TLSConfig and pass that to rootcerts.Config.

Describe alternatives you've considered

Writing PEM string to a temporary file.

Explain any additional use-cases
If there are any use-cases that would help us understand the use/need/value please share them as they can help us decide on acceptance and prioritization.

Additional context

If this is acceptable, I can take a stab at implementing it.

@vishalnayak
Copy link
Contributor

@lawliet89 I don't feel against this. Feel free to take a shot at implementing this. I feel most of the effort will be in plumbing the PEM string till that point. Let us know how it goes!

@lawliet89
Copy link
Contributor Author

Sure. I'll take a look. I think we can leave it to the user of the API client to figure out how to plumb the []byte to the library.

@heatherezell
Copy link
Contributor

Hi @lawliet89 - have you had any luck with this? If you need assistance, please feel free to ping back and we'll help you out! Thanks!

@lawliet89
Copy link
Contributor Author

Sorry, I've not had the time to implement this. If anyone wants to take it on, please feel free. I'll update if/when I implement something.

@heatherezell
Copy link
Contributor

Thanks, @lawliet89 - I'll also check with our product owners to see about potentially roadmapping this ourselves. I can't make any guarantees, so please do feel free to still take a shot at it if you wish!

@averche
Copy link
Contributor

averche commented Apr 4, 2022

Hi @lawliet89, thank you for contributing this! I opened a PR #14753 which follows pretty closely to your description. Please let me know if that's what you had in mind.

@lawliet89
Copy link
Contributor Author

@averche looks great :) Thank you.

@averche
Copy link
Contributor

averche commented Apr 6, 2022

I have merged the fix, thanks for contributing to HashiCorp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clientapi devex Developer Experience tls
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants