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

Failed to fetch public key #5

Closed
ndarilek opened this issue Feb 2, 2017 · 18 comments · Fixed by #419
Closed

Failed to fetch public key #5

ndarilek opened this issue Feb 2, 2017 · 18 comments · Fixed by #419
Assignees

Comments

@ndarilek
Copy link

ndarilek commented Feb 2, 2017

Getting this whenever I use init and either select a key from the menu or enter in a long ID.

I'm pretty sure I have this public key locally as it is from my own private keypair.

Is there any way to get additional debugging details so I can determine what this means? (I.e. failure of the gpg binary, maybe something wrong with my key, etc.)

Thanks.

@dominikschulz
Copy link
Member

Try export GOPASS_DEBUG=true to get some more debug output.

@metalmatze
Copy link
Contributor

You can use: gpg --list-keys to check if a key with the fingerprint exists. We do not much more under the hood.

@ndarilek
Copy link
Author

ndarilek commented Feb 2, 2017 via email

@ndarilek
Copy link
Author

ndarilek commented Feb 2, 2017 via email

@dominikschulz
Copy link
Member

Oh, nice find.

This should be fixed by #9

@ndarilek
Copy link
Author

ndarilek commented Feb 2, 2017 via email

@dominikschulz
Copy link
Member

dominikschulz commented Feb 2, 2017

We're collecting the first batch of feedback in develop and will soon do a point release. If you're using go get you can check out master and build that anytime.

@ndarilek
Copy link
Author

ndarilek commented Feb 2, 2017 via email

@metalmatze
Copy link
Contributor

Simply use go get to fetch the repository to your machine. Once done go to $GOPATH/src/github.com/justwachcom/gopass. If you are in that directory you can see that it is a normal git repository. Run git checkout develop. Now you can build a new binary by running make build.
Hope that helps. Didn't test it, because I'm on mobile right now.

@ndarilek
Copy link
Author

ndarilek commented Feb 2, 2017 via email

@ndarilek
Copy link
Author

ndarilek commented Feb 3, 2017 via email

@metalmatze metalmatze added this to the 1.1.0 milestone Feb 3, 2017
@dominikschulz dominikschulz modified the milestones: 1.0.2, 1.1.0 Mar 20, 2017
@metalmatze metalmatze modified the milestones: 1.1.0, 1.0.2 Mar 24, 2017
@dominikschulz dominikschulz modified the milestones: 1.x.x, 1.1.0 May 17, 2017
@dominikschulz
Copy link
Member

I've tracked down the root cause: Depending on your GPG version and config GPG may mark trused but not signed keys as unknown. Thus gopass would ignore this key for encryption.

To work around this limitation we currently disabled recipient checking and default to alwaystrust.

@kyleboon
Copy link

@dominikschulz I'm running into this problem with the latest version of gopass.

gopass 1.4.1 (634dd033d9ddc5777e0ff5d8ab221b96e6265113 2017-10-06 03:03:40) go1.9.1 darwin amd64
gpg1 --version
gpg (GnuPG) 1.4.22
gpg --version
gpg (GnuPG) 2.2.1
libgcrypt 1.8.1
▶ gopass init D507934588256274
[DEBUG] Loaded config: &{Root:0xc42000f440 Mounts:map[wms:0xc42000f620] Version:1.4.1 XXX:map[]}
[DEBUG] Loaded config from /Users/z002nd2/.config/gopass/config.yml: &{Root:0xc42000f440 Mounts:map[wms:0xc42000f620] Version:1.4.1 XXX:map[]}
Failed to initialized mount wms (/Users/z002nd2/.password-store-wms): password store wms is not initialized. Try gopass init --store wms --path /Users/z002nd2/.password-store-wms. Ignoring
Initializing a new password store ...

[DEBUG] gpg.listKeys: /usr/local/bin/gpg1 [/usr/local/bin/gpg1 --with-colons --with-fingerprint --fixed-list-mode --list-public-keys D507934588256274]
[DEBUG] gpg.listKeys: /usr/local/bin/gpg1 [/usr/local/bin/gpg1 --with-colons --with-fingerprint --fixed-list-mode --list-secret-keys 21169A2321248830D72E81C8D507934588256274]
gpg: error reading key: secret key not available
▶ /usr/local/bin/gpg1 --with-colons --with-fingerprint --fixed-list-mode --list-secret-keys 21169A2321248830D72E81C8D507934588256274
gpg: error reading key: secret key not available

the same command with gpg2 works fine though.

▶ /usr/local/bin/gpg --with-colons --with-fingerprint --fixed-list-mode --list-secret-keys 21169A2321248830D72E81C8D507934588256274
sec:u:4096:1:D507934588256274:1495601237:::u:::scESC::::::23::0:
fpr:::::::::21169A2321248830D72E81C8D507934588256274:
grp:::::::::246896E55F78A2E8DFB17D05923930E3C1753241:
uid:u::::1495601237::68C277AEC585FED73C672133CBAFBFED8730E01F::WMS Secrets <wms@target.com>::::::::::0:
ssb:u:4096:1:C35D3935D344E22F:1495601237::::::e::::::23:
fpr:::::::::F0B179BFDA03F1CBFDC77664C35D3935D344E22F:
grp:::::::::7E2938F202C4B9F831A4D1E2C2F1A9FDD3A05CA4:

@dominikschulz
Copy link
Member

gopass should use gpg2 if that's available.

I think this line https://github.com/justwatchcom/gopass/blob/master/backend/gpg/cli/gpg.go#L62 might be wrong.

@dominikschulz dominikschulz reopened this Oct 17, 2017
@dominikschulz dominikschulz modified the milestones: 1.3.0 - Improved UX, 1.6.0 - Store Integrity Oct 17, 2017
@dominikschulz dominikschulz self-assigned this Oct 17, 2017
@kyleboon
Copy link

kyleboon commented Oct 17, 2017 via email

@kyleboon
Copy link

It looks like this was a change in the homebrew recipe when the version went from 2.1.21 to 2.2.1

@kyleboon
Copy link

For some reason I had gpg1 installed also, I don't need that so I uninstalled and it works for me. Might be worth just adding an override via an env variable in case this comes up for someone who doesn't have a good workaround?

@dragon788
Copy link
Contributor

Might not hurt to capture the version of gpg with gpg --version and do slightly different handling or offer a warning if two versions are detected. Could also do a "smart" detection where if the .gnupg/secring.db exists that means gpg has been initialized, otherwise if the .gnupg/pubring.kbx exists they are using gpg2. I also noticed if you ran gpg2 after gpg1 there is a .gnupg/.gpg-v21-migrated file which reading their release notes strongly suggestions you stop using gpg if possible because gpg2 operations won't update the gpg1 pub/priv keys for trust anymore.

dominikschulz referenced this issue in dominikschulz/gopass Oct 24, 2017
This commit fixes a number of issue around GPG, improves
the GPG binary detection and covers some windows cases.

Fixes #5
Fixes gopasspw#334
Fixes gopasspw#418
dominikschulz added a commit that referenced this issue Oct 24, 2017
This commit fixes a number of issue around GPG, improves
the GPG binary detection and covers some windows cases.

Fixes #5
Fixes #334
Fixes #418
kpitt referenced this issue in kpitt/gopass Jul 21, 2022
This commit fixes a number of issue around GPG, improves
the GPG binary detection and covers some windows cases.

Fixes #5
Fixes gopasspw#334
Fixes gopasspw#418
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

Successfully merging a pull request may close this issue.

5 participants