Self-hosted 公网暴露检查表 · 更新 2026-07-05

Reverse Proxy & Public Exposure Checklist:DNS、TLS、Trusted Proxies、Authentication、WebSockets、Upload Limits、Rate Limits、Logs 与 Emergency Shutoff

面向 NGINX、Caddy、tunnels、VPN 与 home-server gateways 后 self-hosted apps 的公网暴露检查表。

在 self-hosted app 前放一个 reverse proxy,并不会自动让服务适合上公网。真实 exposure chain 包含 DNS、TLS、proxy trust、client-IP handling、authentication、admin surface separation、WebSocket upgrades、upload limits、request/connection limits、logs、fail-open behavior 与 emergency shutoff。

这份 checklist 适用于 CasaOS、Umbrel、Nextcloud、YunoHost、RomM、Penpot 等系统,并把 LAN-only、VPN-only、authenticated public access 与 public anonymous content 当成不同 operating modes。

RepoDaily 判断

默认选择 LAN-only 或 VPN-only,除非公网暴露是真实产品需求。必须 public 时,在受控 edge termination TLS,显式定义 trusted proxies,分离 admin surfaces,在不信任 arbitrary forwarding headers 的前提下保留 real client IP,专门测试 WebSockets 与 large uploads,按 endpoint 设计 rate/connection limits,并保留 tested emergency shutoff path。

快速矩阵

表面基线规则失败信号证据
DNS只有 intended names 指向 public ingressWildcard/stale records 暴露 forgotten servicesDNS inventory 与 owner
TLSValid cert + automated renewal + alertsExpired cert 或 plaintext fallbackRenewal test 与 expiry monitor
Trusted proxies只信任 known proxy addresses/rangesApp 信任 arbitrary X-Forwarded-*Proxy chain map 与 spoof negative test
Client IPReviewed proxy chain 保留 real client identity所有用户变成 proxy IP 或 source IP 可 spoofAccess-log sample 与 spoof test
AuthenticationPrivileged access 前做真实 authInternet reachability 等于 authorizationAnonymous/wrong-role tests
Admin surfaceAdmin routes private 或强隔离同一 public entry 暴露 root/admin consoleRoute inventory 与 access test
WebSockets显式 proxy upgrade 并 auth sessionHTTP 正常但 socket bypass controlsHandshake/origin/auth tests
Uploads设置 intentional size/timeoutsUnlimited uploads 耗尽 disk 或 legitimate upload 被误伤Boundary-size tests
Rate limits按 endpoint 设计 request/connection controlsLogin/API 可无限 hammerLoad/abuse test
Logs记录 auth/proxy/upstream/security events 并 redaction无 client identity 或 logs 泄露 tokensSample incident trace
Shutoff有 tested disable-public-ingress path只能在线热改 productionRunbook 与 exercise result

Public Exposure 准备度评分卡

给 internet → app 的完整 exposure path 打分,不只看 reverse proxy config。

控制项0 分1 分2 分Owner 问题
Exposure modeEverything publicSome private routesLAN/VPN/public modes 显式分类哪些 service 真需要 internet access?
TLS lifecycleManual/unclearAuto renewal onlyAuto renewal + expiry monitor + failure alert谁会发现 renewal failure?
Proxy trustTrust all headersSingle proxy configuredExplicit chain + trusted ranges + spoof tests哪个 hop 可声明 client identity?
AuthenticationApp default onlyStrong app authStrong auth + admin separation + session controlsPublic users 能否触达 admin flows?
Protocol handling只测 HTTPManual WS/upload testsAutomated HTTP/WS/upload boundary tests非 HTTP path 是否保留相同 policy?
Abuse controlsNoneBasic rate limitEndpoint-aware rate/connection/body-size/timeout controls哪个 endpoint 最容易被滥用?
ObservabilityProxy logs onlyApp + proxy logsCorrelated client/proxy/upstream/security events + redaction能否重建 abusive session?
Emergency responseManual editsDocumented disableTested ingress shutoff + DNS/tunnel revoke + rollback多快能 stop public access?

45 分钟 Public Exposure Review

Self-hosted service 上公网前运行。

0–5 分钟:分类 exposure

列出 hostnames、ports、tunnels、CDN、proxies 与 intended audience。

成功标准没有 public route 缺少 named need/owner。

5–10 分钟:追踪 proxy trust

记录 TLS termination 与 trusted proxy addresses;从 untrusted client 尝试 spoof forwarded headers。

成功标准Direct request 无法伪造 client identity。

10–20 分钟:测试 auth/admin separation

测试 anonymous、normal user、wrong role、direct-origin paths。

成功标准Public users 不能触达 admin surfaces 或 bypass proxy。

20–30 分钟:测试 protocols/limits

测试 WebSocket upgrade、normal upload、oversize upload、slow request 与 burst requests。

成功标准Legitimate flow 正常,abuse boundaries 可预测 fail。

30–40 分钟:检查 logs

跨 proxy/app logs 追踪 login failure 与 successful session,并检查 redaction。

成功标准Client identity/events 可 trace 且不泄露 secrets。

40–45 分钟:演练 shutoff

关闭 public route,同时保留 private operator access,再 deliberate restore。

成功标准Emergency response 不依赖 improvising production edits。

Public Exposure Decision Flow

  1. 把每个 service 分类为 LAN-only、VPN-only、authenticated public service 或 intentional anonymous public content。不要因为一个 app 需要 remote access 就公开整台 host。
  2. 画出 ingress chain:DNS、CDN/tunnel、edge proxy、internal proxy、application,以及 WebSocket/upload endpoints;记录 TLS termination 与 client identity authority。
  3. 窄配置 trusted proxies。App 只能信任 known proxy addresses/ranges 的 forwarding headers,并在 logs 中保留 direct peer 与 resolved client identity。
  4. User-facing 与 admin surfaces 分开。Admin console、host dashboard、DB UI、container manager、backup interface 优先 VPN/private network。
  5. 验证 protocol-specific behavior:HTTP redirects、WebSockets、large uploads、streaming、background callbacks、WebDAV-like clients、mobile clients、OAuth redirects。
  6. 按 app behavior 设置 body size、header size、idle/read/write timeout、request rate 与 concurrent connections,不复制 generic snippet。
  7. 使用真实 client-IP handling 测 auth 与 brute-force controls;proxy misconfig 会把所有用户折叠成一个 IP,或允许 spoofed forwarded address 污染 logs/policy。
  8. 集中足够 evidence 追踪 DNS name、client、proxy、upstream、auth result、status、latency、security event,同时不记录 passwords、cookies、Authorization headers 与 sensitive payload。
  9. 演练 emergency shutoff:关闭 public route/tunnel,保留 logs 与 LAN/VPN operator access,必要时 rotate credentials,私下 patch/test,再 deliberate reopen。

场景表

场景推荐 exposure mode必需控制停止条件
CasaOS admin dashboardLAN/VPN onlyPrivate routing、strong admin auth、no direct public portDashboard 对 arbitrary internet clients 可达
Umbrel home cloudVPN-first;只选择性公开 appPer-app route review、TLS、auth、update owner因一个 app 需要 sharing 就公开 whole appliance
NextcloudAuthenticated public if neededTrusted proxies、TLS、brute-force protection、upload/WebDAV tests、logsForwarded IP trust broad 或 abuse 无法 trace
YunoHost multi-app serverPer-domain/per-app policyTLS、app auth、admin separation、firewall、app review一个 weak app 污染所有 domain 的 trust assumption
RomM sharingAuthenticated public 或 VPNUser roles、upload limits、WS test、storage monitorFriend-sharing 获得 broader library/admin access
Penpot collaborationAuthenticated public 或 VPN-onlyAuth review、WebSocket support、upload limits、private admin opsRealtime collaboration 绕过 proxy controls
Temporary demoShort-lived authenticated routeExpiry、narrow DNS、no prod secrets、auto shutoffDemo 在 review window 后仍在线
Emergency incidentPublic ingress off,operator path privatePreserve logs、revoke route/tunnel、rotate secrets、patch privatelyRoot cause/credential scope 未知就 reopen

公网暴露风险

Reverse proxy security placebo

Proxy 可做 TLS termination 和 central policy,但 weak auth、broad admin routes 与 trusted-header mistakes 仍然危险。

Forwarded-header spoofing

App 若信任 arbitrary clients 的 X-Forwarded-*,attacker 可 spoof client identity,影响 logs、redirects 与 abuse controls。

Admin surface leakage

Home-server dashboard、container manager、backup console 与 root admin panel 不应因为 app traffic 走同一 proxy 就一起 public。

WebSocket policy gap

HTTP protected 不代表 WebSocket upgrade 正确;socket 可能 bypass middleware 或超长存活。

Upload exhaustion

Unlimited body size、long timeouts 与 public upload endpoints 会消耗 disk、memory、temp space、upstream workers。

Global rate-limit mistake

一个 generic limit 可能破坏 sync/upload,又没有真正保护 login 或 expensive APIs。

Log privacy leak

Access logs、debug traces、query strings、headers 与 upstream errors 可能泄露 tokens、share links、filenames 与 personal data。

No emergency cut path

Compromise 时需要 stop public ingress,同时保留 private operator access 与 evidence。

Exposure Patterns

LAN by default

Host dashboards/admin interfaces 留在 LAN/VPN,只公开真正需要 public access 的 named services。

One trust boundary per proxy hop

记录哪个 proxy 能 set client identity headers,并相应配置 downstream trusted-proxy lists。

Public app, private admin

通过 separate hostnames、routes、VPN policy 或 identity-aware access,让 public user traffic 不能触达 admin surfaces。

Protocol fixture tests

维护 HTTP redirect、login、WebSocket upgrade、representative upload size 与 real-client-IP logging 的简单自动测试。

Endpoint-aware abuse controls

Login、password reset、expensive search、upload 与 API endpoints 使用比 static assets 更严格的 controls。

Emergency ingress switch

保留 documented/rehearsed hostname、route、tunnel 或 public listener disable path,同时保持 private operator access。

FAQ

面向 self-hosted operator 的简短回答。

HTTPS 足够吗?

不够。HTTPS 只保护 transport;仍需要 auth、proxy trust、admin separation、updates、abuse controls、logs、backups 与 incident response。

Home-server dashboard 应该公开吗?

通常 host/platform administration 应留在 LAN/VPN,只公开真正需要 public access 的 application routes。

为什么 trusted proxies 重要?

App 常使用 forwarded headers 判断 client IP、host 与 scheme;只有 known proxies 应被允许声明这些值。

WebSockets 要单独测试吗?

要。Upgrade handling、auth、origin expectations、idle timeouts 与 connection limits 与普通 HTTP 不完全相同。

所有 endpoint 应使用同一 rate limit 吗?

不应。Login、password reset、expensive search、API、upload 有不同成本和 abuse characteristics。

Emergency shutoff 是什么?

能快速 disable public ingress,同时保留 private operator access、logs 与 recovery capability 的 tested path。

相关雷达

Self-hosted Apps & Local Infrastructure 雷达

相关 RepoDaily briefs

Sources

  1. Nextcloud Reverse Proxy documentation
  2. Nextcloud Brute Force Protection
  3. NGINX WebSocket Proxying
  4. NGINX Request Rate Limiting module
  5. NGINX Connection Limiting module
  6. NGINX Core module client_max_body_size
  7. Caddy Reverse Proxy
  8. Caddy HTTPS Quick Start
  9. Caddy Trusted Proxies
  10. RepoDaily Home Server Backup & Recovery Checklist

Feedback

这页是否帮助你做出决定?

匿名反馈只用于判断内容是否真正有用。

报告过期或缺失的证据