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

[Discussion] External secrets integration #2469

Open
gramidt opened this issue Feb 12, 2021 · 11 comments
Open

[Discussion] External secrets integration #2469

gramidt opened this issue Feb 12, 2021 · 11 comments
Assignees
Labels

Comments

@gramidt
Copy link
Member

gramidt commented Feb 12, 2021

Is your feature request related to a problem? Please describe.
The Collector does not provide a mechanism to retrieve secrets from external systems or processes. The current mechanisms are to either hardcode the secret in the corresponding config or use environment variable expansion. While the latter is better than the former, it still has significant room for improvement, since environment variables are prone to being accidentally exposed.

Key problems to think about:

  • Expiration and auto-rotation of secrets/credentials
  • The secrets management ecosystem is vast ( Hashicorp Vault, Volterra Vault, AWS Secrets Manager, AWS Cloud HSM, GCP Secrets Manager, Azure KeyVault, ...)
  • Not all users will have an HSM or secret manager, but would still like to store their secrets more securely
  • While not directly related, there should be a way to mark a config setting as "sensitive" and mask "sensitive" fields out if printing the config (debugging, etc.)

This problem is currently affecting multiple components that rely on secrets. If any component would like to adopt a more secure mechanism for secret management, they would have to implement them independently. The below list is just to reference a type of issue that currently exists, and is not to be considered a comprehensive list:

Describe the solution you'd like
I would love a mechanism that's similar to the current environment variable expansion but allows for integration into secret managers, HSMs, and other options such as files. This approach would enable all components to support secure secrets without having to do anything initially. The tricky part is determining how to support secret rotations without restarting the collector.

Describe alternatives you've considered

  • Use a sidecar proxy approach when deploying the collector and try to instrument authentication there when applicable; however, this solution does not cover all bases and requires yet another process to run and manage.
  • Use a sidecar approach when deploying the collector and use a custom templating to template the config prior to starting the collector. Still not a secure solution and requires yet another process to run and manage.
@gramidt
Copy link
Member Author

gramidt commented Feb 12, 2021

One idea could be to use something like gomplate (MIT License), since it has many of the needed integrations already built in ( see https://github.com/hairyhenderson/gomplate/tree/master/data ). It could be used within config/config.go and would follow a similar pattern to the current environment variable expansion (

// expandEnvLoadedConfig is a utility function that goes recursively through a config object
), and be additive, so that the current method of variable expansion will continue to work. If implemented, we'll just need to ensure that the templating does not clash with Helm.

@gramidt gramidt changed the title [Discussion] Create a mechanism to allow receivers and exporters to retrieve external secrets [Discussion] External secrets integration Feb 14, 2021
@gramidt
Copy link
Member Author

gramidt commented Feb 23, 2021

@alolita @jpkrohling - While not critical at this moment, could you provide your thoughts on this when you have some spare cycles?

@jpkrohling
Copy link
Member

jpkrohling commented Feb 25, 2021

I like the proposal and I could have made use of that for the PR that introduced the PerRPCCredentials option, where we did touch the topic of a generic mechanism to get conf value from external files.

I would make this opt-in with the possibility for components to register a callback, so that they can reload whatever needs to be reloaded when the config value changes.

@tigrannajaryan
Copy link
Member

@pjanotti is looking into this.

@gramidt
Copy link
Member Author

gramidt commented Feb 25, 2021

@pjanotti - Let me know if you would like assistance in your research and initial PRs.

@pjanotti
Copy link
Contributor

pjanotti commented Mar 8, 2021

Hi @gramidt, @jpkrohling, @alolita and @tigrannajaryan here is a doc with a design based on some prototyping. I would love to get some quick feedback so we can make this available soon.

@jpkrohling
Copy link
Member

Thanks for the proposal, @pjanotti! I left a couple of comments there.

@gramidt
Copy link
Member Author

gramidt commented Mar 8, 2021

Thank you for the proposal, @pjanotti! I have added it to my queue to review this afternoon.

@gramidt
Copy link
Member Author

gramidt commented Mar 10, 2021

@pjanotti - Passing this document around to get further feedback from our teams. I'll be sure to share the feedback in the near future.

@gramidt
Copy link
Member Author

gramidt commented Apr 5, 2021

@pjanotti - I apologize for the delay. Our team overall loved the proposal. It went above what our expectation were and couldn't be more excited to see this take form. Let me know if you need anything at all.

@BjarteHaram
Copy link

Hi! My company recently enabled Kyverno to identify Kubernetes vulnerabilities and reported a vulnerability since we inject an API key into an environment variable. Does anyone have an update on the resolution to this issue?

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

No branches or pull requests

6 participants