marcwebbie / passpie

:closed_lock_with_key: Multiplatform command-line password manager
http://passpie.readthedocs.org/
MIT License
921 stars 68 forks source link

Fix an issue with gpg2 (v2.1) where it does not respect --passphrase #105

Closed eiginn closed 8 years ago

eiginn commented 8 years ago

gpg2.1 will not use passphrase at command line due to the started gpg-agent not respecting the option without setting:

gpg.conf:pinentry-mode loopback gpg-agent.conf:allow-loopback-pinentry

This results in the default pinentry program popping up after typing passphrase at passpie prompt (or even garbage).

Further this leaves an idle gpg-agent around that is not addressed by this commit.

ref: https://bugs.g10code.com/gnupg/issue1772 https://wiki.archlinux.org/index.php/GnuPG#Unattended_passphrase

eiginn commented 8 years ago

Here's what it ends up looking like run by hand Without confs:

gpg2 --no-tty --always-trust --homedir /tmp/tmp5hhhPK --batch --passphrase '<REMOVED>' --yes --emit-version --verbose -o - -d <REMOVED>
gpg: armor header: Version: GnuPG v2
gpg: public key is <REMOVED>
gpg: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg: waiting for the agent to come up ... (5s)
gpg: connection to agent established
gpg: using subkey <REMOVED> instead of primary key <REMOVED>
gpg: using subkey <REMOVED> instead of primary key <REMOVED>
gpg: encrypted with 2048-bit RSA key, ID <REMOVED>, created <REMOVED>
      "Passpie (Auto-generated by Passpie) <passpie@local>"
<pinentry dialog here>
gpg: public key decryption failed: Operation cancelled
gpg: decryption failed: No secret key

With confs:

gpg2 --no-tty --always-trust --homedir /tmp/tmp5hhhPK --batch --passphrase '<REMOVED>' --yes --emit-version --verbose -o - -d <REMOVED>
gpg: armor header: Version: GnuPG v2
gpg: public key is <REMOVED>
gpg: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg: waiting for the agent to come up ... (5s)
gpg: connection to agent established
gpg: using subkey <REMOVED> instead of primary key <REMOVED>
gpg: using subkey <REMOVED> instead of primary key <REMOVED>
gpg: encrypted with 2048-bit RSA key, ID <REMOVED>, created <REMOVED>
      "Passpie (Auto-generated by Passpie) <passpie@local>"
gpg: AES256 encrypted data
gpg: original file name=''
<REMOVED>
marcwebbie commented 8 years ago

Hey @eiginn,

Thanks for your contribution, would you mind checking the broken build in travis?

eiginn commented 8 years ago

Huh, that's oddly confusing why its failing due to importing * from _compat when it succeeds on other commits.

marcwebbie commented 8 years ago

Hello @eiginn,

I've fixed the issues with the lint on import from _compat, Would you mind rebasing and pushing back for merging?

Regards,

codecov-io commented 8 years ago

Current coverage is 78.55%

Merging #105 into master will decrease coverage by 0.59%

@@             master       #105   diff @@
==========================================
  Files            18         18          
  Lines          1012       1021     +9   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            801        802     +1   
- Misses          211        219     +8   
  Partials          0          0          

Powered by Codecov. Last updated by b1795ce...99ae256