-
Notifications
You must be signed in to change notification settings - Fork 641
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
Environment / Credential injection for SNMP Generator #459
Comments
Actually, templating would be useful for the likes of Docker Secrets; rather than just supporting environment variables. https://grafana.com/docs/installation/docker/#reading-secrets-from-files-support-for-docker-secrets |
Environment variables are not a good way to handle secrets. In general this sort of thing is best done by changing snmp.yml before it's deployed, and is not something to handle within the generator/exporter themselves. |
Working example of this here: I disagree, having creds in plaintext with no way to inject is bad. |
Most of us aren't passing in plain text. Env vars in memory vs plaintext pw in files is always immensely safer. |
From the Kubernetes Secrets documentation:
This is the safest and most supported mode of Kubernetes Secrets. I am going to lock this thread, as it's not productive and this not a policy we are going to change. |
Host operating system: output of
uname -a
Host: Red Hat Enterprise Linux Server release 7.6 (Maipo)
Docker: version 1.13.1
Container images: docker.io/prom/snmp-generator:master 8925d142d366 8 days ago
snmp_exporter version: output of
snmp_exporter -version
This relates to the generator; there is no version, and only 'master'. The docker image has image 8925d142d366, and is currently the latest available.
Feature Request
generator.yml produces snmp.yml, and both contains credentials (in plain-text) that are passwords (in SNMPv3 at least they are properly considered passwords or shared keys).
As a deployer of Prometheus I want to use automate the deployment using tools such as Docker (in this particular case, docker-compose).
I need a way to safely inject credentials into the execution of the generator so I don't end up with credentials leaking into Git.
To illustrate, I'm working on the following:
One useful and generalisable method would be allowing environment variables to be interpolated in the YAML and I can therefore inject the credentials using already established patterns for credential injection.
Risks of implementing
There is a small risk that introducing an interpolation layer could lead to some unexpected behaviour, but the liklihood seems very slim. That could be mitigated by disabling such intepolation by default.
Risks of not implementing
Credentials would likely leak into git history. While SNMP is generally never exposed on the internet, and typically access-controlled within a LAN, this would still not be appropriate, particularly if the access level were to grant R/W access.
You could easily imagine someone writing an interpolation tool for themselves, but this could open issues due to bad coding practices (eg. using the Python YAML 'load' instead of 'safe_load')
Potential Solutions
I would suggest that the generator would benefit most by simple environment variable interpolation, and anything more complex should be achieved with an external tool (eg. Ansible deployment).
Workarounds
Currently I'm just having the generator produce snmp-new.yml, which I then manually edit to produce snmp.yml. I just need to ensure that snmp.yml doesn't get captured into git.
Thanks,
Cameron
The text was updated successfully, but these errors were encountered: