aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2015-04-24 23:51:33 +0200
committerDavid Runge <dave@sleepmap.de>2015-04-24 23:51:33 +0200
commit65552f3d26db9b2bcc0d131ddf69985670436f81 (patch)
treebb44779dab7f4238a2dc2923e56e22243b3abc20 /scripts
parent86516af3b7aa46e2b3303643acdba463f42ead71 (diff)
downloaduenv-65552f3d26db9b2bcc0d131ddf69985670436f81.tar.gz
uenv-65552f3d26db9b2bcc0d131ddf69985670436f81.tar.bz2
uenv-65552f3d26db9b2bcc0d131ddf69985670436f81.tar.xz
uenv-65552f3d26db9b2bcc0d131ddf69985670436f81.zip
autotunnel: Adding example config, systemd service file and script for autossh managed SSH tunnel to predefined host
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/autotunnel21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/autotunnel b/scripts/autotunnel
new file mode 100755
index 0000000..230940d
--- /dev/null
+++ b/scripts/autotunnel
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+if [ -z "$SERVER_ALIVE_INTERVAL" ];then
+ SERVER_ALIVE_INTERVAL=45
+fi
+
+if [ -z "$SERVER_ALIVE_COUNT_MAX" ];then
+ SERVER_ALIVE_INTERVAL=2
+fi
+
+if [ -z "$MONITORING_PORT" ];then
+ MONITORING_PORT=0
+fi
+
+/usr/bin/autossh -M "$MONITORING_PORT" \
+ -NCTv \
+ -o ServerAliveInterval="$SERVER_ALIVE_INTERVAL" \
+ -o ServerAliveCountMax="$SERVER_ALIVE_COUNT_MAX" \
+ -o TCPKeepAlive=yes \
+ -w $TUN_DEVICE:$TUN_DEVICE \
+ $HOST