SoftwareStartups/clawfort
GitHub: SoftwareStartups/clawfort
基于 Pulumi IaC 在 Hetzner VPS 上一键部署带内容护栏和零信任访问的安全自托管 AI 网关。
Stars: 0 | Forks: 0
# ClawFort
ClawFort 是部署在 Hetzner VPS 上的安全自托管 AI 网关 —— 通过 Citadel 内容护栏将请求路由到 OpenRouter,且仅能通过 Tailscale VPN 访问。完整技术栈由 Pulumi IaC 进行配置。
## 技术栈
| 组件 | 角色 |
|-----------|------|
| **OpenClaw** (`@openclaw/cli`) | AI 网关,监听 `127.0.0.1:18789` |
| **Citadel OSS** | 护栏中间件,监听 `127.0.0.1:3333` |
| **GOG** | Google Calendar CLI 工具;通过 socket activation 以 `gog-user` 身份运行 |
| **OpenRouter** | 统一的 LLM 代理 (Claude, GPT-4, Llama 等) |
| **Nginx** | 反向代理 (Tailscale IP → 网关) |
| **Tailscale** | 零信任 VPN,唯一的访问路径 |
| **Hetzner CCX13** | VPS 主机 (Ubuntu 24.04 LTS) |
| **Systemd (用户)** | 带有 lingering 的服务管理 |
| **Pulumi + ESC** | IaC 配置 + 加密密钥 |
通过 registry 添加你自己的工具 —— 参见 `infra/config/tool-registry.ts`。
## 快速开始
### 1. 前置条件
遵循 [docs/prerequisites.md](docs/prerequisites.md) 来设置账户、生成密钥并填充 Pulumi ESC 环境。
### 2. 部署
```
task install && task up
```
Pulumi 会配置服务器、安装所有软件、配置服务并注入密钥 —— 无需手动 SSH。
### 3. 验证
```
task verify
```
有关手动检查的详细信息,请参见 [docs/verification.md](docs/verification.md)。
## 任务
运行 `task --list` 以查看所有可用任务。主要任务:
| 任务 | 描述 |
|------|-------------|
| `task install` | 安装 infra/ 依赖 |
| `task check` | Lint + 格式检查 + 类型检查 (并行) |
| `task lint` | ESLint |
| `task lint:fix` | ESLint --fix |
| `task format` | Prettier 写入 |
| `task format:check` | Prettier 检查 |
| `task typecheck` | tsc --noEmit |
| `task preview` | Pulumi 预运行 |
| `task up` | 部署到生产环境 |
| `task destroy` | 销毁所有资源 (需确认) |
| `task outputs` | 显示 Stack 输出 (IP,服务器 ID) |
| `task info` | 显示服务器 IP、主机名和服务器 ID |
| `task ssh` | 通过 Tailscale SSH 连接到服务器 |
| `task verify` | 运行部署后的健康检查 |
| `task keys:ssh` | 为 Hetzner 生成 SSH 密钥对 |
| `task keys:token` | 生成随机的网关身份验证 token |
## 运维操作
无需 SSH 即可远程管理服务和查看日志:
```
# Service management
task server:status # show openclaw + citadel status
task server:restart # restart both services
task server:stop # stop both services
task server:start # start both services
# 日志
task logs:openclaw # recent openclaw logs
task logs:citadel # recent citadel logs
task logs:nginx # recent nginx logs
task logs:follow # follow openclaw + citadel logs (live)
# Security checks
task security:firewall # UFW status
task security:isolation # tool user isolation checks
task security:audit # all security checks
```
## 文档
- [docs/prerequisites.md](docs/prerequisites.md) — 账户、密钥和 ESC 设置
- [docs/deployment.md](docs/deployment.md) — 运行和管理部署
- [docs/verification.md](docs/verification.md) — 部署后的健康检查
- [docs/references.md](docs/references.md) — 外部参考
标签:AI代理, AI工具注册, CISA项目, Citadel, EC2, Google日历集成, Hetzner, IaC, IP 地址批量处理, Naabu, Nginx, OpenClaw, OpenRouter, Pulumi, Systemd服务管理, Tailscale, TypeScript, 云服务器部署, 人工智能网关, 任务自动化, 内容安全, 反向代理, 大语言模型代理, 安全插件, 安全自托管, 提示词注入防护, 数据加密, 特权提升, 网络安全, 自动化攻击, 自动化部署, 隐私保护, 零信任网络