在SSH2Stream上激活调试 - NodeJS

时间:2018-06-05 16:37:58

标签: node.js logging ssh

首先,我不是开发人员,也不是流利地说英语,但我会尽力解释我的问题

我有一台设备(Aruba交换机)必须连接到运行NodeJS的redhat 7.2服务器,在SSH中。 我得到的错误消息是关于密钥交换的问题,我想调查一下。 在服务器端,我有这个错误:

SSH server - Error occcured on client","stack":"Error: Handshake failed: no matching key exchange algorithm\n    
at check_KEXINIT (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:2284:15)\n    
at check (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:2222:9)\n    
at onKEXINIT (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:2219:5)\n    
at SSH2Stream.<anonymous> (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:206:5)\n    
at emitTwo (events.js:106:13)\n    at SSH2Stream.emit (events.js:191:7)\n    
at parse_KEXINIT (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:4117:8)\n    
at parsePacket (/.../node_modules/ssh2-streams/lib/ssh.js:4013:12)\n    
at SSH2Stream._transform (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:669:13)\n    
at SSH2Stream.Transform._read (_stream_transform.js:167:10)\n    
at SSH2Stream._read (/.../nodejs/node_modules/ssh2-streams/lib/ssh.js:251:15)\n    
at SSH2Stream.Transform._write (_stream_transform.js:155:12)","level":"error","timestamp":"2018-06-05T09:14:28.964Z"}

在/.../nodejs/node_modules/ssh2-streams/lib/ssh.js中,我有这样的行:

 if (i === len) {
    // No suitable match found!
    debug('DEBUG: No matching key exchange algorithm');
    var err = new Error('Handshake failed: no matching key exchange algorithm');
    err.level = 'handshake';
    self.emit('error', err);
    self.disconnect(DISCONNECT_REASON.KEY_EXCHANGE_FAILED);
    return false;
  }

  var kex_algorithm = clientList[i];
  debug('DEBUG: KEX algorithm: ' + kex_algorithm);
  if (firstFollows
      && (!init.algorithms.kex.length
          || kex_algorithm !== init.algorithms.kex[0])) {
    // Ignore next incoming packet, it was a wrong first guess at KEX algorithm
    instate.ignoreNext = true;
  }

  debug('DEBUG: (local) Host key formats: ' + algos.serverHostKey);
  debug('DEBUG: (remote) Host key formats: ' + init.algorithms.srvHostKey);

在哪里可以看到调试行的输出? (比如最后一个)

感谢任何帮助:)

0 个答案:

没有答案