Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use VPN with Bitbucket Pipelines

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?

like image 499
Max Malysh Avatar asked Jul 25 '17 17:07

Max Malysh


People also ask

Does bitbucket have CI CD pipeline?

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.

Are bitbucket pipelines good?

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.


1 Answers

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
like image 107
Max Malysh Avatar answered Sep 17 '22 14:09

Max Malysh