mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 10:46:34 +00:00
escape params
This commit is contained in:
parent
880fb43fd9
commit
b88f7a993c
@ -15,7 +15,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
var getSubShellCommand;
|
var _, bash, getSubShellCommand;
|
||||||
|
|
||||||
|
_ = require('lodash');
|
||||||
|
|
||||||
|
bash = require('bash');
|
||||||
|
|
||||||
getSubShellCommand = require('../utils/helpers').getSubShellCommand;
|
getSubShellCommand = require('../utils/helpers').getSubShellCommand;
|
||||||
|
|
||||||
@ -36,6 +40,11 @@ module.exports = {
|
|||||||
boolean: true,
|
boolean: true,
|
||||||
description: 'increase verbosity',
|
description: 'increase verbosity',
|
||||||
alias: 'v'
|
alias: 'v'
|
||||||
|
}, {
|
||||||
|
signature: 'noproxy',
|
||||||
|
parameter: 'noproxy',
|
||||||
|
boolean: true,
|
||||||
|
description: "don't use the proxy configuration for this connection. Only makes sense if you've configured proxy globally."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
action: function(params, options, done) {
|
action: function(params, options, done) {
|
||||||
@ -77,15 +86,26 @@ module.exports = {
|
|||||||
throw new Error('Did not find running application container');
|
throw new Error('Did not find running application container');
|
||||||
}
|
}
|
||||||
return Promise["try"](function() {
|
return Promise["try"](function() {
|
||||||
var command, proxyAuth, proxyConfig, proxyHost, proxytunnelCommand, sshProxyCommand, subShellCommand;
|
var command, i, proxyAuth, proxyCommand, proxyConfig, sshProxyCommand, subShellCommand, tunnelOptions;
|
||||||
sshProxyCommand = '';
|
sshProxyCommand = '';
|
||||||
proxyConfig = global.PROXY_CONFIG;
|
proxyConfig = global.PROXY_CONFIG;
|
||||||
if (proxyConfig) {
|
if (proxyConfig && !options.noproxy) {
|
||||||
proxyAuth = proxyConfig.proxyAuth;
|
proxyAuth = proxyConfig.proxyAuth;
|
||||||
proxyHost = "-p " + proxyConfig.host + ":" + proxyConfig.port;
|
tunnelOptions = {
|
||||||
proxyAuth = proxyAuth ? "-P " + proxyAuth : '';
|
proxy: proxyConfig.host + ":" + proxyConfig.port,
|
||||||
proxytunnelCommand = "proxytunnel " + proxyHost + " " + proxyAuth + " -d %h:%p";
|
dest: '%h:%p'
|
||||||
sshProxyCommand = "-o ProxyCommand='" + proxytunnelCommand + "'";
|
};
|
||||||
|
if (proxyAuth) {
|
||||||
|
i = proxyAuth.indexOf(':');
|
||||||
|
_.assign(tunnelOptions, {
|
||||||
|
user: proxyAuth.substring(0, i),
|
||||||
|
pass: proxyAuth.substring(i + 1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
proxyCommand = "proxytunnel " + (bash.args(tunnelOptions, '--', '='));
|
||||||
|
sshProxyCommand = "-o " + (bash.args({
|
||||||
|
ProxyCommand: proxyCommand
|
||||||
|
}, '', '='));
|
||||||
}
|
}
|
||||||
command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no " + sshProxyCommand + " -p " + options.port + " " + username + "@ssh." + proxyUrl + " enter " + uuid + " " + containerId;
|
command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no " + sshProxyCommand + " -p " + options.port + " " + username + "@ssh." + proxyUrl + " enter " + uuid + " " + containerId;
|
||||||
subShellCommand = getSubShellCommand(command);
|
subShellCommand = getSubShellCommand(command);
|
||||||
|
@ -786,6 +786,10 @@ ssh gateway port
|
|||||||
|
|
||||||
increase verbosity
|
increase verbosity
|
||||||
|
|
||||||
|
#### --noproxy <noproxy>
|
||||||
|
|
||||||
|
don't use the proxy configuration for this connection. Only makes sense if you've configured proxy globally.
|
||||||
|
|
||||||
# Notes
|
# Notes
|
||||||
|
|
||||||
## note <|note>
|
## note <|note>
|
||||||
|
@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
_ = require('lodash')
|
||||||
|
bash = require('bash')
|
||||||
{ getSubShellCommand } = require('../utils/helpers')
|
{ getSubShellCommand } = require('../utils/helpers')
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
@ -50,7 +52,8 @@ module.exports =
|
|||||||
signature: 'noproxy'
|
signature: 'noproxy'
|
||||||
parameter: 'noproxy'
|
parameter: 'noproxy'
|
||||||
boolean: true
|
boolean: true
|
||||||
description: "don't use the proxy configuration for this connection. Only makes sense if you've configured proxy globally."
|
description: "don't use the proxy configuration for this connection.
|
||||||
|
Only makes sense if you've configured proxy globally."
|
||||||
]
|
]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
child_process = require('child_process')
|
child_process = require('child_process')
|
||||||
@ -88,16 +91,16 @@ module.exports =
|
|||||||
proxyConfig = global.PROXY_CONFIG
|
proxyConfig = global.PROXY_CONFIG
|
||||||
if proxyConfig and not options.noproxy
|
if proxyConfig and not options.noproxy
|
||||||
{ proxyAuth } = proxyConfig
|
{ proxyAuth } = proxyConfig
|
||||||
proxyHost = "#{proxyConfig.host}:#{proxyConfig.port}"
|
tunnelOptions =
|
||||||
|
proxy: "#{proxyConfig.host}:#{proxyConfig.port}"
|
||||||
|
dest: '%h:%p'
|
||||||
if proxyAuth
|
if proxyAuth
|
||||||
i = proxyAuth.indexOf(':')
|
i = proxyAuth.indexOf(':')
|
||||||
proxyUser = proxyAuth.substring(0, i)
|
_.assign tunnelOptions,
|
||||||
proxyPassword = proxyAuth.substring(i + 1)
|
user: proxyAuth.substring(0, i)
|
||||||
proxyAuth = "--user=#{proxyUser} --pass=#{proxyPassword}"
|
pass: proxyAuth.substring(i + 1)
|
||||||
else
|
proxyCommand = "proxytunnel #{bash.args(tunnelOptions, '--', '=')}"
|
||||||
proxyAuth = ''
|
sshProxyCommand = "-o #{bash.args({ ProxyCommand: proxyCommand }, '', '=')}"
|
||||||
proxytunnelCommand = "proxytunnel --proxy=#{proxyHost} #{proxyAuth} --dest=%h:%p"
|
|
||||||
sshProxyCommand = "-o ProxyCommand='#{proxytunnelCommand}'"
|
|
||||||
|
|
||||||
command = "ssh #{verbose} -t \
|
command = "ssh #{verbose} -t \
|
||||||
-o LogLevel=ERROR \
|
-o LogLevel=ERROR \
|
||||||
|
@ -33,10 +33,12 @@
|
|||||||
"gulp-shell": "^0.5.2"
|
"gulp-shell": "^0.5.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@resin.io/valid-email": "^0.1.0",
|
||||||
"ansi-escapes": "^2.0.0",
|
"ansi-escapes": "^2.0.0",
|
||||||
"any-promise": "^1.3.0",
|
"any-promise": "^1.3.0",
|
||||||
"babel-preset-es2015": "^6.16.0",
|
"babel-preset-es2015": "^6.16.0",
|
||||||
"babel-register": "^6.16.3",
|
"babel-register": "^6.16.3",
|
||||||
|
"bash": "0.0.1",
|
||||||
"bluebird": "^3.3.3",
|
"bluebird": "^3.3.3",
|
||||||
"capitano": "^1.7.0",
|
"capitano": "^1.7.0",
|
||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
@ -85,8 +87,7 @@
|
|||||||
"umount": "^1.1.5",
|
"umount": "^1.1.5",
|
||||||
"underscore.string": "^3.1.1",
|
"underscore.string": "^3.1.1",
|
||||||
"unzip2": "^0.2.5",
|
"unzip2": "^0.2.5",
|
||||||
"update-notifier": "^0.6.1",
|
"update-notifier": "^0.6.1"
|
||||||
"valid-email": "^0.0.2"
|
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"removedrive": "^1.0.0"
|
"removedrive": "^1.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user