# Connect managed devices to your VPN gateway with their certificate

> Give managed devices an IKEv2 VPN to the gateway you run, signed in to with their Trustaige certificate, decided by Trustaige RADIUS or by the gateway.

Source: https://docs.trustaige.com/manage/vpn-gateway

Replace these placeholders with your organization's own values:

- `<your-vpn-gateway>`: VPN gateway, for example `vpn.example.com`. The Gateway identity on the VPN network’s page in the hub, or its Gateway when no identity is set.
- `<your-office-network>`: Office network, for example `10.20.0.0/16`. One of the Office networks on the VPN network’s page in the hub.

Your office already has a VPN gateway, and people reach it today with a
username, a password and a one-time code. With Trustaige, each managed device
connects to the same gateway with the certificate Trustaige gives it, held in
the device's own hardware. Nobody types anything, and a device that leaves,
or whose owner leaves, loses the VPN with it.

Trustaige delivers the VPN profile and the certificate to every device; the
gateway terminates the tunnel, as it does today. Trustaige runs no VPN server.

## Two ways to decide each connection

| | Trustaige RADIUS decides | The gateway checks the certificate |
|---|---|---|
| How the device signs in | EAP-TLS inside IKEv2, passed through the gateway to Trustaige RADIUS | The device certificate itself, in IKEv2 |
| What is checked on every connection | The device, its owner, its posture and your policies | The certificate's issuer, and its status over OCSP |
| A device that loses its standing | Disconnected within seconds, or at its next sign-in | Refused at its next connection |
| The gateway needs | To pass EAP through to a RADIUS server | To trust your organization's authorities and check OCSP |
| Hub setting, at **Server** | **Trustaige RADIUS** | **The gateway checks the certificate** |

Choose Trustaige RADIUS wherever your gateway can pass EAP through to RADIUS:
it sees the most and acts fastest. Choose the gateway's own check where the
gateway can't pass EAP through, or for a Windows device tunnel that connects
before anyone signs in; see
[A gateway that checks the certificate](/manage/vpn-gateway-certificate).

1. Device → VPN gateway: IKE_SA_INIT, the one proposal
2. VPN gateway → Device: the gateway’s certificate, checked against its identity
3. VPN gateway → Trustaige RADIUS: Access-Request carrying EAP
4. Device ↔ Trustaige RADIUS: EAP-TLS: the device certificate, proved by its hardware key
5. Trustaige RADIUS → VPN gateway: Access-Accept with Session-Timeout, or Access-Reject
6. VPN gateway → Device: tunnel up, to the office networks

The TLS session runs between the device and Trustaige RADIUS. The gateway
relays it and can't read it.

## Guides for your gateway

| Gateway | Trustaige RADIUS decides | The gateway checks the certificate |
|---|---|---|
| strongSwan 6 | [strongSwan](/manage/vpn-gateway-strongswan) | [strongSwan, gateway-checked](/manage/vpn-gateway-strongswan#the-gateway-checks-the-certificate) |
| FortiGate (FortiOS 7.2 and later) | [FortiGate](/manage/vpn-gateway-fortigate) | [FortiGate, gateway-checked](/manage/vpn-gateway-fortigate#the-gateway-checks-the-certificate) |
| MikroTik RouterOS 7 | [MikroTik](/manage/vpn-gateway-mikrotik) | [MikroTik, gateway-checked](/manage/vpn-gateway-mikrotik#the-gateway-checks-the-certificate) |
| Any other IKEv2 gateway | This page, with the gateway's own documentation | [A gateway that checks the certificate](/manage/vpn-gateway-certificate) |

## Set up the VPN in the hub

1. **Add the network.** Open **Devices › Networks**, choose **Add network**,
   and at **Kind** choose **VPN**.

2. **Network.** Name it, then enter:
   - **Gateway**: the name or address devices dial, for example
     `vpn.example.com`.
   - **Gateway identity**: the name on the gateway's certificate, only when it
     differs from the **Gateway**. Devices accept the gateway only under this
     identity.
   - **The gateway's certificate**: **From a public authority** when a public
     CA issued it, or **From your own authority**, with that authority's
     certificate in PEM. Devices trust the authority you give for this VPN
     only.
   - **What the VPN carries**: **The office's networks**, with your **Office
     networks** (for example `10.20.0.0/16, 192.168.50.0/24`), or **All
     traffic**.
   - **DNS servers** and **Office domains**, optional.

3. **Server.** Choose **Trustaige RADIUS**, or **The gateway checks the
   certificate**.

4. **Who may join** and **Devices.** Choose whose devices receive the VPN.
   **Review** shows what each platform receives.

5. **Done.** With Trustaige RADIUS, serve the VPN at the site whose gateway
   will send its sign-ins, then register the gateway (below). With the
   gateway's own check, choose **Set up your gateway** for the trust bundle and
   status addresses.

## Connect the gateway to Trustaige RADIUS

The gateway is registered at a site, like an access point, and sends Trustaige
the sign-in of every connection to its VPN, and of nothing else.

1. **Serve the VPN at the site.** Open **Devices › Networks › Sites** and the
   site, or connect one, and serve the VPN under **Networks served**. A gateway
   can be registered only for a VPN its site already serves.

2. **Register the gateway.** Under **Access points**, choose **Add access
   point**, then **A VPN gateway**, and the make: **strongSwan**,
   **FortiGate**, **MikroTik** or **Other**. If the site serves more than one
   VPN on Trustaige RADIUS, choose **The VPN it serves**. Name it, and enter
   the **Public address** its RADIUS requests reach the internet from. A
   gateway on the office network can send through the site's connector
   instead, from its **Office network address**.

3. **Disconnects.** Turn on **Takes disconnects** only where the gateway ends
   a tunnel on a Disconnect-Request (see [Disconnects](#disconnects)).
   Otherwise choose under **Connections sign in again every**: 15 minutes, 30
   minutes, 1 hour (the default) or 4 hours.

4. **Register gateway**, then copy the values the hub shows: the **Server**
   (or **Primary server** and **Secondary server**), the **Port**, and the
   shared secret, shown once.

Each guide sets the gateway up with these values. The gateway must sign every
Access-Request with Message-Authenticator, which every gateway does for EAP.

## The one proposal

Every device proposes exactly one suite, and the gateway must offer it. A
gateway that offers anything else fails at the first message.

| | IKE SA | Tunnel (child SA) |
|---|---|---|
| Encryption | AES-256 (CBC) | AES-256-GCM, 16-byte ICV |
| Integrity and PRF | HMAC-SHA-256 | None separate (GCM) |
| Key exchange | Group 19 (ECP-256) | PFS with group 19 (ECP-256) |
| Lifetime | 8 hours | 1 hour |

In strongSwan's notation that is `aes256-sha256-ecp256` for IKE and
`aes256gcm16-ecp256` for the tunnel. Configure no fallback: Windows proposes
MODP-1024 when it is sent no suite, which is why every profile sends this one.

## The gateway's certificate

Devices check the gateway's own certificate before they send anything about
themselves. It must:

- carry the extended key usage `serverAuth`;
- name the **Gateway identity** (or the **Gateway**, when no identity is set)
  in its subject alternative name: `DNS:<your-vpn-gateway>`. If devices dial an
  IP address, put that address in as a DNS name entry, `DNS:203.0.113.10`,
  beside an IP address entry; Windows matches only DNS name entries;
- chain to a public CA, or to the authority you gave under **From your own
  authority**. The gateway sends its intermediate certificates with its own;
- hold an RSA key (2048 bits or more) on a VPN that Trustaige RADIUS decides,
  and an ECDSA P-256 key on one the gateway checks. Apple devices expect the
  gateway's key to be of the type their profile names: RSA unless told
  otherwise, and ECDSA P-256 when they sign in with their own certificate.

The identity devices expect is the one the hub shows on the VPN network's page,
here `<your-vpn-gateway>`. Each guide sets the gateway's IKE identity to it.

## Routes

On a VPN that carries **The office's networks**, the gateway's traffic
selectors must be exactly your **Office networks**, for example
`<your-office-network>`. Apple devices take their routes from the gateway, not
from the profile, so a network the gateway offers and the hub doesn't list
still reaches Apple devices, and one the gateway doesn't offer reaches nobody.
On a VPN that carries **All traffic**, the gateway offers `0.0.0.0/0`.

## Disconnects

Trustaige RADIUS answers every accepted connection with a `Session-Timeout`
and `Termination-Action` set to `RADIUS-Request`, so the gateway has the device
sign in again, and decides it again, before the timeout. What happens when a
device loses its standing between sign-ins depends on the gateway's
**Takes disconnects** switch:

- **On.** Trustaige sends the gateway a Disconnect-Request within seconds,
  on UDP 3799 unless you change the port. The site's page shows **Disconnects
  on UDP 3799** beside the gateway; choose it to change the port, and to see
  the addresses Trustaige's requests come from. The gateway must send
  accounting, because Trustaige can end only a session it saw in accounting.
- **Off.** The `Session-Timeout` is no longer than the interval you chose
  under **Connections sign in again every**, and **Disconnect now** completes
  when the device next signs in. A gateway that ignores `Session-Timeout`
  re-authenticates at its own IKE re-authentication interval instead; each
  guide sets that interval to the one you chose.

## What devices receive

| Platform | Receives |
|---|---|
| Apple | Supervised iPhones, iPads and Macs connect, signing in with the device's certificate. User Enrollment devices take per-app VPN only. |
| Windows | With Trustaige RADIUS, a VPN for the signed-in person; the PC first enrols a TPM-protected certificate for its person. With the gateway's check, a device tunnel that connects before anyone signs in, on Windows Enterprise and Education only. |
| Android | Android 11 and later connect through the strongSwan app. |

## Check it works

1. On the site's page, keep **Recent joins** in view, or open **Devices ›
   Networks › Activity**.
2. On a managed device that has received the VPN, connect to it.
3. The connection appears as it is decided, with the device and the reason.
   On the VPN network's page, **Recent connections** lists it, and **Connected
   now** shows the session once the gateway sends accounting.
4. To check disconnects, block the device in the hub. With **Takes
   disconnects** on, its tunnel ends within seconds; with it off, at the
   interval you chose.

## Troubleshooting

**The device says the VPN server did not respond, and the gateway logs no proposal chosen**

The gateway doesn't offer the one proposal. Check both the IKE and the tunnel
proposals against [the one proposal](#the-one-proposal), including group 19
for PFS.

**The device refuses the gateway, or says the server certificate is not valid**

The gateway's certificate doesn't name the identity devices expect, lacks
`serverAuth`, or doesn't chain to the authority the VPN names. Compare its
subject alternative names with the **Gateway identity** on the network's page,
and check that the gateway sends its intermediates.

**“Serve the VPN at … first, then connect its gateway.”**

The VPN isn't served at the site you're registering the gateway at. Serve it
under **Networks served**, then register the gateway.

**“… is checked by the gateway itself, so the gateway sends Trustaige no RADIUS.”**

The VPN's server is **The gateway checks the certificate**. Such a gateway is
set up from the network's **Your VPN gateway** page, not registered at a site.

**Activity says “An access point that is not registered sent a request.”**

The gateway's RADIUS requests come from an address that isn't registered.
Register the address the gateway's requests reach the internet from; behind
NAT, that is the NAT's public address.

**Activity says “The device asked for a sign-in method other than a certificate.”**

The gateway or the device started an EAP method other than EAP-TLS, such as
EAP-MSCHAPv2. The gateway must pass EAP through untouched, and the device must
be using the profile Trustaige sent it.

**The connection succeeds but some office networks are unreachable**

The gateway's traffic selectors differ from the VPN's **Office networks**.
Make them the same; Apple devices route only what the gateway offers.
