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`
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
- eval $(keychain --eval --host "$hostopt-root")
+ eval $(keychain --timeout $lifetime --eval --host "$hostopt-root")
exec "$@"
}
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):" "$@"
- with-agent ssh-add -t $lifetime "$@"
+ with-agent ssh-add -t ${lifetime}m "$@"
;;
list)
with-agent ssh-add -l