Bug 5908 - KWallet GPG don't work
: KWallet GPG don't work
Status: CONFIRMED
Product: Desktop Bugs
Classification: ROSA Desktop
Component: -Enter Bugs Here-
: Fresh
: All Linux
: Normal normal
: 2014 KDE R6
Assigned To: Desktop Triage Team
: Desktop Triage Team
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-08 16:15 MSD by Vladimir Potapov
Modified: 2015-08-22 13:15 MSD (History)
1 user (show)

See Also:
RPM Package:
ISO-related:
Bad POT generating:
Upstream:


Attachments
ss (201.33 KB, image/png)
2015-07-08 16:15 MSD, Vladimir Potapov
Details
gpg-agent-startup.sh (1.17 KB, application/x-shellscript)
2015-08-21 09:23 MSD, Vladimir Potapov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Potapov 2015-07-08 16:15:25 MSD
Created attachment 4176 [details]
ss

KWallet GPG don't work
Comment 1 Vladimir Potapov 2015-08-06 09:20:39 MSD
See also
http://www.linuxquestions.org/questions/slackware-14/kde-4-13-3-kwallet-gpg-encryption-problem-bad-passphrase-4175532686-print/
If I use kgpg and create GPG key, it don't work
Comment 2 Vladimir Potapov 2015-08-21 09:23:41 MSD
Created attachment 4220 [details]
gpg-agent-startup.sh

file from  https://fedorahosted.org/kde-settings/browser/trunk/etc/kde/env/gpg-agent-startup.sh
Comment 3 Vladimir Potapov 2015-08-21 09:28:21 MSD
It's solved:
1) Install attached file gpg-agent-startup.sh to ~/.kde/env
2) Install kgpg and  pinentry-gtk2 (-qt4 too ugly)
3) reboot
4) run kgpg (or "gpg —gen-key" in terminal) and create key (wait.....)
Profit!
Comment 4 Vladimir Potapov 2015-08-21 12:10:24 MSD
If use systemd method for gpg-agent run, gpg-agent don't export variables.
for new gpg 2.1 used another method
https://bugs.kde.org/show_bug.cgi?id=340676
https://bugs.g10code.com/gnupg/issue1750
Comment 5 Zombie Ryushu 2015-08-22 05:52:15 MSD
I'm genuinely hoping this does not sound like word salad.

Gpg-agent creates a socket, that socket's location changes at every startup. Gpg-agent stores that sockets info in an env var called $GPG_AGENT_INFO. optionally gpg-agent can write that info to a file.

When gpg-agent creates the env var, it only does so for the current shell. Any other shell does not get updated.

If you launch gpg-agent as part of KDE or bash_profile, it works because it creates the env var in KDE or bash's shell respectively. Thus program can find the socket's location.

It's dependant on the timing of network manager's connection attempt and it's not fault tolerant. I.e. if gpg-agent crashes then it must be reloaded but no child shell will get the updated env var for the new socket location, (because it changes every time gpg-agent starts up), so for the child shells it stops working.

There is also no support for a TTY as if its part of bash profile, then  new instance of gpg-agent will be created, and thus a new socket, for each console window you open in a window manager or for each news TTY session you open.

 On the other hand, if you start gpg-agent via systemd in user mode, then all of the above is corrected but a new issue appears.

I.e. systemd spawns processes in a unique shell for that process. So the env var that gpg-agent creates never gets used because it only exists in the shell that systemd created for gpg-agent not the users active shell. Also that env var is destroyed shortly after it is created because gpg-agent is a forking process that will terminate its parent process after using it to create the env var, and systemd will terminate the shell it spawned when the gpg-agent parent process terminates as its no longer needed.

As a result the only way to get that info to other programs when using systemd is the env file option for gpg-agent. But that also has an issue.
Comment 6 Vladimir Potapov 2015-08-22 13:15:40 MSD
New gpg-agent (2.1) use updated scheme for run, without GPG_AGENT_INFO.
We assemble this version in the near future.