Skip to content
Guides

Use MedHook tunnels for your other applications

Carry your own applications' traffic on a MedHook-managed VPN tunnel. Add your other networks as local ranges, reach the tunnels from your other VPCs by peering or a hub VPC, tell the healthcare organization what to change on their firewall, and know what MedHook audits.

On this page

A MedHook tunnel connects the MedHook engine to a healthcare organization's network. By default it carries one network on the MedHook side: the GKE node subnet the engine runs in. If your other applications need to reach the same organization, they can use the same tunnel. You don't need a second VPN, and you don't need another change window on the organization's firewall.

This takes two changes on your side and one on the organization's:

  1. Local ranges. Tell MedHook which of your networks the tunnel carries, next to the node subnet.
  2. Reach. Make the tunnel's routes visible to the VPCs those networks live in.
  3. The organization's firewall. Their network engineer adds your ranges to the tunnel's protected networks.

Monitoring, the tunnel watcher's failover and self-heal, and the tunnel-down alerts work as before. They watch the tunnel, not what it carries.

1. Add your networks as local ranges

A tunnel's local ranges are the MedHook side's protected networks. Classic VPN puts them in the local traffic selector, and HA VPN advertises them to the organization over BGP. The firewall configs and the connection packet list them for the organization.

There are two ways to set them.

For every tunnel (Terraform). List your networks in vpn_extra_local_ranges in apps/engine/terraform/gke:

hcl
vpn_extra_local_ranges = ["10.10.0.0/16", "172.20.0.0/22"]

Every tunnel's default local ranges become the node subnet plus these. The HA Cloud Router advertises them next to the node subnet. Its advertisement covers the whole router: every HA tunnel on it advertises these ranges, including tunnels that already exist. The engine reads them from VPN_EXTRA_LOCAL_RANGES through the Helm values. VPN_LOCAL_SUBNETS still means the node subnet only, so the checks that keep tunnels away from the cluster's own ranges are unchanged. A range that overlaps the node, pod or service range fails the plan. With the list empty (the default), nothing changes.

For one tunnel (Tunnels page or API). New tunnel's Routing and security step shows the default as Local subnet (MedHook), read-only like the rest of that step. After creating, change a tunnel's ranges in Settings · Local ranges. Through the API you can also send localSubnets with POST /api/vpn-tunnels or PATCH /api/vpn-tunnels/:id. An empty list goes back to the default. Changing local ranges re-creates the tunnel, the same way a change of remote subnets does, so Settings asks you to confirm first: the tunnel's traffic drops briefly while GCP rebuilds it. As you type, Settings runs the same overlap check that saving would run. Refusals show as errors and the rest as warnings. On HA VPN, the tunnel's two BGP sessions then advertise exactly these ranges.

Keep the node subnet in the list. Without it, the MedHook engine itself can't reach the organization through the tunnel, and the engine warns you.

What the engine checks

The overlap check runs when you create a tunnel or change its subnets. It checks your local ranges the same way it checks remote subnets:

The local range overlapsResult
This tunnel's own remote subnetsRefused. A range can't be on both sides of one tunnel.
Another tunnel's remote subnetsWarning, naming the tunnel and both ranges
The cluster's pod or service rangeWarning. Those addresses are inside the cluster.
A VPN tunnel created outside MedHook in the projectWarning, naming the tunnel, its region and the ranges

A warning never stops the change. The API returns warnings in warnings, and New tunnel and Settings show them.

2. Reach the tunnels from your other VPCs

The tunnels' routes live in the VPC MedHook runs in: static routes for Classic VPN, and BGP-learned routes for HA VPN. Your applications' VPCs need those routes too. There are two ways to give them.

Option A: VPC peering

List your VPCs in vpn_peer_networks:

hcl
vpn_peer_networks = [
  { name = "apps", network = "projects/my-apps/global/networks/apps-vpc" },
]

Terraform peers the MedHook VPC with each of them, with export_custom_routes = true. The tunnels' static and BGP-learned routes are offered to your VPC, and nothing of yours is imported into MedHook's.

A peering has two halves, one in each project. Create your half yourself, with import custom routes on:

bash
gcloud compute networks peerings create medhook \
  --project=my-apps --network=apps-vpc \
  --peer-project=MEDHOOK_PROJECT --peer-network=MEDHOOK_VPC \
  --import-custom-routes

Then add your VPC's ranges to vpn_extra_local_ranges, so the organization's side sends traffic for them into the tunnel.

Peering is not transitive. A VPC peered with your apps VPC doesn't see the tunnels. Peer each VPC that needs them, or use a hub.

Option B: a hub VPC

If MedHook is installed into your existing hub VPC, the tunnels are already in the network your applications reach through the hub, so no peering is needed. Add the spoke and on-prem ranges to vpn_extra_local_ranges so the tunnels carry them. Your hub's routing does the rest: shared VPC, Network Connectivity Center, or its own peering, exporting custom routes.

Whichever you use, open your firewall rules for the traffic. MedHook creates no firewall rules for your applications.

3. What the organization changes on their firewall

Their tunnel must protect your ranges as well as MedHook's node subnet:

  • Classic VPN (policy-based). Add your ranges to the local networks of the tunnel's phase 2 selectors (the "remote" side, from their point of view). Each new range is a new selector pair on most firewalls.
  • HA VPN (BGP). Accept the new prefixes from MedHook's Cloud Router. If they filter what they import, add your ranges to that filter.

The peer config, every firewall format (Cisco ASA, Juniper, pfSense, strongSwan, Fortinet, Palo Alto, IOS) and the connection packet list the tunnel's local ranges as MedHook's protected networks. After you change the ranges, send the organization the config again. A config they downloaded earlier still has the old ranges.

PHI and audit scope

MedHook audits only its own messages on the tunnel. The workflows that send and receive through it are logged, masked and kept under your retention settings. Traffic between your other applications and the organization is not logged, filtered or masked by MedHook. Your own controls must cover it, and your BAA with the organization must cover it too.

On the Tunnels page, a tunnel whose local ranges go beyond the node subnet shows a Carries non-MedHook traffic badge. Its Overview shows a note about the audit scope, which each viewer can dismiss.