parent
16aa48baeb
commit
b60b754680
@ -0,0 +1,28 @@
|
||||
SSH Envoy
|
||||
=========
|
||||
|
||||
Provides for an easier use of [SSH][1] by setting up [ssh-agent][2], using the [envoy][3] service for systemd.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
### Identities
|
||||
|
||||
To load multiple identities, add the following line to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:ssh-envoy:load' identities 'id_rsa' 'id_dsa' 'id_github'
|
||||
|
||||
If new identities are added while the agent is running, they will be added on your next login/source.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
*The authors of this module should be contacted via the [issue tracker][4].*
|
||||
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
- [Viktor Jackson](https://github.com/xlator)
|
||||
|
||||
[1]: http://www.openssh.com
|
||||
[2]: http://www.openbsd.org/cgi-bin/man.cgi?query=ssh-agent&sektion=1
|
||||
[3]: https://github.com/vodik/envoy
|
||||
[4]: https://github.com/sorin-ionescu/prezto/issues
|
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Provides for an easier use of SSH by setting up ssh-agent via envoy (https://github.com/vodik/envoy)
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
# Viktor Jackson <viktor.jackson@gmail.com>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
if [[ "$OSTYPE" == darwin* ]] || (( ! $+commands[envoy] )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Load identities from config
|
||||
zstyle -a ':prezto:module:ssh-envoy:load' identities '_ssh_identities'
|
||||
|
||||
# Check if envoyd is running
|
||||
if [[ `systemctl show envoy --property=ActiveState` != "ActiveState=active" ]]; then
|
||||
|
||||
# Start envoy, add identities
|
||||
if (( ${#_ssh_identities} > 0 )); then
|
||||
/usr/bin/envoy -t ssh-agent ${^_ssh_identities[@]}
|
||||
else
|
||||
/usr/bin/envoy -t ssh-agent
|
||||
fi
|
||||
|
||||
else
|
||||
for _ssh_id in $_ssh_identities
|
||||
do
|
||||
# Check identities and add ones that aren't already added
|
||||
envoy -l | grep "$HOME/.ssh/$_ssh_id" > /dev/null
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "New identity: $_ssh_id"
|
||||
envoy -a $_ssh_id
|
||||
fi
|
||||
done
|
||||
fi
|
Loading…
Reference in new issue