# Connect a FortiGate VPN gateway to Trustaige

> Set up a FortiGate dial-up IPsec IKEv2 gateway that relays EAP-TLS to Trustaige RADIUS, or checks Trustaige device certificates itself over OCSP.

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

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-radius-server>`: Trustaige RADIUS server, for example `203.0.113.10`. The Server, or Primary server, the hub shows when you register your RADIUS server at a site.
- `<your-network-ca-id>`: Network authority ID, for example `3b8f6a1e-5c2d-4e7f-9a10-6d4c2b8e1f35`. The ID in the authority’s CRL address, under Your RADIUS server on the network’s page.
- `<your-radius-secret>`: RADIUS shared secret, a secret. The hub shows it once, when you register your RADIUS server at a site.

A FortiGate dial-up IPsec gateway with EAP turned on relays each connection's
EAP-TLS conversation to a RADIUS server and acts on the answer. With Trustaige
RADIUS as that server, managed devices connect with their Trustaige
certificate, using the VPN client built into each platform, and Trustaige
decides every connection by the device, its owner, its posture and your
policies. FortiClient isn't involved.

Read [Connect managed devices to your VPN gateway](/manage/vpn-gateway) first
for the hub's side. This page is for certificate sign-in; to have people sign
in to FortiClient with their passkey instead, see
[Sign in to FortiGate VPN with Trustaige](/manage/vpn-fortigate).

## Before you start

| You need | Why |
|---|---|
| FortiOS 7.2 or later | Fortinet documents IKEv2 with EAP-TLS relayed to an external RADIUS server from 7.2. |
| A certificate for the FortiGate, with its private key | Devices check it before they sign in (see [the gateway's certificate](/manage/vpn-gateway#the-gateways-certificate)). |
| A VPN network in the hub, served at a site, with the FortiGate registered there | The hub gives you the RADIUS servers, the port and the shared secret. |
| UDP 500 and 4500 open to the FortiGate; UDP 1812 out to Trustaige | IKE and NAT traversal in; RADIUS out. |

## In Trustaige

1. Add the VPN network with **Server** set to **Trustaige RADIUS**, and serve
   it at the site, as [the overview](/manage/vpn-gateway#set-up-the-vpn-in-the-hub)
   describes.

2. On the site's page, under **Access points**, choose **Add access point**,
   then **A VPN gateway** and **FortiGate**. Enter the **Public address** the
   FortiGate's RADIUS requests come from.

3. Leave **Takes disconnects** off, and choose an interval under
   **Connections sign in again every**; 1 hour is the default. FortiGate's
   handling of a Disconnect-Request for an IPsec tunnel isn't documented, so
   the FortiGate re-authenticates each tunnel at that interval instead, and
   Trustaige decides it again.

4. Choose **Register gateway**, and copy the **Server** (or **Primary server**
   and **Secondary server**), the **Port** and the shared secret.

## On the FortiGate

The steps use the CLI; each object also exists in the GUI under the same name.
`wan1` and `internal` stand for your WAN and office interfaces.

1. **Import the FortiGate's certificate.** Go to **System → Certificates**,
   choose **Create/Import → Certificate → Import Certificate**, and import the
   certificate with its key, as a PKCS #12 file or a certificate and key pair.
   Name it `trustaige-vpn-gateway`. Import any intermediate that issued it
   under **Import → CA Certificate**, so the FortiGate sends it with its own.

2. **Add Trustaige RADIUS.** One RADIUS server object, with the hub's
   secondary server inside it when there is one: a dial-up gateway with EAP
   supports only one.

   ```text title="FortiOS CLI"
   config user radius
       edit "trustaige"
           set server "<your-radius-server>"
           set secret <your-radius-secret>
           set radius-port 1812
       next
   end
   ```

   Set `radius-port` to the hub's **Port**. If the hub showed a secondary
   server, add `set secondary-server` with it. If the FortiGate has more than
   one public address, add `set source-ip` with the one you registered.

3. **Make a user group for the VPN.** It holds the RADIUS server itself, with
   no group match: everyone Trustaige accepts is in it. Trustaige sends no group
   attributes, and decides who may connect itself.

   ```text title="FortiOS CLI"
   config user group
       edit "trustaige-vpn"
           set member "trustaige"
       next
   end
   ```

4. **Name the office networks.** One address per entry in the VPN's **Office
   networks**, gathered in one group:

   ```text title="FortiOS CLI"
   config firewall address
       edit "trustaige-office-1"
           set subnet <your-office-network>
       next
   end
   config firewall addrgrp
       edit "trustaige-office"
           set member "trustaige-office-1"
       next
   end
   ```

5. **Phase 1.** A dial-up IKEv2 gateway, authenticated by its certificate,
   with EAP for the device:

   ```text title="FortiOS CLI"
   config vpn ipsec phase1-interface
       edit "trustaige-vpn"
           set type dynamic
           set interface "wan1"
           set ike-version 2
           set peertype any
           set net-device disable
           set mode-cfg enable
           set proposal aes256-sha256
           set dhgrp 19
           set authmethod signature
           set certificate "trustaige-vpn-gateway"
           set localid "<your-vpn-gateway>"
           set eap enable
           set eap-identity send-request
           set authusrgrp "trustaige-vpn"
           set keylife 3600
           set reauth enable
           set ipv4-start-ip 10.99.0.10
           set ipv4-end-ip 10.99.0.250
           set ipv4-netmask 255.255.255.0
           set dns-mode manual
           set ipv4-dns-server1 10.20.0.53
           set ipv4-split-include "trustaige-office"
       next
   end
   ```

   - `proposal aes256-sha256` with `dhgrp 19` is the IKE half of
     [the one proposal](/manage/vpn-gateway#the-one-proposal). Name no other
     proposal or group.
   - `localid` is the identity devices expect, the **Gateway identity** on the
     VPN network's page. Fortinet requires it to match the certificate's
     subject alternative name.
   - `eap enable` with `eap-identity send-request` asks the device for its EAP
     identity and relays the EAP-TLS conversation to Trustaige.
   - `authusrgrp` puts the user group on phase 1. Put it here or on the
     firewall policy, not both.
   - `keylife 3600` with `reauth enable` has each tunnel sign in again every
     hour, which repeats EAP-TLS. Set `keylife` to the interval you chose in
     the hub, in seconds. FortiGate doesn't reliably act on Trustaige's
     `Session-Timeout` for IPsec tunnels, so this is what ends a tunnel whose
     device lost its standing. Devices still keep their own 8-hour IKE
     lifetime; IKEv2 lets each side keep its own.
   - The address range, DNS server and split include are your own. Choose a
     range the office routes back to the FortiGate.

6. **Phase 2.** The tunnel half of the proposal, offering only the office
   networks:

   ```text title="FortiOS CLI"
   config vpn ipsec phase2-interface
       edit "trustaige-vpn"
           set phase1name "trustaige-vpn"
           set proposal aes256gcm
           set pfs enable
           set dhgrp 19
           set keylifeseconds 3600
           set src-addr-type name
           set src-name "trustaige-office"
           set dst-addr-type name
           set dst-name "all"
       next
   end
   ```

   The phase 2 source is the FortiGate's side of the tunnel, so
   `trustaige-office` is what devices are offered. Apple devices route only
   that; on a VPN that carries **All traffic**, use `all` there too.

7. **Allow the traffic.** One policy from the tunnel to the office:

   ```text title="FortiOS CLI"
   config firewall policy
       edit 0
           set name "trustaige-vpn-to-office"
           set srcintf "trustaige-vpn"
           set dstintf "internal"
           set srcaddr "all"
           set dstaddr "trustaige-office"
           set action accept
           set schedule "always"
           set service "ALL"
       next
   end
   ```

## Check it works

1. On the FortiGate, start the IKE and authentication debug:

   ```text title="FortiOS CLI"
   diagnose debug application ike -1
   diagnose debug application fnbamd -1
   diagnose debug enable
   ```

2. Connect from a managed device that has received the VPN. The IKE debug
   shows the proposal chosen and EAP starting; `fnbamd` shows the RADIUS
   exchange with `trustaige` and its result.
3. In the hub, the site's **Recent joins** and the network's **Recent
   connections** show the decision. On the FortiGate,
   `diagnose vpn ike gateway list` lists the tunnel.
4. Turn the debug off with `diagnose debug disable` and
   `diagnose debug reset`.

## The gateway checks the certificate

For a VPN whose **Server** is **The gateway checks the certificate**, the
FortiGate authenticates the device certificate itself, trusts only your
organization's authorities, and asks Trustaige for each certificate's status
over OCSP. Nothing is registered at a site. See
[A gateway that checks the certificate](/manage/vpn-gateway-certificate) for
what changes for devices.

1. **Import your authorities.** On the network's page, open **Your VPN
   gateway** and download the trust bundle. The FortiGate imports one CA per
   file: split the bundle, or download each authority's certificate from
   `https://id.trustaige.com/pki/ca/<your-network-ca-id>.crt`, with the ID in
   that authority's CRL address. Import each under **System → Certificates → Import → CA
   Certificate**. The FortiGate names them `CA_Cert_1`, `CA_Cert_2` and so on.

2. **Make a PKI user for the authority.** It admits any certificate the
   authority issued:

   ```text title="FortiOS CLI"
   config user peer
       edit "trustaige-devices"
           set ca "CA_Cert_1"
       next
   end
   ```

3. **Check status over OCSP**, at the address in each device certificate:

   ```text title="FortiOS CLI"
   config vpn certificate setting
       set ocsp-status enable
       set ocsp-option certificate
       set strict-ocsp-check enable
   end
   ```

   `strict-ocsp-check` refuses a certificate whose status is `unknown` or
   can't be fetched, rather than admitting it with a warning.

4. **Change phase 1** to authenticate the device by its certificate, without
   EAP:

   ```text title="FortiOS CLI"
   config vpn ipsec phase1-interface
       edit "trustaige-vpn"
           set peertype peer
           set peer "trustaige-devices"
           set eap disable
           unset authusrgrp
       next
   end
   ```

   The rest of phase 1, phase 2 and the policy stay as above, `keylife` and
   `reauth enable` included.

During a rollover the bundle holds two authorities. Import the new one, make a
second PKI user for it, gather both in a peer group (`config user peergrp`),
and set `peertype peergrp` with `set peergrp` on phase 1.

The FortiGate checks status when a tunnel is set up. A device that loses its
standing is refused at its next connection; one already connected stays until
its tunnel re-authenticates, at `keylife`. Set `keylife` to the longest you'll
allow.

## Troubleshooting

**The IKE debug shows “no proposal chosen”**

The phase 1 or phase 2 proposal differs from the device's. Check
`proposal aes256-sha256` and `dhgrp 19` on phase 1, and `proposal aes256gcm`,
`pfs enable` and `dhgrp 19` on phase 2.

**The device refuses the FortiGate before any RADIUS request**

The device didn't accept the FortiGate's certificate, or `localid` isn't the
identity it expects. Check the certificate's subject alternative names and
`serverAuth`, and that its intermediate is imported.

**fnbamd shows no reply from trustaige**

Nothing came back from Trustaige. Check that outbound UDP to the hub's port is
allowed, that the FortiGate is registered at the address its requests come
from (`source-ip`), and the shared secret.

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

EAP reached Trustaige as something other than EAP-TLS. Check that the device
uses the profile Trustaige sent it, and that phase 1 relays to the `trustaige`
server alone: with another server or local users in the group, the FortiGate
may answer EAP itself.

**The tunnel comes up, but some office networks are unreachable**

The phase 2 source or the policy's destination doesn't hold every office
network. Make `trustaige-office` match the VPN's **Office networks**.

**With the gateway's check, every device is refused after OCSP is turned on**

The FortiGate can't reach `id.trustaige.com` over HTTPS on port 443, or
doesn't fetch OCSP over HTTPS. Check its outbound access first.

## What hasn't been confirmed yet

- Whether FortiOS sends RADIUS accounting for a dial-up IPsec tunnel to the
  RADIUS server in its user group hasn't been recorded in Trustaige's lab.
  Without accounting, connections still appear under **Recent connections**,
  but not under **Connected now**.
- Whether the FortiGate fetches OCSP over HTTPS, as Trustaige's status
  addresses require, hasn't been recorded in the lab.
- A peer group (`peertype peergrp`) for a rollover hasn't been recorded in the
  lab on an IKEv2 dial-up gateway.

## Fortinet documentation

- [Windows IKEv2 native VPN with user certificate](https://docs.fortinet.com/document/fortigate/7.6.6/administration-guide/726232/windows-ikev2-native-vpn-with-user-certificate): EAP-TLS relayed to a RADIUS server
- [`config vpn certificate setting`](https://docs.fortinet.com/document/fortigate/7.2.3/cli-reference/353620): OCSP options
- [FortiOS IKEv2 EAP user authentication](https://community.fortinet.com/t5/FortiGate/Technical-Tip-FortiOS-IKEv2-EAP-user-authentication-operation/ta-p/418199)
