Loading .ssh/.gitignore +6 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,11 @@ authorized_keys # local IDs id* # runtime directory .runtime # legacy runtime .config.* # local configs config.local .config.* .ssh/config +1 −1 Original line number Diff line number Diff line Loading @@ -24,5 +24,5 @@ Host 192.168.* 10.* *.lan *.local localhost # Use connection sharing for any host that does not explicitly block it. Host * ControlMaster auto ControlPath ~/.ssh/%r@%h:%p ControlPath RUNTIME/%r@%h:%p ControlPersist 2h .ssh/ssh +35 −5 Original line number Diff line number Diff line Loading @@ -4,6 +4,12 @@ set -eu : ${SSH_BIN:=`which ssh`}; export SSH_BIN die() { [ ${CODE:=$?} -gt 1 ] || CODE=2 echo >&2 "$*" exit $CODE } ssh_version() { eval `ssh -V 2>&1 | sed -n \ 's/OpenSSH_\([0-9]\+\)\.\([0-9]\+\).*/SSH_MAJOR="\1" SSH_MINOR="\2"/p'` Loading @@ -18,6 +24,21 @@ platform() { esac } runtime() { if [ -n "$XDG_RUNTIME_DIR" ] && [ -d "$XDG_RUNTIME_DIR" ]; then RUNTIME="$XDG_RUNTIME_DIR/ssh" elif [ -d /tmp ]; then RUNTIME=/tmp/user/`id -u`/ssh else RUNTIME=$HOME/.ssh/.runtime fi if ! [ -d "$RUNTIME" ]; then mkdir -p "$RUNTIME" chmod 0750 `dirname $RUNTIME` fi >&2 } rule_unix_sockets() { # Windows has no unix sockets so disable shared connections # (Control* settings) Loading @@ -35,18 +56,26 @@ rule_canonisation() { fi } rule_runtime() { # Replace RUNTIME with the value of the RUNTIME variable [ -n "$RUNTIME" ] || die "RUNTIME not set" echo "s!\\\bRUNTIME\\\b!${RUNTIME-.}!g;" | tee /proc/self/fd/2 } make_config() { [ -z "${CONFIG-}" ] || return 0 platform && ssh_version platform && ssh_version && runtime PLATFORM="$PLATFORM:`hostname -f`:$SSH_MAJOR.$SSH_MINOR" PLATFORM_ID=`echo "$PLATFORM" | md5sum | cut -f1 -d' '` CONFIG=~/.ssh/.config.$PLATFORM_ID; export CONFIG CONFIG="$RUNTIME/config-$PLATFORM_ID" if [ -f "$CONFIG" ] && [ "$CONFIG" -nt ~/.ssh/config ] && ( ! [ -r ~/.ssh/config.local ] || [ "$CONFIG" -nt ~/.ssh/config.local ] ); then if [ -f "$CONFIG" ] && [ "$CONFIG" -nt ~/.ssh/config ] && [ "$CONFIG" -nt $0 ] && (! [ -r ~/.ssh/config.local ] || [ "$CONFIG" -nt ~/.ssh/config.local ]) then return fi Loading @@ -54,6 +83,7 @@ make_config() { sed >"$CONFIG" " `rule_unix_sockets` `rule_canonisation` `rule_runtime` " } Loading Loading
.ssh/.gitignore +6 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,11 @@ authorized_keys # local IDs id* # runtime directory .runtime # legacy runtime .config.* # local configs config.local .config.*
.ssh/config +1 −1 Original line number Diff line number Diff line Loading @@ -24,5 +24,5 @@ Host 192.168.* 10.* *.lan *.local localhost # Use connection sharing for any host that does not explicitly block it. Host * ControlMaster auto ControlPath ~/.ssh/%r@%h:%p ControlPath RUNTIME/%r@%h:%p ControlPersist 2h
.ssh/ssh +35 −5 Original line number Diff line number Diff line Loading @@ -4,6 +4,12 @@ set -eu : ${SSH_BIN:=`which ssh`}; export SSH_BIN die() { [ ${CODE:=$?} -gt 1 ] || CODE=2 echo >&2 "$*" exit $CODE } ssh_version() { eval `ssh -V 2>&1 | sed -n \ 's/OpenSSH_\([0-9]\+\)\.\([0-9]\+\).*/SSH_MAJOR="\1" SSH_MINOR="\2"/p'` Loading @@ -18,6 +24,21 @@ platform() { esac } runtime() { if [ -n "$XDG_RUNTIME_DIR" ] && [ -d "$XDG_RUNTIME_DIR" ]; then RUNTIME="$XDG_RUNTIME_DIR/ssh" elif [ -d /tmp ]; then RUNTIME=/tmp/user/`id -u`/ssh else RUNTIME=$HOME/.ssh/.runtime fi if ! [ -d "$RUNTIME" ]; then mkdir -p "$RUNTIME" chmod 0750 `dirname $RUNTIME` fi >&2 } rule_unix_sockets() { # Windows has no unix sockets so disable shared connections # (Control* settings) Loading @@ -35,18 +56,26 @@ rule_canonisation() { fi } rule_runtime() { # Replace RUNTIME with the value of the RUNTIME variable [ -n "$RUNTIME" ] || die "RUNTIME not set" echo "s!\\\bRUNTIME\\\b!${RUNTIME-.}!g;" | tee /proc/self/fd/2 } make_config() { [ -z "${CONFIG-}" ] || return 0 platform && ssh_version platform && ssh_version && runtime PLATFORM="$PLATFORM:`hostname -f`:$SSH_MAJOR.$SSH_MINOR" PLATFORM_ID=`echo "$PLATFORM" | md5sum | cut -f1 -d' '` CONFIG=~/.ssh/.config.$PLATFORM_ID; export CONFIG CONFIG="$RUNTIME/config-$PLATFORM_ID" if [ -f "$CONFIG" ] && [ "$CONFIG" -nt ~/.ssh/config ] && ( ! [ -r ~/.ssh/config.local ] || [ "$CONFIG" -nt ~/.ssh/config.local ] ); then if [ -f "$CONFIG" ] && [ "$CONFIG" -nt ~/.ssh/config ] && [ "$CONFIG" -nt $0 ] && (! [ -r ~/.ssh/config.local ] || [ "$CONFIG" -nt ~/.ssh/config.local ]) then return fi Loading @@ -54,6 +83,7 @@ make_config() { sed >"$CONFIG" " `rule_unix_sockets` `rule_canonisation` `rule_runtime` " } Loading