mcp-ssh-manager 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +201 -0
  2. package/CLAUDE.md +3 -5
  3. package/Formula/ssh-manager.rb +2 -2
  4. package/INSTALLATION.md +4 -0
  5. package/README.md +31 -5
  6. package/cli/codex.js +67 -0
  7. package/cli/guard.js +69 -0
  8. package/cli/lib/config.sh +102 -37
  9. package/cli/ssh-manager +13 -0
  10. package/cli/ssh-manager.js +1 -1
  11. package/desktop/electron/electron-builder.yml +5 -0
  12. package/desktop/electron/locale.mjs +55 -0
  13. package/desktop/electron/main.js +52 -65
  14. package/desktop/electron/native-menu.mjs +44 -0
  15. package/desktop/electron/native.fr.json +58 -0
  16. package/desktop/electron/native.ja.json +58 -0
  17. package/desktop/electron/native.zh-CN.json +58 -0
  18. package/desktop/electron/package-lock.json +2 -2
  19. package/desktop/electron/package.json +1 -1
  20. package/desktop/electron/smoke-test.mjs +15 -1
  21. package/dist/ui/app.css +1 -1
  22. package/dist/ui/app.js +135 -119
  23. package/docs/MIGRATION.md +1 -1
  24. package/docs/SECURITY_MODES.md +15 -8
  25. package/docs/SEO.md +1 -1
  26. package/package.json +17 -3
  27. package/scripts/language.mjs +172 -0
  28. package/scripts/test-upgrade-from-published.mjs +24 -2
  29. package/server.json +2 -2
  30. package/src/audit.js +6 -15
  31. package/src/background-job.js +44 -0
  32. package/src/backup-manager.js +24 -29
  33. package/src/config-loader.js +5 -1
  34. package/src/control-plane.js +5 -0
  35. package/src/database-manager.js +13 -31
  36. package/src/dump-guard.js +79 -0
  37. package/src/health-monitor.js +8 -4
  38. package/src/index.js +183 -21
  39. package/src/logger.js +3 -1
  40. package/src/quiet-stderr.js +15 -0
  41. package/src/ssh-guard.js +344 -0
  42. package/src/ssh-manager.js +51 -0
  43. package/src/tunnel-manager.js +14 -4
package/CHANGELOG.md CHANGED
@@ -7,6 +7,207 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.3.0] - 2026-11-19
11
+
12
+ **French and Japanese interfaces, the SSH agent key in the server form, and long
13
+ commands shown in full.** Nothing to change on upgrade: the tools of the engine are
14
+ the same (its only change is one boolean added to the interface's `/api/options`),
15
+ and the release pipeline upgrades 3.8.5, 3.8.6, 3.8.7, every 4.0.x, 4.1.0 and 4.2.0
16
+ from the registry to this version and back. One thing does behave differently
17
+ without being asked: the interface and the desktop menus follow a French or a
18
+ Japanese system language until you choose one, as they already did for Chinese.
19
+
20
+ The Windows installer is still **not Authenticode-signed**, for the same reason
21
+ as 4.0.0: Windows shows *"Windows protected your PC"*, *More info → Run anyway*,
22
+ and `ssh-manager app` checks the installer against the SHA-256 in
23
+ `release-manifest-win32.json`. macOS builds are signed and notarized.
24
+
25
+ Three of these came from people who read the project closely: thanks to
26
+ @zenk-sugimoto (the Japanese interface), @TillNano (the agent key in the form) and
27
+ @congzhou09 (whole commands in Live and Activity).
28
+
29
+ ### Added
30
+
31
+ - **A French interface (Français), and a way to add any other language in minutes.**
32
+ *Options → Appearance → Language* now offers Français, and the desktop menus,
33
+ dialogs and notifications follow it (the Windows installer has a French page).
34
+ Languages are no longer listed anywhere in the code: the interface and the desktop
35
+ application find their catalogues in their folders, the selector is built from what
36
+ they find, and the tests loop over what exists. `npm run lang -- add <code>` creates
37
+ a language's three files from the English text, and `npm run lang -- status` shows
38
+ how much of each is still English; the steps are in `ui/README.md`, "Adding a
39
+ language". A system language is matched by its exact tag, else its family (`fr-CH`
40
+ uses French), else English; nothing changes for a language that is not shipped.
41
+ - **The server form can name an SSH agent key** (#148, thanks to @TillNano).
42
+ *Agent public key*, in the authentication section, takes the path of a `.pub`
43
+ file: the engine then offers only that identity from your SSH agent and signs
44
+ with it, so the private key never reaches the engine (the setting existed since
45
+ 4.1.0, but only in `.env`, TOML or the environment, which left a server managed
46
+ in the interface with no way to use it). The engine refuses an agent key
47
+ together with a password, a private key or agent forwarding, so the form
48
+ disables the others while one is chosen, says why when the agent key field is
49
+ the one that is closed, and tells you that saving removes a password or a key
50
+ already saved for that server. It warns when this application sees no SSH agent
51
+ (`SSH_AUTH_SOCK` empty): the interface's `/api/options` now says whether one is
52
+ visible. Nothing changes for a server that does not use it.
53
+ - **A Japanese interface (日本語).** *Options → Appearance → Language* now offers
54
+ English, 简体中文 and 日本語, for the desktop application and the web interface;
55
+ the desktop menus, dialogs and notifications follow it, and the Windows installer
56
+ has Japanese and Chinese pages. Until you choose, a Japanese system or browser
57
+ language selects Japanese, as a Chinese one selects Chinese; the choice is
58
+ remembered and English is exactly as it was. The translation is @zenk-sugimoto's
59
+ (#149): thank you. Japanese is set in Japanese fonts only, Chinese in Chinese
60
+ fonts only, because the same Han characters are drawn differently in the two.
61
+
62
+ ### Fixed
63
+
64
+ - **Live and Activity show the whole command.** A long command was cut off with an
65
+ ellipsis on both pages, and an Activity → Commands entry could only be opened when
66
+ its output had been recorded (`SSH_MANAGER_LOG_OUTPUT=1`, off by default), so in
67
+ practice you could not read what an agent had run. A row keeps its one-line
68
+ overview, with the full command as its tooltip; opening it shows the command in
69
+ full, wrapped, with the copy button of the approval card. Every Commands entry now
70
+ opens, several can stay open together, and an open entry no longer collapses or
71
+ loses a text selection when a new one arrives. By @congzhou09 (#151): thank you.
72
+
73
+ ## [4.2.0] - 2026-11-13
74
+
75
+ **A Chinese interface, a fuller audit log, and a guard against raw ssh.** Nothing
76
+ to change on upgrade: the guard and the background mode are off unless you use
77
+ them, and the audit log only gains lines when `AUDIT_LOG` is already on (the
78
+ release pipeline upgrades 3.8.5, 3.8.6, 3.8.7 and every 4.0.x and 4.1.x from the
79
+ registry to this version and back). Two things do behave differently without
80
+ being asked: a tool that fails now sets `isError` in its reply, and the interface
81
+ follows a Chinese system language until you choose one.
82
+
83
+ The Windows installer is still **not Authenticode-signed**, for the same reason
84
+ as 4.0.0: Windows shows *"Windows protected your PC"*, *More info → Run anyway*,
85
+ and `ssh-manager app` checks the installer against the SHA-256 in
86
+ `release-manifest-win32.json`. macOS builds are signed and notarized.
87
+
88
+ Many of these came from reading what the forks of this project changed: thanks
89
+ to @jaredshuai, @SEU-zhc, @fyq163 and @xutianhao6 for the work and the ideas.
90
+
91
+ ### Added
92
+
93
+ - **`ssh-manager codex setup` and `ssh-manager codex status`.** `setup` points
94
+ OpenAI Codex at this engine: only the `ssh-manager` table of
95
+ `~/.codex/config.toml` is replaced, the rest of the file stays, the entry names
96
+ the npm engine, and a second run changes nothing; without an npm install it says
97
+ how to get one and writes nothing. `status` says what Codex runs today. They were
98
+ documented (with `migrate`, `test` and `convert`, which have no meaning with the
99
+ V4 engine; `ssh-manager export servers.toml` writes the servers as TOML) and none
100
+ of them existed. The entry that `ConfigLoader.saveToCodexConfig` wrote named
101
+ `<current directory>/src/index.js`, a file that exists only in a source checkout,
102
+ so for an npm install Codex started no engine; it now names the module's own
103
+ folder. Found thanks to @jaredshuai's fork.
104
+ - **A Chinese interface (简体中文).** Options → Appearance has a *Language / 语言*
105
+ selector, for the desktop application and the web interface; the desktop menus,
106
+ dialogs and notifications follow it. Until you choose, the interface follows the
107
+ system language (Chinese for a `zh` locale, English for anything else), and the
108
+ choice is remembered. English is exactly as it was. Server names, commands,
109
+ paths and what a remote host prints are never translated. The translation is
110
+ @xutianhao6's, from his fork's community build: adapted here, completed for the
111
+ strings it missed and proofread. Thank you.
112
+ - **`ssh_execute` with `background: true`** starts a command detached from the
113
+ SSH session and returns at once with `{ pid, logFile }`, for a job that
114
+ outlives the timeout (a training run, a long build). Read its output with
115
+ `ssh_tail` (`follow: false`), check or stop it with `ssh_process_manager`.
116
+ The log file is never chosen by the caller: a free path would let a command
117
+ that passes the `readonly` policy overwrite any file the SSH user can write,
118
+ so the engine creates a private one with `mktemp`. The launcher works under a
119
+ csh or tcsh login shell; Windows targets are refused with a clear error. The
120
+ idea is @SEU-zhc's.
121
+ - **`ssh-manager guard`**, an opt-in hook for Claude Code that refuses (or, with
122
+ `--mode ask`, asks about) `ssh`, `scp`, `sftp` and a remote `rsync` run from the
123
+ agent's own shell, where the approval, the policy and the audit log do not
124
+ apply, and tells the agent which MCP tool to use. `install` edits only its own
125
+ entry in `~/.claude/settings.json` (a copy is kept the first time), `remove`
126
+ restores the file, `print` and `status` write nothing. It reads the command
127
+ text: a guard against accidents, not a security boundary. The idea is
128
+ @fyq163's, whose hook only reminded.
129
+ - **`SSH_LOG_STDERR=false`** keeps the engine silent on stderr, for a client that
130
+ draws a terminal interface on that stream (OpenCode and Kilo were the
131
+ reports). The log file still receives the log lines; nothing changes unless
132
+ the variable is set. The idea is @fyq163's.
133
+
134
+ ### Changed
135
+
136
+ - **With `AUDIT_LOG` set, every tool that targets the server records its
137
+ outcome**, not only a denial or an approval decision: `ssh_tail`, `ssh_sync`,
138
+ `ssh_deploy`, `ssh_db_*`, `ssh_backup_*`, `ssh_process_manager` and the rest now
139
+ leave a line with `success`, and `error` when they failed. A tool that records
140
+ its own exit code still writes exactly one line. Tools that only read local
141
+ state (server list, aliases, tunnel list) leave none. The design is
142
+ @jaredshuai's.
143
+ - **A tool that fails now says so in the MCP reply**: the 36 tools that answered
144
+ "❌ … failed" as plain text now also set `isError`, which is what a client
145
+ expects (and what the audit log needs to tell a failure from a success).
146
+
147
+ ### Fixed
148
+
149
+ - **A failed dump no longer reports success.** `mysqldump … | gzip > file` (and
150
+ `pg_dump`) reports the exit code of its last command: with a wrong password, a
151
+ missing database or a full disk the dump died, gzip still succeeded, and
152
+ `ssh_db_dump` and `ssh_backup_create` answered success with an empty archive of
153
+ 20 bytes. The cron script made by `ssh_backup_schedule` did the same every night,
154
+ and its retention cleanup then deleted the good archives. A dump that fails now
155
+ fails, with the dump program's own message, and leaves no file; the dump still
156
+ streams, with no temporary file. The cron script has `set -o pipefail`, removes a
157
+ failed archive and stops before the cleanup. Found thanks to @jaredshuai's fork.
158
+ - **A corrupt archive is no longer restored in part.** `gunzip -c dump.gz | mysql`
159
+ ran the database program on whatever gunzip had read, so a truncated archive was
160
+ restored half-way with no error. A gzip file is now tested whole before
161
+ `ssh_db_import` or `ssh_backup_restore` start the database program (MySQL and
162
+ PostgreSQL). A plain dump under a `.gz` name, which a backup made without
163
+ compression used to leave, is still restored.
164
+ - **A MongoDB backup can be restored.** It was written as `<id>.tar.gz` but
165
+ measured and restored as `<id>.gz`: a size of 0 and no way back. One place now
166
+ knows the path, a restore checks the file is there before it starts, and
167
+ archives made by older versions (they were already `<id>.tar.gz`) become
168
+ restorable. `ssh_db_dump` reports the path it really wrote.
169
+ - **`ssh-manager server remove prod` removes `prod`, not `prod_eu` too.** The CLI
170
+ matched a server's lines by the bare prefix `SSH_SERVER_PROD_`, which every
171
+ longer name starts with, so the other server lost its host, user and password.
172
+ Lines are now matched by the setting names the engine reads. Found thanks to
173
+ @jaredshuai's fork.
174
+ - **Editing a server from the CLI keeps its settings.** It deleted all the
175
+ server's lines and wrote seven back, so a read-only server became unrestricted:
176
+ its mode, allow and deny patterns, audit log, group and proxy jump were dropped.
177
+ Only the settings the wizard asks for are replaced now, in place.
178
+ - **A password with a `#` survives the CLI.** `ssh-manager server add` wrote
179
+ `a#b c"d` bare, and the engine read it back as `a` (dotenv starts a comment at
180
+ any `#`). A value is quoted only when dotenv would misread it, so every other
181
+ value is written exactly as before; one that cannot be carried is refused with a
182
+ reason and nothing is written.
183
+ - **The health check no longer counts container layers as disks.** On a Docker
184
+ host every `overlay` layer repeated the same usage, and `tmpfs`, `devtmpfs` and
185
+ `squashfs` mounts counted as full disks (a snap mount is always at 100 %), which
186
+ raised duplicate or false disk alerts. The check now records each mount's
187
+ filesystem type and skips those, keeping `/` even inside a container, and an
188
+ alert fires when usage reaches the threshold, not only when it passes it. In the
189
+ interface, the health card keeps long mount paths and alert text inside its
190
+ borders. Thanks to @xutianhao6.
191
+ - **Remote tunnels (`ssh_tunnel_create` with `type: "remote"`, `ssh -R`) never
192
+ worked**: they failed with `this.ssh.forwardIn is not a function`, because the
193
+ connection wrapper only had `forwardOut`. They work now, and closing one
194
+ cancels the forward and removes its listener. A failed creation is reported as
195
+ an error. Found thanks to @jaredshuai's fork.
196
+ - **Six simultaneous calls on a cold engine opened six SSH connections**, all kept
197
+ open and five of them unreachable, a burst of logins that a server's
198
+ `MaxStartups` or fail2ban can refuse. Callers now wait for the connection being
199
+ established; a failed attempt is not remembered. Found thanks to
200
+ @jaredshuai's fork.
201
+
202
+ ### Security
203
+
204
+ - **A database password no longer reaches the audit log or the approval request
205
+ in clear text.** `dbPassword` and `db_password` (taken by the backup, restore,
206
+ dump and import tools) were missing from a list of names to redact, so a
207
+ refused or approved call wrote the password into the audit file and showed it
208
+ in the approval request. The audit log now redacts any key that looks like a
209
+ secret, with the same rule as the logger. Found thanks to @jaredshuai's fork.
210
+
10
211
  ## [4.1.0] - 2026-11-13
11
212
 
12
213
  **Choose the agent key per server, and sudo in the audit log.** Nothing to
package/CLAUDE.md CHANGED
@@ -44,11 +44,9 @@ ssh-manager server show SERVER # Show server details
44
44
 
45
45
  ### OpenAI Codex Integration
46
46
  ```bash
47
- ssh-manager codex setup # Configure for Codex
48
- ssh-manager codex migrate # Convert servers to TOML
49
- ssh-manager codex test # Test Codex integration
50
- ssh-manager codex convert to-toml # Convert .env to TOML
51
- ssh-manager codex convert to-env # Convert TOML to .env
47
+ ssh-manager codex setup # Point Codex at this engine (~/.codex/config.toml)
48
+ ssh-manager codex status # What Codex runs today
49
+ ssh-manager export servers.toml # Servers as TOML (.toml, .env, .csv and .xlsx are written)
52
50
  ```
53
51
 
54
52
  ### Tool Management (NEW in v3.1)
@@ -13,8 +13,8 @@
13
13
  class SshManager < Formula
14
14
  desc "SSH server management for AI agents, with approval and audit"
15
15
  homepage "https://github.com/bvisible/mcp-ssh-manager"
16
- url "https://registry.npmjs.org/mcp-ssh-manager/-/mcp-ssh-manager-4.0.3.tgz"
17
- sha256 "99267e8df2ddfdb0e0cc0edf4ef2901dd430cd4569c2c3793ea1d7e8eeeabcd4"
16
+ url "https://registry.npmjs.org/mcp-ssh-manager/-/mcp-ssh-manager-4.2.0.tgz"
17
+ sha256 "d4eea0d26644cb7154e126e8d849a07f1da1399eb71d18464b97794eb9ba082a"
18
18
  license "MIT"
19
19
 
20
20
  depends_on "node"
package/INSTALLATION.md CHANGED
@@ -143,6 +143,10 @@ export SSH_MANAGER_ENV="/path/to/your/.env"
143
143
 
144
144
  # Optional: Set default log level
145
145
  export SSH_LOG_LEVEL="INFO"
146
+
147
+ # Optional: keep the engine silent on stderr, for a client that draws a terminal
148
+ # interface on it. The log file (SSH_LOG_FILE) still receives the log lines.
149
+ export SSH_LOG_STDERR=false
146
150
  ```
147
151
 
148
152
  ## 📦 Project Scope Installation
package/README.md CHANGED
@@ -20,8 +20,11 @@
20
20
  <div align="center">
21
21
 
22
22
  [![npm version](https://img.shields.io/npm/v/mcp-ssh-manager.svg?style=flat-square&logo=npm&color=c04500)](https://www.npmjs.com/package/mcp-ssh-manager)
23
+ [![Downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbvisible%2Fmcp-ssh-manager%2Fstats%2Fdownloads.json&style=flat-square)](docs/DOWNLOAD-STATS.md)
23
24
  [![npm downloads](https://img.shields.io/npm/dm/mcp-ssh-manager.svg?style=flat-square&logo=npm&color=c04500)](https://www.npmjs.com/package/mcp-ssh-manager)
24
- [![Version](https://img.shields.io/badge/release-4.1.0-c04500?style=flat-square)](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.1.0)
25
+ [![Desktop app downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbvisible%2Fmcp-ssh-manager%2Fstats%2Fdesktop.json&style=flat-square)](https://github.com/bvisible/mcp-ssh-manager/releases/latest)
26
+ [![GitHub stars](https://img.shields.io/github/stars/bvisible/mcp-ssh-manager?style=flat-square&color=c04500)](https://github.com/bvisible/mcp-ssh-manager/stargazers)
27
+ [![Version](https://img.shields.io/badge/release-4.3.0-c04500?style=flat-square)](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.3.0)
25
28
  [![Claude Code](https://img.shields.io/badge/Claude_Code-Compatible-5A67D8?style=flat-square&logo=anthropic)](https://claude.ai/code)
26
29
  [![OpenAI Codex](https://img.shields.io/badge/OpenAI_Codex-Compatible-00A67E?style=flat-square&logo=openai)](https://openai.com/codex)
27
30
  [![MCP](https://img.shields.io/badge/MCP-Server-orange?style=flat-square)](https://modelcontextprotocol.io)
@@ -54,9 +57,9 @@ An MCP SSH server is the most dangerous tool you can hand an agent: a shell on m
54
57
 
55
58
  ## Choose your workspace
56
59
 
57
- **Desktop application (`4.1.0`):** one installation with its own runtime,
60
+ **Desktop application (`4.3.0`):** one installation with its own runtime,
58
61
  terminal, file browser and server settings. No separate Node.js or npm
59
- installation. [Download it](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.1.0):
62
+ installation. [Download it](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.3.0):
60
63
 
61
64
  | Platform | File | Signature |
62
65
  |---|---|---|
@@ -64,7 +67,7 @@ installation. [Download it](https://github.com/bvisible/mcp-ssh-manager/releases
64
67
  | Windows x64 / arm64 | `…-setup.exe` | **Not code-signed yet.** Windows shows *"Windows protected your PC"*: *More info → Run anyway*. Check the file against the SHA-256 in `release-manifest-win32.json` on the release (`ssh-manager app` does it for you). Signing comes in a later release. |
65
68
  | Linux x64 | `.deb`, `.AppImage` | Unsigned, as Linux packages usually are |
66
69
 
67
- **Already using npm / the CLI?** `npm update -g mcp-ssh-manager` brings 4.1.0,
70
+ **Already using npm / the CLI?** `npm update -g mcp-ssh-manager` brings 4.3.0,
68
71
  and the V4 engine runs without an interface, from your existing `.env`, TOML or
69
72
  process variables — no automatic import, no forced wizard, no approval prompt
70
73
  unless you enable one per server. The one behaviour that tightens is **SSH
@@ -191,6 +194,12 @@ ssh-manager control # prints a local URL — or `ssh-manager app` for t
191
194
 
192
195
  One thing in two wrappers. `ssh-manager control` runs the whole interface in a browser tab with nothing extra to install; the desktop builds for macOS, Windows and Linux are that same page with the engine inside them, so they need neither Node nor the npm package.
193
196
 
197
+ The interface, desktop menus and notifications support English, Français, 简体中文 and 日本語.
198
+ Choose **Options → Appearance → Language** to switch languages.
199
+ Until you choose, your system or browser language selects the matching one; other
200
+ languages use English. Your saved choice takes precedence. A new language is three
201
+ files and one command (`npm run lang -- add <code>`): see [Adding a language](ui/README.md#adding-a-language).
202
+
194
203
  The desktop build adds the two things a browser tab cannot do:
195
204
 
196
205
  - **It lives in the menu bar.** The icon carries a count when something is waiting, and its menu lists what is blocked on you, which shells and commands are open right now, and your servers — so "is anything waiting on me?" costs a glance instead of a window switch. Closing the window leaves it there rather than quitting.
@@ -316,6 +325,19 @@ AES-256-GCM, master key in your OS keychain (a `0600` file where there is none
316
325
 
317
326
  **The key belongs to this machine.** A vault copied to a new laptop is ciphertext nobody can open — `vault backup` writes a copy encrypted under a passphrase you choose, which is what makes the move survivable. Your `.env` is never modified, not by `import`, not by the interface, and a setup half in each is a normal state rather than a broken one. Upgrading changes nothing on its own: see **[docs/MIGRATION.md](docs/MIGRATION.md)**.
318
327
 
328
+ ### Keep the agent on the tools
329
+
330
+ Approval, modes and the audit log only see what goes through these tools. An agent that also has a terminal can run `ssh prod rm -rf …` there and none of it applies. For Claude Code, an opt-in hook closes that door:
331
+
332
+ ```bash
333
+ ssh-manager guard install # refuse ssh, scp, sftp and remote rsync in the agent's shell
334
+ ssh-manager guard install --mode ask # …or ask you each time
335
+ ssh-manager guard print # show what it would write, change nothing
336
+ ssh-manager guard remove
337
+ ```
338
+
339
+ The agent is told why and which tool to use instead (`ssh_execute`, `ssh_upload`, `ssh_sync`, `ssh_tunnel_create`). It is a guard against accidents, not a security boundary: it reads the command text. Keep SSH keys and agent sockets away from the account the agent runs as. Nothing is installed unless you run `install`; it edits only its own entry in `~/.claude/settings.json`, and keeps a copy of the file as it was.
340
+
319
341
  ### The unglamorous parts, which are the ones that bite
320
342
 
321
343
  - **Your sudo password never reaches the remote command line.** It travels on the SSH channel's stdin, so it isn't visible in `ps`, in `/proc/<pid>/cmdline`, or in an `auditd` trail — unlike the `echo "$pass" | sudo -S` pattern common in this category ([#34](https://github.com/bvisible/mcp-ssh-manager/issues/34)).
@@ -562,7 +584,7 @@ user = "admin"
562
584
  agent_public_key_path = "~/.ssh/id_ed25519.pub"
563
585
  ```
564
586
 
565
- The `.env` equivalent is `SSH_SERVER_[NAME]_AGENT_PUBLIC_KEY_PATH`; the internal configuration field is `agentPublicKeyPath`. This option fails if the public key file is missing or invalid, the agent is unavailable, or the agent does not offer a matching identity. It cannot be combined with `key_path`, `password`, `cert_path`, or enabled `forward_agent`; conflicting configuration is rejected. Omitting the option preserves the existing authentication behavior. `ssh_sync` uses system OpenSSH and does not apply this filter: configure its `IdentityFile` and `IdentitiesOnly yes` in your SSH client configuration separately.
587
+ In the desktop application and the browser interface it is the *Agent public key* field of the server form, which also closes the password, private key and agent-forwarding inputs while it is set. The `.env` equivalent is `SSH_SERVER_[NAME]_AGENT_PUBLIC_KEY_PATH`; the internal configuration field is `agentPublicKeyPath`. This option fails if the public key file is missing or invalid, the agent is unavailable, or the agent does not offer a matching identity. It cannot be combined with `key_path`, `password`, `cert_path`, or enabled `forward_agent`; conflicting configuration is rejected. Omitting the option preserves the existing authentication behavior. `ssh_sync` uses system OpenSSH and does not apply this filter: configure its `IdentityFile` and `IdentitiesOnly yes` in your SSH client configuration separately.
566
588
 
567
589
  **OpenSSH user certificates** — for servers that trust a certificate authority (`TrustedUserCAKeys`), point `CERTPATH` / `cert_path` at the certificate signed for `KEYPATH` (usually `<key>-cert.pub`). It is read on every connection, so a short-lived certificate renewed on disk needs no restart, and a missing file fails the connection instead of falling back to the bare key. It takes effect once `ssh2` ships certificate support ([mscdex/ssh2#1495](https://github.com/mscdex/ssh2/pull/1495)); until then the plain key is offered, as before. `ssh_sync` uses the system `ssh`, which finds `<key>-cert.pub` next to the key on its own.
568
590
 
@@ -697,6 +719,10 @@ The hero animation ships twice, light and dark, swapped by `<picture>` on `prefe
697
719
 
698
720
  ## What's new
699
721
 
722
+ **[4.3.0](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.3.0) — French and Japanese interfaces, and the agent key in the server form.** The interface and the desktop menus now come in Français and 日本語 next to English and 简体中文 (*Options → Appearance → Language*; the Japanese is @zenk-sugimoto's), and a new language is three files and one command (`npm run lang -- add <code>`, see [Adding a language](ui/README.md#adding-a-language)). The server form has an *Agent public key* field, so a server can use one identity of your SSH agent without its private key reaching the engine (asked for by @TillNano), and Live and Activity show a command in full instead of cutting it off (@congzhou09). See the [CHANGELOG](CHANGELOG.md#430---2026-11-19).
723
+
724
+ **[4.2.0](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.2.0) — a Chinese interface, a fuller audit log, and a guard against raw ssh.** The interface and the desktop menus come in 简体中文 (*Options → Appearance → Language*; thanks to @xutianhao6). With `AUDIT_LOG` on, every tool now records what it did, not only a few. `ssh_execute` can start a long job in the background (`background: true`, an idea from @SEU-zhc), and the opt-in `ssh-manager guard` keeps an agent from running `ssh` in its own shell, where approval and audit do not apply (an idea from @fyq163). Fixed, thanks to @jaredshuai's fork: **backups that reported success when the dump had failed** (an empty archive, every night from `ssh_backup_schedule`), a corrupt archive restored in part, MongoDB backups that could not be restored, `ssh-manager server remove` deleting a look-alike server, editing a server turning read-only into unrestricted, remote tunnels that never worked, a database password in the audit log, and six simultaneous calls opening six connections. `ssh-manager codex setup` now exists. A tool that fails now sets `isError` in its reply. See the [CHANGELOG](CHANGELOG.md#420---2026-11-13).
725
+
700
726
  **[4.1.0](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.1.0) — choose the agent key per server, and sudo in the audit log.** A server can name the one key of your SSH agent it uses, so an agent that holds many keys (a password manager's, say) no longer runs into `MaxAuthTries` before the right one is offered (thanks to @RebornOnce, [#128](https://github.com/bvisible/mcp-ssh-manager/pull/128)); with `AUDIT_LOG` on, `ssh_execute_sudo`, downloads, group commands and commands sent to a session now record what they did, never the sudo password ([#134](https://github.com/bvisible/mcp-ssh-manager/pull/134), thanks to @orshih6, reported by @revert12); [`llms-install.md`](llms-install.md) lets an agent set the server up for you; dependencies refreshed. Nothing to change on upgrade. See the [CHANGELOG](CHANGELOG.md#410---2026-11-13).
701
727
 
702
728
  **[4.0.3](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.3) — a security release; upgrade.** `ssh_db_query`, the read-only tool, could run shell commands on the server through the `psql` and `mysql` clients' own commands (`\!`), including on servers in `readonly` or `restricted` mode ([GHSA-qmf5-hrhv-5hjm](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-qmf5-hrhv-5hjm), reported by @orshih6). Every version before it is affected. A MySQL query must now be one line without backslashes. See the [CHANGELOG](CHANGELOG.md#403---2026-11-05).
package/cli/codex.js ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ // `ssh-manager codex` — point OpenAI Codex at this engine.
3
+ //
4
+ // ssh-manager codex setup Write Codex's ssh-manager entry (~/.codex/config.toml)
5
+ // ssh-manager codex status What Codex runs today
6
+ //
7
+ // It uses the same code as the interface's AI tools panel (src/agent-clients.js): only
8
+ // the ssh-manager table of the file is replaced, every other table and comment stays,
9
+ // and the entry names the engine that npm installed. The commands were documented
10
+ // (setup, migrate, test, convert) long before they existed; setup and status are the
11
+ // two that have a meaning with the V4 engine. Idea from jaredshuai's fork, which found
12
+ // the other way of writing the entry pointing into a source checkout.
13
+ //
14
+ // Native Node rather than Bash, so it works on Windows without Git Bash.
15
+ // Exit codes: 0 done, 1 could not, 2 a command that does not exist.
16
+ import { fileURLToPath } from 'node:url';
17
+ import { agentContext, agentsStatus, useEngine } from '../src/agent-clients.js';
18
+ import { BOLD, DIM, RESET } from './style.js';
19
+
20
+ const USAGE = `
21
+ ${BOLD}ssh-manager codex${RESET} — OpenAI Codex
22
+
23
+ ssh-manager codex setup Point Codex at this engine (the ssh-manager table of ~/.codex/config.toml)
24
+ ssh-manager codex status Whether Codex is installed and what its ssh-manager entry runs
25
+
26
+ ${DIM}Servers for Codex: ssh-manager export servers.toml writes them in TOML.${RESET}
27
+ `;
28
+
29
+ const describe = state => (state.engine === 'npm' ? 'the npm engine' : state.engine === 'app' ? "the desktop app's engine"
30
+ : state.engine === 'other' ? 'another ssh-manager (a checkout or a custom command)' : 'nothing yet');
31
+
32
+ /**
33
+ * @param {string[]} args
34
+ * @param {import('../src/agent-clients.js').Context} [context]
35
+ * @param {{ log: (text: string) => void, error: (text: string) => void }} [out]
36
+ * @returns {Promise<number>} the exit code
37
+ */
38
+ export async function codexCommand(args, context = agentContext(), out = console) {
39
+ const [command] = args;
40
+ if (!command || ['help', '-h', '--help'].includes(command)) { out.log(USAGE); return command ? 0 : 2; }
41
+ if (command !== 'setup' && command !== 'status') {
42
+ out.error(`Unknown command: codex ${command}\n${USAGE}`);
43
+ return 2;
44
+ }
45
+ try {
46
+ if (command === 'status') {
47
+ const state = (await agentsStatus(context)).clients.find(client => client.id === 'codex');
48
+ out.log(`Codex ${state.installed ? 'is installed' : 'was not found here'}; its ssh-manager entry runs ${describe(state)}${state.version ? ` ${state.version}` : ''}.`);
49
+ out.log(`${DIM}${state.configPath}${RESET}`);
50
+ return 0;
51
+ }
52
+ const state = await useEngine('codex', 'npm', context);
53
+ out.log(`Codex now runs ${describe(state)}${state.version ? ` ${state.version}` : ''}.`);
54
+ out.log(`${DIM}${state.configPath}${RESET}`);
55
+ out.log('Start a new Codex session for it to take effect.');
56
+ return 0;
57
+ } catch (error) {
58
+ out.error(error.message.includes('not installed with npm')
59
+ ? 'mcp-ssh-manager is not installed with npm here: run `npm install -g mcp-ssh-manager` first.'
60
+ : error.message);
61
+ return 1;
62
+ }
63
+ }
64
+
65
+ if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
66
+ codexCommand(process.argv.slice(2)).then(code => process.exit(code));
67
+ }
package/cli/guard.js ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ // ssh-manager guard: an opt-in Claude Code hook that refuses (or asks about) an
3
+ // `ssh`, `scp`, `sftp` or remote `rsync` run from the agent's shell, because it
4
+ // would skip the approval, the policy and the audit log of the MCP tools.
5
+ // Nothing is changed unless `install` is run; `print` shows what it would do.
6
+ import {
7
+ MODES, claudeSettingsPath, guardStatus, hookCommand, hookScriptPath, installGuard, removeGuard,
8
+ } from '../src/ssh-guard.js';
9
+
10
+ const HELP = `Usage: ssh-manager guard <command> [options]
11
+
12
+ Keep an AI agent from running ssh, scp, sftp or a remote rsync in its own shell,
13
+ where ssh-manager's approval, policy and audit log do not see it. Claude Code only.
14
+
15
+ Commands:
16
+ install Add the hook to Claude Code's settings (and copy its script)
17
+ remove Take the hook out again
18
+ status Say whether it is installed, and in which mode
19
+ print Show what install would write, and change nothing
20
+
21
+ Options:
22
+ --mode deny|ask deny (default) refuses the command and tells the agent to use
23
+ the MCP tools; ask lets you decide each time
24
+ --settings FILE Claude Code settings file (default: ~/.claude/settings.json,
25
+ or $CLAUDE_CONFIG_DIR/settings.json)
26
+ --delete-script With remove: also delete the copied script
27
+
28
+ This is a guard against accidents, not a security boundary: it reads the command
29
+ text. Keep SSH keys and agent sockets away from the account the agent runs as.
30
+ `;
31
+
32
+ function option(args, name) {
33
+ const index = args.indexOf(name);
34
+ return index === -1 ? undefined : args[index + 1];
35
+ }
36
+
37
+ const [command, ...args] = process.argv.slice(2);
38
+ const settingsFile = option(args, '--settings') || claudeSettingsPath();
39
+ const mode = option(args, '--mode') || 'deny';
40
+
41
+ try {
42
+ if (!command || ['help', '-h', '--help'].includes(command)) {
43
+ process.stdout.write(HELP);
44
+ } else if (command === 'install') {
45
+ if (!MODES.includes(mode)) throw new Error(`--mode must be one of ${MODES.join(', ')}`);
46
+ const done = installGuard({ mode, settingsFile });
47
+ console.log(`Installed in ${done.settingsFile} (mode: ${done.mode}).`);
48
+ console.log(`The hook script is ${done.script}.`);
49
+ console.log('Restart the Claude Code sessions that are open for it to apply.');
50
+ } else if (command === 'remove') {
51
+ const done = removeGuard({ settingsFile, deleteScript: args.includes('--delete-script') });
52
+ console.log(done.removed ? `Removed from ${done.settingsFile}.` : `Nothing to remove in ${done.settingsFile}.`);
53
+ } else if (command === 'status') {
54
+ const status = guardStatus({ settingsFile });
55
+ console.log(status.installed ? `Installed in ${status.settingsFile} (mode: ${status.mode}).` : `Not installed (${status.settingsFile}).`);
56
+ if (status.installed && !status.scriptPresent) console.log('The hook script is missing: run `ssh-manager guard install` again.');
57
+ } else if (command === 'print') {
58
+ if (!MODES.includes(mode)) throw new Error(`--mode must be one of ${MODES.join(', ')}`);
59
+ console.log(`Would add to ${settingsFile}:\n`);
60
+ console.log(JSON.stringify({ hooks: { PreToolUse: [{ matcher: 'Bash', hooks: [{ type: 'command', command: hookCommand(hookScriptPath(), mode) }] }] } }, null, 2));
61
+ console.log('\nNothing was changed.');
62
+ } else {
63
+ process.stderr.write(`Unknown command: ${command}\n\n${HELP}`);
64
+ process.exit(2);
65
+ }
66
+ } catch (error) {
67
+ process.stderr.write(`${error.message}\n`);
68
+ process.exit(1);
69
+ }