# Sign in to FortiGate VPN with Trustaige

> Make Trustaige the SAML sign-in for FortiGate SSL VPN and IPsec IKEv2, so people connect with FortiClient and their passkey, matched to FortiGate groups.

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

Replace these placeholders with your organization's own values:

- `<your-vpn-host>`: VPN gateway address, for example `vpn.example.com`. The address people connect to, as entered when setting up the VPN app in the hub.
- `<your-org-id>`: Organization short ID, for example `a1B2c3D4e5F6`. The part after /o/ in your hub’s address.

FortiGate accepts a SAML identity provider for remote access. With Trustaige as
that provider, FortiClient opens Trustaige in the system browser, the person
proves it's them with their passkey, and FortiGate admits them to the user
groups their Trustaige groups map to. The username, password and one-time code
go away.

1. Person → FortiClient: connects with single sign-on
2. FortiClient → FortiGate: asks to sign in
3. FortiGate → Trustaige: AuthnRequest, in the system browser
4. Person ↔ Trustaige: passkey
5. Trustaige → FortiGate: signed assertion: username and group
6. FortiGate → FortiClient: tunnel up

One app serves one FortiGate listener: the SSL VPN port, or the IKE SAML port
for IPsec IKEv2. FortiOS 7.6.3 replaces SSL VPN tunnel mode with IPsec IKEv2,
so new deployments use IPsec.

## Before you begin

| You need | Why |
|---|---|
| FortiOS **7.0.1** or later for SSL VPN; **7.6.1** or later for IPsec IKEv2 | Earlier versions can't send FortiClient to an external browser. |
| FortiClient **7.2.5** or **7.4.1** or later for IPsec IKEv2 | The external browser over IPsec needs both sides. |
| The address and port people connect to | Trustaige builds the FortiGate's SAML URLs from them. |
| A certificate on that address that devices trust | The system browser opens the FortiGate during sign-in, and refuses an untrusted certificate. |
| The permission to manage apps in Trustaige | You create the app and assign its groups. |

## 1. Set up the app in the hub

1. In the hub, go to **Apps**. Under **Integrations**, find **FortiGate VPN**
   and click **Connect**, then **Begin setup**.
2. At **Enter the FortiGate's VPN address**, enter the **VPN address**, for
   example `<your-vpn-host>`, and the **Port**: the SSL VPN listening port, or
   the IKE SAML port for IPsec IKEv2 (1001 unless you changed it). Click
   **Save**.
3. Check the three addresses the hub shows. They're the ones FortiGate shows
   for the same address and port:

   | Hub label | Value |
   |---|---|
   | **Application identifier** | `https://<your-vpn-host>:10443/remote/saml/metadata` |
   | **Reply URL** | `https://<your-vpn-host>:10443/remote/saml/login` |
   | **Sign-out URL** | `https://<your-vpn-host>:10443/remote/saml/logout` |

   Click **I've done this**.

The next step shows Trustaige's own values. Open **Need to enter values
manually?** to see them, and save the **Signing certificate** as a `.pem` file
for the FortiGate.

| Hub label | Value |
|---|---|
| **Identity provider URL** | `https://id.trustaige.com` |
| **Sign-in endpoint** | `https://id.trustaige.com/o/<your-org-id>/saml/sso` |
| **Sign-out endpoint** | `https://id.trustaige.com/o/<your-org-id>/saml/slo` |

**Choose who can connect.** On the app's page, in the **Access** section,
click **Assign groups** and choose the groups whose people use the VPN. These
are the groups FortiGate receives.

## 2. Add Trustaige to the FortiGate

1. Go to **System → Certificates**, click **Import → Remote Certificate**, and
   upload Trustaige's signing certificate.
2. Go to **User & Authentication → Single Sign-On** and click **Create New**.
   Under **SP address**, enter the same address and port as in the hub.
3. For the identity provider, choose **Custom** and enter the **Identity
   provider URL** as the entity ID, the **Sign-in endpoint** as the single
   sign-on URL, the **Sign-out endpoint** as the single logout URL, and the
   certificate you imported.
4. Under **Additional SAML attributes**, set the attribute that identifies users
   to `username` and the attribute that identifies groups to `group`. Both are
   case-sensitive.

The same server in the CLI, for port 10443 and a remote certificate named
`REMOTE_Cert_1`:

```text title="FortiOS CLI"
config user saml
    edit "trustaige"
        set entity-id "https://<your-vpn-host>:10443/remote/saml/metadata"
        set single-sign-on-url "https://<your-vpn-host>:10443/remote/saml/login"
        set single-logout-url "https://<your-vpn-host>:10443/remote/saml/logout"
        set idp-entity-id "https://id.trustaige.com"
        set idp-single-sign-on-url "https://id.trustaige.com/o/<your-org-id>/saml/sso"
        set idp-single-logout-url "https://id.trustaige.com/o/<your-org-id>/saml/slo"
        set idp-cert "REMOTE_Cert_1"
        set user-name "username"
        set group-name "group"
        set digest-method sha256
    next
end
```

## 3. Match Trustaige groups to user groups

Trustaige sends each assigned group the person belongs to, directly or through
a parent group, in the `group` attribute: the group's slug, or its name when it
has none.

1. Go to **User & Authentication → User Groups** and create a **Firewall**
   group.
2. Under **Remote Groups**, add the `trustaige` server and enter the Trustaige
   group this user group stands for.
3. Use the user group in the SSL VPN or IPsec policy.

```text title="FortiOS CLI"
config user group
    edit "vpn-staff"
        set member "trustaige"
        config match
            edit 1
                set server-name "trustaige"
                set group-name "vpn-staff"
            next
        end
    next
end
```

**For IPsec IKEv2**, also name the IKE SAML port and the SAML server on the
interface that receives the connections, and use the user group in the
phase 1 configuration:

```text title="FortiOS CLI"
config system global
    set auth-ike-saml-port 1001
end
config system interface
    edit "wan1"
        set ike-saml-server "trustaige"
    next
end
```

## 4. Turn on FortiClient's external browser

> **Important:** This step is required. FortiClient opens SAML sign-in in an embedded browser
> unless told otherwise, and passkeys are not reliable there. In the system
> browser, passkeys and the device's own sign-in work as everywhere else.

In the FortiClient VPN connection, or the connection in your FortiClient EMS
profile, turn on both:

- **Enable Single Sign On (SSO) for VPN Tunnel**
- **Use external browser as user-agent for saml user authentication**

FortiClient waits for the browser to hand the result back on a local port,
8020 by default, set by `saml-redirect-port` under `config vpn ssl settings`.

## 5. Test a connection

On a device with FortiClient, connect with single sign-on. The system browser
opens your organization's Trustaige sign-in; prove it's you with your passkey,
and FortiClient connects. Each sign-in appears in the hub's **Audit log**.

Policies on the app apply to this sign-in like any other, device trust
included, because it happens in the system browser.

## What Trustaige sends

| | |
|---|---|
| Name ID | The person's email in your organization, format `emailAddress` |
| `username` | The person's email in your organization |
| `group` | The app's assigned groups the person belongs to |
| Signatures | The response and the assertion are both signed |

Trustaige also sends `uid`, `givenName`, `surname`, `displayName`, `roles` and
`deviceId` under their own names; FortiGate ignores them. To rename an
attribute, open the app's menu, choose **Edit app**, and change it under
**Attribute Mappings**.

## Troubleshooting

**The sign-in window says passkeys aren't available**

FortiClient is using its embedded browser. Turn on **Use external browser as
user-agent for saml user authentication** in the connection, and check the
FortiOS and FortiClient versions under [Before you begin](#before-you-begin).

**“no application is configured for this service provider”**

The entity ID the FortiGate sends doesn't match the app's **Application
identifier**. Compare them character for character, port included. To correct
the hub's side, open the app's menu, choose **Edit app**, and change the
**Entity ID**.

**“failed to resolve ACS endpoint: requested ACS URL not registered”**

The FortiGate's single sign-on URL differs from the app's **Reply URL**, often
by the port. Make the two the same.

**“Access denied: you are not assigned to this application”**

The person isn't in any group assigned to the app. Add them to one, or assign
a group they're in.

**The person signs in, but FortiGate refuses the connection**

No user group matched. Check that the `group-name` in the user group is the
Trustaige group exactly as sent (its slug, or its name when it has none), and
that the group is assigned to the app.
