File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,13 @@ draw_menu() {
8282 echo " [!] SUB_STORE_FRONTEND_BACKEND_PATH 仍为模块默认值"
8383 echo " 建议用下方菜单项重新生成随机路径"
8484 fi
85+ # 安全提醒: 运行用户为 root 时告警
86+ if run_user_is_root; then
87+ echo " [!] 当前运行用户为 root, 建议改为 shell 用户"
88+ echo " 可在 sub_store.config 中修改 run_as_user"
89+ echo " shell 用户如果网络访问受限,可在 sub_store.env 中配置代理"
90+ echo " SUB_STORE_BACKEND_DEFAULT_PROXY=<你的代理软件代理地址>"
91+ fi
8592 echo " ---------------------------------------"
8693 echo " "
8794 echo " --- $title ---"
Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ backend_path_is_default() {
9595 [ " ${SUB_STORE_FRONTEND_BACKEND_PATH:- } " = " $DEFAULT_BACKEND_PATH " ]
9696}
9797
98+ run_user_is_root () {
99+ [ " $run_as_user " != " shell" ] && [ " $run_as_user " != " 2000" ]
100+ }
101+
98102compute_direct_urls () {
99103 if [ " ${SUB_STORE_BACKEND_MERGE:- } " = " true" ]; then
100104 # 合并模式: 单端口, 前端带 ?api= 指向后端路径
@@ -166,6 +170,12 @@ print_status_json() {
166170 _backend_path_is_default=false
167171 fi
168172
173+ if run_user_is_root; then
174+ _run_user_is_root=true
175+ else
176+ _run_user_is_root=false
177+ fi
178+
169179 printf ' {'
170180 printf ' "serviceRunning":%s,' " $_service_running "
171181 printf ' "autostart":%s,' " $_autostart "
@@ -175,7 +185,8 @@ print_status_json() {
175185 printf ' "frontUrl":"%s",' " $( json_escape " $FRONT_ADDR " ) "
176186 printf ' "backUrl":"%s",' " $( json_escape " $BACK_ADDR " ) "
177187 printf ' "openUrl":"%s",' " $( json_escape " $OPEN_URL " ) "
178- printf ' "backendPathIsDefault":%s' " $_backend_path_is_default "
188+ printf ' "backendPathIsDefault":%s,' " $_backend_path_is_default "
189+ printf ' "runUserIsRoot":%s' " $_run_user_is_root "
179190 printf ' }\n'
180191}
181192
Original file line number Diff line number Diff line change @@ -26,4 +26,4 @@ http_meta_pid_file="${run_path}/http-meta.pid"
2626# node 默认以低权限 shell (uid 2000) 运行, 不授予多余权限
2727# 运行目录 (run/) 与 http-meta 目录已由安装脚本自动授权给该用户
2828# 置空则以 root 运行
29- run_as_user=" shell "
29+ run_as_user=" root "
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ SUB_STORE_DATA_BASE_PATH="${run_path}"
2020# 若仍在使用模块默认值, 执行菜单 (TUI) 会告警, 可用菜单项一键重新生成
2121SUB_STORE_FRONTEND_BACKEND_PATH=" /2cXaAxRGfddmGz2yx1wA"
2222# 默认代理, 支持 SOCKS5 / HTTP / HTTPS
23+ # shell 用户可能必改
2324# SUB_STORE_BACKEND_DEFAULT_PROXY="socks5://127.0.0.1:7890"
2425
2526# ---------- 请求限制 ----------
You can’t perform that action at this time.
0 commit comments