fix: 移除 ProtectSystem 沙箱限制,修复 unix socket 创建失败

ProtectSystem=strict/full 把 /etc /opt 等挂载为只读,
即使 ReadWritePaths 配合也会有各种坑。
服务已用专用低权用户 portal_page 运行,文件系统权限本身就够了,
没必要再加 systemd 文件系统沙箱。
This commit is contained in:
2026-05-28 15:43:48 +08:00
parent 5184d42d00
commit 58c8504c75
+4 -4
View File
@@ -170,11 +170,11 @@ StandardOutput=journal
StandardError=journal StandardError=journal
SyslogIdentifier=${SERVICE_NAME} SyslogIdentifier=${SERVICE_NAME}
# 安全加固 # 安全加固:专用低权用户运行,无需额外文件系统沙箱
NoNewPrivileges=true # ProtectSystem=strict/full 会阻止写入 /etc 和 /opt 等目录,
ProtectSystem=full # 导致配置文件和 unix socket 无法创建,得不偿失
ProtectHome=true ProtectHome=true
ReadWritePaths=${DATA_DIR} ${CONFIG_DIR} ${LOG_DIR} ${PID_DIR} ${INSTALL_DIR} NoNewPrivileges=true
# 环境变量 # 环境变量
Environment=GIN_MODE=release Environment=GIN_MODE=release