I need to access a remote server from Bitbucket Pipelines. This remote server is available only to a specific host which has its IP address whitelisted. Here is what I want:
Pipelines <---> The gateway host <---> The remote server
I was trying to use sshutle
to setup an ssh-based VPN to forward all network traffic via the gateway host, but it looks like Pipelines don't allow containers to run VPN (see issue #12753).
What can I do to access the remote server?
Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket. It allows you to automatically build, test, and even deploy your code based on a configuration file in your repository. Essentially, we create containers in the cloud for you.
Bitbucket Pipelines is a very polished but limited experience. It can be a great tool for rapidly getting a small team into the CI/CD world, but if you need more advanced functionality you will quickly hit the limits of the platform.
There is a solution if forwarding only http/https is enough for you. Use SSH to set up a socks5 proxy.
First, add Bitbucket's public SSH key to ~/.ssh/authorized_keys
on the gateway server. Open Repository --> Settings --> (Pipelines) SSH keys
and follow instructions on this page.
Then add these steps to the bitbucket-pipelines.yml
:
# Start in foreground (-fN), use compression (-C), set up port forwarding (-D)
ssh -fN -C -D 41337 [email protected]
export http_proxy='socks5://localhost:41337'
export https_proxy='socks5://localhost:41337'
Use curl
to check whether proxy works:
curl http://checkip.amazonaws.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With