Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ Client.prototype.connect = function(cfg) {
var hasSentAuth = false;
function doNextAuth(authName) {
hasSentAuth = true;
debug('------- DEBUG: doNextAuth authName : '+ authName);
if (authName === false) {
stream.removeListener('USERAUTH_FAILURE', onUSERAUTH_FAILURE);
stream.removeListener('USERAUTH_PK_OK', onUSERAUTH_PK_OK);
Expand Down Expand Up @@ -547,6 +548,8 @@ Client.prototype.connect = function(cfg) {
// Check that we support the key type first
// TODO: move key type checking logic to ssh2-streams
switch (pubKeyFullType) {
//TODO: there are a range of possible certs that are valid see https://github.com/PowerShell/openssh-portable/blob/8ab565c53f3619d6a1f5ac229e212cad8a52852c/sshkey.c#L138
case 'ssh-rsa-cert-v01@openssh.com':
case 'ssh-rsa':
case 'ssh-dss':
case 'ecdsa-sha2-nistp256':
Expand Down Expand Up @@ -575,7 +578,11 @@ Client.prototype.connect = function(cfg) {
var sigFullTypeLen = readUInt32BE(signed, 0);
if (4 + sigFullTypeLen + 4 < signed.length) {
var sigFullType = signed.toString('ascii', 4, 4 + sigFullTypeLen);
if (sigFullType !== pubKeyFullType) {
//TODO: construct a more robust all case cert error check see: https://github.com/PowerShell/openssh-portable/blob/8ab565c53f3619d6a1f5ac229e212cad8a52852c/auth2-pubkey.c#L89
if (!((pubKeyFullType === 'ssh-rsa-cert-v01@openssh.com' && sigFullType === 'ssh-rsa') ||
(sigFullType == pubKeyFullType))
)
{
err = new Error('Agent key/signature type mismatch');
err.level = 'agent';
self.emit('error', err);
Expand Down
49 changes: 49 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 25 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
{ "name": "ssh2",
{
"name": "ssh2",
"version": "0.8.5",
"author": "Brian White <mscdex@mscdex.net>",
"description": "SSH2 client and server modules written in pure JavaScript for node.js",
"main": "./lib/client",
"engines": { "node": ">=5.2.0" },
"engines": {
"node": ">=5.2.0"
},
"dependencies": {
"ssh2-streams": "~0.4.4"
},
"scripts": {
"test": "node test/test.js"
},
"keywords": [ "ssh", "ssh2", "sftp", "secure", "shell", "exec", "remote", "client" ],
"licenses": [ { "type": "MIT", "url": "http://github.com/mscdex/ssh2/raw/master/LICENSE" } ],
"repository" : { "type": "git", "url": "http://github.com/mscdex/ssh2.git" }
"keywords": [
"ssh",
"ssh2",
"sftp",
"secure",
"shell",
"exec",
"remote",
"client"
],
"licenses": [
{
"type": "MIT",
"url": "http://github.com/mscdex/ssh2/raw/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "http://github.com/mscdex/ssh2.git"
}
}