From bdc5369f8fffb195da151b496fed0abea7f79a1b Mon Sep 17 00:00:00 2001 From: Gordon Grant-Stuart Date: Mon, 30 Jan 2023 18:06:30 +0000 Subject: [PATCH] changes --- README.md | 10 ++++++++-- etc/tunnelkeeper.conf | 2 +- tunnelkeeper | 7 ++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e039864..a14235f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,12 @@ Install it as a service with `tunnelkeeper install`. -Create a config file `/opt/tunnelkeeper/etc/tunnels.conf`. It's an ssh config file, so see `man ssh_config` for information. TunnelKeeper will connect to each host listed, and make sure every connection in `tunnels.conf` stays open in the background. +Edit the config file `/opt/tunnelkeeper/etc/tunnelkeeper.conf`. If you make changes to tunnelkeeper.conf, run `systemctl restart tunnelkeeper`. -If you make changes to tunnels.conf, run `systemctl restart tunnelkeeper`. +There are 3 sections: +#### settings +- `debug [0..3]`: Debug logging levels 0 (no logging) to 3 (too much logging) +#### ssh +- It's an ssh config file, so see `man ssh_config` for information. TunnelKeeper will connect to each host listed, and make sure every connection in `tunnelkeeper.conf` stays open in the background. +#### passwords +- `host password`: Passwords of the hosts in the ssh section. They are stored in plaintext, so don't use it if you can avoid it. diff --git a/etc/tunnelkeeper.conf b/etc/tunnelkeeper.conf index 19b20c7..62cd0e2 100644 --- a/etc/tunnelkeeper.conf +++ b/etc/tunnelkeeper.conf @@ -18,4 +18,4 @@ debug 0 [passwords] # Use this section at your own risk, because the passwords are stored in plaintext. -#server1 p@$$w0rd \ No newline at end of file +# server1 p@$$w0rd \ No newline at end of file diff --git a/tunnelkeeper b/tunnelkeeper index 0231433..428169b 100755 --- a/tunnelkeeper +++ b/tunnelkeeper @@ -48,7 +48,7 @@ case "$1" in done else # passwordless auth while [[ -e "$BASEDIR/var/${2}.connected" ]]; do - ssh -F "${SSHCONF}" $dbgopt -N $2 2>&1 | dbg + ssh -F "${SSHCONF}" $dbgopt -N $2 '#tunnelkeeper' 2>&1 | dbg sleep 5 done fi @@ -56,11 +56,12 @@ case "$1" in FORKSCREEN ) while [[ -e "$BASEDIR/var/${2}.connected" ]]; do echo $$ > "$BASEDIR/var/${2}.screen" - ssh -F "${SSHCONF}" $dbgopt -N $2 2>&1 | dbg + ssh -F "${SSHCONF}" $dbgopt -N $2 '#tunnelkeeper' 2>&1 | dbg done ;; - FORKKILL ) kill $(sudo netstat -tnlp | grep "127[0-9\.]*:${2}" | grep -o '[0-9]*/ssh' | grep -o '[0-9]*') &>/dev/null ;; + # FORKKILL ) kill $(sudo netstat -tnlp | grep "127[0-9\.]*:${2}" | grep -o '[0-9]*/ssh' | grep -o '[0-9]*') &>/dev/null ;; FORKDEL ) rm "$BASEDIR/var/${2}.connected" ;; + FORKKILL ) pkill -f '#tunnelkeeper' &>/dev/null ;; start) [[ -e "$BASEDIR/var/tunnelkeeper.pid" ]] && exit echo $$ > "$BASEDIR/var/tunnelkeeper.pid"