agent-ssh-cli 0.2.9 → 0.3.1

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.
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white" alt="Node.js >=18"></a>
13
13
  <a href="https://www.npmjs.com/"><img src="https://img.shields.io/badge/npm-%3E%3D8-CB3837?logo=npm&logoColor=white" alt="npm >=8"></a>
14
14
  <a href="https://github.com/sleepinginsummer/agent-ssh-cli"><img src="https://img.shields.io/badge/sys-win%2Fmac%2Flinux-0078D6" alt="sys win/mac/linux"></a>
15
- <a href="https://github.com/sleepinginsummer/agent-ssh-cli/releases"><img src="https://img.shields.io/badge/release-v0.2.9-blue" alt="release v0.2.9"></a>
15
+ <a href="https://github.com/sleepinginsummer/agent-ssh-cli/releases"><img src="https://img.shields.io/badge/release-v0.3.1-blue" alt="release v0.3.1"></a>
16
16
  <a href="https://github.com/sleepinginsummer/agent-ssh-cli/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen" alt="PRs welcome"></a>
17
17
  </p>
18
18
 
@@ -88,7 +88,7 @@ AGENT_SSH_CONFIG=/path/to/config.json
88
88
  - `name`: 连接名,必须唯一
89
89
  - `host`: SSH 主机地址
90
90
  - `username`: SSH 用户名
91
- - `password` / `privateKey`: 认证方式,二者必须且只能配置一个
91
+ - `password` / `passwordRef` / `privateKey`: 认证方式,密码、密码引用、私钥三类认证只能保留一种
92
92
  - `port`: SSH 端口,默认 `22`
93
93
  - `passphrase`: 私钥口令,仅配合 `privateKey` 使用
94
94
  - `pty`: 是否分配伪终端,默认 `false`,也可通过 `exec --pty` 临时开启
@@ -100,6 +100,8 @@ AGENT_SSH_CONFIG=/path/to/config.json
100
100
 
101
101
  完整示例见 [example.config.json](example.config.json)。`~/.agent-ssh-cli/config.json` 保存真实连接信息。
102
102
 
103
+ 为防止配置文件中的密码泄露,密码认证会在第一次使用该服务器时被动加密保存:首次写入明文 `password` 后,执行 `exec`、`upload` 或 `download` 连接该服务器时,CLI 会把密码加密保存到配置目录下的 `secrets.json`,生成本地 `secret.key`,并把配置中的 `password` 置空、写入 `passwordRef`。后续运行通过 `passwordRef` 解密认证;如需修改密码,把空的 `password` 重新填成新密码,下次连接会自动覆盖旧密文。
104
+
103
105
  参考配置
104
106
 
105
107
  ```json
@@ -109,7 +111,8 @@ AGENT_SSH_CONFIG=/path/to/config.json
109
111
  "host": "192.0.2.10",
110
112
  "port": 22,
111
113
  "username": "root",
112
- "password": "******",
114
+ "password": "",
115
+ "passwordRef": "agentsshcli:密码服务器",
113
116
  "commandBlacklist": [
114
117
  "(^|[;&|()\\s])rm(\\s|$)",
115
118
  "(^|[;&|()\\s])shutdown(\\s|$)",
@@ -159,6 +162,8 @@ agentsshcli exec 密码服务器 --command-file ./script.sh --timeout 60000
159
162
  npm install -g agent-ssh-cli@latest
160
163
  ```
161
164
 
165
+ 卸载:
166
+
162
167
  ```bash
163
168
  npm uninstall -g agent-ssh-cli
164
169
  npm cache clean --force
@@ -4,7 +4,8 @@
4
4
  "host": "192.0.2.10",
5
5
  "port": 22,
6
6
  "username": "root",
7
- "password": "******",
7
+ "password": "",
8
+ "passwordRef": "agentsshcli:密码服务器",
8
9
  "allowedLocalPaths": [
9
10
  "./tmp"
10
11
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-ssh-cli",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "基于 CLI 的 SSH 代理工具,按 ssh-mcp-server 的能力一一映射",
5
5
  "type": "module",
6
6
  "engines": {
@@ -27,10 +27,10 @@
27
27
  "build:native-package": "npm run build:native-bin && node scripts/build-native-package.js"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@agent-ssh-cli/darwin-arm64": "0.2.9",
31
- "@agent-ssh-cli/darwin-x64": "0.2.9",
32
- "@agent-ssh-cli/linux-arm64": "0.2.9",
33
- "@agent-ssh-cli/linux-x64": "0.2.9",
34
- "@agent-ssh-cli/win32-x64": "0.2.9"
30
+ "@agent-ssh-cli/darwin-arm64": "0.3.1",
31
+ "@agent-ssh-cli/darwin-x64": "0.3.1",
32
+ "@agent-ssh-cli/linux-arm64": "0.3.1",
33
+ "@agent-ssh-cli/linux-x64": "0.3.1",
34
+ "@agent-ssh-cli/win32-x64": "0.3.1"
35
35
  }
36
36
  }