Mailing List Archive

gpg-agent not setting environment correctly.
Hello,

I am trying to setup KMail to use GnuPG. I have emerged unstable gnupg
(1.9.19), gpg-agent (1.9.19) and pinentry (0.7.2-r1). I am now trying to
setup gpg-agent and have followed documentation on gentoo site but the
problem is that even after setting the agent-startup.sh the way it explains,
the environment is not getting updated. I get the following results when
trying to know about gpg agent's env

$ $GPG_AGENT_INFO
bash: /tmp/gpg-roleYu/S.gpg-agent:8297:1: No such file or directory

Now, even though gpg-agent is working as daemon, KMail asks for password
everytime I try to send a signed mail and complains that gpg-agent is not
running. I have googled but can not find a solution so if someone who is
running KMail and gpg-agent could give some insights then I will be highly
thankful.

Abhay
--
gentoo-security@gentoo.org mailing list
Re: gpg-agent not setting environment correctly. [ In reply to ]
On Thursday 10 November 2005 18:15, abhay wrote:
> Hello,
>
> I am trying to setup KMail to use GnuPG. I have emerged unstable gnupg
> (1.9.19), gpg-agent (1.9.19) and pinentry (0.7.2-r1).

I don't think you need unstable versions of gnupg and pinentry. I'm using
stable versions and they work ok. gpg-agent OTOH is still ~x86 masked I
guess.

> I am now trying to
> setup gpg-agent and have followed documentation on gentoo site but the
> problem is that even after setting the agent-startup.sh the way it
> explains, the environment is not getting updated. I get the following
> results when trying to know about gpg agent's env
>
> $ $GPG_AGENT_INFO
> bash: /tmp/gpg-roleYu/S.gpg-agent:8297:1: No such file or directoryg

that's normal. the variable contains the location of a fd socket with some
extra info.

pjlv@archon ~ $ ls -l $GPG_AGENT_INFO
ls: /tmp/gpg-K6J5z2/S.gpg-agent:25227:1: No such file or directory
pjlv@archon ~ $ ls -l /tmp/gpg-K6J5z2/S.gpg-agent
srwxr-xr-x 1 pjlv users 0 Nov 10 23:51 /tmp/gpg-K6J5z2/S.gpg-agent

there it is! gpg-agent seems to be working ok.

please note that you're trying to execute that file by issuing $VARIABLE.
you'd want to do something more like echo $VARIABLE to see if it's defined.
then you could look for the file.

> Now, even though gpg-agent is working as daemon, KMail asks for password
> everytime I try to send a signed mail and complains that gpg-agent is not
> running. I have googled but can not find a solution so if someone who is
> running KMail and gpg-agent could give some insights then I will be highly
> thankful.

have you checked that gpg-agent is indeed running? do a ps -C gpg-agent?

pjlv@archon ~ $ ps -C gpg-agent
PID TTY TIME CMD
25227 ? 00:00:00 gpg-agent
pjlv@archon ~ $

it it is not running (this will sound ugly but it has a purpose) have you
tried logging out and in again from kde? the gpg-agent is started when users
log into kde sessions (remember /usr/kde/3.4/env/agent-startup.sh?).

IIRC my installation was very simple.

1. emerge pinentry and gpg-agent
2. uncommented some lines from /usr/kde/3.4/env/agent-startup.sh
and /usr/kde/3.4/shutdown/agent-shutdown.sh (as instructed). when I log into
kde it starts gpg-agent automatically.
3. tweaked ~/.gnupg/gpg-agent.conf with
pinentry-program /usr/bin/pinentry-qt
no-grab
default-cache-ttl 1800
4. make sure kmail was correctly configured to handle my gpg keys.

regards,
pedro venda.
--

Pedro João Lopes Venda
email: pjvenda at pjvenda org
http://www.pjvenda.org
Re: gpg-agent not setting environment correctly. [ In reply to ]
On Friday 11 Nov 2005 7:52 am, you wrote:
> I don't think you need unstable versions of gnupg and pinentry. I'm using
> stable versions and they work ok. gpg-agent OTOH is still ~x86 masked I
> guess.
>
Ok so I now emerged the stable packages and unmerged the hard masked packages
but still the same problem.

> have you checked that gpg-agent is indeed running? do a ps -C gpg-agent?
I passed the command you mentioned and gpg-agent is running.

> it it is not running (this will sound ugly but it has a purpose) have you
> tried logging out and in again from kde? the gpg-agent is started when
> users log into kde sessions (remember /usr/kde/3.4/env/agent-startup.sh?).
Actually I was so desperate that even restarted the system. Doesn't help.

I followed the instructions on this page
http://kmail.kde.org/kmail-pgpmime-howto.html#gnupg
When I pass the command "echo "test" | gpg -ase -r 0xDEADBEEF | gpg" as
mentioned on the page, I get an error that says "gpg: problem with the agent
- disabling agent use". Seems as though gpg-agent is not allowing
connections. Anyways to solve this problem. I am completely stumped.

Abhay
--
gentoo-security@gentoo.org mailing list
Re: gpg-agent not setting environment correctly. [ In reply to ]
On Friday 11 Nov 2005 7:52 am, Pedro Venda wrote:
> have you checked that gpg-agent is indeed running? do a ps -C gpg-agent?
>
> pjlv@archon ~ $ ps -C gpg-agent
> PID TTY TIME CMD
> 25227 ? 00:00:00 gpg-agent
> pjlv@archon ~ $
*Feeling really dumb at the moment*
Thanks to that part of your mail, something clicked :-)
I tried to start gpg-agent from command line instead of from the scripts. Even
though the daemon was starting it was not taking connections. A little more
googling and the error messages made me check the gpg-agent.conf once again.

I had blindly followed the instructions from kmail.kde.org thus putting path
to pinentry in gpg-agent.conf as /usr/local/bin/pinentry-qt instead
of /usr/bin/pinentry-qt. Changed it to correct path and it works now.

Probably the most stupid mistake since I did an accidental "rm -fR /"

Thanks for your help.

Abhay