diff --git a/README.md b/README.md index f223ffb1..156c9387 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Requisites - [Git](https://git-scm.com) - The following executables should be correctly installed in your shell environment: - `ssh`: Any recent version of the OpenSSH ssh client (required by `resin sync` and `resin ssh`) - - if you need `ssh` to work behind the proxy you also need `proxytunnel`[http://proxytunnel.sourceforge.net/] installed (available as `proxytunnel` package for Ubuntu, for example) + - if you need `ssh` to work behind the proxy you also need [`proxytunnel`](http://proxytunnel.sourceforge.net/) installed (available as `proxytunnel` package for Ubuntu, for example) - `rsync`: >= 2.6.9 (required by `resin sync`) ##### Windows Support @@ -27,7 +27,7 @@ If you still want to use `cmd.exe` you will have to use a package manager like M 2. Install the `msys-rsync` and `msys-openssh` packages. 3. Add MinGW to the `%PATH%` if this hasn't been done by the installer already. The location where the binaries are places is usually `C:\MinGW\msys\1.0\bin`, but it can vary if you selected a different location in the installer. 4. Copy your SSH keys to `%homedrive%%homepath\.ssh`. -5. Install [proxytunnel](http://proxytunnel.sourceforge.net/) +5. If you need `ssh` to work behind the proxy you also need to install [proxytunnel](http://proxytunnel.sourceforge.net/) Getting Started --------------- diff --git a/lib/actions/ssh.coffee b/lib/actions/ssh.coffee index a703ca50..1967d9c1 100644 --- a/lib/actions/ssh.coffee +++ b/lib/actions/ssh.coffee @@ -46,6 +46,11 @@ module.exports = boolean: true description: 'increase verbosity' 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: (params, options, done) -> child_process = require('child_process') @@ -79,13 +84,21 @@ module.exports = throw new Error('Did not find running application container') if not containerId? Promise.try -> sshProxyCommand = '' + proxyConfig = global.PROXY_CONFIG - if proxyConfig + if proxyConfig and not options.noproxy { proxyAuth } = proxyConfig - proxyHost = "-p #{proxyConfig.host}:#{proxyConfig.port}" - proxyAuth = if proxyAuth then "-P #{proxyAuth}" else '' - proxytunnelCommand = "proxytunnel #{proxyHost} #{proxyAuth} -d %h:%p" + proxyHost = "#{proxyConfig.host}:#{proxyConfig.port}" + if proxyAuth + i = proxyAuth.indexOf(':') + proxyUser = proxyAuth.substring(0, i) + proxyPassword = proxyAuth.substring(i + 1) + proxyAuth = "--user=#{proxyUser} --pass=#{proxyPassword}" + else + proxyAuth = '' + proxytunnelCommand = "proxytunnel --proxy=#{proxyHost} #{proxyAuth} --dest=%h:%p" sshProxyCommand = "-o ProxyCommand='#{proxytunnelCommand}'" + command = "ssh #{verbose} -t \ -o LogLevel=ERROR \ -o StrictHostKeyChecking=no \ diff --git a/lib/app.coffee b/lib/app.coffee index 91854165..2bff2741 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -38,7 +38,7 @@ catch # If that is not set as well the initialize will do nothing globalTunnel.initialize(proxy) -# TODO: make this a feature of capitano +# TODO: make this a feature of capitano https://github.com/resin-io/capitano/issues/48 global.PROXY_CONFIG = globalTunnel.proxyConfig _ = require('lodash') diff --git a/package.json b/package.json index 69694679..aa93d297 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "dockerode": "^2.4.2", "drivelist": "^5.0.16", "etcher-image-write": "^9.0.3", - "global-tunnel-ng": "np-maintain/global-tunnel", + "global-tunnel-ng": "^2.1.0", "inquirer": "^3.0.6", "is-root": "^1.0.0", "js-yaml": "^3.7.0",