mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
fix(auth): real client IP rate-limiting + remote default-password guard
- Add custom-server.js: inject unspoofable socket IP, strip client XFF (wired into Docker CMD + CLI spawn + build-cli copy) - loginLimiter: key on trusted x-9r-real-ip, TRUST_PROXY opt-in, global fallback - Force password change on first remote login while default is in use - Add /api/auth/reset-password (local-only) so CLI reset writes live SQLite - CLI settings: reset via API instead of stale db.json - Fix OAuth modals opening duplicate browser tabs on add-connection - Add cli:pack / cli:publish scripts Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
isTunnelManuallyDisabled, isTunnelReconnecting, isTailscaleReconnecting,
|
||||
getTunnelService, getTailscaleService, setTunnelUnexpectedExitCallback,
|
||||
killCloudflared, isCloudflaredRunning, ensureCloudflared,
|
||||
isTailscaleRunning, isTailscaleRunningStrict,
|
||||
isTailscaleRunning, isTailscaleRunningStrict, isDaemonAlive, startFunnel,
|
||||
checkInternet,
|
||||
RESTART_COOLDOWN_MS, NETWORK_SETTLE_MS,
|
||||
WATCHDOG_INTERVAL_MS, NETWORK_CHECK_INTERVAL_MS, VIRTUAL_IFACE_REGEX,
|
||||
@@ -176,6 +176,18 @@ async function safeRestartTailscale(reason) {
|
||||
const running = reason === "startup" ? await isTailscaleRunningStrict() : isTailscaleRunning();
|
||||
if (running) return;
|
||||
|
||||
// Daemon alive but funnel dropped → recover funnel only; never full-restart (preserves login/daemon).
|
||||
if (isDaemonAlive() && svc.activeLocalPort) {
|
||||
try {
|
||||
await startFunnel(svc.activeLocalPort);
|
||||
svc.lastRestartAt = Date.now();
|
||||
console.log("[Tailscale] funnel re-established (daemon alive)");
|
||||
} catch (err) {
|
||||
console.log("[Tailscale] funnel recovery failed:", err.message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const force = FORCE_RESTART_REASONS.test(reason);
|
||||
if (!force && Date.now() - svc.lastRestartAt < RESTART_COOLDOWN_MS) {
|
||||
console.log(`[Tailscale] degraded but cooldown active, skip (${reason})`);
|
||||
|
||||
Reference in New Issue
Block a user