Support for gpg2?
Hi!
I'm using gpg 2.1 and I'm unable to use sops because it can't find the new pubring.kbx that gpg2 uses. Looks like it's hardcoded to open pubring.gpg.
After digging a bit more, I'm not sure crypto/openpgp supports gpg > 2 :frowning:
I'm guessing I can't use sops unless I have secring.gpg and pubring.gpg and not pubring.kbx?
We need to add an option to use command line gpg or gpg2 instead of using the crypto/openpgp library.
I haven't looked at gpg2 yet. Do you know if the command line arguments are the same as with gpg ?
I think we should do this distinctly from the openpgp Go package. Maybe even replace the current gpg handling to use the gpg binary like python sops did, and add openpgp as a new master key provider (like KMS). This way we'd end up with 3 providers, KMS, go-openpgp and gpg.
On Fri, Jan 13, 2017, 15:54 Julien Vehent [:ulfr] [email protected] wrote:
We need to add an option to use command line gpg or gpg2 instead of using the crypto/openpgp library. I haven't looked at gpg2 yet. Do you know if the command line arguments are the same as with gpg ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mozilla/sops/issues/189#issuecomment-272461629, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJ-V5w4VgRjdji4IpxVlNF4mrNX3Zo7ks5rR5AwgaJpZM4LiYBw .
That doesn't make a lot of sense to me. It's the same protocol and key format, just a different way of accessing the data.
sops 1 supported SOPS_GPG_EXEC. I think sops 2 should support it as well and, if defined, use the gpg binary specified in path to encrypt/decrypt the data key.
It has the benefit of allowing to use sops without gpg installed. I don't know if that is important to anyone, though. Since we already have an implementation using crypto/openpgp, I think it might be good to keep it around and add a new one using the binary.
On Fri, Jan 13, 2017, 16:25 Julien Vehent [:ulfr] [email protected] wrote:
That doesn't make a lot of sense to me. It's the same protocol and key format, just a different way of accessing the data.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/mozilla/sops/issues/189#issuecomment-272469163, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJ-V-d6eP5RuyyvfO1FWVEywJqijPfLks5rR5dXgaJpZM4LiYBw .
I absolutely think crypto/openpgp should be the default method of performing PGP operations. My point is users should be able to override this and use the gpg1/2 binary by specifying the path to the binary in SOPS_GPG_EXEC.
Are we sure the Go package doesn't already support the GnuPG 2.1 keyring location and format? The problem I saw from looking at the code was that sops has the paths of the keyrings hardcoded to the <= 2.0 versions of GnuPG, not necessarily a problem with the OpenPGP implementation itself.
I don't see support for anything over v2.0 in the read tests.
I'm 99.8% sure crypto/openpgp doesn't support gpg2 keyring format. That said, you can change the default location of the keyring using the GNUPGHOME env variable.
My understanding is that secring.gpg is gone, as well. Both rings are stored inside pubring.kbx.
@jimmycuadra is correct, see the changelog
Maybe we can access it through the agent?
With GnuPG 2.1 this changed and gpg now also delegates all private key operations to the gpg-agent.
Hang on; doesn't SOPS talk to gpg-agent? (This is relevant to my interests, because I was unable to get SOPS to work with my Yubikey 4 token.)
@lvh the Python version did, as it just calls the gpg binary it finds in your PATH. The Go version uses Go's crypto/openpgp package, which is fully independent from GPG and thus doesn't talk to the agent.
Gotcha. See #191; I was confused by: https://github.com/mozilla/sops/blob/0483f8a07af035f2cb75e7a72b1901eccac82ed1/pgp/keysource.go#L15
also hi @autrilla long time no see
Err, you're right, we do talk to gpg-agent. I didn't express myself correctly.
SOPS talks to gpg-agent to retrieve the passphrase for private keys. crypto/openpgp does not support smart card private keys. In any case, as I understand it, the way we communicate with gpg-agent would not work for smart cards at all, as even if we get the passphrase we'll never have access to the private key, which crypto/openpgp needs.
It's very likely I'm totally wrong about this, as my understanding of gpg is very limited.
OK, that makes a lot of sense after more review of the code! You're right of course, the entire point of the token is that the key lives on the card and never, never leaves -- you send the message to the token to be encrypted, and it sends the encrypted thing back to you.
I'm glad I learned the Go version doesn't support smart cards. I've been using sops with my Yubikey for a while and only now am realizing it's cause I still have the Python version. I'd better not upgrade. >_<
Sops 1 is still maintained and installable via pip. You're safe to upgrade, we won't force you to v2.
On January 18, 2017 8:08:30 PM EST, Jimmy Cuadra [email protected] wrote:
I'm glad I learned the Go version doesn't support smart cards. I've been using sops with my Yubikey for a while and only now am realizing it's cause I still have the Python version. I'd better not upgrade. >_<
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/mozilla/sops/issues/189#issuecomment-273652292
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
jvehent commented on Jan 13 I absolutely think crypto/openpgp should be the default method of performing PGP operations. My point is users should be able to override this and use the gpg1/2 binary by specifying the path to the binary in SOPS_GPG_EXEC.
Au contraire, given that crypto/openpgp isn't updated -- and tbh, even if it is -- it should only be a backup to CLI gpg when the latter isn't installed. What's the path forward on this issue?
The path forward for now is implementing support for calling the gpg binary. What we should default to is a bit bikesheddy but I suppose it's up for discussion.
As I see it, the advantages for defaulting to crypto/openpgp:
- Simpler to implement, therefore harder to mess up
- No external dependencies
And the advantages for defaulting to the binary:
- Support for more gpg features such as smart cards and the new gpg2 keyring format
Personally I agree with @jvehent that defaulting to crypto/openpgp is the way to go here, even if it has some issues. In any case, we could just add an option in .sops.yaml to override the default.