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.

Shell-secrets – GPG-encrypted environment variables

93 pointsby mgarciaisaia27 days ago

11 comments

viraptor27 days ago
Unless you&#x27;re good at actually maintaining your gpg keychain and need other people to access this, I really wouldn&#x27;t bother with gpg. There are way better and simpler options.<p>Age has a simpler interface and SSH key support <a href="https:&#x2F;&#x2F;github.com&#x2F;FiloSottile&#x2F;age">https:&#x2F;&#x2F;github.com&#x2F;FiloSottile&#x2F;age</a><p>ejson2env has the environment variable integration and ejson has multiple backends <a href="https:&#x2F;&#x2F;github.com&#x2F;Shopify&#x2F;ejson2env">https:&#x2F;&#x2F;github.com&#x2F;Shopify&#x2F;ejson2env</a><p>direnv can support any cli secrets manager per project directory <a href="https:&#x2F;&#x2F;direnv.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;direnv.net&#x2F;</a><p>I&#x27;ve dealt with enough &quot;why did this break&quot; situations with gpg secrets files used by capable teams that I&#x27;d never recommend that to anyone. And unless you really need the public key support (teams and deployment support), you&#x27;re unlikely to gain anything better over a password manager.
评论 #43727049 未加载
评论 #43724228 未加载
评论 #43725313 未加载
评论 #43724857 未加载
woodruffw27 days ago
The more general version of this is probably sops[1].<p>(A general problem with these kinds of “wrap GPG” tools is that you end up with “mystery meat” encryption&#x2F;signatures: your tool’s security margin is at the mercy of GPG’s opaque and historically not very good defaults.)<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;getsops&#x2F;sops">https:&#x2F;&#x2F;github.com&#x2F;getsops&#x2F;sops</a>
评论 #43724905 未加载
评论 #43724735 未加载
评论 #43725335 未加载
ykonstant26 days ago
Since GPG and openssh support the TPM for some operations, I am tempted to store secrets in the TPM instead; I think a hardware safe is better than messing with persistent envars and having to pay attention to children etc.<p>But I am very nervous about doing so, since I have heard bad things about the reliability of the TPM (limited writes or something?) and locking myself out of important places. Any people with experience using the TPM for secrets in Linux?
hnlmorg27 days ago
Coincidentally I’ve written something similar to this too.<p>My main takeaway was that GPG isn’t nearly as user friendly as it needs to be.
评论 #43722906 未加载
Valodim27 days ago
The correct way to do stuff like this these days with openpgp is to use a SOP (stateless openpgp) implementation. <a href="https:&#x2F;&#x2F;www.openpgp.org&#x2F;about&#x2F;sop&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.openpgp.org&#x2F;about&#x2F;sop&#x2F;</a>
bitbasher27 days ago
Couldn&#x27;t you just use pass and have something like this in your bash script&#x2F;env:<p>export SOME_SECRET=&quot;$(pass show some&#x2F;secret)&quot;
评论 #43722710 未加载
评论 #43723155 未加载
vcdimension26 days ago
I&#x27;ve forked the repo and created a zsh version: <a href="https:&#x2F;&#x2F;github.com&#x2F;vapniks&#x2F;shell-secrets">https:&#x2F;&#x2F;github.com&#x2F;vapniks&#x2F;shell-secrets</a>
asveikau27 days ago
I do something like this in my .muttrc. It was showing up in documentation iirc, as the typical way to store credentials for mutt.
ognarb27 days ago
I like the idea. GPG encryption are super helful when sharing secrets.<p>Disclaimer: I work on some UI for GPG as my day job.
pluto_modadic27 days ago
for a newer password manager... <a href="https:&#x2F;&#x2F;github.com&#x2F;FiloSottile&#x2F;passage">https:&#x2F;&#x2F;github.com&#x2F;FiloSottile&#x2F;passage</a>
评论 #43730645 未加载
dvektor26 days ago
I store my secrets in gpg encrypted files and inject them into my environment in my shell rc file.<p>AWS_SECRET_ACCESS_KEY=$(gpg -d ~&#x2F;.secrets&#x2F;aws&#x2F;key.asc)<p>type of deal. its annoying to put in a password every time i open a new tmux pane but hey, better than plain text.
评论 #43725374 未加载
评论 #43725023 未加载