DSH SSH Tunnel: Multi-machine SSH Workbench

Introduction

The design philosophy of DeepSeek Harness (DSH) is “Everything is a Plugin.” In agent development scenarios, it is often necessary to operate multiple servers simultaneously. Traditional SSH clients or direct calls to subprocess break context isolation, while managing SSH tunnels manually can be tedious. This article introduces the community plugin dsh-ssh-tunnel, which consolidates multiple SSH hosts into a host library and provides a per-project authorization mechanism.

What is this

dsh-ssh-tunnel is a plugin located in the right sidebar of the official DSH, maintained by OMSociety. It provides a Host Library, Per-Project Authorization features, and integrates the SSHManager tool and a Dual-pane SFTP panel into the sidebar.

The core logic of the plugin is: the model uses the SSHManager tool to execute commands or transfer files, while you manage hosts and authorizations in the sidebar. Remote operations only occur within the tools and panels you explicitly invoke, keeping local and remote files strictly distinct. The companion plugin is dsh-git-forge (for Git credentials and push policies).

Core Features

  • Host Library: Manage multiple hosts, supporting passwords or private keys (including passphrases). Keys are stored only on the host side and do not enter the model context.
  • Per-Project Authorization: The authorization key is the DSH session workspace (projectPathKey). Authorization must be granted before connecting; the Connect button does not automatically write authorization.
  • SSHManager Tool: Provides functions for remote exec, SFTP list/read/write/create/delete, upload/download, and interactive session read/write.
  • Central Panel: Interactive Terminal (xterm) and Dual-pane SFTP: the left side is the project workspace, the right side is the remote end, allowing direct upload and download.
  • Resumable Connections: Dropped sessions are retained as tombstones and can be reconnected (using the same id) or closed. Unexpected disconnections trigger automatic reconnection up to 3 times (ssh2 keepalive 30s × 3).
  • Host Key Fingerprint: Stored as SHA256 hex in known_hosts.json. Fingerprints are confirmed and displayed in the sidebar upon first connection or when the fingerprint changes.
  • Local Path Guard: Local paths for upload, download, list, and delete are restricted within the Project Workspace Root, verified by both lexical analysis and realpath.
  • Bilingual UI: The sidebar and panels switch instantly between Chinese and English following the DSH interface language.

Installation and Activation

Install from npm:

# Stop any running DSH first (running services lock dependencies; restart after installation)
dsh plugin --profile <profile> add "dsh-ssh-tunnel"

After installation, refresh the browser page for the “SSH Tunnel” entry to appear in the right sidebar—restarting the host alone is insufficient, as client artifacts are fetched during page load.

Typical Usage

  1. Open the “SSH Tunnel” in the right sidebar → add a host in the Host Library (using password or private key).
  2. Switch to Project Authorization, check the host for the current project, and save (Connections fail without authorization; this is intentional).
  3. Return to Tunnel Sessions and click Connect; you will be prompted to confirm the host key fingerprint on the first connection.
  4. Click Terminal for an interactive shell, or click SFTP to open the dual-pane panel.
  5. Have the model use SSHManager action=exec to run a command, sftp_list to view directories, or sftp_upload / sftp_download to transfer files to verify the entire link.

Security and Notes

  • Trust Boundary: The plugin’s HTTP API is mounted on the DSH host’s local web service, accepting only local loopback and configured trusted hosts, and validates the browser Origin. The API has no authentication token—any process able to access this port locally is treated as an authorized user. Session APIs must include projectPathKey; cross-project visibility is not allowed.
  • Authentication Methods: Only Password or Private Key are supported. Keyboard-interactive authentication (including web MFA for bastion hosts) is not supported.
  • Fail-Closed Path Guard: Local paths for upload, download, list, mkdir, and delete are restricted within the Project Workspace Root. Both lexical and realpath verifications are performed; out-of-bounds paths and symlinks pointing outside the workspace are rejected.
  • Immediate Authorization Revocation: Write operations are re-checked for authorization before initiation and before result reporting. After revocation, output is discarded and fails with not authorized, downloaded local files are deleted, and affected surviving sessions are closed.
  • Tool Results: Tool results and list APIs do not return password / PEM / passphrases. Prioritize key-based login; if secrets.json may have been leaked, rotate credentials immediately.

Ecosystem Background

The DSH philosophy is “Everything is a Plugin.” The community directory is not officially affiliated with DeepSeek or High-Flyer. The plugin follows the MIT license.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye