From d5532f8355ce10b9721927a6159118565d3f09c0 Mon Sep 17 00:00:00 2001 From: Petro1990 Date: Fri, 13 Mar 2026 19:40:09 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81:=20v1.3.4=20-=20=D1=83?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B1?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=BE=D0=BD=D0=B5=D1=87=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=86=D0=B8=D0=BA=D0=BB=D0=B0=20=D0=BF=D0=B0=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D1=8F,=20=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20Basic=20Auth=20=D0=B8=20X-NDM-Realm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rproxy | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/rproxy b/rproxy index 48814ea..781b25d 100644 --- a/rproxy +++ b/rproxy @@ -3,7 +3,7 @@ # Публикация локальных сервисов через SSH-туннели + nginx на VPS # http://5.104.75.50:3000/Petro1990/rProxy -VERSION="1.3.3" +VERSION="1.3.4" CONF_DIR="/opt/etc/rproxy" CONF_FILE="$CONF_DIR/rproxy.conf" SERVICES_DIR="$CONF_DIR/services" @@ -189,6 +189,16 @@ get_router_ip() { echo "192.168.1.1" } +enable_router_basic_auth() { + msg "Настраиваю роутер на использование Basic Auth для совместимости..." + # Для новых версий KeeneticOS + ndmq -p "web-server auth basic" >/dev/null 2>&1 + # Для старых версий или альтернативных API + ndmq -p "ip http auth basic" >/dev/null 2>&1 + # Принудительно задаем realm + ndmq -p "web-server realm Keenetic" >/dev/null 2>&1 +} + next_free_ext_port() { local port=$BASE_EXT_PORT while true; do @@ -489,7 +499,10 @@ do_add_interactive() { prompt "Защитить сервис паролем от роутера? (д/н) [н]: " local use_ndm_auth="no" case "$REPLY" in - д|Д|y|Y|да|yes) use_ndm_auth="yes" ;; + д|Д|y|Y|да|yes) + use_ndm_auth="yes" + enable_router_basic_auth + ;; esac draw_separator @@ -521,10 +534,11 @@ do_add_interactive() { proxy_set_header Host \"$router_ip\"; proxy_set_header Origin \"http://$router_ip\"; proxy_set_header Referer \"http://$router_ip/\"; + proxy_set_header X-NDM-Realm \"Keenetic\"; } location @auth_required { - add_header WWW-Authenticate 'Basic realm=\"Keenetic NDM Auth\"' always; + add_header WWW-Authenticate 'Basic realm=\"Keenetic\"' always; return 401; } "