concourse / pool-resource

atomically manages the state of the world (e.g. external environments)
Apache License 2.0
56 stars 36 forks source link

Add HTTP Proxy support for SSH #62

Closed Aggouri closed 3 years ago

Aggouri commented 3 years ago

This PR adds support for SSH-based access to git via HTTP Proxy in a shamelessly similar way to what was done in https://github.com/concourse/git-resource/pull/154. Most of the work is a one-to-one copy of the work done in that PR.

The gist of it is that we install proxytunnel in the base image(s), and use it together with ProxyCommand to talk to a standard HTTP proxy through which SSH commands transit.

This approach is essential in environments where internet access is only possible via corporate proxies which support HTTP CONNECT but block all traffic other than HTTP on ports 80 and 443. At the same time, in these environments, accessing GitHub using personal tokens is frowned upon, making connecting via SSH the only viable option.

The configuration block is:

source:
    uri: ...
    ...
    https_tunnel:
      proxy_host: proxy-server.mycorp.com
      proxy_port: 3128
      proxy_user: myuser
      proxy_password: myverysecurepassword

The whole https_tunnel block is optional. Similarly, it is possible to omit proxy_user and proxy_password when the proxy does not have authentication.

Done:

Thanks for taking the time to review and consider merging this PR :)

xtremerui commented 3 years ago

thx for the PR!