Module updates (#185)
* chore: removed compression option code, standardjs * chore: update packages * chore: update favicon.ico location * chore: standardjs run * chore: update changelog
This commit is contained in:
parent
fcfa6874cd
commit
58c3601af0
13 changed files with 1081 additions and 632 deletions
24
ChangeLog.md
24
ChangeLog.md
|
@ -1,10 +1,30 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
### 0.2.10-1 [TBD]
|
### 0.3.0-pre-release-1 [TBD]
|
||||||
### Added
|
### Added
|
||||||
- Add configuration option to restrict connections to specified subnets thanks to @Mierdin
|
- Add configuration option to restrict connections to specified subnets thanks to @Mierdin
|
||||||
|
- favicon
|
||||||
|
- added module `serve-favicon` to serve favicon from root if pre-fetched by browser
|
||||||
|
- added `link rel=icon` line in client.htm to serve favico.ico out of /ssh/
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Using new repo for read-config -> read-config-ng
|
- Using new repo for read-config -> read-config-ng-
|
||||||
|
- removed express compression feature, added no real value.
|
||||||
|
- module updates
|
||||||
|
- ssh2 to 0.8.8
|
||||||
|
- xterm 4.4.0
|
||||||
|
- development module updates (does not impact production, only for development and rebuilding)
|
||||||
|
- fortawesome/fontawesome-svg-core 1.2.27
|
||||||
|
- fortawesome/free-solid-svg-icons 5.12.1
|
||||||
|
- standard-version 7.1.0
|
||||||
|
- webpack 4.42.0
|
||||||
|
- webpack-cli 3.3.11
|
||||||
|
- terser-webpack-plugin 2.3.5
|
||||||
|
- copy-webpack-plugin 5.1.1
|
||||||
|
- cross-env 7.0.2
|
||||||
|
- css-loader 3.4.2
|
||||||
|
- file-loader 5.1.0
|
||||||
|
- style-loader 1.1.3
|
||||||
|
- url-loader 3.0.0
|
||||||
|
|
||||||
### Potentially Breaking Changes
|
### Potentially Breaking Changes
|
||||||
- Move all child resources to start from under /ssh
|
- Move all child resources to start from under /ssh
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||||
|
<link rel="icon" href="/ssh/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@
|
||||||
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||||
|
<link rel="icon" href="/ssh/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
|
@ -41,7 +41,7 @@ function resizeScreen () {
|
||||||
}
|
}
|
||||||
|
|
||||||
socket = io.connect({
|
socket = io.connect({
|
||||||
path: "/ssh/socket.io"
|
path: '/ssh/socket.io'
|
||||||
})
|
})
|
||||||
|
|
||||||
term.onData(function (data) {
|
term.onData(function (data) {
|
||||||
|
|
1598
app/package-lock.json
generated
1598
app/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "webssh2",
|
"name": "webssh2",
|
||||||
"version": "0.2.10-1",
|
"version": "0.3.0-pre-release-0",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
".gitignore"
|
".gitignore"
|
||||||
],
|
],
|
||||||
|
@ -30,19 +30,15 @@
|
||||||
"basic-auth": "~2.0.1",
|
"basic-auth": "~2.0.1",
|
||||||
"cidr-matcher": "2.1.1",
|
"cidr-matcher": "2.1.1",
|
||||||
"colors": "~1.4.0",
|
"colors": "~1.4.0",
|
||||||
"compression": "~1.7.4",
|
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"express": "~4.17.1",
|
"express": "~4.17.1",
|
||||||
"express-session": "~1.17.0",
|
"express-session": "~1.17.0",
|
||||||
"morgan": "~1.9.1",
|
"morgan": "~1.9.1",
|
||||||
"read-config-ng": "~1.6.1",
|
"read-config-ng": "~1.6.1",
|
||||||
|
"serve-favicon": "^2.5.0",
|
||||||
"socket.io": "2.2.0",
|
"socket.io": "2.2.0",
|
||||||
"ssh2": "~0.8.6",
|
"ssh2": "~0.8.8",
|
||||||
"terser-webpack-plugin": "^2.2.1",
|
"validator": "^12.2.0"
|
||||||
"validator": "^12.1.0",
|
|
||||||
"xterm-addon-fit": "^0.3.0",
|
|
||||||
"xterm-addon-search": "^0.3.0",
|
|
||||||
"xterm-addon-web-links": "^0.2.1"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
|
@ -66,25 +62,29 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.25",
|
"terser-webpack-plugin": "^2.3.5",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.11.2",
|
"xterm-addon-fit": "^0.3.0",
|
||||||
|
"xterm-addon-search": "^0.5.0",
|
||||||
|
"xterm-addon-web-links": "^0.2.1",
|
||||||
|
"@fortawesome/fontawesome-svg-core": "^1.2.27",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "^5.12.1",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"copy-webpack-plugin": "^5.0.5",
|
"copy-webpack-plugin": "^5.1.1",
|
||||||
"cross-env": "^6.0.3",
|
"cross-env": "^7.0.2",
|
||||||
"css-loader": "^3.2.0",
|
"css-loader": "^3.4.2",
|
||||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||||
"file-loader": "^4.2.0",
|
"file-loader": "^5.1.0",
|
||||||
"nodaemon": "0.0.5",
|
"nodaemon": "0.0.5",
|
||||||
"postcss-discard-comments": "^4.0.2",
|
"postcss-discard-comments": "^4.0.2",
|
||||||
"snazzy": "^8.0.0",
|
"snazzy": "^8.0.0",
|
||||||
"standard": "^14.3.1",
|
"standard": "^14.3.1",
|
||||||
"standard-version": "^7.0.0",
|
"standard-version": "^7.1.0",
|
||||||
"style-loader": "^1.0.0",
|
"style-loader": "^1.1.3",
|
||||||
"url-loader": "^2.2.0",
|
"url-loader": "^3.0.0",
|
||||||
"webpack": "^4.41.2",
|
"webpack": "^4.42.0",
|
||||||
"webpack-cli": "^3.3.10",
|
"webpack-cli": "^3.3.11",
|
||||||
"webpack-merge": "^4.2.2",
|
"webpack-merge": "^4.2.2",
|
||||||
"webpack-stream": "^5.2.1",
|
"webpack-stream": "^5.2.1",
|
||||||
"xterm": "^4.2.0"
|
"xterm": "^4.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
||||||
/* const CleanWebpackPlugin = require('clean-webpack-plugin') */
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin')
|
||||||
const merge = require('webpack-merge')
|
const merge = require('webpack-merge')
|
||||||
const common = require('./webpack.common.js')
|
const common = require('./webpack.common.js')
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ module.exports = merge(common, {
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
parallel: 4,
|
parallel: 4,
|
||||||
ie8: false,
|
ie8: false,
|
||||||
safari10: false
|
safari10: false
|
||||||
}
|
}
|
||||||
})],
|
})]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -110,17 +110,16 @@ var session = require('express-session')({
|
||||||
unset: 'destroy'
|
unset: 'destroy'
|
||||||
})
|
})
|
||||||
var app = express()
|
var app = express()
|
||||||
var compression = require('compression')
|
|
||||||
var server = require('http').Server(app)
|
var server = require('http').Server(app)
|
||||||
var myutil = require('./util')
|
var myutil = require('./util')
|
||||||
myutil.setDefaultCredentials(config.user.name, config.user.password, config.user.privatekey);
|
myutil.setDefaultCredentials(config.user.name, config.user.password, config.user.privatekey)
|
||||||
var validator = require('validator')
|
var validator = require('validator')
|
||||||
var io = require('socket.io')(server, { serveClient: false, path: '/ssh/socket.io' })
|
var io = require('socket.io')(server, { serveClient: false, path: '/ssh/socket.io' })
|
||||||
var socket = require('./socket')
|
var socket = require('./socket')
|
||||||
var expressOptions = require('./expressOptions')
|
var expressOptions = require('./expressOptions')
|
||||||
|
var favicon = require('serve-favicon');
|
||||||
|
|
||||||
// express
|
// express
|
||||||
app.use(compression({ level: 9 }))
|
|
||||||
app.use(session)
|
app.use(session)
|
||||||
app.use(myutil.basicAuth)
|
app.use(myutil.basicAuth)
|
||||||
if (config.accesslog) app.use(logger('common'))
|
if (config.accesslog) app.use(logger('common'))
|
||||||
|
@ -129,6 +128,9 @@ app.disable('x-powered-by')
|
||||||
// static files
|
// static files
|
||||||
app.use('/ssh', express.static(publicPath, expressOptions))
|
app.use('/ssh', express.static(publicPath, expressOptions))
|
||||||
|
|
||||||
|
// favicon from root if being pre-fetched by browser to prevent a 404
|
||||||
|
app.use(favicon(path.join(publicPath,'favicon.ico')));
|
||||||
|
|
||||||
app.get('/ssh/reauth', function (req, res, next) {
|
app.get('/ssh/reauth', function (req, res, next) {
|
||||||
var r = req.headers.referer || '/'
|
var r = req.headers.referer || '/'
|
||||||
res.status(401).send('<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=' + r + '"></head><body bgcolor="#000"></body></html>')
|
res.status(401).send('<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=' + r + '"></head><body bgcolor="#000"></body></html>')
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
var debug = require('debug')
|
var debug = require('debug')
|
||||||
var debugWebSSH2 = require('debug')('WebSSH2')
|
var debugWebSSH2 = require('debug')('WebSSH2')
|
||||||
var SSH = require('ssh2').Client
|
var SSH = require('ssh2').Client
|
||||||
var CIDRMatcher = require('cidr-matcher');
|
var CIDRMatcher = require('cidr-matcher')
|
||||||
// var fs = require('fs')
|
// var fs = require('fs')
|
||||||
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
|
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
|
||||||
var termCols, termRows
|
var termCols, termRows
|
||||||
|
@ -25,8 +25,8 @@ module.exports = function socket (socket) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If configured, check that requsted host is in a permitted subnet
|
// If configured, check that requsted host is in a permitted subnet
|
||||||
if ( (((socket.request.session || {}).ssh || {}).allowedSubnets || {}).length && ( socket.request.session.ssh.allowedSubnets.length > 0 ) ) {
|
if ((((socket.request.session || {}).ssh || {}).allowedSubnets || {}).length && (socket.request.session.ssh.allowedSubnets.length > 0)) {
|
||||||
var matcher = new CIDRMatcher(socket.request.session.ssh.allowedSubnets);
|
var matcher = new CIDRMatcher(socket.request.session.ssh.allowedSubnets)
|
||||||
if (!matcher.contains(socket.request.session.ssh.host)) {
|
if (!matcher.contains(socket.request.session.ssh.host)) {
|
||||||
console.log('WebSSH2 ' + 'error: Requested host outside configured subnets / REJECTED'.red.bold +
|
console.log('WebSSH2 ' + 'error: Requested host outside configured subnets / REJECTED'.red.bold +
|
||||||
' user=' + socket.request.session.username.yellow.bold.underline +
|
' user=' + socket.request.session.username.yellow.bold.underline +
|
||||||
|
@ -124,7 +124,7 @@ module.exports = function socket (socket) {
|
||||||
})
|
})
|
||||||
|
|
||||||
conn.on('end', function connOnEnd (err) { SSHerror('CONN END BY HOST', err) })
|
conn.on('end', function connOnEnd (err) { SSHerror('CONN END BY HOST', err) })
|
||||||
conn.on('close', function connOnClose (err) { SSHerror('CONN CLOSE', err) })
|
conn.on('close', function connOnClose (err) { SSHerror('CONN CLOSE', err) })
|
||||||
conn.on('error', function connOnError (err) { SSHerror('CONN ERROR', err) })
|
conn.on('error', function connOnError (err) { SSHerror('CONN ERROR', err) })
|
||||||
conn.on('keyboard-interactive', function connOnKeyboardInteractive (name, instructions, instructionsLang, prompts, finish) {
|
conn.on('keyboard-interactive', function connOnKeyboardInteractive (name, instructions, instructionsLang, prompts, finish) {
|
||||||
debugWebSSH2('conn.on(\'keyboard-interactive\')')
|
debugWebSSH2('conn.on(\'keyboard-interactive\')')
|
||||||
|
|
|
@ -7,12 +7,12 @@ require('colors') // allow for color property extensions in log messages
|
||||||
var debug = require('debug')('WebSSH2')
|
var debug = require('debug')('WebSSH2')
|
||||||
var Auth = require('basic-auth')
|
var Auth = require('basic-auth')
|
||||||
|
|
||||||
let defaultCredentials = {username: null, password: null, privatekey: null};
|
const defaultCredentials = { username: null, password: null, privatekey: null }
|
||||||
|
|
||||||
exports.setDefaultCredentials = function (username, password, privatekey) {
|
exports.setDefaultCredentials = function (username, password, privatekey) {
|
||||||
defaultCredentials.username = username
|
defaultCredentials.username = username
|
||||||
defaultCredentials.password = password
|
defaultCredentials.password = password
|
||||||
defaultCredentials.privatekey = privatekey
|
defaultCredentials.privatekey = privatekey
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.basicAuth = function basicAuth (req, res, next) {
|
exports.basicAuth = function basicAuth (req, res, next) {
|
||||||
|
@ -24,11 +24,11 @@ exports.basicAuth = function basicAuth (req, res, next) {
|
||||||
' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline
|
' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline
|
||||||
: 'is blank'.underline.red.bold))
|
: 'is blank'.underline.red.bold))
|
||||||
} else {
|
} else {
|
||||||
req.session.username = defaultCredentials.username;
|
req.session.username = defaultCredentials.username
|
||||||
req.session.userpassword = defaultCredentials.password;
|
req.session.userpassword = defaultCredentials.password
|
||||||
req.session.privatekey = defaultCredentials.privatekey;
|
req.session.privatekey = defaultCredentials.privatekey
|
||||||
}
|
}
|
||||||
if ( (!req.session.userpassword) && (!req.session.privatekey) ) {
|
if ((!req.session.userpassword) && (!req.session.privatekey)) {
|
||||||
res.statusCode = 401
|
res.statusCode = 401
|
||||||
debug('basicAuth credential request (401)')
|
debug('basicAuth credential request (401)')
|
||||||
res.setHeader('WWW-Authenticate', 'Basic realm="WebSSH"')
|
res.setHeader('WWW-Authenticate', 'Basic realm="WebSSH"')
|
||||||
|
|
Loading…
Reference in a new issue