Skip to content
dsh.fish
Bundle

dsh-plugin-ssh-manager

Manage multi-IP DSH instances from one terminal via SSH tunnels · 在一台终端上通过 SSH 隧道管理多 IP 的 DSH

Source
ljh220300-eng
License
MIT
Updated
Updated 6 days ago

Readme

# dsh-plugin-ssh-manager

Manage DSH instances running on multiple machines (multi-IP) from a single
DSH terminal, connected through SSH tunnels.
在一台终端上通过 SSH 隧道管理多台机器(多 IP)上的 DSH。

- Each configured remote host gets an `ssh -N -L` tunnel from this machine to
  the remote DSH web server (`127.0.0.1:<remotePort>` on the remote side).
- Every host is assigned a stable local port (`21300–21399` by default, or a
  port you pin), so the remote console is always reachable at
  `http://127.0.0.1:<localPort>`.
- Hosts can auto-connect on startup and auto-reconnect with backoff.
- Two surfaces: a **sidebar quick menu** (远程 DSH) that lists hosts and
  opens the remote console in one click, and a full management page under
  **Settings → SSH 隧道主机** (add / edit / delete / connect / disconnect).
- A model tool `ssh_manager` is registered too, so the agent itself can
  `list / status / connect / disconnect / open` tunnels on request.

## Install / 安装

Install into a dsh profile (the profile this app runs, usually `web`):

```
dsh plugin --profile web add github:ljh220300-eng/dsh-plugin-ssh-manager
```

or with plain pnpm inside the profile directory:

```
pnpm -w add github:ljh220300-eng/dsh-plugin-ssh-manager
```

For local development use a path spec instead
(`dsh plugin --profile web add file:F:/work/dsh-plugin-ssh-manager`).

After installing, restart the app (host half loads at boot) and refresh the
page (client half). The `dsh plugin` command reconciles the
`dsh.profile.bundles` layer list for you automatically.

## Authentication / 认证

- **Key (推荐 / recommended)** — `ssh-agent` (default) or an explicit
  identity file. Requires the key on the ssh agent or at the given path;
  first use of a remote host auto-accepts its host key
  (`StrictHostKeyChecking=accept-new`). In the settings form, **选择文件 /
  Choose file** imports a private key straight from your file system — the
  content is uploaded to the local plugin store
  (`$DSH_HOME/plugins/ssh-manager/keys/`, one file per unique key content,
  mode 0600) and the path field is filled for you; the file is removed
  again when its last host is deleted. Typing a host-side path manually
  still works.
- **Password (密码)** — supported through an `SSH_ASKPASS` wrapper that the
  plugin generates next to its config; the password is stored in
  `$DSH_HOME/plugins/ssh-manager/hosts.json` (file mode 0600) and passed to
  ssh via environment only — it never appears in process command lines.
  OpenSSH ≥ 8.4 (SSH_ASKPASS_REQUIRE) is required; on older clients switch
  to key auth.

## Configuration / 配置

- Registry: `$DSH_HOME/plugins/ssh-manager/hosts.json`
  (`~/.dsh/plugins/ssh-manager/hosts.json` unless `DSH_HOME` is set).
- One record per remote host:

```json
{
  "name": "lab-01",
  "sshHost": "192.168.1.10",
  "sshPort": 22,
  "sshUser": "root",
  "authMethod": "key",
  "identityFile": "C:\\Users\\me\\.ssh\\id_ed25519",
  "passphrase": "",
  "remoteHost": "127.0.0.1",
  "remotePort": 3080,
  "localPort": null,
  "autoConnect": true
}
```

- `remotePort` is the port the remote DSH web server listens on
  (`dsh web` defaults to 3080; the desktop app picks its own — check the
  remote machine's GUI URL).
- `remoteHost` is the bind address to reach on the remote side through ssh;
  keep `127.0.0.1` when DSH runs on the ssh host itself.
- Passphrase-protected keys are supported: `passphrase` is answered through
  the same SSH_ASKPASS mechanism as passwords (environment only).

## Requirements / 依赖

- An OpenSSH client (`ssh`) on this machine — Windows ships it as an
  optional feature (设置 → 可选功能 → OpenSSH 客户端); the plugin also
  probes `C:\Windows\System32\OpenSSH\ssh.exe` and `/usr/bin/ssh`.
- No additional npm dependencies; it runs against the packages the dsh
  profile already provides (`@deepseek-ai/dsh-tools`,
  `@deepseek-ai/dsh-home-paths`).

## License

MIT

Install

dsh plugin --profile web add github:ljh220300-eng/dsh-plugin-ssh-manager

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source