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
|
||||
### 0.2.10-1 [TBD]
|
||||
### 0.3.0-pre-release-1 [TBD]
|
||||
### Added
|
||||
- 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
|
||||
- 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
|
||||
- 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;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||
<link rel="icon" href="/ssh/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<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;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||
<link rel="icon" href="/ssh/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
|
|
|
@ -41,7 +41,7 @@ function resizeScreen () {
|
|||
}
|
||||
|
||||
socket = io.connect({
|
||||
path: "/ssh/socket.io"
|
||||
path: '/ssh/socket.io'
|
||||
})
|
||||
|
||||
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",
|
||||
"version": "0.2.10-1",
|
||||
"version": "0.3.0-pre-release-0",
|
||||
"ignore": [
|
||||
".gitignore"
|
||||
],
|
||||
|
@ -30,19 +30,15 @@
|
|||
"basic-auth": "~2.0.1",
|
||||
"cidr-matcher": "2.1.1",
|
||||
"colors": "~1.4.0",
|
||||
"compression": "~1.7.4",
|
||||
"debug": "^4.1.1",
|
||||
"express": "~4.17.1",
|
||||
"express-session": "~1.17.0",
|
||||
"morgan": "~1.9.1",
|
||||
"read-config-ng": "~1.6.1",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"socket.io": "2.2.0",
|
||||
"ssh2": "~0.8.6",
|
||||
"terser-webpack-plugin": "^2.2.1",
|
||||
"validator": "^12.1.0",
|
||||
"xterm-addon-fit": "^0.3.0",
|
||||
"xterm-addon-search": "^0.3.0",
|
||||
"xterm-addon-web-links": "^0.2.1"
|
||||
"ssh2": "~0.8.8",
|
||||
"validator": "^12.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
|
@ -66,25 +62,29 @@
|
|||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.25",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.11.2",
|
||||
"terser-webpack-plugin": "^2.3.5",
|
||||
"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",
|
||||
"copy-webpack-plugin": "^5.0.5",
|
||||
"cross-env": "^6.0.3",
|
||||
"css-loader": "^3.2.0",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^3.4.2",
|
||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||
"file-loader": "^4.2.0",
|
||||
"file-loader": "^5.1.0",
|
||||
"nodaemon": "0.0.5",
|
||||
"postcss-discard-comments": "^4.0.2",
|
||||
"snazzy": "^8.0.0",
|
||||
"standard": "^14.3.1",
|
||||
"standard-version": "^7.0.0",
|
||||
"style-loader": "^1.0.0",
|
||||
"url-loader": "^2.2.0",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-cli": "^3.3.10",
|
||||
"standard-version": "^7.1.0",
|
||||
"style-loader": "^1.1.3",
|
||||
"url-loader": "^3.0.0",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-merge": "^4.2.2",
|
||||
"webpack-stream": "^5.2.1",
|
||||
"xterm": "^4.2.0"
|
||||
"xterm": "^4.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
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 ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
module.exports = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin')
|
||||
const merge = require('webpack-merge')
|
||||
const common = require('./webpack.common.js')
|
||||
|
||||
|
@ -11,6 +11,6 @@ module.exports = merge(common, {
|
|||
ie8: false,
|
||||
safari10: false
|
||||
}
|
||||
})],
|
||||
})]
|
||||
}
|
||||
})
|
|
@ -110,17 +110,16 @@ var session = require('express-session')({
|
|||
unset: 'destroy'
|
||||
})
|
||||
var app = express()
|
||||
var compression = require('compression')
|
||||
var server = require('http').Server(app)
|
||||
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 io = require('socket.io')(server, { serveClient: false, path: '/ssh/socket.io' })
|
||||
var socket = require('./socket')
|
||||
var expressOptions = require('./expressOptions')
|
||||
var favicon = require('serve-favicon');
|
||||
|
||||
// express
|
||||
app.use(compression({ level: 9 }))
|
||||
app.use(session)
|
||||
app.use(myutil.basicAuth)
|
||||
if (config.accesslog) app.use(logger('common'))
|
||||
|
@ -129,6 +128,9 @@ app.disable('x-powered-by')
|
|||
// static files
|
||||
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) {
|
||||
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>')
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
var debug = require('debug')
|
||||
var debugWebSSH2 = require('debug')('WebSSH2')
|
||||
var SSH = require('ssh2').Client
|
||||
var CIDRMatcher = require('cidr-matcher');
|
||||
var CIDRMatcher = require('cidr-matcher')
|
||||
// var fs = require('fs')
|
||||
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
|
||||
var termCols, termRows
|
||||
|
@ -26,7 +26,7 @@ module.exports = function socket (socket) {
|
|||
|
||||
// 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)) {
|
||||
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)) {
|
||||
console.log('WebSSH2 ' + 'error: Requested host outside configured subnets / REJECTED'.red.bold +
|
||||
' user=' + socket.request.session.username.yellow.bold.underline +
|
||||
|
|
|
@ -7,7 +7,7 @@ require('colors') // allow for color property extensions in log messages
|
|||
var debug = require('debug')('WebSSH2')
|
||||
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) {
|
||||
defaultCredentials.username = username
|
||||
|
@ -24,9 +24,9 @@ exports.basicAuth = function basicAuth (req, res, next) {
|
|||
' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline
|
||||
: 'is blank'.underline.red.bold))
|
||||
} else {
|
||||
req.session.username = defaultCredentials.username;
|
||||
req.session.userpassword = defaultCredentials.password;
|
||||
req.session.privatekey = defaultCredentials.privatekey;
|
||||
req.session.username = defaultCredentials.username
|
||||
req.session.userpassword = defaultCredentials.password
|
||||
req.session.privatekey = defaultCredentials.privatekey
|
||||
}
|
||||
if ((!req.session.userpassword) && (!req.session.privatekey)) {
|
||||
res.statusCode = 401
|
||||
|
|
Loading…
Reference in a new issue