← 返回 Skills 市场
olegtsvetkov

Deploy Xray VLESS using 3X UI on your VPS

作者 olegtsvetkov · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ 安全检测通过
201
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install 3x-ui-vps
功能描述
Deploy and manage 3X-UI on a root-managed Ubuntu or Debian VPS using Docker Compose, nginx, ACME certificates, SSH panel tunneling, UFW hardening, and Xray V...
使用说明 (SKILL.md)

3X-UI VPS

Deploy 3X-UI on a VPS with the panel and subscription server bound to loopback, ufw allowing only SSH/HTTP/HTTPS, nginx on public 80/443, and one VLESS + XHTTP transport routed through nginx.

This skill is manual-first because it mutates remote infrastructure. Invoke it only when the user explicitly asks to deploy, repair, harden, or update a VPS.

Hard rule

  • All server-side configuration must be executed only through the bundled scripts in this skill.
  • Do not create or edit remote configs manually over SSH, do not run ad-hoc heredocs on the server, and do not "quick-fix" nginx, Docker, ACME, or 3X-UI by hand.
  • Read-only inspection commands are allowed for diagnosis.
  • If a script fails because the host is in an unexpected state, stop changing the server, patch the relevant script locally in this skill, and rerun the script.
  • The manual fallback in this skill is for the 3X-UI panel UI only. It is not permission to mutate server files manually.

Inputs

Collect these before doing any work:

  • ssh target for the VPS, preferably root@host
  • optional plain-text SSH password if the host is password-auth only
  • public domain pointed at the VPS
  • optional ACME email
  • panel admin username and password
  • optional local tunnel port

Assume Ubuntu or Debian with apt. Do not use this skill on other distributions without adapting the Docker repository setup first.

The operator workstation and the target VPS also need outbound internet access for Docker downloads, ACME issuance, and panel API calls.

Preflight

Before changing the host, confirm these assumptions:

  • the domain already resolves to the VPS from the server side, not only from the operator workstation
  • the operator knows whether SSH access is key-based or password-based
  • if the host already has a certificate for the same domain, reruns must reuse it instead of treating acme.sh "Domains not changed" as a hard failure
  • if panel tunneling starts failing with immediate SSH disconnects after several quick attempts, stop parallel retries, wait briefly, and retry one connection at a time

Workflow

1. Fresh deploy

Use scripts/bootstrap-host.sh.

Example:

./scripts/bootstrap-host.sh \
  --host root@example-vps \
  --ssh-password 'host-password' \
  --domain vpn.example.com \
  --panel-username admin \
  --panel-password 'panel-secret'

Default shape:

  • 3X-UI runs via Docker Compose under /opt/3x-ui
  • Docker is installed on Ubuntu and Debian hosts through get.docker.com
  • container keeps network_mode: host
  • data lives under 3x-ui-data/db/
  • certificates live under 3x-ui-data/cert/
  • panel must bind to 127.0.0.1:\x3Cpanel_port>
  • subscription server must bind to 127.0.0.1:2096
  • panel admin username and password must be applied during deploy
  • the script must resolve the public domain on the server itself with dig before ACME issuance
  • nginx terminates TLS on public 443
  • nginx returns 401 for unmatched traffic
  • nginx proxies only the configured Xray secret path to the local backend port with grpc_pass
  • ufw must allow only SSH, HTTP, and HTTPS from the internet

After deploy, verify:

ssh \x3Ctarget> 'ss -ltnp | egrep ":2053 |:2096 |:1234 "'
ssh \x3Ctarget> 'docker compose -f /opt/3x-ui/docker-compose.yml ps'
ssh \x3Ctarget> 'curl -I http://127.0.0.1:2053/'
ssh \x3Ctarget> 'ufw status numbered'

Read references/architecture.md if you need the full topology or nginx routing rationale.

2. Panel access

Use scripts/open-panel-tunnel.sh and keep the panel SSH-only.

Default tunnel:

./scripts/open-panel-tunnel.sh --host root@example-vps --ssh-password 'host-password' --local-port 12053 --panel-port 2053

Then open http://127.0.0.1:12053.

If the tunnel fails with an immediate SSH disconnect, avoid parallel SSH sessions to the same host for a short period and retry the tunnel as a single connection after a brief pause.

Do not publish the panel in nginx. If the operator later wants a public panel, treat that as a separate hardening decision.

3. Quick inbound bootstrap

Use scripts/bootstrap-inbound.py against the tunneled panel URL.

Important detail:

  • public client transport is TLS because nginx terminates TLS on 443
  • backend Xray inbound behind nginx stays plain XHTTP on loopback
  • the inbound path must match the nginx secret path

Preferred flow:

python3 scripts/bootstrap-inbound.py \
  --panel-url http://127.0.0.1:12053 \
  --username admin \
  --password 'secret' \
  --public-domain vpn.example.com \
  --backend-port 1234 \
  --path /xhttp-keep-this-secret

The script prefers API automation but always prints a manual fallback checklist. Use references/manual-bootstrap.md if API endpoints drift or the panel UI has changed. That fallback is UI-only. If server-side behavior needs to change, update the bundled scripts first and rerun them.

4. Add another client to an existing inbound

Use scripts/add-inbound-client.py against the tunneled panel URL.

This workflow is for adding one more client to an already working inbound without changing nginx, ports, or the existing secret path.

Preferred flow:

python3 scripts/add-inbound-client.py \
  --panel-url http://127.0.0.1:12053 \
  --username admin \
  --password 'secret' \
  --inbound-id 1

Behavior:

  • the script logs in to 3X-UI through the panel tunnel
  • loads the existing inbound
  • appends one more VLESS client to settings.clients
  • keeps the existing public domain and XHTTP path from that inbound
  • updates the same inbound instead of creating a second parallel inbound
  • prints a ready-to-import vless:// client URL

If --inbound-id is omitted, the script may auto-select the inbound only when the panel has exactly one inbound. Otherwise require the operator to pass the inbound ID explicitly.

5. Updates

Use scripts/update-stack.sh.

The update workflow must stay conservative:

./scripts/update-stack.sh --host root@example-vps --ssh-password 'host-password'

This runs:

  • apt update
  • apt upgrade
  • docker compose pull
  • docker compose up -d
  • reapply panel loopback bind
  • reapply subscription loopback bind on 2096
  • reapply ufw rules for SSH, HTTP, and HTTPS only

Do not switch this skill to apt full-upgrade unless the user explicitly asks for it.

Fast troubleshooting

Use these checks before assuming the deploy is broken:

  • ssh \x3Ctarget> 'ss -ltnp | egrep ":2053 |:2096 |:1234 |:443 |:80 "'
  • ssh \x3Ctarget> 'docker compose -f /opt/3x-ui/docker-compose.yml ps'
  • ssh \x3Ctarget> 'curl -I http://127.0.0.1:2053/'
  • ssh \x3Ctarget> 'cat /opt/3x-ui/bootstrap.env'
  • local tunnel check: lsof -nP -iTCP:12053 -sTCP:LISTEN

Interpretation:

  • 127.0.0.1:2053 and 127.0.0.1:2096 mean panel and sub server are correctly isolated
  • 127.0.0.1:1234 means the Xray backend inbound exists
  • public 0.0.0.0:80 and 0.0.0.0:443 should belong to nginx
  • curl -I http://127.0.0.1:2053/ returning 404 is acceptable and proves the panel is responding
  • https://\x3Cdomain>/ returning 401 is the expected nginx default for unmatched traffic

Decision rules

  • Prefer the bundled scripts over retyping long shell sessions.
  • Treat the bundled scripts as the only writable interface to the server state.
  • If deployment or update fails, fix the script or add a new script in this skill. Do not repair the server manually.
  • If the operator provides a plain-text SSH password, pass it through to the bundled script with --ssh-password instead of wrapping SSH manually.
  • Keep Docker installation simple and consistent by using curl -fsSL https://get.docker.com -o get-docker.sh followed by sh ./get-docker.sh.
  • Resolve the public domain from the server itself with dig, not from the operator workstation, before relying on DNS results.
  • Keep the panel on 127.0.0.1; verify with ss -ltnp.
  • Keep the subscription server on 127.0.0.1:2096; verify with ss -ltnp.
  • Keep nginx responsible for public 80/443.
  • Keep the Xray backend on a separate loopback port such as 127.0.0.1:1234.
  • Reuse the exact same secret path in nginx and the inbound config.
  • When the operator asks for another client, prefer adding it to the existing inbound instead of creating a second inbound with duplicate transport settings.
  • Keep nginx default responses normal HTTP 401, not 444, so browsers receive a valid error page.
  • Keep ufw active and restricted to SSH, HTTP, and HTTPS ingress only.
  • On current 3X-UI images, prefer /app/x-ui setting ...; the x-ui wrapper may not apply panel settings correctly inside the container.
  • If this 3X-UI version exposes an extra subscription listener, set subListen=127.0.0.1 and verify that 2096 is not public.
  • If 3X-UI API calls fail, stop guessing and use the manual fallback.

Script inventory

References

安全使用建议
This skill is coherent for deploying 3X‑UI to a root‑managed Debian/Ubuntu VPS and includes the scripts you will run, but it performs privileged changes and fetches/executes remote installers and an unpinned container image. Before using it: (1) review the bundled scripts line-by-line and test in an isolated VM, (2) prefer SSH key authentication (avoid passing plain-text SSH passwords), (3) pin the container image to a digest or known tag instead of :latest, (4) consider replacing get.docker.com and get.acme.sh with pinned or audited install methods if you need stronger supply-chain guarantees, (5) run on a dedicated VPS you control and back up any important data first. If you are not comfortable with those trade-offs, do not run the scripts on production hosts.
功能分析
Type: OpenClaw Skill Name: 3x-ui-vps Version: 1.1.0 The skill bundle provides a comprehensive and security-conscious toolkit for deploying and managing a 3X-UI VPN server on a VPS. It implements several hardening measures, such as binding the management panel and subscription services to loopback (127.0.0.1), enforcing UFW firewall rules (allowing only SSH, HTTP, and HTTPS), and using Nginx as a reverse proxy with TLS termination. The scripts (e.g., bootstrap-host.sh, update-stack.sh) use proper shell escaping (printf %q) when passing variables to remote hosts to prevent injection. While it uses standard but inherently risky patterns like 'curl | bash' for Docker/ACME installation and handles SSH passwords via SSH_ASKPASS, these are aligned with the stated purpose of VPS automation and show no evidence of malicious intent or data exfiltration.
能力评估
Purpose & Capability
Name/description match the code and instructions. The scripts and SKILL.md are focused on installing and managing 3X‑UI, nginx, ACME, UFW, and Xray VLESS. The declared binary requirements (bash, python3, ssh) are appropriate for the included scripts.
Instruction Scope
Runtime instructions and the bundled scripts perform extensive, root-level changes on the remote VPS (apt installs, nginx config changes, ACME issuance, Docker installation, UFW rules, writing files under /opt/3x-ui). This matches the stated purpose (fresh deploy, inbound bootstrap, adding clients, updates). The README also enforces a 'scripts-only' policy and contains fallback manual steps.
Install Mechanism
There is no platform install spec (instruction-only), but the scripts download and execute remote installers on the target host: https://get.docker.com and https://get.acme.sh are fetched and executed. The Docker image is referenced as ghcr.io/mhsanaei/3x-ui:latest (un‑pinned). These are expected for automated VPS deployment, but they increase risk because they execute remote code and pull an unpinned container image.
Credentials
The skill does not request unrelated environment variables or external credentials. It accepts SSH credentials, optional plain-text SSH password, panel admin user/password, domain, and optional ACME email as inputs — all necessary for the task. Note: the helper supports passing a plain-text SSH password (via an SSH_ASKPASS helper). That exposes a sensitive secret in process/environment on the operator workstation while the script runs; use SSH key auth when possible and ensure the workstation is trusted.
Persistence & Privilege
The skill does not request 'always' or modify other skills. disable-model-invocation is true (manual-only invocation), which limits autonomous use. The scripts require root on the remote VPS and make permanent host changes (services, firewall, certificates) appropriate for a deploy tool.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install 3x-ui-vps
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /3x-ui-vps 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
**Changelog for 1.1.0** - Added `disable-model-invocation: true` to skill metadata to prevent automatic invocation; now requires explicit user request before running. - Clarified that usage is manual-first and should only be invoked on explicit user action for deploy, repair, hardening, or update scenarios. - Updated compatibility and requirements section for clarity: now explicit about binaries required (`bash`, `python3`, `ssh`) and outbound internet access. - Streamlined and updated the description and metadata fields. - Minor improvements to skill documentation for accuracy and operator workflow guidance.
v1.0.1
- Initial release of the 3x-ui-vps skill for deploying and managing 3X-UI on Ubuntu or Debian VPS. - Automates secure setup: Docker Compose, nginx TLS termination, ACME certificates, SSH panel tunneling, and UFW hardening by default. - Enforces strict server management: all changes must run through skill scripts, with no manual server editing outside read-only inspection. - Provides scripts for fresh deploy, safe OS/application updates, VLESS inbound bootstrap, client management, and secure panel access. - Keeps the panel/UI isolated on loopback and accessible only via SSH tunnel; public panel publishing requires explicit workflow change. - Full troubleshooting and workflow guides included for reliable operation and maintenance.
元数据
Slug 3x-ui-vps
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Deploy Xray VLESS using 3X UI on your VPS 是什么?

Deploy and manage 3X-UI on a root-managed Ubuntu or Debian VPS using Docker Compose, nginx, ACME certificates, SSH panel tunneling, UFW hardening, and Xray V... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 201 次。

如何安装 Deploy Xray VLESS using 3X UI on your VPS?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install 3x-ui-vps」即可一键安装,无需额外配置。

Deploy Xray VLESS using 3X UI on your VPS 是免费的吗?

是的,Deploy Xray VLESS using 3X UI on your VPS 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Deploy Xray VLESS using 3X UI on your VPS 支持哪些平台?

Deploy Xray VLESS using 3X UI on your VPS 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Deploy Xray VLESS using 3X UI on your VPS?

由 olegtsvetkov(@olegtsvetkov)开发并维护,当前版本 v1.1.0。

💬 留言讨论