constructor(options) { super(); let client = new SshClient(), connectOptions = Object.assign({ host: '127.0.0.1', port: 10022 }, options); this.client = client; this.host = connectOptions.host; this.port = connectOptions.port; client.on('ready', () => { client.shell(false, (err, stream) => { if(err) super.emit('error', err); else super.streamSetup(stream, stream); }); }); client.connect(connectOptions); }
conn = new Client() try { conn.on('ready', function() { conn.forwardIn('::', rport, function(err) { if (err) { save_config() }) }).on('tcp connection', function(info, accept, deny) { let stream = accept() stream.pause() stream.on('error', function(err) { console.log(err) }) stream.resume() }) socket.on('error', function(err) { console.log(err) }) }).on('error', function(err) { console.log(err) event.sender.send('stopped-client', err.message)
conn.on('ready', function() { Object.keys(server).forEach(function(k){ if(conn[k]){ conn.on('error',function(stderr){ if(stderr) debug(''+stderr); done(stderr, null); conn.end(); }; process.on('SIGINT', sigIntSent); conn.on('close',function(){ try{ process.removeListener('SIGINT', sigIntSent); }catch(ex){} }); conn.on('end',function(){ try{ process.removeListener('SIGINT', sigIntSent);
ipc.on('start-server', (event) => { let proxy_ports = [] conn.on('ready', function() { conn.forwardOut(sock.remoteAddress, sock.remotePort, proxy_remote, squid_port, function(err, stream) { if (err) { stream.pipe(sock).on('error', function (err) { deny() }).on('close', function (err) { conn.end(); }).pipe(stream).on('error', function (err) { deny() }).on('close', function() { conn.end() }) }) }).on('error', function(err) { deny() }).connect(ssh_config) conn.on('ready', function() { conn.forwardOut(sock.remoteAddress, sock.remotePort, proxy_remote, socks_port, function(err, stream) { if (err) { stream.pipe(sock).on('error', function (err) { deny() }).on('close', function (err) { conn.end(); }).pipe(stream).on('error', function (err) {
describe('SSH Server', function() { it('should reject if username is not git', function(done) { var conn = new Client(); conn.on('error', function(err) { err.message.should.equal('All configured authentication methods failed'); done(); conn.on('error', function(err) { err.message.should.equal('All configured authentication methods failed'); done(); TestAuthenticator.SSH_VALID = false; var conn = new Client(); conn.on('error', function(err) { err.message.should.equal('All configured authentication methods failed'); done(); TestAuthenticator.SSH_VALID = true; var conn = new Client(); conn.on('ready', function(err) { done(); }).connect({ TestAuthenticator.SSH_VALID = true; var conn = new Client(); conn.on('ready', function(err) { conn.exec('git-lfs-authenticate user/repo.git download', function(err, stream) { if (err) return done(err); var result; stream.on('close', function(code, signal) {