diff --git a/app.js b/app.js index 950a7bf..4ac8c72 100644 --- a/app.js +++ b/app.js @@ -44,6 +44,8 @@ app.get('/ssh/host/:host?', function (req, res, next) { background: req.query.headerBackground || config.header.background }, algorithms: config.algorithms, + keepaliveInterval: config.ssh.keepaliveInterval, + keepaliveCountMax: config.ssh.keepaliveCountMax, term: (/^(([a-z]|[A-Z]|[0-9]|[!^(){}\-_~])+)?\w$/.test(req.query.sshterm) && req.query.sshterm) || config.ssh.term, allowreplay: validator.isBoolean(req.headers.allowreplay + '') || false, @@ -53,9 +55,7 @@ app.get('/ssh/host/:host?', function (req, res, next) { server: config.serverlog.server || false }, readyTimeout: (validator.isInt(req.query.readyTimeout + '', {min: 1, max: 300000}) && - req.query.readyTimeout) || config.ssh.readyTimeout, - verify: config.verify || false, - keepaliveInterval: config.keepaliveInterval || 0 + req.query.readyTimeout) || config.ssh.readyTimeout } if (req.session.ssh.header.name) validator.escape(req.session.ssh.header.name) if (req.session.ssh.header.background) validator.escape(req.session.ssh.header.background) diff --git a/config.json b/config.json index d8b06ad..c5e886c 100644 --- a/config.json +++ b/config.json @@ -11,7 +11,9 @@ "host": null, "port": 22, "term": "xterm-color", - "readyTimeout": 20000 + "readyTimeout": 20000, + "keepaliveInterval": 120000, + "keepaliveCountMax": 10 }, "useminified": false, "header": { @@ -60,5 +62,4 @@ }, "accesslog": false, // http style access logging to console.log "verify": false, // verification of host key hashes, see hostkeyhashes.json - "keepaliveInterval": 0 // value in milliseconds, 0 = disable } diff --git a/socket.js b/socket.js index d9af678..da54fcd 100644 --- a/socket.js +++ b/socket.js @@ -112,25 +112,6 @@ module.exports = function socket (socket) { tryKeyboard: true, algorithms: socket.request.session.ssh.algorithms, readyTimeout: socket.request.session.ssh.readyTimeout, - hostHash: 'sha1', - hostVerifier: function (hash) { - if (socket.request.session.ssh.verify) { - if (hash === hostkeys[socket.request.session.ssh.host]) { - return (verified = true) - } else { - err = { message: 'SSH HOST KEY HASH MISMATCH: ' + hash } - console.error('WEBSSH2 contents of host key hashes: ', JSON.stringify(hostkeys)) - console.error('WEBSSH2 reported hash from ' + socket.request.session.ssh.host + ': ', hash) - console.error('WEBSSH2 host key hash for ' + socket.request.session.ssh.host + ': ', hostkeys[socket.request.session.ssh.host]) - SSHerror('CONN CONNECT', err) - return (verified = false) - } - } else { - console.info('host key verification disabled. hash for host ' + socket.request.session.ssh.host + ': ', hash) - return (noverify = true) - } - }, - keepaliveInterval: socket.request.session.ssh.keepaliveInterval, debug: debug('ssh2') }) } else {