autossh: Add dropbear proxy (-J) support
authorValdikSS ValdikSS <iam@valdikss.org.ru>
Wed, 11 Jan 2023 17:39:35 +0000 (20:39 +0300)
committerRosen Penev <rosenp@gmail.com>
Fri, 3 Feb 2023 18:11:41 +0000 (10:11 -0800)
It's not possible to pass quoted string as a single argument
using uci, which makes it impossible to supply proxy string
to dropbear.

Additional option solves this issue.

Signed-off-by: ValdikSS ValdikSS <iam@valdikss.org.ru>
net/autossh/Makefile
net/autossh/files/autossh.config
net/autossh/files/autossh.init

index 87fd91347e2396064313d296def992265398d71b..9889378f82f423c66e92eb27775d7295fc347710 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=autossh
 PKG_VERSION:=1.4g
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=https://www.harding.motd.ca/autossh/
index faee881a9f9f4a356b3fa8581853b3abcd6e8934..6f4e289182c07ea6a964d9753c970b9682297814 100644 (file)
@@ -1,5 +1,6 @@
 config autossh
        option ssh      '-i /etc/dropbear/id_rsa -N -T -R 2222:localhost:22 user@host'
+       #option dropbearproxy 'ncat --proxy 127.0.0.1:9050 --proxy-type socks5 1.2.3.4 22'
        option gatetime '0'
        option monitorport      '20000'
        option poll     '600'
index 9f6225bb081fd998bb2ca7ad8ea28935f5567d05..80ad5ef47b77f12d2a683b52c4d0256ae922fde0 100644 (file)
@@ -8,6 +8,7 @@ start_instance() {
        local section="$1"
 
        config_get ssh "$section" 'ssh'
+       config_get dropbearproxy "$section" 'dropbearproxy'
        config_get gatetime "$section" 'gatetime'
        config_get monitorport "$section" 'monitorport'
        config_get poll "$section" 'poll'
@@ -17,6 +18,9 @@ start_instance() {
 
        procd_open_instance
        procd_set_param command /usr/sbin/autossh -M ${monitorport:-20000} ${ssh}
+       if [ "$dropbearproxy" ]; then
+               procd_append_param command -J "${dropbearproxy}"
+       fi
        procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
        procd_set_param env AUTOSSH_GATETIME="${gatetime:-30}" AUTOSSH_POLL="${poll:-600}"
        procd_close_instance