Skip to content

本次故障修复结论

问题现象

在配置完 peer relay 之后,出现了下面的现象:

  • tailscale ping 100.x.x.x 正常
  • ssh your_user@100.x.x.x 超时
  • nc -vz 100.x.x.x 22 卡住
  • autossh-log 里反复出现:
text
ssh: connect to host 100.x.x.x port 22: Operation timed out

排查过程

这次实际排查过程中,先后排除了这些方向:

  • autossh 配置错误
  • hf-airsshd 未监听
  • hf-air 的 macOS 防火墙
  • mini 本机终端代理变量
  • 本机系统代理例外配置
  • hf-air 上的 pf 明显规则

关键证据链是:

  1. mini 上抓包能看到发往 100.x.x.x:22 的 SYN
  2. hf-air 上系统抓包看不到对应 22 端口流量
  3. tailscale ping 正常,但普通 TCP 访问失败
  4. hfmacbook 访问 hf-air:22 也失败
  5. 回头检查 policy,发现只加了 relay grant,没有普通网络层 grant

根因

根因是:

  • 只配置了:
json
{
  "src": ["autogroup:member"],
  "dst": ["tag:relay-cn"],
  "app": {
    "tailscale.com/cap/relay": []
  }
}

这只是在授权:

  • 谁可以使用 peer relay

不等于成员之间普通网络层访问授权。

最终解决方案

补上:

json
{
  "src": ["autogroup:member"],
  "dst": ["autogroup:member"],
  "ip": ["*"]
}

之后问题立即恢复。

后续建议

如果你以后想更收敛权限,可以把:

json
"ip": ["*"]

改成更细粒度,例如:

json
"ip": ["tcp:22"]

或者只开放你真正需要的端口集合。