фикс: v1.3.4 - устранение бесконечного цикла пароля, включение Basic Auth и X-NDM-Realm

This commit is contained in:
Petro1990 2026-03-13 19:40:09 +03:00
parent 41ad555e96
commit d5532f8355
1 changed files with 17 additions and 3 deletions

20
rproxy
View File

@ -3,7 +3,7 @@
# Публикация локальных сервисов через SSH-туннели + nginx на VPS # Публикация локальных сервисов через SSH-туннели + nginx на VPS
# http://5.104.75.50:3000/Petro1990/rProxy # http://5.104.75.50:3000/Petro1990/rProxy
VERSION="1.3.3" VERSION="1.3.4"
CONF_DIR="/opt/etc/rproxy" CONF_DIR="/opt/etc/rproxy"
CONF_FILE="$CONF_DIR/rproxy.conf" CONF_FILE="$CONF_DIR/rproxy.conf"
SERVICES_DIR="$CONF_DIR/services" SERVICES_DIR="$CONF_DIR/services"
@ -189,6 +189,16 @@ get_router_ip() {
echo "192.168.1.1" 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() { next_free_ext_port() {
local port=$BASE_EXT_PORT local port=$BASE_EXT_PORT
while true; do while true; do
@ -489,7 +499,10 @@ do_add_interactive() {
prompt "Защитить сервис паролем от роутера? (д/н) [н]: " prompt "Защитить сервис паролем от роутера? (д/н) [н]: "
local use_ndm_auth="no" local use_ndm_auth="no"
case "$REPLY" in case "$REPLY" in
д|Д|y|Y|да|yes) use_ndm_auth="yes" ;; д|Д|y|Y|да|yes)
use_ndm_auth="yes"
enable_router_basic_auth
;;
esac esac
draw_separator draw_separator
@ -521,10 +534,11 @@ do_add_interactive() {
proxy_set_header Host \"$router_ip\"; proxy_set_header Host \"$router_ip\";
proxy_set_header Origin \"http://$router_ip\"; proxy_set_header Origin \"http://$router_ip\";
proxy_set_header Referer \"http://$router_ip/\"; proxy_set_header Referer \"http://$router_ip/\";
proxy_set_header X-NDM-Realm \"Keenetic\";
} }
location @auth_required { location @auth_required {
add_header WWW-Authenticate 'Basic realm=\"Keenetic NDM Auth\"' always; add_header WWW-Authenticate 'Basic realm=\"Keenetic\"' always;
return 401; return 401;
} }
" "