1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

- Change the name of the file in which keychain stores the environment

settings of the running ssh-agent(1) process from ~/.ssh-agent to
  ~/.ssh-agent-`hostname -s`.  This is to allow users with NFS-mounted home
  directories to use keychain on multiple machines simultaneously.
- Bump PORTREVISION

PR:		30506
Submitted by:	Martti Kuparinen <martti.kuparinen@iki.fi>
This commit is contained in:
Johann Visagie 2001-09-11 12:06:29 +00:00
parent e19aceb0b2
commit 6cae6e6901
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=47658
2 changed files with 67 additions and 10 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= keychain
PORTVERSION= 1.2
PORTREVISION= 1
CATEGORIES= security
MASTER_SITES= http://www.ibiblio.org/gentoo/distfiles/

View File

@ -1,29 +1,85 @@
--- keychain.orig Mon Sep 10 06:42:47 2001
+++ keychain Mon Sep 10 08:54:24 2001
@@ -59,7 +59,7 @@
+++ keychain Tue Sep 11 13:55:58 2001
@@ -9,6 +9,7 @@
trap "" INT
PATH="/sbin:/usr/sbin:${PATH}"; export PATH;
KEYCHAIN_KEYS=""
+SHORTHOSTNAME=`hostname -s`
for x in ${*}
do
# if it's not an --option, add it to our list of keys
@@ -46,20 +47,20 @@
Keychain is an OpenSSH key manager, typically run from ~/.bash_profile. When
run, it will make sure ssh-agent is running; if not, it will start ssh-agent.
- It will redirect ssh-agent's output to ~/.ssh-agent, so that cron jobs that
- need to use ssh-agent keys can simply source this file and make the necessary
- passwordless ssh connections. In addition, when keychain runs, it will check
- with ssh-agent and make sure that the ssh RSA/DSA keys that you specified on
- the keychain command line have actually been added to ssh-agent. If not, you
- are prompted for the appropriate passphrases so that they can be added by
- keychain.
+ It will redirect ssh-agent's output to ~/.ssh-agent-HOSTNAME, so that cron
+ jobs that need to use ssh-agent keys can simply source this file and make the
+ necessary passwordless ssh connections. In addition, when keychain runs, it
+ will check with ssh-agent and make sure that the ssh RSA/DSA keys that you
+ specified on the keychain command line have actually been added to ssh-agent.
+ If not, you are prompted for the appropriate passphrases so that they can be
+ added by keychain.
Typically, one uses keychain by adding the following to the top of their
~/.bash_profile (or ~/.zshrc, in case of zsh):
EOHELP
echo -e " ${CYAN}keychain ~/.ssh/id_rsa ~/.ssh/id_dsa"
-echo -e " source ~/.ssh-agent > /dev/null${OFF}"
+echo -e " . ~/.ssh-agent > /dev/null${OFF}"
+echo -e " . ~/.ssh-agent-HOSTNAME > /dev/null${OFF}"
echo -e " # the > /dev/null eliminates the redundant agent PID output"
echo
cat <<EOHELP
@@ -109,7 +109,7 @@
chmod 0600 ~/.ssh-agent
@@ -86,8 +87,9 @@
echo
cat <<EOHELP
This option tells keychain do everything it normally does (ensure ssh-agent is
- running, set up the ~/.ssh-agent file) except that it will not prompt you to
- add any of the keys you specified if they haven't yet been added to ssh-agent.
+ running, set up the ~/.ssh-agent-HOSTNAME file) except that it will not prompt
+ you to add any of the keys you specified if they haven't yet been added to
+ ssh-agent.
EOHELP
echo -e " ${GREEN}--stop${OFF}"
@@ -102,14 +104,14 @@
fi
-if [ ! -f ~/.ssh-agent ]
+if [ ! -f ~/.ssh-agent-${SHORTHOSTNAME} ]
then
- echo -e " ${GREEN}*${OFF} Initializing ~/.ssh-agent file..."
- touch ~/.ssh-agent || ( echo "$0: Cannot create ~/.ssh-agent, exiting." 1>&2 && exit 1 )
- chmod 0600 ~/.ssh-agent
+ echo -e " ${GREEN}*${OFF} Initializing ~/.ssh-agent-HOSTNAME file..."
+ touch ~/.ssh-agent-${SHORTHOSTNAME} || ( echo "$0: Cannot create ~/.ssh-agent-HOSTNAME, exiting." 1>&2 && exit 1 )
+ chmod 0600 ~/.ssh-agent-${SHORTHOSTNAME}
SSH_AGENT_PID="NULL"
else
- source ~/.ssh-agent > /dev/null
+ . ~/.ssh-agent > /dev/null
+ . ~/.ssh-agent-${SHORTHOSTNAME} > /dev/null
fi
match="no"
@@ -130,7 +130,7 @@
chmod 0600 ~/.ssh-agent
@@ -127,10 +129,10 @@
if [ "$match" = "no" ]
then
- chmod 0600 ~/.ssh-agent
+ chmod 0600 ~/.ssh-agent-${SHORTHOSTNAME}
echo -e " ${GREEN}*${OFF} starting new ssh-agent"
nohup ssh-agent > ~/.ssh-agent
- nohup ssh-agent > ~/.ssh-agent
- source ~/.ssh-agent > /dev/null
+ . ~/.ssh-agent > /dev/null
+ nohup ssh-agent > ~/.ssh-agent-${SHORTHOSTNAME}
+ . ~/.ssh-agent-${SHORTHOSTNAME} > /dev/null
fi
if [ -n "`echo $* | grep '\-\-clear'`" ]