dropbear: 'rsakeyfile' -> 'keyfile' transition
[openwrt/staging/jow.git] / package / network / services / dropbear / files / dropbear.init
index ab8e908d8c6bdd2efdc7e1ae5306dd723a262f76..18273e63d0e9085918d66a30cef5c3a9366aa943 100755 (executable)
@@ -9,8 +9,8 @@ USE_PROCD=1
 PROG=/usr/sbin/dropbear
 NAME=dropbear
 PIDCOUNT=0
-EXTRA_COMMANDS="killclients"
-EXTRA_HELP="   killclients Kill ${NAME} processes except servers and yourself"
+
+extra_command "killclients" "Kill ${NAME} processes except servers and yourself"
 
 _dropbearkey()
 {
@@ -119,6 +119,7 @@ validate_section_dropbear()
                'enable:bool:1' \
                'Interface:string' \
                'GatewayPorts:bool:0' \
+               'ForceCommand:string' \
                'RootPasswordAuth:bool:1' \
                'RootLogin:bool:1' \
                'rsakeyfile:file' \
@@ -154,19 +155,29 @@ dropbear_instance()
        PIDCOUNT="$(( ${PIDCOUNT} + 1))"
        local pid_file="/var/run/${NAME}.${PIDCOUNT}.pid"
 
+       # Increase default receive window size to increase
+       # throughput on high latency links
+       if [ "${RecvWindowSize}" -eq "0" ]; then
+               RecvWindowSize="262144"
+       fi
+
        procd_open_instance
        procd_set_param command "$PROG" -F -P "$pid_file"
        [ "${PasswordAuth}" -eq 0 ] && procd_append_param command -s
        [ "${GatewayPorts}" -eq 1 ] && procd_append_param command -a
+       [ -n "${ForceCommand}" ] && procd_append_param command -c "${ForceCommand}"
        [ "${RootPasswordAuth}" -eq 0 ] && procd_append_param command -g
        [ "${RootLogin}" -eq 0 ] && procd_append_param command -w
+       config_list_foreach "$1" 'keyfile' hk_config__keyfile
        if [ -n "${rsakeyfile}" ]; then
-               logger -t ${NAME} -p daemon.warn \
-                       "option 'rsakeyfile' is considered to be deprecated and" \
-                       "will be removed in future releases, use 'keyfile' instead"
+               logger -s -t "${NAME}" -p daemon.crit \
+                 "Option 'rsakeyfile' is considered to be DEPRECATED and will be REMOVED in future releases, use 'keyfile' list instead"
+               sed -i.before-upgrade -E -e 's/option(\s+)rsakeyfile/list keyfile/' \
+                 "/etc/config/${NAME}"
+               logger -s -t "${NAME}" -p daemon.crit \
+                 "Auto-transition 'option rsakeyfile' => 'list keyfile' in /etc/config/${NAME} is done, please verify your configuration"
                hk_config 'rsakeyfile' "${rsakeyfile}"
        fi
-       config_list_foreach "$1" "keyfile" hk_config__keyfile
        [ -n "${BannerFile}" ] && procd_append_param command -b "${BannerFile}"
        append_ports "${ipaddrs}" "${Port}"
        [ "${IdleTimeout}" -ne 0 ] && procd_append_param command -I "${IdleTimeout}"