fixes
This commit is contained in:
parent
30fbd76c8f
commit
67c62ebb95
@ -1,8 +1,4 @@
|
||||
# Everything in this section obeys the same rules as ~/.ssh/config
|
||||
# Excluding the following directives:
|
||||
# - Password
|
||||
# - Watch
|
||||
# - Debug
|
||||
# Everything in this section obeys the same rules as ~/.ssh/config, except for the Password, Watch and Debug directives
|
||||
|
||||
# Examples
|
||||
#
|
||||
|
||||
24
tunnelkeeper
24
tunnelkeeper
@ -3,14 +3,6 @@
|
||||
REALPATH="$(realpath $0)"
|
||||
BASEDIR="${REALPATH%/*}"
|
||||
|
||||
# if [[ "${1}" == "start" ]]; then
|
||||
# rm $BASEDIR/var/*.conf &>/dev/null # Create separate .conf files in var/ from etc/tunnelkeeper.conf
|
||||
# awk -v "dir=$BASEDIR/var" '
|
||||
# /^\[/ {sec=$1}
|
||||
# !/^[#\[]/ {print >> dir"/"sec".conf"}' < $BASEDIR/etc/tunnelkeeper.conf &>/dev/null
|
||||
# fi
|
||||
|
||||
# TKCONF="$BASEDIR/var/[settings].conf"
|
||||
SSHCONF="$BASEDIR/var/ssh.conf"
|
||||
PWCONF="$BASEDIR/var/passwords.conf"
|
||||
WATCHCONF="$BASEDIR/var/watch.conf"
|
||||
@ -18,7 +10,6 @@ DEBUGCONF="$BASEDIR/var/debug.conf"
|
||||
|
||||
function genconfig () {
|
||||
cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Eiv '^ *(watch|password|debug)' > "$SSHCONF"
|
||||
# cat "$BASEDIR/etc/tunnelkeeper.conf" | grep -Ei '^( *watch|Host)' | grep -i -B1 watch | grep -i '^Host' | awk '{print $2}' > "$WATCHCONF"
|
||||
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"
|
||||
@ -31,28 +22,19 @@ function ruroot () {
|
||||
fi
|
||||
}
|
||||
|
||||
# DEBUGLEVEL=$(awk '/^debug/ {print $2}' $TKCONF &>/dev/null)
|
||||
# [[ -z $DEBUGLEVEL ]] && DEBUGLEVEL='0'
|
||||
|
||||
function debugopt () {
|
||||
# lvl=$(awk "/^$2/ {print \$2}" ${DEBUGCONF})
|
||||
case "$(awk "/^$1/ {print \$2}" ${DEBUGCONF})" in
|
||||
2) echo -n '-v';;
|
||||
3) echo -n '-vvv';;
|
||||
# *) dbgopt='';;
|
||||
esac
|
||||
}
|
||||
|
||||
# TIMEOUT=$(awk '/^timeout/ {print $2}' $TKCONF &>/dev/null)
|
||||
# [[ -z $TIMEOUT ]] && TIMEOUT='60'
|
||||
|
||||
function dbg () {
|
||||
[[ "$(awk "/^$1/ {print \$2}" ${DEBUGCONF})" != "0" ]] && logger -t tunnelkeeper
|
||||
# [[ $DEBUGLEVEL != "0" ]] && logger -t tunnelkeeper
|
||||
[[ "$(awk "/^$1/ {print \$2}" ${DEBUGCONF})" =~ "[123]" ]] && logger -t tunnelkeeper
|
||||
}
|
||||
|
||||
function connect () {
|
||||
echo ssh -F "${SSHCONF}" $(debugopt $1) -o "ControlMaster auto" -o "StrictHostKeyChecking no" -S "$BASEDIR/var/$1.tksock" -N $1 '#tunnelkeeper' 2>&1 | dbg $1
|
||||
ssh -F "${SSHCONF}" $(debugopt $1) -o "ControlMaster auto" -o "StrictHostKeyChecking no" -S "$BASEDIR/var/$1.tksock" -N $1 '#tunnelkeeper' 2>&1 | dbg $1
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +54,7 @@ case "$1" in
|
||||
done
|
||||
else # passwordless auth
|
||||
while true; do
|
||||
connect $2 #$dbgopt
|
||||
connect $2
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user