项目简介
Tailscale 是基于 WireGuard 的零配置 VPN 方案,内置双因素认证和单点登录。开源仓库包含守护进程和命令行工具,支持 Linux、Windows 和 macOS。无需复杂防火墙设置即可实现安全点对点连接。
README 预览
# Tailscale\n\nhttps://tailscale.com\n\nPrivate WireGuard® networks made easy\n\n## Overview\n\nThis repository contains the majority of Tailscale's open source code.\nNotably, it includes the `tailscaled` daemon and\nthe `tailscale` CLI tool. The `tailscaled` daemon runs on Linux, Windows,\n[macOS](https://tailscale.com/kb/1065/macos-variants/), and to varying degrees\non FreeBSD and OpenBSD. The Tailscale iOS and Android apps use this repo's\ncode, but this repo doesn't contain the mobile GUI code.\n\nOther [Tailscale repos](https://github.com/orgs/tailscale/repositories) of note:\n\n* the Android app is at https://github.com/tailscale/tailscale-android\n* the Synology package is at https://github.com/tailscale/tailscale-synology\n* the QNAP package is at https://github.com/tailscale/tailscale-qpkg\n* the Chocolatey packaging is at https://github.com/tailscale/tailscale-chocolatey\n\nFor background on which parts of Tailscale are open source and why,\nsee [https://tailscale.com/opensource/](https://tailscale.com/opensource/).\n\n## Using\n\nWe serve packages for a variety of distros and platforms at\n[https://pkgs.tailscale.com](https://pkgs.tailscale.com/).\n\n## Other clients\n\nThe [macOS, iOS, and Windows clients](https://tailscale.com/download)\nuse the code in this repository but additionally include small GUI\nwrappers. The GUI wrappers on non-open source platforms are themselves\nnot open source.\n\n## Building\n\nWe always require the latest Go release, currently Go 1.26. (While we build\nreleases with our [Go fork](https://github.com/tailscale/go/), its use is not\nrequired.)\n\n```\ngo install tailscale.com/cmd/tailscale{,d}\n```\n\nIf you're packaging Tailscale for distribution, use `build_dist.sh`\ninstead, to burn commit IDs and version info into the binaries:\n\n```\n./build_dist.sh tailscale.com/cmd/tailscale\n./build_dist.sh tailscale.com/cmd/tailscaled\n```\n\nIf your distro has conventions that preclude the use of\n`build_dist.sh`, please do the常见问题 (5)
故障排除如何修复使用 Tailscale Android 拆分隧道允许列表模式时的 DNS 解析失败问题?
根本原因:当 Tailscale for Android 以 allowlist(包含)模式运行拆分隧道时,Tailscale 应用本身未被自动添加到允许列表中,因此 Tailscale 进程被排除在 VPN 之外。这意味着即使子网路由正常工作,被允许的应用也无法访问 Tailscale 的 DNS 解析器。旧文档中关于 allowlist 模式需要 MDM 的说法已经过时:该功能不再有 MDM 限制。此问题影响 Android 17 及其他受支持的 Android 版本上的 Tailscale v1.98.8。
解决方案:
1. 即时临时变通方案:将拆分隧道切换回默认的 blocklist 模式,并屏蔽除你在 allowlist 模式中所允许的那组应用之外的所有应用。DNS 解析将立即恢复。
2. 永久修复:官方补丁已包含在 https://pkgs.tailscale.com/unstable/ 提供的不稳定(unstable)构建中。升级到该不稳定构建即可解决此问题,或等待包含该修复的后续稳定版本发布。
故障排除为什么当节点已经处于 Running 状态且带有 advertised tags 时,裸执行 'tailscale up' 会挂起并且永远不返回?
这是 Tailscale 1.102.5(Linux)中的一个已知 bug:当节点已经处于 Running 状态且设置了 AdvertiseTags 时,不带参数的 tailscale up 会永久阻塞,最终以 context canceled 终止(例如在 timeout 下退出码为 124)。节点保持在线且功能正常;只有 CLI 会挂起。变通方法:
1. 在运行命令前检查状态,如果已经启动则跳过:
if [ "$(tailscale status --json --peers=false | jq -r .BackendState)" != "Running" ]; then
sudo tailscale up
fi
2. 如果必须运行 tailscale up(例如为了恢复状态),请传入完整的非默认标志集(包括你的标签),并用 timeout 包裹:
timeout 30 sudo tailscale up --advertise-tags=tag:your-tag --ssh --accept-routes使用完整的现有标志重复执行
up 会立即返回,因为 CLI 检测到标签没有变化,会走快速的"编辑并返回"路径。
根本原因:不带参数的 up 会被视为没有标签标志的 'simpleUp',因此 CLI 认为标签发生了变化,禁用了快速的 justEdit 返回路径,然后等待一个永远不会触发的 IPN Running 通知,因为 tailscaled 没有执行任何状态转换(WantRunning 已经为 true)。未设置标签的节点不受影响,会立即返回。
故障排除如何修复在 Safari 中从 macOS 应用打开 Tailscale Admin Console 时出现的 "Error 401 - bad tailscale-authstate2 cookie" 错误?
在 Safari 中使用 Apple SSO 时,点击 Tailscale macOS 菜单栏应用中的 Admin Console 按钮会出现此错误。该应用会打开 controlplane.tailscale.com/login,并在该子域名上设置 tailscale-authstate2 cookie,但 Apple 的 OAuth 会重定向回 login.tailscale.com —— Safari 严格的 cookie 作用域规则不会跨子域名发送该 cookie,从而导致 401 错误(Chrome 因其 Lax+POST 宽松窗口机制而可以正常工作)。
**临时解决方法:** 直接在浏览器中访问 https://login.tailscale.com/admin,而不是使用应用中的 Admin Console 按钮。由于登录和 cookie 与 OAuth 的 redirect_uri 保持在同一域名下,Apple SSO 可以成功。
**永久修复(需要 Tailscale 服务端更改):** 要么在 tailscale-authstate2 cookie 上设置 Domain=.tailscale.com,要么更新 macOS 应用,使其直接打开 https://login.tailscale.com/admin。
故障排除Mullvad 公共 DNS 关闭后(194.242.2.2 停止工作),使用 Mullvad 出口节点时如何修复失效的 DNS?
Mullvad 正在关闭其公共加密 DNS 服务器,194.242.2.2(自 2023 年以来为 Mullvad 出口节点通告的解析器)将于 2026-11-02 停止响应,导致出口节点用户的 DNS 中断。修复方法:更新到为 Mullvad 出口节点通告隧道内解析器 10.64.0.1(而非 194.242.2.2)的版本——该解析器在隧道内工作,不受此次关闭的影响。手动解决方法:覆盖出口节点的 DNS 配置,改用 10.64.0.1(仅可通过 Mullvad 隧道访问)。如果您在隧道外使用了 Mullvad 的公共 DNS,请切换到 Quad9(9.9.9.9),该服务由 Mullvad 官方推荐,且 Mullvad 现在是其赞助商。
故障排除如何修复在使用安全扫描器构建 Go 项目时出现的 golang.org/x/net 漏洞告警?
将 golang.org/x/net 从 v0.59.0 升级到 v0.60.0,并使用 Go 1.27.2 工具链。运行:
go get golang.org/x/net@v0.60.0
go mod tidy
对于 Tailscale,还需将 go.toolchain.rev 更新为 Go 1.27.2 工具链对应的提交(186053ab2af2ef8fc43f3c1d1150216e89d4aff0),然后重新构建并重新扫描。这样即使存在漏洞的代码路径在运行时未被使用,也能清除扫描器的检测结果。