This commit is contained in:
Gordon Grant-Stuart 2023-01-30 18:06:30 +00:00
parent c8f718c327
commit bdc5369f8f
3 changed files with 13 additions and 6 deletions

View File

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

View File

@ -18,4 +18,4 @@ debug 0
[passwords]
# Use this section at your own risk, because the passwords are stored in plaintext.
#server1 p@$$w0rd
# server1 p@$$w0rd

View File

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