Commit graph

22 commits

Author SHA1 Message Date
Marc Cornellà
fabee55948
ssh-agent: autoload identities not already loaded (#7174)
With this PR the ssh-agent plugin checks the `ssh-add -l` output for the
identities added, and adds all those specified by the user that haven't been
added yet.

We also decouple the logic of starting ssh-agent from the logic of adding
identities, meaning that even if ssh-agent has been started by some other means
(like launchd) we can still ssh-add the user's identities.

Fixes #3019
Fixes #6979
2019-01-09 21:19:52 +01:00
Michael Stucki
302270174d Use existing ssh-agent when invoking a sudo shell (#3891)
When invoking a shell as root using ```sudo -s```, the ssh-agent plugin
starts a new agent although it already exists.

The problem boils down to a check if ssh-agent is running using
```ps x```. If that is extended to ```ps ax``` for root, then the
existing ssh-agent will still work.
2018-07-01 18:20:34 +02:00
Marc Cornellà
5bd9500bf4 ssh-agent: check ssh-agent process w/ ps again
The alternative is using tools that aren't available everywhere.
The latest report is that cygwin/msys2 doesn't have pgrep.

Fixes #5418.
2016-09-17 13:01:10 +02:00
Marc Cornellà
973a4e646c ssh-agent: fix non-standard process check w/ pgrep
Confirmed to work on MacOS, OpenBSD, Solaris and busybox.
2016-09-05 08:31:20 +02:00
Marc Cornellà
53c3567cc3 Force ssh-agent output to use bourne-style syntax
On systems where the shell cannot be changed because of a strict
security policy, ssh-agent will use the syntax of whatever the
default $SHELL is.
For instance, if the default shell is tcsh, ssh-agent will use the
c-shell style (setenv).

This change forces ssh-agent to use bourne-style syntax since that
has to be later interpreted by zsh. Consequently, the environment
file will contain `export' statements from now on (instead of
`setenv').
2016-09-03 20:49:55 +02:00
Marc Cornellà
142ad842d7 Simplify PID check of current ssh-agent 2016-09-03 20:49:55 +02:00
Marc Cornellà
cb0833ac13 Clean up formatting of ssh-agent plugin 2016-09-03 20:49:55 +02:00
Marc Cornellà
b60acddefe Extract comments into README for ssh-agent plugin 2016-09-03 20:49:55 +02:00
Marc Cornellà
81e73e3d18 Delete useless /usr/bin/env in ssh-agent 2016-09-03 20:49:55 +02:00
Maximilian Güntner
0c60f421cb ssh-agent: Use /usr/bin/env to find ssh-add
This change is important when ssh-add is not inside /usr/bin e.g.
on NixOS.

Signed-off-by: Maximilian Güntner <code@maschinenpsychologe.de>
2016-09-03 20:49:55 +02:00
Piotr Gaczkowski
24ac1aa348 Clobber ssh environment regardless of setopt (#5322) 2016-08-21 00:02:58 +02:00
ncanceill
2c19c0e59e typo, fixes #1806 2014-05-24 08:31:59 +02:00
Christian Höltje
cfe468f6f6 ssh-agent: prevent environment file from flapping
On an OS X laptop, the variable `$HOST` changes a lot depending
on what wifi network you're connected to.  This causes a lot
of `~/.ssh/environment-$HOST` files to be created and
causes multiple ssh-agents to created.

Instead, use `scutil --get ComputerName` to get something
more stable.
2014-03-13 14:44:58 -04:00
nishigori
dd4f57010c Fix bad ps syntax in ssh-agent plugin 2013-11-05 08:40:13 +09:00
Robby Russell
b2376c3770 Merge pull request #1529 from aquaplanet/fix-sshagent-openbsd
Fix ssh-agent plugin for OpenBSD, making it more portable
2013-11-04 12:29:42 -08:00
Armin Widegreen
5c529b5daa Fix ssh-agent plugin identities comment for using multiple identities. 2013-07-16 17:24:07 +02:00
Marcel Wolf
2a1c9ff340 add ssh-agent option to set default lifetime of identities
By default, ssh-agent stores identities forever. It has an option to
set a maximum lifetime for identites (useful to expire passphrase protected
keys). Allow this option to be set using:

zstyle :omz:plugins:ssh-agent lifetime <time>
2013-03-16 00:06:46 -04:00
Anders Andersson
1f4bb8deb7 OpenBSD doesn't have -ef flags for ps. Both linux and OpenBSD have -x flags which works just as greate here 2012-12-30 09:52:32 +01:00
gwjo
40b7f2099d Add support for loading mulitple identities 2011-06-04 22:34:49 -04:00
gwjo
35b879a17b Add support for agent forwarding 2011-06-04 22:34:17 -04:00
Theodore Robert Campbell Jr
9d991a5080 ssh-agent plugin now ends in "-$HOST" so an agent is started properly with nfs shared homes. 2011-03-01 01:38:12 -05:00
Robby Russell
26d97a9355 Reorganizing plugins so that each plugin has it's own directory now so that any plugin-specific functions can be bundled within there. 2010-09-30 21:34:06 -07:00
Renamed from plugins/ssh-agent.plugin.zsh (Browse further)