dsh-ssh-ops: Centralized Management of Linux Server Credentials and Operations Records

Preface

DSH (DeepSeek Harness) adopts an “everything is a plugin” architecture, connecting operational capabilities as plugins into conversations. For agent developers, the typical pain points are: scattered credentials, manual SSH every time, no visibility into server environments, and no audit trail after running commands. The dsh-ssh-ops plugin turns these into a managed capability—executing SSH commands, inspecting environments, and managing applications based on conversational instructions—while also providing a read-only server overview and a real-time color terminal on the Web side.

What It Is

dsh-ssh-ops is a DSH plugin maintained by lambsouls, categorized under admin-security. It provides centralized custody of Linux server credentials, supports executing commands over SSH via conversational instructions, environment inspection, and management of installed applications, and offers a read-only overview plus a real-time color terminal on the Web interface.

Installation

In the plugin directory:

dsh plugin --profile <your profile> add /absolute/path/to/dsh-ssh-ops

Or via the profile’s package.json using a link:

{
  "dsh-ssh-ops": "link:/path/to/dsh-ssh-ops"
}

Dependency requirements:
- Node ≥ 20 (uses node:fs cpSync and ESM)
- Python 3 + paramiko (remote execution goes through a Python subprocess): pip install paramiko
- If you need a fixed interpreter, specify pythonPath in the plugin Config; otherwise it resolves in order: $SSH_OPS_PYTHON / $PYTHON / python on PATH.

Tools & Commands

Tool Purpose
ssh_server_list List managed servers (no credentials included), with profile summaries
ssh_server_register Register/update credentials (password or private key, AES-256-GCM encrypted at rest)
ssh_server_env Single connection for environment profiling + app discovery, results written back
ssh_server_profile Read this machine’s profile (traits / port map / constraints / runbooks / timeline / open questions)
ssh_server_profile_save Create or incrementally update a profile
ssh_server_profile_audit Health check: which servers lack a profile, which are orphans, which contain credentials
ssh_server_exec Execute a single bash -lc command
ssh_app_control Run status/start/stop/restart/reload/logs on a discovered application
ssh_server_forget Delete server credentials (requires confirm: true)

Profile Contents

A profile records “what quirks this machine has” and includes:

Field What It Captures
summary / role What this machine is and what to watch out for
traits Unique characteristics (network / storage / runtime / dependency / ownership…)
portMap Only ports where the external port differs from the internal port
constraints Hard constraints / things not to touch
runbooks Steps to follow when a specific issue arises
timeline Changes / incidents / decisions
openQuestions Unconfirmed items that need your input

Writing guidelines: only record what you actually know. Put unknowns into openQuestions and ask—do not pollute the profile with “probably” or “maybe” noise. List items merge incrementally by id; passing a new value for the same id is an update, so you can fill in entries one at a time.

UI & Terminal

Two entry points, same data source:

  • Right sidebar tab “🖧 Ops”: docked to the right of the conversation, visible while you chat.
  • Main panel “Server Ops Console”: click the sidebar icon, fills the central area.

Terminal and server tabs:

  • Terminal: dark background (#0d1117, the only area on the page that doesn’t follow the theme) + true ANSI colors. The red/green/blue/yellow from systemctl status / docker ps / ls --color / git diff, 256-color, and true-color output are all rendered as-is.

Terminal colors and session headers:

  • Blue: session header— which server was connected to, which address (for consecutive operations on the same machine, shown only once)
  • Cyan: prompt (environment info, de-emphasized)
  • Bold green: the command to be run this round
  • Orange / red / gray: stderr / failure / session teardown

The prompt is real: after connecting, the remote hostname is queried once on the same connection, so it displays the machine’s own name; if unavailable, it falls back to the address. The username is the login user (not necessarily root), with # / $ indicating privileged/unprivileged. When a command starts with an explicit absolute-path cd, the ~ in the prompt follows suit and changes to that directory.

Connection info is not repeated: consecutive operations on the same machine are treated as “one SSH session,” and the session header is printed only once. Exit codes are not repeated: exit codes, command count, and total elapsed time are attributed to the session and printed once at teardown. When all commands succeed, “exit code 0” is omitted—only the command count and elapsed time are reported; exit codes are surfaced only when there’s a failure.

  • Servers: one row per machine, showing user@address:port, reachability status, and app count. Machines with a profile get an extra “Profile ↗” button. Expand to see name/tag editing, connection info, tag pills, notes, and the application list (user apps flat, system services collapsed).

Profile drawer: a profile records “what quirks this machine has,” which most users don’t need at a glance. The row keeps only a “Profile” button; clicking it opens a drawer within the panel to view the full profile (the whole window dims, the drawer centers).

Name and tags (the only two things editable on the panel):
- Name: the display name shown on the panel and in the list. Leave empty and it falls back to the address.
- Tags: comma-separated (both Chinese and English commas accepted), deduplicated (case-insensitive), max 12 tags, each ≤ 24 characters. Rendered as pills for categorization and quick scanning.

Changing the name and tags only modifies the display info in the local credential vault—the server is not touched: address, port, username, credentials, and id all remain unchanged. Need to change connection info or credentials? You must use ssh_server_register in the conversation.

Data-Code Boundary

All user data lives under ~/.dsh/ssh-ops/, completely separated from the code directory:

Location Contents
~/.dsh/ssh-ops/vault/servers.json Credential vault (metadata in plaintext + secrets in ciphertext)
~/.dsh/ssh-ops/vault/master.key AES-256-GCM master key
~/.dsh/ssh-ops/vault/keys/*.pem Private keys temporarily on disk (key auth only)
~/.dsh/ssh-ops/profiles/<serverId>.json Server profile (plaintext: this machine’s unique traits, port map, constraints)
~/.dsh/ssh-ops/logs/ops-console.ndjson Operation log (redacted)
Repo directory Only .js / .py / .md / .json / icons

All three paths can be overridden via plugin Config (vaultDir / logDir / profileDir), but do not point them into the repo.

Security Model

Storage

  • Metadata (name/address/port/username/auth method/app list/notes) in plaintext; passwords, private keys, and passphrases in AES-256-GCM ciphertext.

Transmission

  • Credentials are passed only via subprocess stdin—never in command-line arguments, never in any log. Each operation is an independent SSH session, opened and closed per use, with no persistent background connections.

Redaction

lib/redact.js has two layers:
1. Exact replacement of known credential values (passwords / full private key text / passphrase / every line of a private key);
2. Pattern-based fallback: PEM private key blocks in full, sshpass -p, password=/passwd:/pwd=, Bearer, sk-*, ghp_*, AKIA*.

No plaintext credentials exist in ops-console.ndjson.

Color Channel

Remote output is captured once, then split into two paths:
- Console log (for the panel): ANSI codes preserved
- Returned to the model: stripAnsi() removes them

SSH requests a PTY (get_pty=True) and inlines TERM=xterm-256color, COLORTERM=truecolor, PAGER=cat, SYSTEMD_PAGER=cat, GIT_PAGER=cat, SYSTEMD_COLORS=1.

Two side effects of PTY:
1. stderr is merged into stdout (a terminal has only one stream), so color is the only way to distinguish stderr;
2. The command believes it’s in an interactive terminal → a pager (less/more) pops up waiting for input. PAGER=cat is essential.

Self-Testing

# 211 assertions total
node test-host.mjs       # 45: encryption/redaction/vault/logging/probe parsing/tool contracts/param validation
node test-profile.mjs    # 25: profile normalization/incremental merge/deletion

Use Cases & Caveats

Suitable for scenarios that require centralized custody of Linux server credentials, execution of ops commands via conversational instructions, and independent per-server profiles with a real-time color terminal.

The plugin runs with the current dsh process’s privileges. Review the source code and license (MIT) before installing.

Summary

dsh-ssh-ops turns “a pile of scattered SSH passwords + manually typing bash every time” into a managed capability: credentials are centrally encrypted and stored, commands are executed over SSH per session instructions to run tasks, inspect environments, and manage applications; each server gets an independent profile recording its unique quirks; the Web side provides a server overview and a real-time color terminal.

  • Directory page: https://www.skillhub.cn/plugins/lambsouls/dsh-ssh-ops
  • GitHub: https://github.com/lambsouls/dsh-ssh-ops
羽毛球分组比赛记分
小程序二维码

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

Xiaoye