buywatermelon/tunpilot/deploying-xray-nodes
Claude Code and agent skill by buywatermelon/tunpilot
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Deploys TCP Trojan proxy nodes on Xray-core with certbot Let's Encrypt or self-signed EC P-256 + SHA-256 certificate fingerprint pinning, TCP Fast Open kernel tuning with BBR, nginx-compatible fallback site, gRPC user sync (not HTTP auth callback), and systemd hardening with strict filesystem isolation. Use when deploying a Trojan node on Xray, pinning a self-signed cert fingerprint, configuring TCP Fast Open, or setting up the Xray gRPC stats API. Not for Hysteria2 — see deploying-hy2-nodes.
Install
npx vskill@latest install buywatermelon/tunpilot/deploying-xray-nodesSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as buywatermelon/tunpilot/deploying-xray-nodes.
TunPilot Xray-core Trojan Node Deployment
Deploy a production-grade Xray-core Trojan proxy node with automatic performance tuning, security hardening, and certificate fingerprint pinning.
Prerequisite: TunPilot server running and tunpilot CLI configured (use getting-started skill if not). All TunPilot operations below go through the CLI.
Auxiliary files (read when referenced below):
- xray-template.md — config templates (ACME / self-signed variants)
- ../_shared/DIAG_SETUP.md — diagnostic tooling install
- ../_shared/SYSTEMD_HARDENING.md — hardening drop-in template
- ../_shared/SSH_TROUBLESHOOTING.md — generic SSH/systemd issues
Phase 1: Gather Information & Probe Server
1.1 Ask the User
- SSH destination — e.g.
root@node1.example.comor SSH config alias - Domain name (optional) — if none, self-signed + fingerprint pinning will be used
- Node name — human-readable label (e.g.
tokyo-trojan)
1.2 Test SSH
1.3 Probe Server (single SSH round trip)
1.4 Build Server Profile
| Parameter | Source | Derived Setting | |
|---|---|---|---|
| Memory | free -b | TCP buffer sizes (rmem/wmem) | |
| CPU cores | nproc | Connection capacity | |
| Port conflicts | ss -tulnp | Whether TCP/443 and TCP/80 are available | |
| Firewall type | probe | ufw / firewall-cmd / manual | |
| Kernel tuning | sysctl | Skip 2.1 if BBR + somaxconn + TFO already set | |
| Existing Xray | version check | Fresh install vs upgrade |
1.5 Confirm With User
- TLS strategy — ACME (requires domain) vs self-signed + SHA-256 fingerprint pinning
- Fallback site — what to serve on port 80 for non-Trojan traffic (default: skip; nginx can be added later)
- gRPC API port — default
10085
Phase 2: Deploy
2.1 Kernel Tuning
Skip if probe showed values already tuned.
2.2 Install Xray-core
2.3 Install Diagnostic Tooling
Read ../_shared/DIAG_SETUP.md and run both steps on this server.
2.4 TLS Certificate
Config A — Domain + certbot standalone:
Keep cert management separate from Xray via certbot. Auto-reload Xray on renewal via a post-hook:
Config B — Self-signed EC P-256 + SHA-256 fingerprint pinning:
Save the fingerprint — used in add_node (2.5) and embedded in subscription configs so clients can verify the cert despite self-signed status.
2.5 Register Node in TunPilot
Run tunpilot node add. Note: Trojan/Xray uses gRPC sync rather than HTTP auth callback, so the returned auth_callback_url is not consumed by the client.
2.6 Write Xray Config
Read xray-template.md and pick:
- Config A (ACME) — cert paths point to Let's Encrypt symlinks
- Config B (Self-signed) — cert paths point to
/etc/xray/*.pemdirectly
Fill placeholders, then:
2.7 Systemd Hardening
Read ../_shared/SYSTEMD_HARDENING.md and apply with:
{{SERVICE}}=xray{{READ_WRITE_PATHS}}=/usr/local/etc/xray /etc/xray /var/log/xray{{CAPABILITIES}}— omit bothAmbientCapabilitiesandCapabilityBoundingSetlines; Xray runs as root and does not need them.
2.8 Firewall
Trojan is TCP-only (unlike Hysteria2 which is UDP):
2.9 Start Service & Sync Users
If inactive:
Once running, run tunpilot node sync to push all assigned users to the node via gRPC. Unlike Hysteria2, Xray needs an explicit sync because it does not authenticate via HTTP callback.
Phase 3: Verify
3.1 Health Check
3.2 gRPC API
Returns stats (possibly empty if no traffic yet). If the command errors, verify the api block in the Xray config and that 10085 is listening.
3.3 Deployment Summary
Report to user: node name and ID, server IP/domain, protocol (Trojan) and port, TLS type, certificate fingerprint (if self-signed), gRPC API port, kernel tuning status, health check result, and subscription instructions (tunpilot user update <user-id> --nodes <node-id>,… to grant access, then tunpilot node sync to push users).
Troubleshooting
| Symptom | Diagnosis | Fix | ||
|---|---|---|---|---|
tunpilot health shows unreachable | gRPC API not accessible | Verify stats_port matches Xray api.listen; check SSH connectivity | ||
| Service won't start | Config syntax error | xray run -test -c /usr/local/etc/xray/config.json validates JSON; then journalctl -u xray --no-pager -n 50 | ||
| ACME cert fails | DNS misconfig or port 80 occupied | dig <domain>; `ss -tlnp \ | grep ':80 '` | |
| Clients can't connect | Firewall blocking TCP/443 | `ss -tlnp \ | grep 443; test with nc -z <ip> 443` | |
| gRPC sync fails | Xray API not listening | Verify api block; `ss -tlnp \ | grep 10085` | |
| Users authenticate but get no quota | Users not synced after assign | Run tunpilot node sync | ||
| Certificate pinning errors | Fingerprint mismatch | Re-extract: openssl x509 -in /etc/xray/cert.pem -noout -fingerprint -sha256 and update via tunpilot node update <id> --cert-fingerprint <hex> |
For generic SSH / systemd issues, see ../_shared/SSH_TROUBLESHOOTING.md.
CLI Reference
| Command | Use When | |
|---|---|---|
tunpilot node list | See all registered nodes | |
tunpilot node add --protocol trojan … | Register a new node (Phase 2.5) | |
tunpilot node update <id> … | Change node config (port, SNI, fingerprint, enable/disable) | |
tunpilot node remove <id> | Delete a node (cascades user assignments) | |
tunpilot health [<id>] | Verify node reachability | |
tunpilot node sync | Push users to Trojan nodes via gRPC (Phase 2.9) | |
tunpilot traffic --node <id> | Query traffic usage | |
tunpilot user update <id> --nodes <node-id>,… | Grant a user access to specific nodes | |
tunpilot sub create --user <id> --format <format> | Generate a subscription link |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/deploying-xray-nodes/SKILL.md
Popularity
- Repository stars
- 10
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 Mar 2026, 8 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/buywatermelon/tunpilot/deploying-xray-nodes)