12 · Private access with OpenVPN or Tailscale¶
Outcome: a hardened VPN host in your landing zone's public subnet that routes your laptop into the private network. With OpenVPN cloudseed builds the whole PKI itself: you add users, download .ovpn profiles, connect and revoke from the CLI. With Tailscale the host joins your tailnet as a subnet router. Either way, private subnets, internal load balancers and private Kubernetes API endpoints become reachable without an SSH tunnel.
Verified with --dry-run (Terraform render + validate); run for real with cloud credentials
tests/scenarios/12-private-access-vpn.sh renders and validates an AWS environment with OpenVPN and a GCP one with Tailscale, checks the estimate and vpn status, and checks that the user, connect and provisioning commands stop with a clear message before the VPN host exists. The apply, connecting and revoking need a cloud account.
| Time | Cost | Level | Needs |
|---|---|---|---|
| ~20 min | ≈ $70 / month for the AWS example (cs finops estimate); the VPN host adds ≈ $12 | Intermediate | A cloud account; for Tailscale a tailnet |
What you'll build¶
%%{init: {"flowchart": {"nodeSpacing": 30, "rankSpacing": 38, "padding": 12}}}%%
flowchart TB
laptop["Your laptop<br/>OpenVPN client / Tailscale"] -- "UDP 1194 (OpenVPN)<br/>or tailnet" --> vpn
subgraph vpc["Landing zone (AWS / GCP / Azure)"]
subgraph pub["Public subnet"]
vpn["VPN host (Ubuntu)<br/>OpenVPN + Easy-RSA PKI<br/>or Tailscale subnet router"]
bastion["Bastion"]
end
subgraph priv["Private subnets"]
apps["Workloads, internal LBs"]
api["Private Kubernetes API"]
end
end
vpn -- "NAT into the private network" --> apps & apiBefore you start¶
- A cloud account as in 02, 03 or 04.
- For OpenVPN: the client on your machine (
cs install openvpn, or any OpenVPN app). - For Tailscale: a tailnet, a reusable pre-authorized auth key and the Tailscale app.
Step 1: How the VPN works¶
Step 2: A landing zone with an OpenVPN host¶
cs setup aws -y --env vpn --region us-west-2 --allow-ip 203.0.113.7 --var enable_vpn=true --dry-run
cs finops estimate aws --env vpn
Expected output (abbreviated)
When the plan looks right, create it (interactive; unattended add -y --auto-approve):
Ansible builds the OpenVPN server and an Easy-RSA PKI on the host (EC keys, tls-crypt, a CRL), hardened like the bastion. The VPN port (UDP 1194) accepts connections from anywhere, so you can connect from any network, but only clients holding a certificate from this PKI get in; SSH to the VPN host stays limited to your --allow-ip.
Step 3: Add users and connect¶
cs vpn add-user aws --env vpn alice
cs vpn users aws --env vpn
cs install openvpn
cs vpn connect aws --env vpn --user alice
cs vpn status aws --env vpn
add-user issues a client certificate and downloads an inline profile to ~/.cloudseed/envs/aws-vpn/vpn/alice.ovpn (0600): any OpenVPN app can import it. connect starts the OpenVPN client on this machine with that profile (and creates one for you when there is none).
Expected output of cs vpn status aws --env vpn while connected
Step 4: Use the private network, then disconnect¶
While connected, private IPs answer directly: SSH to workloads, internal load balancers, and a private EKS / GKE / AKS API (cs kubectl then needs no bastion tunnel).
Step 5: Revoke, re-provision¶
cs vpn revoke aws --env vpn alice
cs vpn provision aws --env vpn
cs provision aws --env vpn --host vpn
revoke adds the certificate to the CRL at once; cs undo aws --env vpn would re-issue it. vpn provision (or provision --host vpn) re-runs the VPN host's Ansible play: idempotent, safe any time.
Step 6: Tailscale instead of OpenVPN¶
cs creds set TS_AUTHKEY
cs setup gcp -y --env mesh --project-id my-gcp-project --region us-central1 --allow-ip 203.0.113.7 --var enable_vpn=true --var vpn_type=tailscale --dry-run
cs setup gcp --env mesh --project-id my-gcp-project --region us-central1 --allow-ip 203.0.113.7 --var enable_vpn=true --var vpn_type=tailscale
cs vpn status gcp --env mesh
cs vpn connect gcp --env mesh
The host joins your tailnet and advertises the network CIDR; approve the route once in the Tailscale admin console. vpn connect runs tailscale up --accept-routes. Users are tailnet devices, so add-user, users and revoke are OpenVPN-only. Tailscale's coordination plane is a SaaS; traffic stays end-to-end encrypted. In FIPS environments only OpenVPN is allowed (11).
Use an agent, MCP or the UI¶
Follow the same numbered steps and verification/cleanup conditions through your chosen interface. Start with the interface setup and coverage guide; replace account/project/subscription and SSH placeholders before any live request.
Agent prompt: “Follow the private-access walkthrough for aws-vpn. Inspect the selected OpenVPN or Tailscale topology, then create only the approved user access. Verify routes and revocation while keeping client private keys out of chat and reports.”
MCP starter: cloudseed_vpn with:
Use the matching tool for each remaining step in this page; the command-to-tool map lists the tool family. Keep aws-vpn selected. Preview first; add confirm:true only to the specific change you have authorized. Host bootstrap, provider login and interactive applications retain their documented human steps.
UI: Select aws-vpn → Environments → VPN. Use status/users, then the add-user/revoke actions with the page’s user name. VPN connect/disconnect affects your host and may require native prompts; download/use the private client profile locally, never paste it into an agent conversation.
Verify it worked¶
vpn statusshowsConnected yeswhile the client runs; the VPN host's public IP is incs output.troubleshootchecks the VPN host like the bastion (reachability, allowed IPs, provisioning).
Clean up¶
cs vpn disconnect aws --env vpn
cs destroy aws --env vpn --purge-state --purge
cs destroy gcp --env mesh --purge-state --purge
What just happened¶
enable_vpn=trueadds thevpnmodule of the cloud stack (a host in the public subnet, its firewall rule, a static IP) and theansible/vpn.ymlplay (rolesopenvpnortailscale).- The PKI never leaves the VPN host except for the client profiles you download; they stay in the environment's working directory with 0600 permissions and are never shown to AI agents.
- Learn more: VPN guide · Security and FIPS · Explain index
Next steps¶
- 03 · Private GKE: reach the private API through the VPN.
- 13 · Day-2 operations: update your IP, audit trail, undo.
- 11 · FIPS 140 mode: OpenVPN restricted to AES-GCM.