Files
DragonCoreNEWCLI/README.md
T
2026-09-29 10:05:43 -03:00

6.3 KiB

DragonCoreSSH CLI

DragonCoreSSH server with a terminal administration menu and HTTP API. Based on the supplied DragonCoreSSH-NewWEB source. The supplied SSHPlus archive informed the menu organization; its code and licensing mechanism are not included. The browser panel and static assets have been removed. SSH, Xray, DNSTT, BHTTP, BTUN, HCR, UDPGW, PostgreSQL accounting, and bot/API service code remain in the Go server.

Install on a fresh Linux/systemd host

Extract this archive, then run sudo bash install.sh from the extracted DragonCoreSSH-CLI directory. The installer sets up the Go server, PostgreSQL, Xray, service, and the menu command. If /usr/local/bin/menu already exists, it is saved as menu.backup.<timestamp> before the DragonCoreSSH command is installed. It generates all credentials. It needs a compatible Linux distribution and access to its system packages, the Go toolchain download, and Xray release download. Run it only on a fresh server: like the original installer it generates new database and configuration credentials.

Run menu from a root shell, or sudo menu otherwise. The dragoncore command remains an alias. Other commands: sudo menu status, sudo menu users, sudo menu logs, sudo menu api-password show, sudo menu api-password change. The change command generates a new API password, restarts the service, verifies it, and restores the old one if verification fails. It never prompts for a password. Creating/resetting SSH users generates credentials and prints them once.

The menu detects the terminal width. On a phone it uses a compact status header and wraps menu labels and account details; on a wider terminal it uses the fuller layout. If an SSH app reports the wrong width, run menu --mobile to force 40 columns, or set DRAGONCORE_COLUMNS=36 to choose another width. For editing advanced JSON from a phone SSH client, install nano or set $EDITOR to your preferred terminal editor.

Migrate an existing DragonCoreSSH-NewWEB installation

Back up /opt/sshpanel, its PostgreSQL database, and /etc/systemd/system/sshpanel.service first. Extract this release on the server and run sudo bash update.sh from its directory. The updater builds the CLI version, preserves .env, config.json, Xray configuration, SSH keys, accounts, and database, then restarts the service. It reads this local release only; it does not fetch the NewWEB branch. The previous binary is saved as /opt/sshpanel/sshpanel.bak. The old admin/ directory is no longer served. The existing ADMIN_HTTP_ADDR setting is preserved; set it to 127.0.0.1:9090 and restart if remote API access is unnecessary.

API

The API defaults to http://127.0.0.1:9090 on new installations. Administrative endpoints accept Authorization: Bearer <API password>; use the api-password show command as root to view the value. Existing session-based API clients still work, including managed-server integrations. The /check and payment webhook endpoints remain part of the API. If exposing the API remotely for integrations, use TLS and appropriate access controls. There is no browser UI; / returns 404.

Example: curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:9090/api/users (set TOKEN privately; avoid putting credentials in shell history).

Menu areas

  • The main menu shows live VPS OS, CPU, RAM, disk, uptime, clock, network speed, SSH online/expired/total, Xray online, and service status. The CLI falls back to local VPS metrics when the API is down.
  • SSH users: list/live usage, create, create a 24-hour test account, renew/edit, change limits and quotas, generate a new SSH password, report usage/speed, reset traffic, delete expired or individual users.
  • Xray: inbounds, clients, create UUID, edit/delete clients, reset traffic, status, edit JSON, start/stop/restart, and a guided shared-port setup.
  • Connection modes: show SSH/TLS listeners and configured DNSTT/BHTTP/HCR/BTUN/UDPGW/Xray ports, live protocol statistics and logs, TLS certificates and issuance, DNSTT public key and key regeneration, and edit protocol settings.
  • VPS and traffic: detailed network interface rates and byte totals, SSH/Xray account activity, daily/monthly traffic, system logs, build status.
  • Configuration: banner, guided SSH listener ports and default limits, full server JSON, Xray JSON, bot settings display, managed servers display. The service validates settings through its API and applies server settings live.
  • Reseller management remains in the Telegram bot; the CLI has no reseller menu.
  • API password: view and rotate.
  • Service status, logs, and restart.

Full configuration remains available through the server API. Use the JSON editor option for settings not covered by guided prompts. This uses the editor in $EDITOR, or nano if unset. The CLI never requests a login or password. Root access to .env is its local authentication boundary.

Native Xray on the same SSH/TLS ports

In Xray → Share SSH/TLS ports (WS/XHTTP), select an existing VLESS/VMess inbound or enter a new tag. Choose WebSocket or XHTTP, then enter a distinct URL path. Leaving the path blank generates /c1, /c2, and so on. New inbounds receive a generated UUID. The menu applies and starts/restarts the native emulator. Existing inbound clients are preserved, but switching an inbound's transport requires updating their client configurations.

Shared inbounds use dragoncoreSharedPort: true in the native Xray JSON. The path is required, must be more specific than /, and cannot overlap another shared path. The server rejects shared raw TCP and inbound TLS settings because the DragonCoreSSH public listener terminates TLS itself. Configure the client with TLS security on the panel's TLS port (for example 443), or no TLS on a public SSH/HTTP port (for example 80), and use the path printed by the menu. TLS XHTTP can negotiate HTTP/2; WebSocket uses HTTP/1.1. The same inbound is available on each configured public listener without a separate Xray socket. External Xray mode does not support this option. Ports owned by other processes, including a separate system sshd, cannot be shared through this router.

Build and checks

Requires Go 1.25.4 and the dependencies in go.mod: go build -o sshpanel . and go test ./.... The CLI needs Python 3 with only the standard library. Run python3 -m py_compile dragoncore_cli.py and bash -n install.sh update.sh for syntax checks.