projects
/
user
/
alex
/
software
/
my-snippets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0cb6a3d
)
sshroot: store the timeout in minutes
author
Alex Dehnert
<adehnert@mit.edu>
Mon, 12 Mar 2012 18:36:54 +0000
(14:36 -0400)
committer
Alex Dehnert
<adehnert@mit.edu>
Mon, 12 Mar 2012 18:36:54 +0000
(14:36 -0400)
sshroot
patch
|
blob
|
history
diff --git
a/sshroot
b/sshroot
index 6a0c4b5f6e8d906e1d572c75e54a7e3a2b78adf5..97ae2ea7ab46ebf6df8b0d01be7f7447de718479 100755
(executable)
--- a/
sshroot
+++ b/
sshroot
@@
-2,7
+2,9
@@
export KRB5CCNAME=/tmp/krb5cc_$(id -u).root
export KRBTKFILE=/dev/null
export KRB5CCNAME=/tmp/krb5cc_$(id -u).root
export KRBTKFILE=/dev/null
-lifetime=900
+# lifetime, in minutes
+lifetime=15
+
hostopt=""
[ -z "$hostopt" ] && hostopt="${HOSTNAME}"
[ -z "$hostopt" ] && hostopt=`uname -n 2>/dev/null || echo unknown`
hostopt=""
[ -z "$hostopt" ] && hostopt="${HOSTNAME}"
[ -z "$hostopt" ] && hostopt=`uname -n 2>/dev/null || echo unknown`
@@
-11,14
+13,14
@@
keys=~/.ssh/id_rsa_root
function with-keys
{
unset SSH_AUTH_SOCK SSH_AGENT_PID
function with-keys
{
unset SSH_AUTH_SOCK SSH_AGENT_PID
- eval $(keychain --eval --host "$hostopt-root" $keys)
+ eval $(keychain --
timeout $lifetime --
eval --host "$hostopt-root" $keys)
exec "$@"
}
function with-agent
{
unset SSH_AUTH_SOCK SSH_AGENT_PID
exec "$@"
}
function with-agent
{
unset SSH_AUTH_SOCK SSH_AGENT_PID
- eval $(keychain --eval --host "$hostopt-root")
+ eval $(keychain --
timeout $lifetime --
eval --host "$hostopt-root")
exec "$@"
}
exec "$@"
}
@@
-28,11
+30,11
@@
shift
case "$command" in
init)
echo "Loading default keys (lifetime $lifetime)..."
case "$command" in
init)
echo "Loading default keys (lifetime $lifetime)..."
- with-agent ssh-add -t $
lifetime
"$@" $keys
+ with-agent ssh-add -t $
{lifetime}m
"$@" $keys
;;
add)
echo "Loading keys (lifetime $lifetime):" "$@"
;;
add)
echo "Loading keys (lifetime $lifetime):" "$@"
- with-agent ssh-add -t $
lifetime
"$@"
+ with-agent ssh-add -t $
{lifetime}m
"$@"
;;
list)
with-agent ssh-add -l
;;
list)
with-agent ssh-add -l