bdy 1.26.11-stage → 1.26.12-dev
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/distTs/package.json +2 -2
- package/node_modules/ssh2/README.md +2 -1
- package/node_modules/ssh2/lib/protocol/Protocol.js +1 -1
- package/node_modules/ssh2/lib/protocol/handlers.misc.js +7 -1
- package/node_modules/ssh2/lib/server.js +8 -1
- package/node_modules/ssh2/package.json +1 -1
- package/node_modules/ssh2/test/test-userauth-pkok.js +83 -0
- package/package.json +2 -2
package/distTs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.26.
|
|
4
|
+
"version": "1.26.12-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://buddy.works/docs/cli",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"puppeteer-core": "25.16.0",
|
|
90
90
|
"range-parser": "1.2.1",
|
|
91
91
|
"socket.io-client": "4.8.3",
|
|
92
|
-
"ssh2": "npm:@buddy-works/ssh2@1.17.0-pq.
|
|
92
|
+
"ssh2": "npm:@buddy-works/ssh2@1.17.0-pq.2",
|
|
93
93
|
"tar-stream": "3.2.0",
|
|
94
94
|
"terminal-kit": "3.1.2",
|
|
95
95
|
"undici": "8.12.3",
|
|
@@ -5,7 +5,7 @@ SSH2 client and server modules written in pure JavaScript for [node.js](http://n
|
|
|
5
5
|
This is `@buddy-works/ssh2`, a fork of [ssh2](https://github.com/mscdex/ssh2) that can be used in its place:
|
|
6
6
|
|
|
7
7
|
```json
|
|
8
|
-
"ssh2": "npm:@buddy-works/ssh2@1.17.0-pq.
|
|
8
|
+
"ssh2": "npm:@buddy-works/ssh2@1.17.0-pq.2"
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
The version is the one of ssh2 it is based on, with a suffix of its own. What it adds:
|
|
@@ -16,6 +16,7 @@ The version is the one of ssh2 it is based on, with a suffix of its own. What it
|
|
|
16
16
|
* `destroy()` on server connections, and a client `destroy()` that also frees a half-closed socket.
|
|
17
17
|
* `hostVerifier` is passed the server's identification.
|
|
18
18
|
* `setNoDelay()` works before `connect()`.
|
|
19
|
+
* Servers work with OpenSSH 10 clients that use an RSA key: the answer to a key query names the algorithm of the query (`rsa-sha2-256`, `rsa-sha2-512`) instead of `ssh-rsa`, and `server-sig-algs` no longer runs `ecdsa-sha2-nistp521` and `rsa-sha2-512` together.
|
|
19
20
|
* Fixes: Ed25519 keys generated with a public key starting with a zero byte, the exit status of the SFTP subsystem ([#1492](https://github.com/mscdex/ssh2/pull/1492)), an exception on a write after the connection is gone with compression on.
|
|
20
21
|
|
|
21
22
|
Development/testing is done against OpenSSH (8.7 currently).
|
|
@@ -2112,7 +2112,7 @@ function modesToBytes(modes) {
|
|
|
2112
2112
|
|
|
2113
2113
|
function sendExtInfo(proto) {
|
|
2114
2114
|
let serverSigAlgs =
|
|
2115
|
-
'ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521'
|
|
2115
|
+
'ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,'
|
|
2116
2116
|
+ 'rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss';
|
|
2117
2117
|
if (eddsaSupported)
|
|
2118
2118
|
serverSigAlgs = `ssh-ed25519,${serverSigAlgs}`;
|
|
@@ -274,6 +274,7 @@ module.exports = {
|
|
|
274
274
|
);
|
|
275
275
|
methodData = {
|
|
276
276
|
keyAlgo: realKeyAlgo,
|
|
277
|
+
sigAlgo: keyAlgo,
|
|
277
278
|
key,
|
|
278
279
|
signature,
|
|
279
280
|
blob,
|
|
@@ -282,7 +283,12 @@ module.exports = {
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
} else {
|
|
285
|
-
methodData = {
|
|
286
|
+
methodData = {
|
|
287
|
+
keyAlgo: realKeyAlgo,
|
|
288
|
+
sigAlgo: keyAlgo,
|
|
289
|
+
key,
|
|
290
|
+
hashAlgo,
|
|
291
|
+
};
|
|
286
292
|
methodDesc = 'publickey -- check';
|
|
287
293
|
}
|
|
288
294
|
}
|
|
@@ -152,6 +152,10 @@ class PKAuthContext extends AuthContext {
|
|
|
152
152
|
super(protocol, username, service, method, cb);
|
|
153
153
|
|
|
154
154
|
this.key = { algo: pkInfo.keyAlgo, data: pkInfo.key };
|
|
155
|
+
// The algorithm name as the client sent it: `key.algo` is the key type, so
|
|
156
|
+
// for an RSA key it says 'ssh-rsa' where the client asked for
|
|
157
|
+
// 'rsa-sha2-256' or 'rsa-sha2-512'
|
|
158
|
+
this._sigAlgo = pkInfo.sigAlgo || pkInfo.keyAlgo;
|
|
155
159
|
this.hashAlgo = pkInfo.hashAlgo;
|
|
156
160
|
this.signature = pkInfo.signature;
|
|
157
161
|
this.blob = pkInfo.blob;
|
|
@@ -160,7 +164,10 @@ class PKAuthContext extends AuthContext {
|
|
|
160
164
|
accept() {
|
|
161
165
|
if (!this.signature) {
|
|
162
166
|
this._initialResponse = true;
|
|
163
|
-
|
|
167
|
+
// PK_OK has to name the algorithm of the request (RFC 4252, 7). OpenSSH
|
|
168
|
+
// 10 checks it and drops the connection on 'ssh-rsa', which it no longer
|
|
169
|
+
// accepts.
|
|
170
|
+
this._protocol.authPKOK(this._sigAlgo, this.key.data);
|
|
164
171
|
} else if (hasValidSignature(this)) {
|
|
165
172
|
AuthContext.prototype.accept.call(this);
|
|
166
173
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buddy-works/ssh2",
|
|
3
|
-
"version": "1.17.0-pq.
|
|
3
|
+
"version": "1.17.0-pq.2",
|
|
4
4
|
"author": "Brian White <mscdex@mscdex.net>",
|
|
5
5
|
"description": "SSH2 client and server modules written in pure JavaScript for node.js (fork of ssh2 with post-quantum key exchange)",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
fixture,
|
|
7
|
+
fixtureKey,
|
|
8
|
+
mustCall,
|
|
9
|
+
setup,
|
|
10
|
+
} = require('./common.js');
|
|
11
|
+
|
|
12
|
+
const { generateKeyPairSync, parseKey } = require('../lib/index.js').utils;
|
|
13
|
+
|
|
14
|
+
const serverCfg = { hostKeys: [ fixture('ssh_host_rsa_key') ] };
|
|
15
|
+
// There is no Ed25519 fixture
|
|
16
|
+
const ed25519Key = (() => {
|
|
17
|
+
const raw = generateKeyPairSync('ed25519').private;
|
|
18
|
+
return { raw, key: parseKey(raw) };
|
|
19
|
+
})();
|
|
20
|
+
const debug = false;
|
|
21
|
+
|
|
22
|
+
// What the server tells a client about public key algorithms: the list it
|
|
23
|
+
// accepts (server-sig-algs) and, in its answer to a key query, the algorithm
|
|
24
|
+
// of that query (RFC 4252, 7). OpenSSH 10 drops the connection when the answer
|
|
25
|
+
// names another one, as 'ssh-rsa' for a query with 'rsa-sha2-512'.
|
|
26
|
+
[
|
|
27
|
+
{ desc: 'RSA', clientKey: fixtureKey('id_rsa'), queried: 'rsa-sha2-256' },
|
|
28
|
+
{ desc: 'ECDSA', clientKey: fixtureKey('id_ecdsa') },
|
|
29
|
+
{ desc: 'Ed25519', clientKey: ed25519Key },
|
|
30
|
+
].forEach(({ desc, clientKey, queried }) => {
|
|
31
|
+
const { client, server } = setup(
|
|
32
|
+
`publickey, ${desc}: algorithm names sent by the server`,
|
|
33
|
+
{
|
|
34
|
+
client: { username: 'foo', privateKey: clientKey.raw },
|
|
35
|
+
server: serverCfg,
|
|
36
|
+
debug,
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// The key type, which is what the application is given as `ctx.key.algo`
|
|
41
|
+
const keyType = clientKey.key.type;
|
|
42
|
+
const expected = queried || keyType;
|
|
43
|
+
|
|
44
|
+
server.on('connection', mustCall((conn) => {
|
|
45
|
+
conn.on('authentication', mustCall((ctx) => {
|
|
46
|
+
if (ctx.method !== 'publickey')
|
|
47
|
+
return ctx.reject();
|
|
48
|
+
assert.strictEqual(ctx.key.algo, keyType);
|
|
49
|
+
ctx.accept();
|
|
50
|
+
}, 3)).on('ready', mustCall(() => {
|
|
51
|
+
conn.end();
|
|
52
|
+
}));
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
// The handlers exist once the socket is connected, before anything is read
|
|
56
|
+
client.on('connect', mustCall(() => {
|
|
57
|
+
const handlers = client._protocol._handlers;
|
|
58
|
+
|
|
59
|
+
const onExtInfo = handlers.EXT_INFO;
|
|
60
|
+
handlers.EXT_INFO = mustCall((p, exts) => {
|
|
61
|
+
const ext = exts.find((e) => e.name === 'server-sig-algs');
|
|
62
|
+
assert(ext, 'Missing server-sig-algs');
|
|
63
|
+
assert.deepStrictEqual(ext.algs, [
|
|
64
|
+
'ssh-ed25519',
|
|
65
|
+
'ecdsa-sha2-nistp256',
|
|
66
|
+
'ecdsa-sha2-nistp384',
|
|
67
|
+
'ecdsa-sha2-nistp521',
|
|
68
|
+
'rsa-sha2-512',
|
|
69
|
+
'rsa-sha2-256',
|
|
70
|
+
'ssh-rsa',
|
|
71
|
+
'ssh-dss',
|
|
72
|
+
]);
|
|
73
|
+
onExtInfo(p, exts);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const onPKOK = handlers.USERAUTH_PK_OK;
|
|
77
|
+
handlers.USERAUTH_PK_OK = mustCall((p, keyAlgo, key) => {
|
|
78
|
+
assert.strictEqual(keyAlgo, expected);
|
|
79
|
+
assert.deepStrictEqual(key, clientKey.key.getPublicSSH());
|
|
80
|
+
onPKOK(p, keyAlgo, key);
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
83
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.26.
|
|
4
|
+
"version": "1.26.12-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://buddy.works/docs/cli",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"puppeteer-core": "25.16.0",
|
|
90
90
|
"range-parser": "1.2.1",
|
|
91
91
|
"socket.io-client": "4.8.3",
|
|
92
|
-
"ssh2": "npm:@buddy-works/ssh2@1.17.0-pq.
|
|
92
|
+
"ssh2": "npm:@buddy-works/ssh2@1.17.0-pq.2",
|
|
93
93
|
"tar-stream": "3.2.0",
|
|
94
94
|
"terminal-kit": "3.1.2",
|
|
95
95
|
"undici": "8.12.3",
|