Description | This article demonstrates the use of X.509 certificates to authenticate a FortiClient to a remote IPsec gateway, using SAML for user authentication. |
Scope | FortiOS v7.2.0 and later, FortiClient v7.2.4 and later. |
Solution |
Example Topology:
Note: X.509 certificates are often referred to as 'SSL certificates', but they are not restricted to use in SSL. If a FortiGate local certificate was in use for SSL VPN before, it can, in many cases, be reused for IPsec VPN.
See Fortinet documentation SAML-based authentication for FortiClient remote access dialup IPsec VPN clients, or Technical Tip: Recommended basic configuration for SSL VPN to IPsec VPN migration with SAML authenti... for more on this step.
Verify SAML authentication is working as expected using a pre-shared key VPN before configuring signature authentication. The remainder of this article assumes a SAML SP for IPsec VPN users is already correctly configured and deployed.
Import the Certificate of the CA that signs VPN client certificates. From the GUI, Navigate to System -> Certificate -> Create/Import -> CA Certificate -> Upload File. After import, the CA certificate will have a name like 'CA_Cert_1'. Optionally, rename the certificate.
config vpn certificate ca rename CA_Cert_1 to 'Private CA' end
This configuration will be used for authenticating the client device in IKEv2 phase1 authentication. The client devices must have certificates signed by the referenced CA.
config user peer edit "peer_admin-ou" set mandatory-ca-verify enable <-- default setting set ca "Private User CA" <--imported CA next end
If multiple CAs are used to sign client certificates, multiple peers can be configured and included in a peergrp.
config user peergrp edit "IKE peers" set member "peer1" "peer2" next end
Note the settings in bold. config vpn ipsec phase1-interface edit "dialup_admin" set type dynamic set interface "port1" set ike-version 2 set authmethod signature set peertype peer set net-device disable set mode-cfg enable set proposal aes256-sha256 set dpd on-idle set dhgrp 20 14 5 set eap enable set eap-identity send-request set eap-cert-auth enable set certificate "vpn.sitea.example.com" set peer "peer_admin-ou" set ipv4-start-ip 10.253.0.100 set ipv4-end-ip 10.253.0.200 set dns-mode auto set ipv4-split-include "Admin Split Tunnel Addresses" set dpd-retryinterval 60 next end
config vpn ipsec phase2-interface edit "dialup_admin" set phase1name "dialup_admin" next end
The SAML server used must be the same one configured on the interface hosting the dial-up IPsec tunnels.
config user group edit "VPN Admin General Access" set member "IKE_SAML" <-- SAML SP configuration in 'config user saml'. next end
If users require different access depending on groups returned in the SAML assertion, additionally configure a group match.
config user group edit "VPN Admin General Access" set member "IKE_SAML" config match edit 1 set server-name "IKE_SAML" set group-name "LAB_org_admin_unpriv" next end next end
config firewall policy edit <index> set name "IPsec RA Admin General Access" set srcintf "dialup_admin" set dstintf "port2" set action accept set srcaddr "IPsec RA Admin Clients" set dstaddr "Admin General Access" set schedule "always" set service "PING" set logtraffic all set groups "VPN Admin General Access" next end
Note: The user group referencing the SAML SP configuration must be configured on the tunnel firewall policy or in the phase1-interface configuration. It must not be configured on both.
For domain-joined endpoints, this may be done automatically via GPO. For an example of how to manually import a certificate using Windows, see Importing user certificate into Windows 10.
The FortiClient SSO port must match the configured auth-ike-saml-port, and the remote gateway should match the CN or SAN in the FortiGate's server certificate.
config system global set auth-ike-saml-port 20443 end
The IKE version must be 2. If visible, NAT Traversal must be enabled in most deployments.
By default, FortiClient accepts any server certificate from FortiGate for authenticating the remote gateway, as long as it is signed by a trusted CA. It is recommended to enable Certificate subject checking to verify that the FQDN of the remote gateway matches the CN or SAN in the subject field.
This setting is supported by both EMS-managed and VPN-only FortiClients. See 'cert_subjectcheck' in IKE settings.
In this case, user peers can be used to direct the VPN connection attempt to the appropriate dial-up gateway.
config user peer edit "peer_admin-ou" set ca "Private CA" set subject "OU=IT" next edit "peer_sales-ou" set ca "Private CA" set subject "OU=SALES" next end
The principal advantage of configuring multiple remote access IPsec gateways is the ability to assign different VPN configurations to different client groups, such as different address pools, split-tunnel routes, and DNS servers. Alternatively, a single IPsec gateway can be used, and access control applied based on matching groups in the firewall policy.
Expected behavior:
Related article: |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.