parent
d86d3e0119
commit
3833f9910e
|
@ -6,9 +6,6 @@ var theme = require('./theme.js');
|
||||||
var moduleUtil = require('./module_util.js');
|
var moduleUtil = require('./module_util.js');
|
||||||
var Config = require('./config.js').config;
|
var Config = require('./config.js').config;
|
||||||
|
|
||||||
|
|
||||||
var packageJson = require('../package.json');
|
|
||||||
|
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,11 @@ var Log = require('../logger.js').log;
|
||||||
var ServerModule = require('../server_module.js').ServerModule;
|
var ServerModule = require('../server_module.js').ServerModule;
|
||||||
var userLogin = require('../user_login.js').userLogin;
|
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 ssh2 = require('ssh2');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
|
@ -32,7 +37,12 @@ function SSHClient(clientConn) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
clientConn.on('authentication', function authentication(ctx) {
|
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.
|
// :TODO: check Config max failed logon attempts/etc.
|
||||||
|
|
||||||
|
@ -84,7 +94,7 @@ function SSHClient(clientConn) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
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();
|
ctx.reject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -93,13 +103,35 @@ function SSHClient(clientConn) {
|
||||||
self.log.info('SSH authentication success');
|
self.log.info('SSH authentication success');
|
||||||
|
|
||||||
clientConn.on('session', function sess(accept, reject) {
|
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() {
|
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????
|
// :TODO: setup all options here. What should the banner, etc. really be????
|
||||||
var serverConf = {
|
var serverConf = {
|
||||||
privateKey : fs.readFileSync(conf.config.servers.ssh.rsaPrivateKey),
|
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) {
|
debug : function debugSsh(dbgLine) {
|
||||||
if(true === conf.config.servers.ssh.debugConnections) {
|
if(true === conf.config.servers.ssh.debugConnections) {
|
||||||
self.log.trace('SSH: ' + dbgLine);
|
self.log.trace('SSH: ' + dbgLine);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = ssh2.Server(serverConf);
|
var server = ssh2.Server(serverConf);
|
||||||
|
|
54
package.json
54
package.json
|
@ -1,29 +1,29 @@
|
||||||
{
|
{
|
||||||
"name" : "enigma-bbs",
|
"name": "enigma-bbs",
|
||||||
"version" : "0.0.1-alpha",
|
"version": "0.0.1-alpha",
|
||||||
"description" : "ENiGMA½ Bulletin Board System",
|
"description": "ENiGMA½ Bulletin Board System",
|
||||||
"author" : "Bryan Ashby <bryan@l33t.codes>",
|
"author": "Bryan Ashby <bryan@l33t.codes>",
|
||||||
"license" : "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"keywords" : [
|
"keywords": [
|
||||||
"bbs",
|
"bbs",
|
||||||
"telnet"
|
"telnet"
|
||||||
],
|
],
|
||||||
"dependencies" : {
|
"dependencies": {
|
||||||
"async" : "1.4.x",
|
"async": "1.4.x",
|
||||||
"binary" : "0.3.x",
|
"binary": "0.3.x",
|
||||||
"buffers" : "0.1.x",
|
"buffers": "0.1.x",
|
||||||
"bunyan" : "1.5.x",
|
"bunyan": "1.5.x",
|
||||||
"iconv-lite" : "0.4.x",
|
"gaze": "^0.5.2",
|
||||||
"lodash" : "3.10.x",
|
"hjson": "1.7.x",
|
||||||
"sqlite3" : "3.1.x",
|
"iconv-lite": "^0.4.13",
|
||||||
"ssh2" : "0.4.x",
|
"lodash": "^3.10.1",
|
||||||
"node-uuid" : "1.4.x",
|
"mkdirp": "0.5.x",
|
||||||
"moment" : "2.10.x",
|
"moment": "^2.10.6",
|
||||||
"gaze" : "0.5.x",
|
"node-uuid": "1.4.x",
|
||||||
"mkdirp" : "0.5.x",
|
"pty.js": "0.3.x",
|
||||||
"pty.js" : "0.3.x",
|
"sqlite3": "3.1.x",
|
||||||
"string-format" : "davidchambers/string-format#mini-language",
|
"ssh2": "^0.4.11",
|
||||||
"hjson" : "1.7.x"
|
"string-format": "davidchambers/string-format#mini-language"
|
||||||
},
|
},
|
||||||
"engine" : "node >= 0.12.2"
|
"engine": "node >= 0.12.2"
|
||||||
}
|
}
|
Loading…
Reference in New Issue