From 7a21e9cf349e674cf640ca71f3685f24215c0582 Mon Sep 17 00:00:00 2001 From: Gordon Grant-Stuart Date: Wed, 24 May 2023 15:16:31 +0100 Subject: [PATCH] config file changes --- etc/tunnelkeeper.conf | 8 -------- tunnelkeeper | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/etc/tunnelkeeper.conf b/etc/tunnelkeeper.conf index 97b4493..0cbea3d 100644 --- a/etc/tunnelkeeper.conf +++ b/etc/tunnelkeeper.conf @@ -1,12 +1,4 @@ # Everything in this file obeys the same rules as ~/.ssh/config, except for the Password, Watch and Debug directives - -Host * - ExitOnForwardFailure yes - TCPKeepAlive yes - ServerAliveInterval 15 - ServerAliveCountMax 3 - ControlMaster auto - StrictHostKeyChecking no # Examples # diff --git a/tunnelkeeper b/tunnelkeeper index 4ac8c31..e9c0211 100755 --- a/tunnelkeeper +++ b/tunnelkeeper @@ -10,7 +10,17 @@ DEBUGCONF="$BASEDIR/var/debug.conf" function genconfig () { mkdir -p "$BASEDIR/var" - cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Eiv '^ *(watch|password|debug)' > "$SSHCONF" + cat < "$SSHCONF" +Host * + ExitOnForwardFailure yes + TCPKeepAlive yes + ServerAliveInterval 15 + ServerAliveCountMax 3 + ControlMaster auto + StrictHostKeyChecking no + +EOF + cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Eiv '^ *(watch|password|debug)' >> "$SSHCONF" cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Ei '^( *watch|Host)' | awk '{print $1 " " $2}' | grep -i -B1 --no-group-separator watch | tr '\n' ' ' | sed 's/Host /\n/g; s/ *[Ww]atch//g' > "$WATCHCONF" cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Ei '^( *password|Host)' | awk '{print $1 " " $2}' | grep -i -B1 --no-group-separator password | tr '\n' ' ' | sed 's/Host /\n/g; s/ *[Pp]assword//g' > "$PWCONF" cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Ei '^( *debug|Host)' | awk '{print $1 " " $2}' | grep -i -B1 --no-group-separator debug | tr '\n' ' ' | sed 's/Host /\n/g; s/ *[Dd]ebug//g' > "$DEBUGCONF" @@ -88,7 +98,7 @@ case "$1" in [[ -e "$BASEDIR/var/tunnelkeeper.pid" ]] && exit genconfig echo $$ > "$BASEDIR/var/tunnelkeeper.pid" - cat "$SSHCONF" | awk '/^Host / {print $2}' | grep -v \* | xargs -I% -P0 $0 FORKSTART % '#tunnelkeeper' & + cat "$BASEDIR/etc/tunnelkeeper.conf" | awk '/^Host / {print $2}' | xargs -I% -P0 $0 FORKSTART % '#tunnelkeeper' & ;; stop ) rm -f "$BASEDIR/var/tunnelkeeper.pid"