Files
zeekay acaeda400a Eradicate OpenClaw — resolve merge conflicts and finish the rebrand
Three coordinated things:

1. Resolve the committed upstream/main merge conflicts. 94 files were
   sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
   conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
   by keeping HEAD everywhere — 540 conflict blocks.

2. Rewrite remaining OpenClaw text refs.
     OPENCLAW   → HANZO_BOT
     OpenClaw   → HanzoBot          (PascalCase type identifiers)
     openclaw   → bot               (codebase convention — botToken,
                                    botUsername etc.; avoids invalid
                                    hyphenated JS identifiers)
     openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z]   (compound)
     ai.openclaw.x → ai.hanzo.bot.x  (JVM package path)

3. Delete or rename openclaw-named file paths (116 of them). Dead
   duplicates with a Bot-named canonical from the partial migration:
   deleted. Otherwise renamed.
     ai/openclaw/**           → deleted (ai/hanzo/bot/** canonical)
     Sources/OpenClaw*/       → deleted (Sources/Bot* canonical)
     Tests/OpenClawIPCTests/  → deleted (Tests/BotIPCTests canonical)
     OpenClawKit/             → deleted (BotKit canonical)
     openclaw-tools.*.ts      → deleted (bot-tools.*.ts canonical)
     openclaw-root.ts etc.    → deleted (bot-root.ts canonical)
     types.openclaw.ts        → deleted (types.bot.ts canonical)
     extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
     docs/start/openclaw.md   → renamed hanzo-bot.md (+ zh-CN)
     docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
     scripts/.../openclaw-*   → deleted (bot/hanzo-bot parallels)
     openclaw.mjs             → deleted (hanzo-bot.mjs is package.bin)

Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).

Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.

The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.

Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2026-05-11 17:56:29 -07:00

5.9 KiB
Raw Permalink Blame History

read_when, summary, title, x-i18n
read_when summary title x-i18n
你想要带安全加固的自动化服务器部署
你需要带 VPN 访问的防火墙隔离设置
你正在部署到远程 Debian/Ubuntu 服务器
使用 Ansible、Tailscale VPN 和防火墙隔离进行自动化、加固的 HanzoBot 安装 Ansible
generated_at model provider source_hash source_path workflow
2026-02-03T07:49:29Z claude-opus-4-5 pi 896807f344d923f09039f377c13b4bf4a824aa94eec35159fc169596a3493b29 install/ansible.md 15

Ansible 安装

将 HanzoBot 部署到生产服务器的推荐方式是通过 hanzo-bot-ansible — 一个安全优先架构的自动化安装程序。

快速开始

一条命令安装:

curl -fsSL https://raw.githubusercontent.com/hanzo-bot/hanzo-bot-ansible/main/install.sh | bash

📦 完整指南:github.com/hanzo-bot/hanzo-bot-ansible

hanzo-bot-ansible 仓库是 Ansible 部署的权威来源。本页是快速概述。

你将获得

  • 🔒 防火墙优先安全:UFW + Docker 隔离(仅 SSH + Tailscale 可访问)
  • 🔐 Tailscale VPN:安全远程访问,无需公开暴露服务
  • 🐳 Docker:隔离的沙箱容器,仅绑定 localhost
  • 🛡️ 纵深防御:4 层安全架构
  • 🚀 一条命令设置:几分钟内完成部署
  • 🔧 Systemd 集成:带加固的开机自启动

要求

  • 操作系统:Debian 11+ 或 Ubuntu 20.04+
  • 访问权限:Root 或 sudo 权限
  • 网络:用于包安装的互联网连接
  • Ansible:2.14+(由快速启动脚本自动安装)

安装内容

Ansible playbook 安装并配置:

  1. Tailscale(用于安全远程访问的 mesh VPN)
  2. UFW 防火墙(仅允许 SSH + Tailscale 端口)
  3. Docker CE + Compose V2(用于智能体沙箱)
  4. Node.js 22.x + pnpm(运行时依赖)
  5. HanzoBot(基于主机,非容器化)
  6. Systemd 服务(带安全加固的自动启动)

注意:Gateway 网关直接在主机上运行(不在 Docker 中),但智能体沙箱使用 Docker 进行隔离。详情参见沙箱隔离。

安装后设置

安装完成后,切换到 hanzo-bot 用户:

sudo -i -u hanzo-bot

安装后脚本将引导你完成:

  1. 新手引导向导:配置 HanzoBot 设置
  2. 提供商登录:连接 WhatsApp/Telegram/Discord/Signal
  3. Gateway 网关测试:验证安装
  4. Tailscale 设置:连接到你的 VPN mesh

常用命令

# 检查服务状态
sudo systemctl status hanzo-bot

# 查看实时日志
sudo journalctl -u hanzo-bot -f

# 重启 Gateway 网关
sudo systemctl restart hanzo-bot

# 提供商登录(以 hanzo-bot 用户运行)
sudo -i -u hanzo-bot
hanzo-bot channels login

安全架构

4 层防御

  1. 防火墙(UFW):仅公开暴露 SSH(22)+ Tailscale(41641/udp)
  2. VPN(Tailscale):Gateway 网关仅通过 VPN mesh 可访问
  3. Docker 隔离:DOCKER-USER iptables 链防止外部端口暴露
  4. Systemd 加固:NoNewPrivileges、PrivateTmp、非特权用户

验证

测试外部攻击面:

nmap -p- YOUR_SERVER_IP

应该显示仅端口 22(SSH)开放。所有其他服务(Gateway 网关、Docker)都被锁定。

Docker 可用性

Docker 用于智能体沙箱(隔离的工具执行),而不是用于运行 Gateway 网关本身。Gateway 网关仅绑定到 localhost,通过 Tailscale VPN 访问。

沙箱配置参见多智能体沙箱与工具。

手动安装

如果你更喜欢手动控制而非自动化:

# 1. 安装先决条件
sudo apt update && sudo apt install -y ansible git

# 2. 克隆仓库
git clone https://github.com/hanzo-bot/hanzo-bot-ansible.git
cd hanzo-bot-ansible

# 3. 安装 Ansible collections
ansible-galaxy collection install -r requirements.yml

# 4. 运行 playbook
./run-playbook.sh

# 或直接运行(然后手动执行 /tmp/hanzo-bot-setup.sh)
# ansible-playbook playbook.yml --ask-become-pass

更新 HanzoBot

Ansible 安装程序设置 HanzoBot 为手动更新。标准更新流程参见更新。

要重新运行 Ansible playbook(例如,用于配置更改):

cd hanzo-bot-ansible
./run-playbook.sh

注意:这是幂等的,可以安全地多次运行。

故障排除

防火墙阻止了我的连接

如果你被锁定:

  • 确保你可以先通过 Tailscale VPN 访问
  • SSH 访问(端口 22)始终允许
  • Gateway 网关仅通过 Tailscale 访问,这是设计如此

服务无法启动

# 检查日志
sudo journalctl -u hanzo-bot -n 100

# 验证权限
sudo ls -la /opt/hanzo-bot

# 测试手动启动
sudo -i -u hanzo-bot
cd ~/hanzo-bot
pnpm start

Docker 沙箱问题

# 验证 Docker 正在运行
sudo systemctl status docker

# 检查沙箱镜像
sudo docker images | grep hanzo-bot-sandbox

# 如果缺失则构建沙箱镜像
cd /opt/hanzo-bot/hanzo-bot
sudo -u hanzo-bot ./scripts/sandbox-setup.sh

提供商登录失败

确保你以 hanzo-bot 用户运行:

sudo -i -u hanzo-bot
hanzo-bot channels login

高级配置

详细的安全架构和故障排除:

相关内容