dlech/SshAgentLib

SSH Agent mode not work in linux

Aetf opened this issue · 5 comments

Aetf commented

Environment variables SSH_AUTH_SOCK and SSH_AGENT_PID must be exported to entire session, otherwise other programs using ssh won't pick KeeAgent as its ssh-agent.

For other ssh-agent implementations, this work is usually done in a rc file or some kind of init script for the session where the program runs and returns something as a script to be eval. I can't find a way to archive the same thing as KeeAgent is a plugin but not a standalone program.

PS: I managed to rebuild these two variables from the specific path /tmp/ssh-agent-lib-sock/ and here is the script I'm using

# Fix KeeAgent enviroment variable
set _ssh_socket_dir '/tmp/ssh-agent-lib-sock'
set _ssh_socket (ls --indicator-style=none "$_ssh_socket_dir")
if test -S "$_ssh_socket_dir/$_ssh_socket";
    setenv SSH_AGENT_PID (echo "$_ssh_socket" | sed 's/agent\.//g')
    setenv SSH_AUTH_SOCK "$_ssh_socket_dir/$_ssh_socket"
end

This is fish shell script so the syntax may be different but it's easy to adopt to bash, sh, etc.

I haven't been able to find a way to do it for the whole session either, which is why I just use the standard openssh ssh-agent and run KeeAgent in client mode.

I plan to implement dlech/KeeAgent#80, which would be usable on Linux as well. It sounds kind of like what you have done.

Aetf commented

I spent a whole night and still can't get openssh ssh-agent working properly T_T, so KeeAgent's agent mode is my last resort. Thank you for the great work! And I'm looking forward to seeing it usable soon. :)

There are some other small problems though.

  • By setting SSH_AUTH_SOCK using the script I mentioned, I got the following error message doing git clone
Cloning into 'kmscon'...
Error writing to authentication socket.
Error writing to authentication socket.
remote: Counting objects: 7697, done.

Then everything goes as normal. Is there any log at KeeAgent side that can give more detailed info?

  • During the whole authentication procedure, no notification balloon is shown (already enabled in Options). A windows-only feature? If so, it would be appreciate if a similar feature is added on Linux.

What distro/desktop are you using. I've done this on lots of Debian/Ubuntu based distros with lots of GNOME based desktops and it just works out of the box. The only configuration required is disabling the SSH agent in GNOME Keyring and it automatically falls back to the openssh agent.

Re: the error message, I don't remember if I have any logging mechanism in the code currently or not - it has been too long since I have been in that particular part. Agent mode in Linux is not very well tested, so there could very well be another bug here.

The balloon is Windows-only. I have considered adding a notification mechanism to my Keebuntu suite of plugins though. If I do this, then I plan to add support for it to KeeAgent as well.

Aetf commented

Archlinux + KDE 4.13
I'm a KDE fan. 😉 But unfortunately, ssh-agent support was removed from kde-agent early this year and perhaps due to the fish shell I'm using, I can't get openssh agent working by adding it in profile or some where.

About the error message, it seems that it only occurs occasionally, I've done much work using git today and it only happened once. And I roughly read UnixAgent.cs and no logging mechanism present. Maybe due to something changed in protocol? I will pay attention to this to find some pattern, special host or key or operation or something.

For the balloon, well, I'm about used to the 'silent mode' now but still I'm glad to offer test on KDE desktops if implemented.

dlech commented

Can this be closed? Agent mode on Linux was introduced in beta v0.7.7 and there is an open issue for notifications at dlech/KeeAgent#141.