Live data from Hacker News

Shell-secrets – GPG-encrypted environment variables

github.com

31–40 of 43 posts

Re: Shell-secrets – GPG-encrypted environment variables

#31

The more general version of this is probably sops[1]. (A general problem with these kinds of “wrap GPG” tools is that you end up with “mystery meat” encryption/signatures: your tool’s security margin is at the mercy of GPG’s opaque and historically not very good defaults.) [1]: https://github.com/getsops/sops

I didn't know about sops, thanks for sharing!

Encrypting YAML files' values may be handy for another project - will take note of it.

Re: Shell-secrets – GPG-encrypted environment variables

#32
post #22

I store my secrets in gpg encrypted files and inject them into my environment in my shell rc file. AWS_SECRET_ACCESS_KEY=$(gpg -d ~/.secrets/aws/key.asc) type of deal. its annoying to put in a password every time i open a new tmux pane but hey, better than plain text.

That was what I did before knowing about shell-secrets. But I also need different "contexts" on the same domains/tools (different AWS accounts and credentials for different clients), and having none "set" by default prevents me from running _whatever command_ by mistake the majority of the time.

Re: Shell-secrets – GPG-encrypted environment variables

#33

Earlier quoted context omitted.

What happens when you have multiple matching keys? What happens when your key expires? What happens when the output format changes? What happens when the key expires and it's attached to a hardware device? Gpg can fail in ways which do not tell you anything about the real underlying issue. I promise this happens all the time to people for lots of stupid reasons.

> What happens when you have multiple matching keys? Use keyid instead. > What happens when your key expires? GPG will refuse to use it for encryption. Create a new encryption key. > What happens when the output format changes? N/A here (?) > What happens when the key expires and it's attached to a hardware device? You got me.

Also.. expired keys aren't unusable. The encryption doesn't stop working.

If you have an expired GPG private key it will still decrypt things encrypted with the public key.

Re: Shell-secrets – GPG-encrypted environment variables

#34
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.

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?

Re: Shell-secrets – GPG-encrypted environment variables

#35

Earlier quoted context omitted.

The mystery meat in question is GPG, not sops or this. (I also wouldn’t call GPG a low level dependency.)

lowish. Meaning if you run a Linux desktop env with a mild amount of software installed it's likely pulled in already.

So is Perl, that doesn’t make it a good argument to use it still for the same reasons.

Re: Shell-secrets – GPG-encrypted environment variables

#36

Unless you're good at actually maintaining your gpg keychain and need other people to access this, I really wouldn't bother with gpg. There are way better and simpler options. Age has a simpler interface and SSH key support https://github.com/FiloSottile/age ejson2env has the environment variable integration and ejson has multiple backends https://github.com/Shopify/ejson2env direnv can support any cli secrets manage…

Age doesn't even have a keychain. You are expected to maintain your keys manually. So yeah, you will never have a problem with the age keychain. In the same way you will never get into trouble with the law in an anarchy. Not everyone wants to have to deal with all the details themselves.

Re: Shell-secrets – GPG-encrypted environment variables

#37
post #33

Earlier quoted context omitted.

> What happens when you have multiple matching keys? Use keyid instead. > What happens when your key expires? GPG will refuse to use it for encryption. Create a new encryption key. > What happens when the output format changes? N/A here (?) > What happens when the key expires and it's attached to a hardware device? You got me.

Also.. expired keys aren't unusable. The encryption doesn't stop working. If you have an expired GPG private key it will still decrypt things encrypted with the public key.

They're not unusable, but depending on the gpg wrapper it may look like it. Gpgme is the one I had most issues with raining with fatal errors where gpg on its own only reports a warning.

Non of this is impossible to overcome. Yet, I still was sometimes relied on to debug things.

Re: Shell-secrets – GPG-encrypted environment variables

#39

Earlier quoted context omitted.

The mystery meat in question is GPG, not sops or this. (I also wouldn’t call GPG a low level dependency.)

lowish. Meaning if you run a Linux desktop env with a mild amount of software installed it's likely pulled in already.

I’ve used a Linux desktop for my entire adult life, and I’m pretty sure GPG has never been bundled directly with my environment. I used to install it directly, but I haven’t needed that in years either since everything I needed GPG for (= git) supports SSH signing instead.

Re: Shell-secrets – GPG-encrypted environment variables

#40

for a newer password manager... https://github.com/FiloSottile/passage

Looks like FiloSottile may have switched from passage to 1Password:

https://bsky.app/profile/filippo.abyssdomain.expert/post/3l5...

Would be interesting to get more context why move from storing passwords locally to an online service.

Post reply on HN