config file changes

This commit is contained in:
Gordon Grant-Stuart 2023-05-24 15:16:31 +01:00
parent 2b2d408e07
commit 7a21e9cf34
2 changed files with 12 additions and 10 deletions

View File

@ -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
#

View File

@ -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 <<EOF > "$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"