← 返回
安全合规 中文

Cloudflare Access VPS

Add Cloudflare Zero Trust Access authentication to a VPS-hosted OpenClaw agent. Puts a login screen (email OTP, Google SSO, GitHub, or TOTP MFA) in front of...
在 VPS 托管的 OpenClaw 代理上添加 Cloudflare Zero Trust Access 认证,在前面放置登录界面(邮件 OTP、Google SSO、GitHub 或 TOTP MFA)。
maverick-software
安全合规 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 534
下载
💾 2
安装
1
版本
#latest

概述

Cloudflare Access for OpenClaw VPS Agents

Gates the entire domain with Cloudflare Zero Trust Access — every URL, including /ws, /api/,

and the control UI, requires authentication before a byte reaches the VPS.

Architecture

Browser / app hits https://koda.yourdomain.com
        ↓
Cloudflare Edge
  ├── Access policy check → BLOCKED if unauthenticated (login screen shown)
  └── Authenticated → Cloudflare Tunnel → localhost:18789 → OpenClaw
                                                                ↓
                                                       Gateway token auth (layer 2)
                                                                ↓
                                                       Device pairing  (layer 3)

Prerequisites: Cloudflare Tunnel active (cloudflared service running), domain on Cloudflare DNS.

See cloudflare-agent-tunnel skill if tunnel is not yet set up.


Quick Setup (5 Steps)

Step 1 — Enable Zero Trust

  1. dash.cloudflare.com → select your account → Zero Trust
  2. On first visit, pick a team name (e.g. teamplayers) — this becomes teamplayers.cloudflareaccess.com
  3. Free plan: up to 50 users, no credit card required

Step 2 — Add an Identity Provider

Zero Trust → Settings → Authentication → Add new — pick one:

ProviderBest forSetup effort
---------
One-time PIN (email OTP)Simplest, no external appZero — built-in
GoogleTeams with Google Workspace~5 min (OAuth app in Google Console)
GitHubDeveloper teams~5 min (OAuth app in GitHub)

> For most solo/small team deployments, One-time PIN is sufficient and needs no external setup.

Step 3 — Create an Access Application

Zero Trust → Access → Applications → Add an application → Self-hosted

FieldValue
------
Application nameOpenClaw - Koda (or agent name)
Session duration24 hours (reduce for higher security)
Application domainkoda.yourdomain.com
Path(leave blank to gate entire domain)

Click Next.

Step 4 — Create an Access Policy

Policy name: Owners only (or similar)

RuleSetting
------
ActionAllow
Include → SelectorEmails
Include → Valuecharles@yourdomain.com (your email)

To require MFA: Add require rule → Authentication Method → mfa (forces TOTP/hardware key on top of identity provider).

Click Next → Save.

Step 5 — Test

Open a private/incognito window → visit https://koda.yourdomain.com.

You should see a Cloudflare login page. After authenticating, OpenClaw loads normally.


Multi-Agent Setup

Each agent subdomain gets its own Access Application with its own policy.

koda.teamplayers.ai    → Application: "OpenClaw - Koda"    → Policy: owners only
agent2.teamplayers.ai  → Application: "OpenClaw - Agent 2" → Policy: client X only

To add a second agent: repeat Steps 3–4 with the new subdomain.


Service Tokens (for API / Native App Access)

Browser-based Cloudflare login doesn't work for programmatic or native app connections.

Use Service Tokens instead — static credentials sent as HTTP headers.

Zero Trust → Access → Service Auth → Create Service Token

Copy the CF-Access-Client-Id and CF-Access-Client-Secret.

Attach the token to the application:

  • In the Access Application, add a second policy:
  • Action: Allow, Include → Service Token → select the token you created

The caller then sends:

CF-Access-Client-Id: <id>.access
CF-Access-Client-Secret: <secret>

For WebSocket connections (OpenClaw gateway): pass these as HTTP headers on the WS upgrade request.

Full details → references/service-tokens.md


Interaction with OpenClaw Token + Pairing

Cloudflare Access is the outer gate. OpenClaw's own auth layers still apply after it:

LayerWhat it blocks
------
Cloudflare AccessUnauthenticated internet users (never reach the UI)
Gateway tokenAnyone who bypasses Cloudflare (e.g. VPS localhost, misconfigured tunnel)
Device pairingSomeone with the token but on an unapproved browser

For existing deployments, no OpenClaw config changes are needed — Access just wraps the outside.


Troubleshooting

See references/troubleshooting.md for common issues including:

  • "Access denied" after login
  • WebSocket connections failing through Access
  • Service token auth not working
  • Bypassing Access for localhost development

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 23:17 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 89 📥 30,586
content-creation

Copywriting Pro

maverick-software
为任何形式撰写有说服力、高转化率的文案——广告、着陆页、邮件、销售页、标题、产品描述、CTA和社交帖子。App...
★ 2 📥 4,937
security-compliance

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,699