TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: In a microservice architecture, how do you handle managing secrets?

134 pointsby kkamperschroerover 9 years ago
I&#x27;m evaluating solutions for secrets management in relation to a distributed microservice architecture and am curious to hear what everyone else out there does. Some options I&#x27;ve considered:<p>- Git-crypt and deploying secrets along with binaries<p>- Hashicorp Vault<p>- Square Keywhiz<p>- AWS KMS<p>- Lyft Confidant<p>- Roll your own<p>All seem to have pros and cons depending on use cases and how mission critical the service you are offering is.<p>So what do you do to solve this problem in your world?

25 comments

wsargentover 9 years ago
You should check out Daniel Somerfield&#x27;s talk at OWASP, &quot;Turtles All the Way Down: Storing Secrets in the Cloud and the Data Center&quot;<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;OUSvv2maMYI" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;OUSvv2maMYI</a>
评论 #10927518 未加载
gtaylorover 9 years ago
We use Kubernetes, which includes its own secrets API:<p><a href="http:&#x2F;&#x2F;kubernetes.io&#x2F;v1.1&#x2F;docs&#x2F;user-guide&#x2F;secrets.html" rel="nofollow">http:&#x2F;&#x2F;kubernetes.io&#x2F;v1.1&#x2F;docs&#x2F;user-guide&#x2F;secrets.html</a><p>I can&#x27;t remember which issue this was on, but it seemed like there was some discussion on their GitHub project about making pluggable secrets backends (HashiCorp&#x27;s Vault was mentioned).<p>Kubernetes&#x27; secrets API is still very basic, but I think the fundamental concept is very sound and has a great foundation to continue building on.
评论 #10927202 未加载
评论 #10927590 未加载
评论 #10927469 未加载
评论 #10935152 未加载
stevebover 9 years ago
We have started work on exposing Hashicorp Vault secrets via FUSE and Docker volumes. The expectation is your containers will just mount secrets via a mount like &#x2F;secret in the container.<p>The project is brand new and we&#x27;d love to hear your feedback: <a href="https:&#x2F;&#x2F;github.com&#x2F;asteris-llc&#x2F;vaultfs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;asteris-llc&#x2F;vaultfs</a>
评论 #10927681 未加载
esherover 9 years ago
We run a PHP hosting platform and that tickled us as well. We were especially upset with the common sense that storing secrets in ENV vars is a good idea — in PHP those vars are easily exposed. See our blog post: <a href="http:&#x2F;&#x2F;blog.fortrabbit.com&#x2F;how-to-keep-a-secret" rel="nofollow">http:&#x2F;&#x2F;blog.fortrabbit.com&#x2F;how-to-keep-a-secret</a> — here we suggested:<p>1. create a secret key, store it with the code of your App 2. store the encrypted credentials in env vars<p>Later on we even launched our own solution for our clients, an app_secrets.yml file, which can be edited via Dashboard. <a href="http:&#x2F;&#x2F;help.fortrabbit.com&#x2F;secrets" rel="nofollow">http:&#x2F;&#x2F;help.fortrabbit.com&#x2F;secrets</a><p>The nice thing is, that this file is partly managed by the platform for it&#x27;s own credentials and partly by the user.<p>That has been running for a while now. The adaption rate is low until now. It turned out that not everything will fit into that ONE fault. Blackfire.io and NewRelic run as PHP extensions, thus the API-keys are stored with the extension setting.<p>We have also discussed to implement an some open source &quot;Secret as a Service&quot; but came to the conclusion that this can too easily turn into to be a SPOF.<p>I am amazed that this topic is getting discussed again and I have learned about many new concepts here.
jvehentover 9 years ago
I wrote some of my thoughts on the topic, and the primary motivation behind SOPS [1] (which uses PGP and KMS): <a href="https:&#x2F;&#x2F;jve.linuxwall.info&#x2F;blog&#x2F;index.php?post&#x2F;2015&#x2F;10&#x2F;01&#x2F;Introducing-Sops%3A-an-editor-of-encrypted-file-that-uses-AWS-KMS-and-PGP" rel="nofollow">https:&#x2F;&#x2F;jve.linuxwall.info&#x2F;blog&#x2F;index.php?post&#x2F;2015&#x2F;10&#x2F;01&#x2F;In...</a><p>The initial trust problem boils down to trusting the API that controls the provisioning of your infrastructure. Failing that, you have to ask a human to manually authorize new nodes to retrieve secrets (that&#x27;s how puppet approves new agent certs).<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;mozilla&#x2F;sops" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mozilla&#x2F;sops</a>
room271over 9 years ago
A simple solution if you are in AWS is S3 with instance profiles for access.
评论 #10927544 未加载
评论 #10927256 未加载
TomFrostover 9 years ago
We have an open source solution called Cryptex[0] to handle this. It&#x27;s better explained by this blog post[1] that gives the thinking and configuration necessary for most scenarios.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;TechnologyAdvice&#x2F;Cryptex" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;TechnologyAdvice&#x2F;Cryptex</a> [1]: <a href="http:&#x2F;&#x2F;technologyadvice.github.io&#x2F;lock-up-your-customer-accounts-give-away-the-key&#x2F;" rel="nofollow">http:&#x2F;&#x2F;technologyadvice.github.io&#x2F;lock-up-your-customer-acco...</a>
joslin01over 9 years ago
There&#x27;s also blackbox by StackExchange <a href="https:&#x2F;&#x2F;github.com&#x2F;StackExchange&#x2F;blackbox" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;StackExchange&#x2F;blackbox</a>
whisk3rsover 9 years ago
For AWS users, KMS&#x27;s GenerateDataKey is a simple way to store secrets locally in a way that reuses your IAM policies. You can also use grants and EncryptionContext to restrict the ability to decrypt secrets in a very fine-grained manner. As a bonus, all decrypts are logged in CloudTrail. The KMS docs are awful but if you&#x27;re on AWS then it is worth checking out!
transitorykrisover 9 years ago
Conjur (<a href="https:&#x2F;&#x2F;www.conjur.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.conjur.net&#x2F;</a>) has been working well the users of our PaaS. It&#x27;s a self hosted commercial product.
austinjpover 9 years ago
Is there any detailed opinion on good and bad approaches to this problem? It is clearly a hot topic.<p>I&#x27;m sure each product listed conforms to one from a small set of design patterns. Has any credible analysis of these designs been published? Are competing offerings likely to evolve toward a stable converged solution? Or is there something in this problem that remains fundamentally unsolved?<p>I appreciate it&#x27;s turtles all the way down, but I&#x27;m wondering if anyone has proven the merits of some approaches over others, or components within the approaches at least.
salimaneover 9 years ago
We use <a href="https:&#x2F;&#x2F;github.com&#x2F;meltwater&#x2F;secretary" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;meltwater&#x2F;secretary</a> . The key differences with Secretary is that plaintext secrets are never stored to disk or otherwise made visible outside the container.
mikljohanssonover 9 years ago
We ended up creating <a href="https:&#x2F;&#x2F;github.com&#x2F;meltwater&#x2F;secretary" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;meltwater&#x2F;secretary</a> to allow storing encrypted secrets in config files checked into Git by devteams. The encrypted secrets are passed as env vars through the continuous delivery pipeline, Mesos&#x2F;Marathon and into containers. They&#x27;re then decrypted and injected into the app environment at runtime, safely inside the container.<p>At startup the container reaches out to the Secretary daemon that holds the master keys, using public key cryptos to authenticate itself. The Secretary deamon uses Marathon to authenticate containers (checking their public keys stored in env vars) and validate that they&#x27;re authorized for the specific secret in question (checking that the encrypted secret is indeed part of the containers env vars).<p>Meaning that Marathon is the single source of trust of which container can access what secrets. The problem then becomes controlling who and how changes are made to the Git repo containing the CD config, which is something Github does well with roles, status&#x2F;deployment API and pull requests.<p>We had a similar problem as some describe with the distribution of the initial secret (i.e. Vault token) and one time Vault tokens being cumbersome in dynamic scaling envs. We didn&#x27;t want the cleartext token ending up in config files nor in the <a href="https:&#x2F;&#x2F;github.com&#x2F;meltwater&#x2F;lighter" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;meltwater&#x2F;lighter</a> config we use to drive our continuous delivery pipelines that go into Mesos&#x2F;Marathon. We also had some other aspects like<p>* Wanting to keep secrets, app config and code versions promoted together throughout or deployment pipelines. Seeing secrets as another type of app config we wanted to track all config and versions for an app in the same way, in the same place to avoid mismatches or deployment dependencies.<p>* Wanting to enable our very independent devteams to easily manage secrets for their services, same was as they manage the app config, versions and rollout of their services. And delegate management of what service is authorized for what secrets to devteams (with both automated checks for unencrypted secrets, and some gentle manual coaching post-commit)<p>* Versioning and rolling upgrades for secrets? E.g. how to roll out a new secret in a Marathon rolling upgrade? Creating and managing versioned keys in Vault seemed somewhat cumbersome.<p>Perhaps something like that could be used to solve your initial secret distribution problem or even handle the secrets themselves until Vault has solved the initial secret problem..?
ahelwerover 9 years ago
Azure Key Vault! Disclosure: am dev in Azure, although not on this specific product.<p><a href="https:&#x2F;&#x2F;azure.microsoft.com&#x2F;en-us&#x2F;services&#x2F;key-vault&#x2F;" rel="nofollow">https:&#x2F;&#x2F;azure.microsoft.com&#x2F;en-us&#x2F;services&#x2F;key-vault&#x2F;</a>
评论 #10927335 未加载
评论 #10927297 未加载
johnnycarcinover 9 years ago
Because we are already using Consul we went with Vault. We are using it in a POC type setup now (only for a few services&#x2F;scripts) but so far it&#x27;s been pretty easy to work with. The API is fairly easy to use outside of the fact that there is no search function (or wasn&#x27;t last time I checked). The documentation could be better but since it&#x27;s a public project and I haven&#x27;t submitted anything I&#x27;m not going to bash that :) The fact that it&#x27;s a single binary is another thing we liked. just drop it out somewhere and run it.
late2partover 9 years ago
I&#x27;m pretty happy with this solution from Strongauth.<p><a href="http:&#x2F;&#x2F;keyappliance.strongauth.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;keyappliance.strongauth.com&#x2F;</a><p>You can secure the root for it with TPM or HSM.
评论 #10927263 未加载
vascoover 9 years ago
We&#x27;re using Ansible which means we use ansible-vault to store secrets. We store the encrypted files in S3 and decrypt them on deploy as needed.
评论 #10927431 未加载
PaulHouleover 9 years ago
When I am building stuff in AWS, most of the secrets are for entities that are access-controlled by AWS and can be passed in through server roles.
ejpover 9 years ago
Another option for your list, which you&#x27;ll have to evaluate for your use case: <a href="https:&#x2F;&#x2F;wiki.openstack.org&#x2F;wiki&#x2F;Barbican" rel="nofollow">https:&#x2F;&#x2F;wiki.openstack.org&#x2F;wiki&#x2F;Barbican</a><p>I&#x27;ve been evaluating most of these same options for my use case, but haven&#x27;t made any decisions yet.
评论 #10927252 未加载
Crystalinover 9 years ago
It also depends on how secret it needs to be. For most of our secrets (those used for configuration) we use Consul.
评论 #10927654 未加载
评论 #10927271 未加载
malnickover 9 years ago
I used Marathon and Mesos and rolled my own pub&#x2F;priv encryption for our developers JSON (encrypted the ENV parameters POSTed to Marathon): <a href="https:&#x2F;&#x2F;github.com&#x2F;malnick&#x2F;mantle" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;malnick&#x2F;mantle</a>
kt9over 9 years ago
You can encrypt and deploy secrets using Distelli.<p><a href="https:&#x2F;&#x2F;www.distelli.com&#x2F;docs&#x2F;user-guides&#x2F;securing-your-applications" rel="nofollow">https:&#x2F;&#x2F;www.distelli.com&#x2F;docs&#x2F;user-guides&#x2F;securing-your-appl...</a><p>Disclaimer: I&#x27;m the founder at Distelli
评论 #10930596 未加载
grandalfover 9 years ago
What is the tradeoff matrix for these kinds of services? They all seem pretty similar to me.
yodonover 9 years ago
it&#x27;s a huge pain point for us. We&#x27;re a .NET shop rolling our own that mimics&#x2F;overlays app.config and web.config patterns for both dev and production usage. Our concern is less on how do you get the secrets to the box (though that&#x27;s obviously important) and more on how do you keep an attacker who has started penetrating your infrastructure from gaining control of the infrastructure that holds your secrets.
评论 #10927290 未加载
评论 #10927289 未加载
avitzurelover 9 years ago
I&#x27;d choose the one that I am the most comfortable with and is less obtrusive to the rest of my stack.<p>Whatever you choose, make sure you are comfortable with it, it&#x27;s easy to deploy and work with.
评论 #10927249 未加载