NixOS / nixos

OBSOLETE (go to NixOS/nixpkgs) - NixOS, a Linux distribution based on the Nix package manager - OBSOLETE (go to NixOS/nixpkgs)
MIT License
176 stars 102 forks source link

Start gpg-agent in the "official" way to make ssh-support work. #275

Closed pSub closed 10 years ago

pSub commented 11 years ago

I experience problems with ssh support of gpg-agent. The password management does not work, i.e. pinentry is not started and passwords are not remembered. Since it does work for others in #nixos I am doing something wrong, or at least different. The attached changes resolve the problem for me, so it seems that environment variables are not set correctly for me.

I will investigate further to see what causes the problem, to see if those changes are really needed.

My xinit/xsession file is located here: https://github.com/pSub/configs/blob/master/.xinitrc

peti commented 11 years ago

-1 for this patch. I prefer the exec-style invocation of gpg-agent over eval.

If your shell environment lacks the necessary settings to use the agent, then you probably need to source "$HOME/.gpg-agent-info". I have the following code in my ~/.bashrc:

if [ -f "${HOME}/.gpg-agent-info" ]; then
  source "${HOME}/.gpg-agent-info"
  export GPG_AGENT_INFO
  export SSH_AUTH_SOCK
fi
pSub commented 11 years ago

Thanks, I will try this.

edolstra commented 11 years ago

Actually, why is the exec style better? It's confusing and less efficient (because we have to go through the whole session script again - praying that we don't get an infinite loop).

peti commented 11 years ago

Interesting, I didn't see it that way. You may be right ... maybe we should use the --daemonmode instead of exec.

peti commented 11 years ago

Well, here is another question: since the daemon writes its settings to ~/.gpg-agent-info, do we need to eval its output at all?

edolstra commented 11 years ago

OTOH, the advantage of exec is that you know for sure that gpg-agent / ssh-agent will exit when you log out. Not sure what will happen if they're backgrounded as a daemon...

pSub commented 10 years ago

It works for me now and this repository is obsolete anyway, so I close this PR.