фикс: v1.3.4 - устранение бесконечного цикла пароля, включение Basic Auth и X-NDM-Realm
This commit is contained in:
parent
41ad555e96
commit
d5532f8355
20
rproxy
20
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;
|
||||
}
|
||||
"
|
||||
|
|
|
|||
Loading…
Reference in New Issue