ssh-client-wrapper 2.6.2 → 2.8.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.
- package/docker-compose.yml +1 -1
- package/lib/fork.js +13 -1
- package/lib/util.js +2 -1
- package/package.json +3 -3
- package/run_test_all.sh +2 -2
package/docker-compose.yml
CHANGED
package/lib/fork.js
CHANGED
|
@@ -4,7 +4,7 @@ const debugVerbose = require("debug")("sshClientWrapper:verbose:fork");
|
|
|
4
4
|
const debugSendPty = require("debug")("sshClientWrapperInsecure:fork_sendpty");
|
|
5
5
|
const { spawn } = require("node-pty");
|
|
6
6
|
|
|
7
|
-
const { rePwPrompt, rePhPrompt, reNewHostPrompt, buff2String, sendPty, watchDogTimer } = require("./util.js");
|
|
7
|
+
const { rePwPrompt, rePhPrompt, reNewHostPrompt, reRemoteHostIdentificationHasChanged, buff2String, sendPty, watchDogTimer } = require("./util.js");
|
|
8
8
|
|
|
9
9
|
const nodePtyOpt = {
|
|
10
10
|
shell: process.platform === "win32" ? process.env.ComSpec : process.env.SHELL,
|
|
@@ -13,7 +13,19 @@ const nodePtyOpt = {
|
|
|
13
13
|
|
|
14
14
|
function sshLoginCallback (output, ptyProcess, pw, ph, logger = debugSendPty) {
|
|
15
15
|
return new Promise((resolve, reject) => {
|
|
16
|
+
if (reRemoteHostIdentificationHasChanged.test(output)) {
|
|
17
|
+
debug("REMOTE HOST IDENTIFICATION HAS CHANGED");
|
|
18
|
+
const rt = /known_hosts:(\d+)/.exec(output);
|
|
19
|
+
const rt2 = /Host key for (.+) has changed and you have requested strict checking./.exec(output);
|
|
20
|
+
const err = new Error("REMOTE HOST IDENTIFICATION HAS CHANGED");
|
|
21
|
+
err.code = "HostKeyError";
|
|
22
|
+
err.output = output;
|
|
23
|
+
err.lineNumber = rt[1] || null;
|
|
24
|
+
err.host = rt2[1] || null;
|
|
25
|
+
reject(err);
|
|
26
|
+
}
|
|
16
27
|
if (reNewHostPrompt.test(output)) {
|
|
28
|
+
debug("get warning about new host and send yes automatically");
|
|
17
29
|
sendPty(ptyProcess, "yes\n", logger, 17);
|
|
18
30
|
resolve();
|
|
19
31
|
}
|
package/lib/util.js
CHANGED
|
@@ -11,7 +11,7 @@ const acceptableRsyncRetrunCodes = [10, 11, 12, 13, 14];
|
|
|
11
11
|
const rePwPrompt = /password:/;
|
|
12
12
|
const rePhPrompt = /Enter passphrase for key/;
|
|
13
13
|
const reNewHostPrompt = /Are you sure you want to continue connecting/;
|
|
14
|
-
|
|
14
|
+
const reRemoteHostIdentificationHasChanged = /WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! /;
|
|
15
15
|
const Ajv = require("ajv");
|
|
16
16
|
|
|
17
17
|
const ajv = new Ajv({
|
|
@@ -264,6 +264,7 @@ module.exports = {
|
|
|
264
264
|
rePwPrompt,
|
|
265
265
|
rePhPrompt,
|
|
266
266
|
reNewHostPrompt,
|
|
267
|
+
reRemoteHostIdentificationHasChanged,
|
|
267
268
|
buff2String,
|
|
268
269
|
getSshOption,
|
|
269
270
|
sanityCheck,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssh-client-wrapper",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "wrapper library for open ssh client and rsync",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ssh",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"*.js": "eslint --fix"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"ajv": "^8.
|
|
37
|
+
"ajv": "^8.13.0",
|
|
38
38
|
"ajv-keywords": "^5.1.0",
|
|
39
39
|
"debug": "^4.3.4",
|
|
40
|
-
"glob": "^10.3.
|
|
40
|
+
"glob": "^10.3.12",
|
|
41
41
|
"node-pty": "^0.10.1",
|
|
42
42
|
"promise-retry": "^2.0.1"
|
|
43
43
|
},
|
package/run_test_all.sh
CHANGED
|
@@ -11,8 +11,8 @@ docker-compose up testbed -d
|
|
|
11
11
|
export TEST_HOST=localhost
|
|
12
12
|
export TEST_USER=testuser
|
|
13
13
|
export TEST_PW=passw0rd
|
|
14
|
-
export TEST_PORT=
|
|
15
|
-
ssh-keygen -R '[localhost]:
|
|
14
|
+
export TEST_PORT=4100
|
|
15
|
+
ssh-keygen -R '[localhost]:4100'
|
|
16
16
|
|
|
17
17
|
npm run test
|
|
18
18
|
echo local test success
|