OpenClaw 可自动配置 Tailscale Serve(tailnet 内部)或 Funnel(公网)来暴露 Gateway 控制面和 WebSocket 端口,同时保持 Gateway 绑定在 loopback。
模式
| 模式 | 说明 |
|---|---|
serve | Tailnet 内部,通过 tailscale serve,Gateway 保持 127.0.0.1 |
funnel | 公网 HTTPS,通过 tailscale funnel,必须配置 password 认证 |
off | 默认,不管理 Serve/Funnel |
认证
gateway.auth.mode 控制握手方式:
none:私有入口token:默认(设置OPENCLAW_GATEWAY_TOKEN时)password:共享密钥trusted-proxy:身份感知反向代理
当 tailscale.mode = "serve" 且 gateway.auth.allowTailscale: true 时,Control UI/WebSocket 可使用 Tailscale 身份 header(tailscale-user-login)认证,无需 token/password。OpenClaw 通过 tailscale whois 验证身份。
注意:HTTP API 端点(/v1/*、/tools/invoke)不使用 Tailscale 身份 header,仍走正常 HTTP 认证。
配置示例
Tailnet 内部(Serve)
{
gateway: {
bind: "loopback",
tailscale: { mode: "serve" },
},
}访问:https://<magicdns>/
直接绑定 Tailnet IP
{
gateway: {
bind: "tailnet",
auth: { mode: "token", token: "your-token" },
},
}公网(Funnel + 密码)
{
gateway: {
bind: "loopback",
tailscale: { mode: "funnel" },
auth: { mode: "password", password: "replace-me" },
},
}CLI 示例
openclaw gateway --tailscale serve
openclaw gateway --tailscale funnel --auth password注意事项
- Funnel 要求 auth mode 为
password,否则拒绝启动 - Funnel 仅支持端口
443、8443、10000 - Funnel 在 macOS 需要开源版 Tailscale app
gateway.tailscale.resetOnExit: true可在关闭时撤销 Serve/Funnel 配置- Serve/Funnel 只暴露 Gateway 控制面 + WS,节点通过同一 WS 端点连接