Skip to content
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

sops hangs until gpg agent restarted (mac) #338

Open
t3h2mas opened this issue Apr 24, 2018 · 6 comments
Open

sops hangs until gpg agent restarted (mac) #338

t3h2mas opened this issue Apr 24, 2018 · 6 comments

Comments

@t3h2mas
Copy link

t3h2mas commented Apr 24, 2018

what: sops decrypts a file once, on further decryption attempts, sops hangs until gpg agent is restarted.

setup:

  • exported SOPS_PGP_FP
  • created the file "newtest.json" with sops newtest.json
  • ran sops -d newtest.json
  • the decrypted output appears
  • ran sops -d newtest.json again, it hangs indefinitely without ouput
  • ctrl+c sops to stop it
  • kill gpg-agent with gpgconf --kill gpg-agent
  • sops -d newtest.json works again
  • repeats hanging on decryption

is there a better way to debug this?

versions:
macOS 10.13.3
sops 3.0.3 (latest)
gpg (GnuPG/MacGPG2) 2.2.3

@autrilla
Copy link
Contributor

Have you checked this a problem with SOPS, and not a problem with your gpg-agent setup? I can't reproduce this on my machine with macOS 10.13.4, sops 3.0.3 and gpg 2.2.6

@t3h2mas
Copy link
Author

t3h2mas commented Apr 24, 2018

@autrilla Do you have any relevant configuration you could share for your agent setup? I am using the vanilla configuration. (installed via gpg suite)

@autrilla
Copy link
Contributor

I don't have any configuration tweaks. I install gpg and gpg-agent through Homebrew on macOS

@ekristen
Copy link

I see this behavior too, I have to literally kill the gpg-agent each time I want to decrypt.

@uwehdaub
Copy link
Contributor

uwehdaub commented Jul 7, 2020

I see the same behavior with sops 3.5.0 under Ubuntu 18.04.
And after some debugging I truly believe, it's related to a know bug in the x/crypto/opengpg package from golang:
golang/go#28786

I compiled a version of sops with more logging and this shows the endless loop (indirectly by calling the callback passphrasePrompt:

>> sops -d ~/work/sops/secrets 
[PGP]	 INFO[0000] entering function decryptWithCryptoOpenpgp   
[PGP]	 INFO[0000] entering function loadRing with path  /home/uwe/.gnupg/secring.gpg 
[PGP]	 INFO[0000] leaving  function loadRing                   
[PGP]	 INFO[0000] decryptWithCryptoOpenpgp: got keyring        
[PGP]	 INFO[0000] decryptWithCryptoOpenpgp: armor decoded      
[PGP]	 INFO[0000] calling function openpgp.ReadMessage         
[PGP]	 INFO[0000] entering function passphrasePrompt           
[PGP]	 INFO[0000] key candidates [{Entity:0xc000360050 PublicKey:0xc000342680 PrivateKey:0xc000342680 SelfSignature:0xc0000faa80}] 
[PGP]	 INFO[0000] is key symmetric: false                      
[PGP]	 INFO[0000] return with pass with len 18                 
[PGP]	 INFO[0000] leaving  function passphrasePrompt           
[PGP]	 INFO[0000] entering function passphrasePrompt           
[PGP]	 INFO[0000] key candidates [{Entity:0xc000360050 PublicKey:0xc000342680 PrivateKey:0xc000342680 SelfSignature:0xc0000faa80}] 
[PGP]	 INFO[0000] is key symmetric: false                      
[PGP]	 INFO[0000] return with pass with len 18                 
[PGP]	 INFO[0000] leaving  function passphrasePrompt           
[PGP]	 INFO[0000] entering function passphrasePrompt           
[PGP]	 INFO[0000] key candidates [{Entity:0xc000360050 PublicKey:0xc000342680 PrivateKey:0xc000342680 SelfSignature:0xc0000faa80}] 
[PGP]	 INFO[0000] is key symmetric: false                      
[PGP]	 INFO[0000] return with pass with len 18                 
[PGP]	 INFO[0000] leaving  function passphrasePrompt           
[PGP]	 INFO[0000] entering function passphrasePrompt           
[PGP]	 INFO[0000] key candidates [{Entity:0xc000360050 PublicKey:0xc000342680 PrivateKey:0xc000342680 SelfSignature:0xc0000faa80}] 
[PGP]	 INFO[0000] is key symmetric: false                      
[PGP]	 INFO[0000] return with pass with len 18                 
[PGP]	 INFO[0000] leaving  function passphrasePrompt

@ekristen
Copy link

I can confirm linux see this behavior as well. This even happens when there are no suitable PGP keys available. IE using key groups and a KMS and GPG keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants