mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6020] [CLOSED] feat: add SSH access mode for node management (Phase 1-3) #6057
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6057
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6020
Author: @yangbin1322
Created: 7/17/2026
Status: ❌ Closed
Base:
main← Head:feat/ssh-access-mode📝 Commits (2)
8735f3afeat: add SSH access mode for node management (Phase 1-3)a990101fix: address PR review for SSH access mode📊 Changes
38 files changed (+2150 additions, -33 deletions)
View changed files
📝
.env.example(+8 -0)📝
frontend/public/openapi.json(+172 -0)📝
frontend/src/api/queries/useNodeMutations.ts(+6 -0)📝
frontend/src/generated/examples.ts(+17 -0)📝
frontend/src/generated/schemas.ts(+91 -0)📝
frontend/src/generated/types.ts(+18 -0)📝
frontend/src/generated/zod.ts(+19 -0)📝
frontend/src/pages/api-docs/endpoints.ts(+10 -0)📝
frontend/src/pages/nodes/NodeFormModal.tsx(+213 -4)📝
frontend/src/pages/nodes/NodesPage.tsx(+2 -1)📝
frontend/src/schemas/node.ts(+39 -0)📝
go.sum(+2 -0)📝
internal/config/config.go(+9 -0)📝
internal/database/model/model.go(+41 -5)➕
internal/util/crypto/secret.go(+98 -0)➕
internal/util/crypto/secret_test.go(+131 -0)📝
internal/web/controller/node.go(+37 -2)📝
internal/web/job/node_heartbeat_job.go(+23 -0)📝
internal/web/service/node.go(+176 -5)📝
internal/web/service/node_mtls_test.go(+1 -1)...and 18 more files
📄 Description
Extend node management so the panel can adopt a plain Linux server over SSH, alongside the existing API mode that manages an installed 3x-ui panel. SSH and API are two access modes of one node, not separate systems: the server list and management flow stay unified, and an SSH node is designed to become an API node in place once a panel is installed on it (a later phase).
Why on the Node model rather than a new model: the requirement keeps one unified server list and foresees converting an SSH row into an API-managed node in place, which a split model would need a migration between. model.Node gains a Mode (api|ssh, defaulting to api so every existing row is untouched) plus SSH fields; GORM AutoMigrate adds the columns, no hand-written migration needed.
Credentials must be replayed to the remote host, so unlike a login password they cannot be hashed. SSH password and private key are encrypted at rest with AES-256-GCM under XUI_SECRET_KEY (internal/util/crypto/secret.go), fail-closed if the key is unset, and are write-only over the API (json:"-"). Host-key verification mirrors the existing TlsVerifyMode pattern via SshHostKeyMode (trust|pin|skip) + SshHostKeySha256 rather than blindly accepting any key, so a credential is never handed to a machine-in-the-middle.
Backward compatibility: normalize() branches on mode and keeps API-node validation identical; the heartbeat probes SSH nodes over SSH (reachable/ unreachable) instead of HTTP so they never park at a false "offline" and never feed the panel-only traffic-sync or CPU/memory history.
Adds POST /panel/api/nodes/testSSH, the SSH connect/test service, the React add/edit dialog with an access-mode toggle, i18n keys across all 13 locales, and unit + real-SSH-server integration tests. Verified end to end against a live Ubuntu 22.04 host (password and private-key auth, host-key capture, OS detection, encrypted-at-rest confirmed in the DB).
Summary
Why
Type of change
Areas affected
How was this tested?
Screenshots / recordings
Breaking changes
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.