* Update some packages

* Still trying to figure out ssh2
This commit is contained in:
Bryan Ashby 2015-10-19 22:33:11 -06:00
parent d86d3e0119
commit 3833f9910e
3 changed files with 68 additions and 38 deletions

View File

@ -6,9 +6,6 @@ var theme = require('./theme.js');
var moduleUtil = require('./module_util.js');
var Config = require('./config.js').config;
var packageJson = require('../package.json');
var assert = require('assert');
var util = require('util');

View File

@ -8,6 +8,11 @@ var Log = require('../logger.js').log;
var ServerModule = require('../server_module.js').ServerModule;
var userLogin = require('../user_login.js').userLogin;
// :TODO: remove this - currently an experimental hack:
var term = require('../client_term.js');
var packageJson = require('../../package.json');
var ssh2 = require('ssh2');
var fs = require('fs');
var util = require('util');
@ -32,7 +37,12 @@ function SSHClient(clientConn) {
var self = this;
clientConn.on('authentication', function authentication(ctx) {
self.log.trace( { context : ctx }, 'SSH authentication');
self.log.trace(
{
domain : ctx.domain,
username : ctx.username,
method : ctx.method,
}, 'SSH authentication');
// :TODO: check Config max failed logon attempts/etc.
@ -84,7 +94,7 @@ function SSHClient(clientConn) {
break;
default :
self.log.info( { method : ctx.method }, 'Unsupported SSH authentication method. Rejecting connection.');
self.log.info( { method : ctx.method }, 'Unsupported SSH authentication method');
ctx.reject();
}
});
@ -93,13 +103,35 @@ function SSHClient(clientConn) {
self.log.info('SSH authentication success');
clientConn.on('session', function sess(accept, reject) {
self.input = accept();
self.output = self.input;
var session = accept();
session.on('pty-req', function pty(accept, reject, info) {
console.log(info);
var channel = accept();
console.log(channel)
});
session.on('shell', function shell(accept, reject) {
var channel = accept();
channel._write('Hello, world!')
self.input = channel._client._sock;
self.output = channel._client._sock;
self.term = new term.ClientTerminal(self.output);
self.emit('ready')
});
});
});
clientConn.on('end', function clientEnd() {
self.emit('end');
//self.emit('end');
});
}
@ -117,12 +149,13 @@ SSHServerModule.prototype.createServer = function() {
// :TODO: setup all options here. What should the banner, etc. really be????
var serverConf = {
privateKey : fs.readFileSync(conf.config.servers.ssh.rsaPrivateKey),
banner : 'ENiGMA½ BBS SSH Server',
banner : 'ENiGMA½ BBS ' + packageJson.version + ' SSH Server',
ident : 'enigma-bbs-' + packageJson.version + '-srv',
debug : function debugSsh(dbgLine) {
if(true === conf.config.servers.ssh.debugConnections) {
self.log.trace('SSH: ' + dbgLine);
}
}
},
};
var server = ssh2.Server(serverConf);

View File

@ -1,29 +1,29 @@
{
"name" : "enigma-bbs",
"version" : "0.0.1-alpha",
"description" : "ENiGMA½ Bulletin Board System",
"author" : "Bryan Ashby <bryan@l33t.codes>",
"license" : "BSD-2-Clause",
"keywords" : [
"bbs",
"telnet"
],
"dependencies" : {
"async" : "1.4.x",
"binary" : "0.3.x",
"buffers" : "0.1.x",
"bunyan" : "1.5.x",
"iconv-lite" : "0.4.x",
"lodash" : "3.10.x",
"sqlite3" : "3.1.x",
"ssh2" : "0.4.x",
"node-uuid" : "1.4.x",
"moment" : "2.10.x",
"gaze" : "0.5.x",
"mkdirp" : "0.5.x",
"pty.js" : "0.3.x",
"string-format" : "davidchambers/string-format#mini-language",
"hjson" : "1.7.x"
},
"engine" : "node >= 0.12.2"
}
"name": "enigma-bbs",
"version": "0.0.1-alpha",
"description": "ENiGMA½ Bulletin Board System",
"author": "Bryan Ashby <bryan@l33t.codes>",
"license": "BSD-2-Clause",
"keywords": [
"bbs",
"telnet"
],
"dependencies": {
"async": "1.4.x",
"binary": "0.3.x",
"buffers": "0.1.x",
"bunyan": "1.5.x",
"gaze": "^0.5.2",
"hjson": "1.7.x",
"iconv-lite": "^0.4.13",
"lodash": "^3.10.1",
"mkdirp": "0.5.x",
"moment": "^2.10.6",
"node-uuid": "1.4.x",
"pty.js": "0.3.x",
"sqlite3": "3.1.x",
"ssh2": "^0.4.11",
"string-format": "davidchambers/string-format#mini-language"
},
"engine": "node >= 0.12.2"
}