Merge branch 'pathchanges'
This commit is contained in:
commit
546ac911c9
15 changed files with 37 additions and 268 deletions
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"mute": [
|
||||
"read-config",
|
||||
"read-config-ng",
|
||||
"socket.io",
|
||||
"standard",
|
||||
"bithound"
|
||||
|
|
19
ChangeLog.md
19
ChangeLog.md
|
@ -1,8 +1,25 @@
|
|||
# Change Log
|
||||
### 0.2.10 [TBD]
|
||||
### 0.2.10-1 [TBD]
|
||||
### Added
|
||||
- Add configuration option to restrict connections to specified subnets thanks to @Mierdin
|
||||
|
||||
### Changed
|
||||
- Using new repo for read-config -> read-config-ng
|
||||
|
||||
### Potentially Breaking Changes
|
||||
- Move all child resources to start from under /ssh
|
||||
- /socket.io -> /ssh/socket.io
|
||||
- /webssh2.css -> /ssh/webssh2.css
|
||||
- /webssh2.bundle.js -> /ssh/webssh2.bundle.js
|
||||
- /reauth -> /ssh/reauth
|
||||
- perhaps more
|
||||
|
||||
### Fixes
|
||||
- Typo in config.json.sample, thanks @wuchihsu, fixes #173
|
||||
|
||||
### Housekeeping
|
||||
- Removed irrelavant build scripts from /scripts
|
||||
|
||||
### 0.2.9 [2019-06-13]
|
||||
### Changes
|
||||
- Missing require('fs') in `server/app.js` See issue [#135](../../issues/135)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<style>
|
||||
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/webssh2.css" />
|
||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
|
@ -20,6 +20,6 @@
|
|||
<div id="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/webssh2.bundle.js" defer></script>
|
||||
<script src="/ssh/webssh2.bundle.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
|||
<style>
|
||||
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/webssh2.css" />
|
||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
|
@ -20,6 +20,6 @@
|
|||
<div id="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/webssh2.bundle.js" defer></script>
|
||||
<script src="/ssh/webssh2.bundle.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -40,16 +40,9 @@ function resizeScreen () {
|
|||
socket.emit('resize', { cols: term.cols, rows: term.rows })
|
||||
}
|
||||
|
||||
if (document.location.pathname) {
|
||||
var parts = document.location.pathname.split('/')
|
||||
var base = parts.slice(0, parts.length - 1).join('/') + '/'
|
||||
var resource = base.substring(1) + 'socket.io'
|
||||
socket = io.connect(null, {
|
||||
resource: resource
|
||||
socket = io.connect({
|
||||
path: "/ssh/socket.io"
|
||||
})
|
||||
} else {
|
||||
socket = io.connect()
|
||||
}
|
||||
|
||||
term.onData(function (data) {
|
||||
socket.emit('data', data)
|
||||
|
@ -173,7 +166,7 @@ function drawMenu (data) {
|
|||
// reauthenticate
|
||||
function reauthSession () { // eslint-disable-line
|
||||
console.log('re-authenticating')
|
||||
window.location.href = '/reauth'
|
||||
window.location.href = '/ssh/reauth'
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
7
app/package-lock.json
generated
7
app/package-lock.json
generated
|
@ -6654,9 +6654,10 @@
|
|||
"integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==",
|
||||
"dev": true
|
||||
},
|
||||
"read-config": {
|
||||
"version": "git+https://github.com/billchurch/nodejs-read-config.git#6e79091d220afd384915289ca578aa30a17ffb0a",
|
||||
"from": "git+https://github.com/billchurch/nodejs-read-config.git",
|
||||
"read-config-ng": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/read-config-ng/-/read-config-ng-1.6.1.tgz",
|
||||
"integrity": "sha512-tFNIA0+ZqrhJnqLcj175ZMGpn6TJtpTaY64KulfEsgdP0OZPqgVommAonhY9r4eN/PZLpt6cxnvf9yIE+SZEwA==",
|
||||
"requires": {
|
||||
"async": "~1.5.2",
|
||||
"js-yaml": "~3.13.1",
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"express": "~4.17.1",
|
||||
"express-session": "~1.17.0",
|
||||
"morgan": "~1.9.1",
|
||||
"read-config": "git+https://github.com/billchurch/nodejs-read-config.git",
|
||||
"read-config-ng": "~1.6.1",
|
||||
"socket.io": "2.2.0",
|
||||
"ssh2": "~0.8.6",
|
||||
"terser-webpack-plugin": "^2.2.1",
|
||||
|
|
|
@ -91,7 +91,7 @@ let config = {
|
|||
try {
|
||||
if (fs.existsSync(configPath)) {
|
||||
console.log('ephemeral_auth service reading config from: ' + configPath)
|
||||
config = require('read-config')(configPath)
|
||||
config = require('read-config-ng')(configPath)
|
||||
} else {
|
||||
console.error('\n\nERROR: Missing config.json for webssh. Current config: ' + JSON.stringify(config))
|
||||
console.error('\n See config.json.sample for details\n\n')
|
||||
|
@ -115,7 +115,7 @@ var server = require('http').Server(app)
|
|||
var myutil = require('./util')
|
||||
myutil.setDefaultCredentials(config.user.name, config.user.password, config.user.privatekey);
|
||||
var validator = require('validator')
|
||||
var io = require('socket.io')(server, { serveClient: false })
|
||||
var io = require('socket.io')(server, { serveClient: false, path: '/ssh/socket.io' })
|
||||
var socket = require('./socket')
|
||||
var expressOptions = require('./expressOptions')
|
||||
|
||||
|
@ -127,9 +127,9 @@ if (config.accesslog) app.use(logger('common'))
|
|||
app.disable('x-powered-by')
|
||||
|
||||
// static files
|
||||
app.use(express.static(publicPath, expressOptions))
|
||||
app.use('/ssh', express.static(publicPath, expressOptions))
|
||||
|
||||
app.get('/reauth', function (req, res, next) {
|
||||
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>')
|
||||
})
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
#!/bin/bash
|
||||
## Syncs from BIG-IP and builds a release based on version in extensions/ephemeral_auth/package.json
|
||||
#
|
||||
source ./scripts/env.sh
|
||||
source ./scripts/util.sh
|
||||
|
||||
./scripts/pull.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
# failure
|
||||
tput bel;tput bel;tput bel;tput bel
|
||||
echo -e "\n${fgLtRed}Pull command failed. Giving up.${fgLtWhi}\n"
|
||||
echo ${output}
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# get version of package from package.json
|
||||
package_version=$(jq -r ".version" workspace/extensions/webssh2/package.json)
|
||||
# creates new workspace name with version
|
||||
webssh_workspace_name=$webssh_workspace_name-$package_version
|
||||
|
||||
echoNotice "Creating workspace package"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost /bin/tar --exclude='./extensions/webssh2/config.json' -czf - -C /var/ilx/workspaces/Common/$webssh_workspace_name . > Build/Release/$webssh_package_name-$package_version.tgz"
|
||||
|
||||
echoNotice "Creating SHA256 hash"
|
||||
runCommand "shasum -a 256 Build/Release/$webssh_package_name-$package_version.tgz > Build/Release/$webssh_package_name-$package_version.tgz.sha256"
|
||||
|
||||
echoNotice "Copying to current"
|
||||
runCommand "cp Build/Release/$webssh_package_name-$package_version.tgz $webssh_pua_location/$webssh_package_name-current.tgz && \
|
||||
cp Build/Release/$webssh_package_name-$package_version.tgz.sha256 $webssh_pua_location/$webssh_package_name-current.tgz.sha256"
|
||||
|
||||
echoNotice "Deleting any '.DS_Store' files"
|
||||
runCommand "find . -name '.DS_Store' -type f -delete"
|
||||
|
||||
echo -e "\nWorkspace packages located at:\n"
|
||||
echo " Build/Release/$webssh_package_name-$package_version.tgz"
|
||||
echo " Build/Release/$webssh_package_name-$package_version.tgz.sha256"
|
||||
echo " $webssh_pua_location/$webssh_package_name-current.tgz"
|
||||
echo " $webssh_pua_location/$webssh_package_name-current.tgz.sha256"
|
||||
|
||||
echo -e "\n👍 Build Complete 👍\n"
|
||||
|
||||
exit 0
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/sh
|
||||
#webssh_ilxhost=root@192.168.30.209
|
||||
webssh_ilxhost=root@192.168.30.203
|
||||
webssh_workspace_name=webssh2
|
||||
webssh_package_name=BIG-IP-ILX-WebSSH2
|
||||
webssh_pua_location=./bin
|
|
@ -1,30 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# ./scripts/pull.sh
|
||||
#
|
||||
# bill@f5.com
|
||||
#
|
||||
# Pulls an ILX workspace from a BIG-IP and syncs to ./workspace, excludes
|
||||
# ./workspace/extensions/ephemeral_auth/node_modules.
|
||||
#
|
||||
source ./scripts/env.sh
|
||||
source ./scripts/util.sh
|
||||
|
||||
# get version of package from package.json
|
||||
PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1)
|
||||
# creates new workspace name with version
|
||||
webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION
|
||||
|
||||
echo "Pull ${fgLtCya}$webssh_workspace_name${fgLtWhi} from ${fgLtCya}$webssh_ilxhost${fgLtWhi}"
|
||||
|
||||
# check to see if the workspace actually exists before attempting to copy over
|
||||
|
||||
echoNotice "Checking for existing workspace ${fgLtCya}$webssh_workspace_name${fgLtWhi}"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1"
|
||||
|
||||
echoNotice "Pulling ${fgLtCya}$webssh_workspace_name${fgLtWhi} from ${fgLtCya}$webssh_ilxhost${fgLtWhi}"
|
||||
runCommand "rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --include=\"extensions/ephemeral_auth/node_modules/f5-*\" --exclude=\".DS_Store\" --exclude=\"extensions/ephemeral_auth/node_modules/*\" $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/. workspace/. 2>&1"
|
||||
|
||||
echo -e "\n👍 Pull complete 👍\n"
|
||||
|
||||
exit 0
|
|
@ -1,61 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# ./scripts/push.sh
|
||||
#
|
||||
# bill@f5.com
|
||||
#
|
||||
# Pushes ./workspace to a BIG-IP ILX workspace
|
||||
#
|
||||
source ./scripts/env.sh
|
||||
source ./scripts/util.sh
|
||||
|
||||
# get version of package from package.json
|
||||
PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1)
|
||||
# creates new workspace name with version
|
||||
webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION
|
||||
|
||||
echo "Push ${fgLtCya}$webssh_workspace_name${fgLtWhi} to ${fgLtCya}$webssh_ilxhost${fgLtWhi}"
|
||||
|
||||
echoNotice "Checking $webssh_ilxhost for workspace $webssh_workspace_name"
|
||||
output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1)
|
||||
result="$?" 2>&1
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "❌"
|
||||
echoNotice "Attempting to create workspace"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"tmsh create ilx workspace $webssh_workspace_name node-version 6.9.1\" 2>&1"
|
||||
else
|
||||
echo "✅"
|
||||
fi
|
||||
|
||||
echoNotice "Pushing ./workspace to $webssh_ilxhost at $webssh_workspace_name"
|
||||
runCommand "rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --delete --exclude='.DS_Store' --exclude extensions/webssh2/node_modules workspace/. $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/."
|
||||
|
||||
echoNotice "Installing node modules at $webssh_workspace_name on $webssh_ilxhost"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; npm i --production\" 2>&1"
|
||||
|
||||
echoNotice "Setting permissions at $webssh_workspace_name on $webssh_ilxhost"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"chown -R root.sdm /var/ilx/workspaces/Common/$webssh_workspace_name/; \
|
||||
chmod -R ug+rwX,o-w /var/ilx/workspaces/Common/$webssh_workspace_name/; \
|
||||
chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/version; \
|
||||
chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/node_version\" 2>&1"
|
||||
|
||||
echoNotice "Deleting $webssh_workspace_name/node_modules/.bin on $webssh_ilxhost"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost \"cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; rm -rf node_modules/.bin\" 2>&1"
|
||||
|
||||
# switch plugin to new workspace
|
||||
echoNotice "Checking to see if plugin exists"
|
||||
output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx plugin WebSSH_plugin one-line 2>&1)
|
||||
result="$?" 2>&1
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "❌"
|
||||
echoNotice "Attempting to create plugin"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh create ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name extensions { webssh2 { concurrency-mode single ilx-logging enabled } } 2>&1"
|
||||
else
|
||||
echo "✅"
|
||||
echoNotice "Switching plugin to $webssh_workspace_name"
|
||||
runCommand "ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh modify ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name extensions { webssh2 { concurrency-mode single ilx-logging enabled } } 2>&1"
|
||||
fi
|
||||
|
||||
echo -e "\n👍 Push complete 👍\n"
|
||||
|
||||
exit 0
|
|
@ -1,74 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Utility functions / scripts
|
||||
|
||||
echoNotice () { echo -e -n "\n$@... "; }
|
||||
|
||||
fgLtRed=$(tput bold;tput setaf 1)
|
||||
fgLtGrn=$(tput bold;tput setaf 2)
|
||||
fgLtYel=$(tput bold;tput setaf 3)
|
||||
fgLtBlu=$(tput bold;tput setaf 4)
|
||||
fgLtMag=$(tput bold;tput setaf 5)
|
||||
fgLtCya=$(tput bold;tput setaf 6)
|
||||
fgLtWhi=$(tput bold;tput setaf 7)
|
||||
fgLtGry=$(tput bold;tput setaf 8)
|
||||
|
||||
echo ${fgLtWhi}
|
||||
|
||||
# check for jq and try to install...
|
||||
output=$(which jq 2>&1)
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "You need to install jq: https://stedolan.github.io/jq\n"
|
||||
echo -e "If you have *brew* you can install with:\n"
|
||||
echo -e " brew install jq\n"
|
||||
echo -n "Do you want me to try and install that for you (Y/n)? "
|
||||
read -n1 yesno
|
||||
echo
|
||||
if [[ ("$yesno" != "y") ]]; then
|
||||
echo -e "\nUnable to continue, install jq first.\n\n"
|
||||
exit 255
|
||||
else
|
||||
which brew
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "\nYou're a mess... You don't even have brew installed...\nMaybe you should check it out\n"
|
||||
echo -e " https://brew.sh/\n\n"
|
||||
exit 255
|
||||
fi
|
||||
echo
|
||||
brew install jq
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo -e "\nLooks like that failed, I can't do everything... Quitting, install jq...\n"
|
||||
exit 255
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# checks the output of a command to get the status and report/handle failure
|
||||
checkOutput() {
|
||||
if [ $result -eq 0 ]; then
|
||||
# success
|
||||
#echo "${fgLtGrn}[OK]${fgLtWhi}"
|
||||
echo "✅"
|
||||
return
|
||||
else
|
||||
# failure
|
||||
tput bel;tput bel;tput bel;tput bel
|
||||
#echo "${fgLtRed}[FAILED]${fgLtWhi}"
|
||||
echo "❌"
|
||||
echo -e "\nPrevious command failed in ${script_path}/${scriptname} with error level: ${result}"
|
||||
echo -e "\nCommand:\n"
|
||||
echo " ${command}"
|
||||
echo -e "\nSTDOUT/STDERR:\n"
|
||||
echo ${output}
|
||||
exit 255
|
||||
fi
|
||||
}
|
||||
|
||||
# run a comand and check call checkOutput
|
||||
runCommand() {
|
||||
# $1 command
|
||||
command=$@
|
||||
output=$((eval $command) 2>&1)
|
||||
result="$?" 2>&1
|
||||
prevline=$(($LINENO-2))
|
||||
checkOutput
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/bash
|
||||
## displays and optionally changes version of product
|
||||
|
||||
source ./scripts/env.sh
|
||||
|
||||
source ./scripts/util.sh
|
||||
|
||||
echo
|
||||
# get current version of workspace, ask to change or rebuild
|
||||
webssh_ver=$(jq -r ".version" ./app/package.json 2>&1)
|
||||
if [[ $? -ne 0 ]]; then exit; echo "error reading package version";fi
|
||||
|
||||
echo "Current version of package is: $webssh_ver"
|
||||
|
||||
echo -n "If you want to change this version, enter it now otherwise press enter to retain: "
|
||||
|
||||
read newver
|
||||
|
||||
echo
|
||||
|
||||
if [[ ("$newver" != "") ]]; then
|
||||
echo "Updating version of package to: $newver"
|
||||
export newver
|
||||
jq --arg newver "$newver" '.version = $newver' < ./app/package.json > ./app/package.json.new
|
||||
if [[ $? -ne 0 ]]; then exit; echo "error changing version - ilx";fi
|
||||
mv ./app/package.json.new ./app/package.json
|
||||
else
|
||||
echo "No changes made"
|
||||
fi
|
Loading…
Reference in a new issue