Circleci Connect to VPN

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a circleci connect to vpn workflow, use a machine executor or runner. You then start a VPN client inside the job before running your build steps. Teams use this setup when cloud jobs must reach private servers or internal databases. Still, opening a full network tunnel gives one job broad reach across your whole network. If a build script has a flaw, it can hit any host on that subnet. How the circleci connect to vpn workflow operates Standard container jobs in the cloud often lack

VPN Access Control + End-to-End Encryption: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To set up a circleci connect to vpn workflow, use a machine executor or runner. You then start a VPN client inside the job before running your build steps. Teams use this setup when cloud jobs must reach private servers or internal databases. Still, opening a full network tunnel gives one job broad reach across your whole network. If a build script has a flaw, it can hit any host on that subnet.

How the circleci connect to vpn workflow operates

Standard container jobs in the cloud often lack the kernel rights to create network interfaces. Because of this limit, teams pick between two main ways to link their builds. The first way uses a dedicated virtual machine executor in the cloud. Because the job owns the full virtual machine, it can install a VPN client. The job reads a stored secret, starts the background tunnel, and routes traffic inside.

The second way uses a self-hosted runner placed inside your private network. With a local runner, the build machine already lives behind your firewall. The runner polls the cloud service for queued jobs and pulls the work down. You do not need to open a new tunnel for each build run. Both methods let your pipeline talk to internal hosts that block public traffic.

Managing secrets and routing in build jobs

When you run a client inside a cloud machine, you must store client keys. Teams put these keys and passwords into the project settings as secret variables. When the job starts, the build script writes those secrets to a temporary file. The script then starts the tunnel and waits for the route to come up.

You must also check that the tunnel closes when the job finishes or fails. Cloud machines get destroyed after the job ends, which clears the temporary key files. Still, those keys sit in memory while the build runs third-party code and tests. Any step in the same job can read the secret variables or use the tunnel. Teams also face routing issues when the VPN changes the default route on the machine. If all traffic goes into the private tunnel, the agent may lose contact with the cloud controller. You have to set split routing rules so only private subnet traffic enters the tunnel.

VPN Access Control + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What a network tunnel solves and what it misses

A VPN tunnel or local runner solves the basic network path problem for builds. It blocks the public web from hitting your internal servers and private databases. Only traffic coming from the approved tunnel or local subnet can reach the target port. This setup keeps your internal hosts off the public internet and satisfies basic firewall rules.

Still, a network tunnel only checks where the traffic comes from at the start. Once the tunnel is up, the network trusts every packet from that build machine. It does not check which developer triggered the build or what commands run next. A job that only needs to run one database migration gets full network access. Also, your firewall logs only show traffic coming from the VPN client address. You cannot see the exact database queries or server commands inside the encrypted stream. When a bad script drops a table or reads emails, you lack a clear log.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why do standard container executors fail to start a VPN?

Container executors share a host kernel and lack permission to create virtual network adapters. You need a full virtual machine executor or a local runner to change routing tables.

Should we use a cloud VPN step or a self-hosted runner?

A self-hosted runner is better if many builds need private network routes every day. A cloud machine VPN step works well for rare jobs if you manage split routing.

What happens if a build job hangs while the tunnel is open?

The tunnel keeps the session active until the job hits its timeout limit and the machine stops. You should set short job timeouts and add cleanup steps that always run at the end.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.