! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Wrong behavior while stopping gpg-agent without ssh support
Status:
RESOLVED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Mikhail Efremov 2012-04-28 17:13:09 CEST
Created attachment 4371 
Fix-gpg-agent-shutdown.patch

If gpg-agent was started without ssh support then its pid is not stored in the SSH_AGENT_PID variable, but running_sshagent is setted to "gpg-agent".
So while session shutdown xfce4-session sends SIGINT to the ssh-agent that didn't started by xfce4-session and don't terminate the gpg-agent.
I don't sure about this patch, may be best solution will be just don't start gpg-agent without ssh support at all.
Comment 1 Yves-Alexis Perez editbugs 2012-10-26 16:15:11 CEST
Well, as far as I can tell, the all handling of agents is a bit inconsistent.

Basically xfce4-session seems to behaves like the only agent it cares about is the ssh one. Then, one can either use ssh-agent directly, or gpg-agent with --enable-ssh-agent.

The case where people might want to use gpg-agent only for handling gpg-agent and still keep ssh-agent is not really handled, afaict.
Comment 2 Yves-Alexis Perez editbugs 2012-10-26 16:50:38 CEST
In my opinion, the handling should be done like :

if !/startup/gpg-agent/enabled || /startup/gpg-agent/enabled == true;
   if !GPG_AGENT_INFO || (GPG_AGENT_INFO && GPG_AGENT_INFO points to garbage);
      run gpg-agent
      remember/export environment
      remember gpg-agent was run
      # ssh-agent mode of gpg-agent should be handled in .gnupg/gpg-agent.conf
      # but in case it's not, handling it here might work
   fi
fi

if !/startup/ssh-agent/enabled || /startup/ssh-agent/enabled == true;
    if !SSH_AGENT_PID || (SSH_AGENT_PID && SSH_AGENT_PID points to garbage);
    # if gpg-agent has been started in ssh-agent mode just above, 
    # SSH_AGENT_PID will be set. same thing if it has been started by another    
    # script
       run ssh-agent
       remember/export environment
       remember ssh-agent was run
    fi
fi

What do you think?
Comment 3 Mikhail Efremov 2013-06-27 16:49:35 CEST
Created attachment 5079 
Handle-gpg-and-ssh-agents-separately.patch

Yes, handling gpg and ssh agents separately is the best solution.
Patch is attached.
I didn't drop the handling of /startup/ssh-agent/type, but this can simplify code a bit. I think the gpg-agent shouldn't be launched with SSH support by default: it may not support some SSH keys types that are supported by the ssh-agent (same problem with gnome-keyring, see https://bugzilla.gnome.org/show_bug.cgi?id=641082 for example).

Bug #8792

Reported by:
Mikhail Efremov
Reported on: 2012-04-28
Last modified on: 2014-08-29

People

Assignee:
Xfce Bug Triage
CC List:
4 users

Version

Version:
Unspecified

Attachments

Fix-gpg-agent-shutdown.patch (2.45 KB, patch)
2012-04-28 17:13 CEST , Mikhail Efremov
no flags
Handle-gpg-and-ssh-agents-separately.patch (13.34 KB, patch)
2013-06-27 16:49 CEST , Mikhail Efremov
no flags

Additional information