commit
238208cb53
17 changed files with 127 additions and 90 deletions
|
@ -1,11 +1,12 @@
|
|||
# Change Log
|
||||
## [0.2.5] TBD
|
||||
## [0.2.5] 20180911
|
||||
### Added
|
||||
- Reauth function thanks to @vbeskrovny and @vvalchev (9bbc116)
|
||||
- Controlled by `config.json` option `options.allowreauth` true presents reauth dialog and false hides dialog
|
||||
### Changed
|
||||
- `options.challengeButton` enabled
|
||||
- previously this configuraiton option did nothing, this now enables the Credentials button site-wide regardless of the `allowreplay` header value
|
||||
- previously this configuration option did nothing, this now enables the Credentials button site-wide regardless of the `allowreplay` header value
|
||||
- Updated debug module to v4
|
||||
|
||||
## [0.2.4] 2018-07-18
|
||||
### Added
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Filename: /config/startup_script_webssh_commands.sh
|
||||
# Initializes WebSSH2 tmm-to-node listener
|
||||
# WebSSHVSIP should be the IP on an existing BIGIP virtual server assigned to
|
||||
# the WebSSH2 service.
|
||||
#
|
||||
# bill@f5.com February 2018
|
||||
|
||||
export myFileName=$0
|
||||
export REMOTEUSER=root
|
||||
export WEBSSHVSIP=
|
||||
|
||||
# check to see if we're in /config/startup, if not add ourselves
|
||||
IN_STARTUP=`grep startup_script_webssh_commands.sh /config/startup | wc -l`
|
||||
if [ $IN_STARTUP -eq 0 ]; then
|
||||
echo Adding script to /config/startup and ensuring correct permissions...
|
||||
logger -p local0.notice -t $myFileName Adding $0 to /config/startup and ensuring correct permissions...
|
||||
chmod 755 /config/startup
|
||||
chmod 755 /config/startup_script_webssh_commands.sh
|
||||
echo /config/startup_script_webssh_commands.sh \& >> /config/startup
|
||||
echo >> /config/startup
|
||||
fi
|
||||
|
||||
# Limit to 13 times in while-loop, ie. 12 x 10 secs sleep = 2 mins.
|
||||
MAX_LOOP=13
|
||||
|
||||
while true
|
||||
do
|
||||
# check to see if tmm interface is up
|
||||
IPLINKLIST=$(ip link list tmm 2>&1)
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ ! -z $WEBSSHVSIP ]; then
|
||||
IPADDRADD=$(/sbin/ip addr add $WEBSSHVSIP/32 dev tmm 2>&1)
|
||||
if [ $? -eq 0 ]; then
|
||||
# success
|
||||
echo SUCCESS $IPADDRADD
|
||||
logger -p local0.notice -t $myFileName IPADDRADD: SUCCESS: $IPADDRADD
|
||||
else
|
||||
# failure
|
||||
echo FAILURE $IPADDRADD
|
||||
logger -p local0.notice -t $myFileName IPADDRADD: FAILURE: $IPADDRADD
|
||||
fi
|
||||
else
|
||||
echo FAILURE: WEBSSHVSIP not specified.
|
||||
echo Open $0 and set the WEBSSHVSIP and try again
|
||||
echo
|
||||
logger -p local0.notice -t $myFileName IPADDRADD: FAILURE: NO WEBSSHVSIP SPECIFIED
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
# If tmm interface is not up yet, script sleep 10 seconds and check again.
|
||||
sleep 10
|
||||
|
||||
# Safety check not to run this script in background beyond 2 mins (ie. 12 times in while-loop).
|
||||
if [ "$MAX_LOOP" -eq 1 ]; then
|
||||
logger -p local0.notice -t $myFileName tmm interface not up within 2 minutes. Exiting script.
|
||||
logger -p local0.notice -t $myFileName IPLINKLIST: $IPLINKLIST
|
||||
exit
|
||||
fi
|
||||
((MAX_LOOP--))
|
||||
done
|
||||
|
||||
# End of file /config/startup_script_webssh_commands.sh
|
2
build.sh
2
build.sh
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
## Syncs from BIG-IP and builds a release based on version in extensions/ephemeral_auth/package.json
|
||||
|
||||
ilxhost=root@192.168.30.210
|
||||
ilxhost=root@192.168.30.216
|
||||
workspace_name=webssh2
|
||||
package_name=BIG-IP-13.1.0.8-ILX-WebSSH2
|
||||
pua_location=/Users/bill/Documents/GitHub/f5-pua/bin
|
||||
|
|
6
index.js
6
index.js
|
@ -1,10 +1,12 @@
|
|||
// index.js
|
||||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
/*
|
||||
* index.js
|
||||
*
|
||||
* WebSSH2 - Web to SSH2 gateway
|
||||
* Bill Church - https://github.com/billchurch/WebSSH2 - May 2017
|
||||
*
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
var config = require('./server/app').config
|
||||
var server = require('./server/app').server
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "webssh2",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.5",
|
||||
"ignore": [
|
||||
".gitignore"
|
||||
],
|
||||
|
@ -30,7 +30,7 @@
|
|||
"basic-auth": "^2.0.0",
|
||||
"colors": "^1.3.1",
|
||||
"compression": "^1.7.3",
|
||||
"debug": "^3.1.0",
|
||||
"debug": "^4.0.0",
|
||||
"express": "^4.16.3",
|
||||
"express-session": "^1.15.6",
|
||||
"morgan": "^1.9.0",
|
||||
|
|
12
revsync.sh
Executable file
12
revsync.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
ilxhost=root@192.168.30.216
|
||||
workspace_name=webssh2
|
||||
package_name=BIG-IP-13.1.0.8-ILX-WebSSH2
|
||||
pua_location=/Users/bill/Documents/GitHub/f5-pua/bin
|
||||
echo 'hello'
|
||||
rsync -e 'ssh -ax' -av --delete --exclude='.DS_Store' --exclude extensions/$workspace_name/node_modules workspace/. $ilxhost:/var/ilx/workspaces/Common/$workspace_name/.
|
||||
|
||||
ssh $ilxhost chown -R root.sdm /var/ilx/workspaces/Common/$workspace_name/
|
||||
ssh $ilxhost chmod -R ug+rwX,o-w /var/ilx/workspaces/Common/$workspace_name/
|
||||
ssh $ilxhost chmod u+rw,go-w /var/ilx/workspaces/Common/$workspace_name/version
|
||||
ssh $ilxhost chmod u+rw,go-w /var/ilx/workspaces/Common/$workspace_name/node_version
|
|
@ -1,3 +1,5 @@
|
|||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
// app.js
|
||||
|
||||
var path = require('path')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
// socket.js
|
||||
|
||||
// private
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
// util.js
|
||||
|
||||
// private
|
||||
|
|
2
sync.sh
2
sync.sh
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
ilxhost=root@192.168.30.210
|
||||
ilxhost=root@192.168.30.216
|
||||
workspace_name=webssh2
|
||||
package_name=BIG-IP-13.1.0.8-ILX-WebSSH2
|
||||
pua_location=/Users/bill/Documents/GitHub/f5-pua/bin
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
# Change Log
|
||||
## [0.2.5] 20180911
|
||||
### Added
|
||||
- Reauth function thanks to @vbeskrovny and @vvalchev (9bbc116)
|
||||
- Controlled by `config.json` option `options.allowreauth` true presents reauth dialog and false hides dialog
|
||||
### Changed
|
||||
- `options.challengeButton` enabled
|
||||
- previously this configuration option did nothing, this now enables the Credentials button site-wide regardless of the `allowreplay` header value
|
||||
- Updated debug module to v4
|
||||
|
||||
## [0.2.4] 2018-07-18
|
||||
### Added
|
||||
- Browser title window now changes with xterm escape sequences (see http://tldp.org/HOWTO/Xterm-Title-3.html)
|
||||
|
@ -15,6 +24,9 @@
|
|||
|
||||
## [0.2.3] unreleased
|
||||
|
||||
### Fixed
|
||||
- ESC]0; is now removed from log files when using the browser-side logging feature
|
||||
|
||||
## [0.2.0] 2018-02-10
|
||||
Mostly client (browser) related changes in this release
|
||||
|
||||
|
@ -165,5 +177,3 @@ and events in the application (not including the ssh2 module debug)
|
|||
## [0.0.1] - 2016-06-28
|
||||
### Added
|
||||
- Initial proof of concept and release. For historical purposes only.
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# WebSSH2
|
||||
[](https://badge.fury.io/gh/billchurch%2Fwebssh2) [](https://travis-ci.org/billchurch/WebSSH2) [](https://snyk.io/test/github/billchurch/webssh2) [](https://www.bithound.io/github/billchurch/WebSSH2) [](https://www.bithound.io/github/billchurch/WebSSH2/master/dependencies/npm) [](https://nodesecurity.io/orgs/billchurch/projects/b0a0d9df-1340-43ef-9736-ef983c057764) [](https://greenkeeper.io/)
|
||||
[](https://badge.fury.io/gh/billchurch%2Fwebssh2) [](https://travis-ci.org/billchurch/WebSSH2) [](https://snyk.io/test/github/billchurch/webssh2) [](https://nodesecurity.io/orgs/billchurch/projects/b0a0d9df-1340-43ef-9736-ef983c057764) [](https://greenkeeper.io/)
|
||||
|
||||
[](https://www.buymeacoffee.com/billchurch)
|
||||
|
||||
Web SSH Client using ssh2, socket.io, xterm.js, and express
|
||||
|
||||
|
@ -8,6 +9,14 @@ A bare bones example of an HTML5 web-based terminal emulator and SSH client. We
|
|||
|
||||
<img width="600" height="340" alt="WebSSH2 v0.2.0 demo" src="https://github.com/billchurch/WebSSH2/raw/master/screenshots/demo-800.gif">
|
||||
|
||||
# Requirements
|
||||
Node v6.x or above. If using <v6.x you should be able to run by replacing the "read-config" package to @1 like this (after a clone):
|
||||
|
||||
`npm install --save read-config@1
|
||||
`
|
||||
|
||||
Just keep in mind that there is no intention to ensure compatability with Node < v6.x
|
||||
|
||||
# Instructions
|
||||
To install:
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
// index.js
|
||||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
/*
|
||||
* index.js
|
||||
*
|
||||
* WebSSH2 - Web to SSH2 gateway
|
||||
* Bill Church - https://github.com/billchurch/WebSSH2 - May 2017
|
||||
*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "webssh2",
|
||||
"version": "0.2.4",
|
||||
"version": "0.2.5",
|
||||
"ignore": [
|
||||
".gitignore"
|
||||
],
|
||||
|
@ -17,27 +17,70 @@
|
|||
"contributors": [
|
||||
{
|
||||
"name": "Bill Church",
|
||||
"email": "bill@f5.com"
|
||||
"email": "wmchurch@gmail.com"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": "6.9.1"
|
||||
"node": "6"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/billchurch/WebSSH2/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"basic-auth": "^2.0.0",
|
||||
"colors": "^1.1.2",
|
||||
"compression": "^1.7.1",
|
||||
"debug": "^3.1.0",
|
||||
"express": "^4.16.1",
|
||||
"colors": "^1.3.1",
|
||||
"compression": "^1.7.3",
|
||||
"debug": "^4.0.0",
|
||||
"express": "^4.16.3",
|
||||
"express-session": "^1.15.6",
|
||||
"morgan": "^1.9.0",
|
||||
"read-config": "^2.0.0",
|
||||
"socket.io": "^2.0.4",
|
||||
"ssh2": "^0.5.5",
|
||||
"validator": "^9.0.0"
|
||||
"socket.io": "^2.1.1",
|
||||
"ssh2": "^0.6.1",
|
||||
"validator": "^10.5.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"build": "webpack --progress --colors --config scripts/webpack.prod.js",
|
||||
"builddev": "webpack --progress --colors --config scripts/webpack.dev.js",
|
||||
"analyze": "webpack --json --config scripts/webpack.prod.js | webpack-bundle-size-analyzer",
|
||||
"test": "snyk test",
|
||||
"watch": "nodemon index.js",
|
||||
"standard": "standard --verbose --fix | snazzy",
|
||||
"cleanmac": "find . -name '.DS_Store' -type f -delete"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome": "^1.1.8",
|
||||
"@fortawesome/fontawesome-free-solid": "^5.0.13",
|
||||
"ajv": "^6.5.2",
|
||||
"bithound": "^1.7.0",
|
||||
"clean-webpack-plugin": "^0.1.19",
|
||||
"copy-webpack-plugin": "^4.5.2",
|
||||
"css-loader": "^1.0.0",
|
||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||
"file-loader": "^1.1.11",
|
||||
"nodemon": "^1.18.3",
|
||||
"postcss-discard-comments": "^4.0.0",
|
||||
"snazzy": "^7.1.1",
|
||||
"snyk": "^1.90.0",
|
||||
"standard": "^11.0.1",
|
||||
"style-loader": "^0.21.0",
|
||||
"uglifyjs-webpack-plugin": "^1.2.7",
|
||||
"url-loader": "^1.0.1",
|
||||
"webpack": "^4.16.5",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-merge": "^4.1.4",
|
||||
"webpack-stream": "^5.1.0",
|
||||
"xterm": "^3.5.1"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"client/public/webssh2.bundle.js",
|
||||
"bigip/*",
|
||||
"screenshots/*",
|
||||
"bin/*",
|
||||
"build/*",
|
||||
"workspace/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
// app.js
|
||||
|
||||
var path = require('path')
|
||||
|
@ -35,6 +37,11 @@ app.disable('x-powered-by')
|
|||
// static files
|
||||
app.use(express.static(publicPath, expressOptions))
|
||||
|
||||
app.get('/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>')
|
||||
})
|
||||
|
||||
app.get('/ssh/host/:host?', function (req, res, next) {
|
||||
res.sendFile(path.join(path.join(publicPath, 'client.htm')))
|
||||
// capture, assign, and validated variables
|
||||
|
@ -60,7 +67,8 @@ app.get('/ssh/host/:host?', function (req, res, next) {
|
|||
tabStopWidth: (validator.isInt(req.query.tabStopWidth + '', {min: 1, max: 100}) && req.query.tabStopWidth) ? req.query.tabStopWidth : config.terminal.tabStopWidth,
|
||||
bellStyle: ((req.query.bellStyle) && (['sound', 'none'].indexOf(req.query.bellStyle) > -1)) ? req.query.bellStyle : config.terminal.bellStyle
|
||||
},
|
||||
allowreplay: (validator.isBoolean(req.headers.allowreplay + '') ? myutil.parseBool(req.headers.allowreplay) : false),
|
||||
allowreplay: config.options.challengeButton || (validator.isBoolean(req.headers.allowreplay + '') ? myutil.parseBool(req.headers.allowreplay) : false),
|
||||
allowreauth: config.options.allowreauth || false,
|
||||
mrhsession: ((validator.isAlphanumeric(req.headers.mrhsession + '') && req.headers.mrhsession) ? req.headers.mrhsession : 'none'),
|
||||
serverlog: {
|
||||
client: config.serverlog.client || false,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
// socket.js
|
||||
|
||||
// private
|
||||
|
@ -7,7 +9,8 @@ var SSH = require('ssh2').Client
|
|||
// var fs = require('fs')
|
||||
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
|
||||
var termCols, termRows
|
||||
var menuData = '<a id="logBtn"><i class="fas fa-clipboard fa-fw"></i> Start Log</a><a id="downloadLogBtn"><i class="fas fa-download fa-fw"></i> Download Log</a>'
|
||||
var menuData = '<a id="logBtn"><i class="fas fa-clipboard fa-fw"></i> Start Log</a>' +
|
||||
'<a id="downloadLogBtn"><i class="fas fa-download fa-fw"></i> Download Log</a>'
|
||||
|
||||
// public
|
||||
module.exports = function socket (socket) {
|
||||
|
@ -24,7 +27,7 @@ module.exports = function socket (socket) {
|
|||
termRows = rows
|
||||
})
|
||||
conn.on('banner', function connOnBanner (data) {
|
||||
// need to convert to cr/lf for proper formatting
|
||||
// need to convert to cr/lf for proper formatting
|
||||
data = data.replace(/\r?\n/g, '\r\n')
|
||||
socket.emit('data', data.toString('utf-8'))
|
||||
})
|
||||
|
@ -40,6 +43,7 @@ module.exports = function socket (socket) {
|
|||
socket.emit('status', 'SSH CONNECTION ESTABLISHED')
|
||||
socket.emit('statusBackground', 'green')
|
||||
socket.emit('allowreplay', socket.request.session.ssh.allowreplay)
|
||||
socket.emit('allowreauth', socket.request.session.ssh.allowreauth)
|
||||
conn.shell({
|
||||
term: socket.request.session.ssh.term,
|
||||
cols: termCols,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict'
|
||||
/* jshint esversion: 6, asi: true, node: true */
|
||||
// util.js
|
||||
|
||||
// private
|
||||
|
@ -12,7 +14,7 @@ exports.basicAuth = function basicAuth (req, res, next) {
|
|||
req.session.userpassword = myAuth.pass
|
||||
debug('myAuth.name: ' + myAuth.name.yellow.bold.underline +
|
||||
' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline
|
||||
: 'is blank'.underline.red.bold))
|
||||
: 'is blank'.underline.red.bold))
|
||||
next()
|
||||
} else {
|
||||
res.statusCode = 401
|
||||
|
|
Loading…
Reference in a new issue