From 8ad0361da8d4c2f26be9387b72e60430897b496b Mon Sep 17 00:00:00 2001 From: mhoellein Date: Fri, 7 Dec 2018 11:28:44 +0100 Subject: [PATCH] autossh reverse ssh tunnel zum vserver --- .etckeeper | 1 + default/locale | 10 +--------- group | 1 + group- | 1 + gshadow | 1 + gshadow- | 1 + passwd | 1 + passwd- | 1 + shadow | 1 + shadow- | 1 + subgid | 1 + subgid- | 1 + subuid | 1 + subuid- | 1 + systemd/system/autossh.service | 17 +++++++++++++++++ .../multi-user.target.wants/autossh.service | 1 + 16 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 systemd/system/autossh.service create mode 120000 systemd/system/multi-user.target.wants/autossh.service diff --git a/.etckeeper b/.etckeeper index 9d10177b..f6548a2b 100755 --- a/.etckeeper +++ b/.etckeeper @@ -4588,6 +4588,7 @@ maybe chmod 0644 'systemd/resolved.conf' maybe chmod 0755 'systemd/system' maybe chmod 0644 'systemd/system.conf' maybe chmod 0644 'systemd/system/alexa.service' +maybe chmod 0644 'systemd/system/autossh.service' maybe chmod 0755 'systemd/system/bluetooth.target.wants' maybe chmod 0755 'systemd/system/default.target.wants' maybe chmod 0755 'systemd/system/display-manager.service.wants' diff --git a/default/locale b/default/locale index fcd63170..1b353335 100644 --- a/default/locale +++ b/default/locale @@ -1,9 +1 @@ -#LANG=de_DE.UTF-8 -LC_NUMERIC="he_IL.UTF-8" -LC_MONETARY="he_IL.UTF-8" -LC_PAPER="he_IL.UTF-8" -LC_NAME="he_IL.UTF-8" -LC_ADDRESS="he_IL.UTF-8" -LC_TELEPHONE="he_IL.UTF-8" -LC_MEASUREMENT="he_IL.UTF-8" -LC_IDENTIFICATION="he_IL.UTF-8" +LANG=de_DE.UTF-8 diff --git a/group b/group index b0c248b5..25c0a8df 100644 --- a/group +++ b/group @@ -102,3 +102,4 @@ rdma:x:151: geoclue:x:155: lool:x:156: serverbackup:x:5003: +autossh:x:5004: diff --git a/group- b/group- index 6d7399a9..b0c248b5 100644 --- a/group- +++ b/group- @@ -101,3 +101,4 @@ Debian-snmp:x:121: rdma:x:151: geoclue:x:155: lool:x:156: +serverbackup:x:5003: diff --git a/gshadow b/gshadow index 4aacf351..e7a1a38a 100644 --- a/gshadow +++ b/gshadow @@ -102,3 +102,4 @@ rdma:!:: geoclue:!:: lool:!:: serverbackup:!:: +autossh:!:: diff --git a/gshadow- b/gshadow- index 2910f44b..4aacf351 100644 --- a/gshadow- +++ b/gshadow- @@ -101,3 +101,4 @@ Debian-snmp:!:: rdma:!:: geoclue:!:: lool:!:: +serverbackup:!:: diff --git a/passwd b/passwd index 883bc006..d71abaac 100644 --- a/passwd +++ b/passwd @@ -75,3 +75,4 @@ Debian-snmp:x:145:121::/var/lib/snmp:/bin/false geoclue:x:148:155::/var/lib/geoclue:/usr/sbin/nologin lool:x:149:156::/opt/lool:/usr/sbin/nologin serverbackup:x:5003:5003::/home/serverbackup:/bin/bash +autossh:x:5004:5004:ssh tunnel user:/home/autossh:/bin/sh diff --git a/passwd- b/passwd- index ffb2b572..883bc006 100644 --- a/passwd- +++ b/passwd- @@ -74,3 +74,4 @@ cups-pk-helper:x:111:108:user for cups-pk-helper service,,,:/home/cups-pk-helper Debian-snmp:x:145:121::/var/lib/snmp:/bin/false geoclue:x:148:155::/var/lib/geoclue:/usr/sbin/nologin lool:x:149:156::/opt/lool:/usr/sbin/nologin +serverbackup:x:5003:5003::/home/serverbackup:/bin/bash diff --git a/shadow b/shadow index 9839f507..6aceca98 100644 --- a/shadow +++ b/shadow @@ -75,3 +75,4 @@ Debian-snmp:!:17827:0:99999:7::: geoclue:*:17827:0:99999:7::: lool:*:17828:0:99999:7::: serverbackup:$6$eaExedUs$qMxK2M5Q/pA6bz8crjGw1pESBnAFkus3IHDZTkCe1FFOw6LECghvQfM86zyNk.G4L5chDSgYeElHSvWgPIxJ.1:17841:0:99999:7::: +autossh:!:17872:0:99999:7::: diff --git a/shadow- b/shadow- index a1410950..9839f507 100644 --- a/shadow- +++ b/shadow- @@ -74,3 +74,4 @@ cups-pk-helper:*:17827:0:99999:7::: Debian-snmp:!:17827:0:99999:7::: geoclue:*:17827:0:99999:7::: lool:*:17828:0:99999:7::: +serverbackup:$6$eaExedUs$qMxK2M5Q/pA6bz8crjGw1pESBnAFkus3IHDZTkCe1FFOw6LECghvQfM86zyNk.G4L5chDSgYeElHSvWgPIxJ.1:17841:0:99999:7::: diff --git a/subgid b/subgid index 528dacee..fe085b9b 100644 --- a/subgid +++ b/subgid @@ -5,3 +5,4 @@ git:296608:65536 door:362144:65536 webssh:427680:65536 serverbackup:493216:65536 +autossh:558752:65536 diff --git a/subgid- b/subgid- index 2d2190c3..528dacee 100644 --- a/subgid- +++ b/subgid- @@ -4,3 +4,4 @@ remoteBackup:231072:65536 git:296608:65536 door:362144:65536 webssh:427680:65536 +serverbackup:493216:65536 diff --git a/subuid b/subuid index 528dacee..fe085b9b 100644 --- a/subuid +++ b/subuid @@ -5,3 +5,4 @@ git:296608:65536 door:362144:65536 webssh:427680:65536 serverbackup:493216:65536 +autossh:558752:65536 diff --git a/subuid- b/subuid- index 2d2190c3..528dacee 100644 --- a/subuid- +++ b/subuid- @@ -4,3 +4,4 @@ remoteBackup:231072:65536 git:296608:65536 door:362144:65536 webssh:427680:65536 +serverbackup:493216:65536 diff --git a/systemd/system/autossh.service b/systemd/system/autossh.service new file mode 100644 index 00000000..4eac245a --- /dev/null +++ b/systemd/system/autossh.service @@ -0,0 +1,17 @@ +[Unit] +Description=Keeps a tunnel to 'remote.example.com' open +After=network.target ssh.service + +[Service] +User=autossh +# -p [PORT] +# -l [user] +# -M 0 --> no monitoring +# -N Just open the connection and do nothing (not interactive) +# LOCALPORT:IP_ON_EXAMPLE_COM:PORT_ON_EXAMPLE_COM +ExecStart=/usr/bin/autossh -M 20000 -f -i /root/.ssh/root@hoellein.online -N -T -R12345:localhost:22 root@hoellein.online +ExecStop=/usr/bin/killall -s KILL autossh +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/systemd/system/multi-user.target.wants/autossh.service b/systemd/system/multi-user.target.wants/autossh.service new file mode 120000 index 00000000..c132a279 --- /dev/null +++ b/systemd/system/multi-user.target.wants/autossh.service @@ -0,0 +1 @@ +/etc/systemd/system/autossh.service \ No newline at end of file -- 2.43.0