Skip to main content
  1. Fortinet/

Enforcing VPN Connections with Security Posture Tags

Table of Contents

Introduction
#

When protecting communications from remote users trying to access an internal resource behind FortiGate, different options exist for applying authentication and authorization.

First, for authentication the following options can be used:

  • SSL-VPN: commonly used for remote access from individual users over TLS on TCP/443. Two different modes are supported: tunnel and web.
  • IPsec VPN: typically used for site-to-site connectivity. However, a dial-up VPN can be setup to support remote users. Furthermore, using IKEv2 (instead of IKEv1), supports configuring TCP over port 443. This enables IKE negotiation over TCP, encapsulating ESP packets inside TCP headers.
  • ZTNA proxy: a private application/service is exposed to remote users using FortiGate as a public proxy. Client certificate authentication and credentials-based authentication are supported. The communication is secured over TLS between the endpoint and the proxy. EMS and licensed FortiClient is required for this authentication method to work properly.
Starting FortiOS 7.6.3, SSL-VPN tunnel mode has been removed and SSL-VPN web mode has been renamed to Agentless VPN.

For VPNs, once the endpoint is connected, it’s fully trusted. While, for ZTNA, the client certificate is checked for each request based on it’s zero trust model.

After the endpoint has authenticated, authorization is enforced via firewall policies. FortiGate allows to define two types of firewall policies:

  • Standard: traditional firewall policies matching source zone/interface/IP/user and destination zone/interface/IP, reinforced with security profiles.
  • ZTNA: similar to standard policies but security posture can be analyzed using security posture tags (previously known as ZTNA tags) for a defined ZTNA server destination.

Security posture tags are not only used for the authorization process on ZTNA firewall policies, they can also be enforced when the user is trying to connect to a VPN tunnel. Following, this will be put to test.

In this article, two different methods are discussed regarding the enforcement of dialup VPN connections from FortiClient using security posture tags.

Topology and Pre-requisites
#

FortiGate IPsec VPN with FortiClient as Dialup client topology
Tested using FortiOS v7.6.4, FortiClient v7.4.4, and EMS v7.4.4.

Enforcing remote access profile with security posture tag
#

This is the one of the two methods that can be used for enforcing security posture on users with FortiClient trying to connect to a VPN dialup on FortiGate. Using this method, the remote access endpoint profile on EMS is configured to enforce VPN connections using security posture tags. In this method, the enforcement is done at the host level; this means that if the connection is rejected, FortiGate won’t see any packet coming from the client (no VPN logs).

For example, the following security posture tag named “Critical Vulnerability” is created for tagging endpoints with at least one critical vulnerability found on the endpoint after a vulnerability scan:

Configuring security posture tag for critical vulnerability on FortiClient EMS

The endpoint trying to connect to the VPN is currently tagged with the “Critical Vulnerability” tag:

FortiClient tagged with security posture tag of Critical Vulnerability

For this scenario, to block any user with a critical vulnerability, i.e. tagged with “Critical Vulnerability” from connecting to the VPN, the following configuration must be applied on the EMS:

  1. On EMS, go to Endpoint Profiles > Remote Access and edit the relevant remote access profile.
  2. Under General section, turn on the Enable Secure Remote Access option:
Enable Secure Remote Access enabled on Remote Access Profile on FortiClient EMS
  1. Select the desired VPN tunnel you are planning to enforce with security posture tag validation, and click on Edit Tunnel:
Edit Tunnel of remote access profile on FortiClient EMS
  1. Go to Advanced Settings section, under Tags you can select a tag and the desired action (allow/prohibit) if the tag is matched for a user trying to connect to the VPN:
Tag enforcement configuration on VPN tunnel of FortiClient EMS

Depending on the selected action the enforcement is as follows:

  • Allow: if the endpoint doesn’t have the selected tag, the VPN connection is rejected.
  • Prohibit: if endpoint has the selected tag, the VPN connection is rejected.

In this example, any endpoint with Critical Vulnerability tag, is prohibited from connecting to the VPN:

Enforcing critical vulnerability tag on VPN tunnel of FortiClient EMS
  1. Optionally, enable the Customize Host Check Fail Warning option, which allows to define a message that will be displayed to users when their connection to the VPN is prohibited:
Configuring Customize Host Check Fail Warning
  1. Save the VPN tunnel configuration, then Save the remote access profile.
  2. From the endpoint tagged with a Critical Vulnerability, the VPN connection will be refused and the defined notification message will pop up as shown:
VPN connection blocked because tag enforcement on FortiClient

An important feature added starting FortiClient 7.4.3 is that endpoints already connected to the VPN are periodically verified for checking their tag compliance status. If the endpoint matches the prohibited security tag or doesn’t have the allowed security tag any more, the VPN is disconnected showing the following error together with the admin-defined pop up message:

VPN disconnected because of tag enforcement - NotCompliance_Ztna Tag

Check FortiClient 7.4.0 New Features - Security posture tag enforcement during VPN connection (7.4.3) as reference.

Enforcing FortiGate Dialup VPN with security posture tag
#

This is the second method that can be used to enforce security posture on users with FortiClient trying to connect to a VPN dialup on FortiGate. This method requires configuring the Authentication section of the VPN on FortiGate by specifying the tag(s) that needs to be matched for allowing the connection of the endpoint. In this method, the enforcement is done at the FortiGate level, so VPN logs would show when a endpoint was rejected because of security posture enforcement.

For example, the endpoint trying to connect to the VPN according to the topology currently has the following tags:

FortiClient tagged with security posture tag of Critical Vulnerability

In this case, to enforce endpoints that have at least one of the following tags:

  • “Telemetry connected”: endpoint with FortiClient connected to the EMS.
  • “Antivirus running”: endpoint with a running antivirus software.

the following configuration is applied on FortiGate::

  1. Go to VPN > VPN Tunnels and edit the IPsec dialup tunnel that will be enforced with security posture tag. Focus on the Authentication section:
VPN tunnel, remote gateway matching Any on FortiGate
IKEv2 is required for applying security posture tags.
  1. Set the Remote gateway matching setting to ZTNA, and then specify the desired Security posture tags:
VPN tunnel, remote gateway matching Any on FortiGate
VPN tunnel, remote gateway matching security posture tags on FortiGate

If multiple tags are selected, at least one tag must match so the client can connect to the VPN.

The equivalent CLI configuration is as follows:

config vpn ipsec phase1-interface
    edit "RA-VPN"
        set remote-gw-match ztna
        set remote-gw-ztna-tags "EMS1_ZTNA_Antivirus running" "EMS1_ZTNA_Telemetry Connected"
    next
end
  1. Press OK to save changes.

In order for FortiGate to properly enforce security posture tags on VPN connections, it’s required to have tag information shared from EMS updated and complete on FortiGate. This means that the tags on FortiGate must resolve to the endpoint IP address(es) that are actually tagged with them.

The IP addresses resolved by the tags correspond to endpoint configured IP address(es), not to the NATed public IP addresses if the client is behind a NAT router.

For EMS to share all endpoints’ resolved IP addresses to the fabric connected FortiGate, even if their gateway don’t point to the linked FortiGate, change Only share FortiClietns connected to this fabric device (Recommended) to Share all FortiClient, under Fabric & Connectors > Fabric Devices:

Share all FortiClients to FortiGate Fabric Device on FortiClient EMS

Check additional information regarding each FortiClient endpoint sharing mode here: FortiClient 7.4.4 EMS Administration Guide - Fabric and also FortiClient 7.4.4 EMS Administration Guide - Matched endpoints and resolved addresses

To confirm all IP addresses resolved by a tag on FortiGate, use the GUI or CLI:

  • On GUI, navigate to Policy & Objects > ZTNA, select Security Posture Tag, hover over the desired tag, and select View resolved addresses:
Telemetry connected security posture tag on FortiGate

The list of resolved IP addresses for the selected tag is shown:

View resolved addresses of security posture tag Telemetry Connected on FortiGate
  • On CLI, execute the following command specifying the dynamic address name:
# diagnose firewall dynamic list [name]
  • For example:
# diagnose firewall dynamic list "EMS1_ZTNA_Telemetry Connected"

CMDB name: EMS1_ZTNA_Telemetry Connected
TAG name: Telemetry Connected
EMS1_ZTNA_Telemetry Connected: ID(81)
        ADDR(172.16.7.3)
        ADDR(10.0.3.2)
Total IP dynamic range blocks: 0.
Total IP dynamic addresses: 2.

Testing security posture tag enforcement
#

Since the user trying to connect is currently tagged with “Telemetry Connected”, the VPN connection is successful:

Connected to IPsec VPN dialup on FortiClient

To verify what happens when no tag is matched, the “Telemetry connected” tag is removed on the FortiGate VPN configuration, only leaving “Antivirus running” which is not currently tagged on the endpoint:

VPN tunnel, remote gateway matching security posture tags on FortiGate

When the user tries to connect to the VPN again, an “EMSTokenCheckFailed” error is shown:

VPN disconnected because of tag enforcement - NotCompliance_Ztna Tag
ZTNA tags failed on VPN connection on FortiClient

On FortiGate, go to Log & Report > System Events and select the VPN Events. Here, an Error log will also specify the reason why the VPN connection was not possible:

FortiGate VPN event logs error because of ZTNA tag check failed

The Reason field of the log indicates EMS ZTNA tags check failed:

FortiGate VPN event log details error because of ZTNA tag check failed

Regarding SSL VPN and Security Posture Tag Enforcement
#

Reference: https://community.fortinet.com/t5/Support-Forum/FortiClient-EMS-7-4-Remote-Access-profile-not-showing-SSL-VPN/m-p/324940

In FortiClient EMS 7.4, the SSL VPN configuration is not available by default because of the security risk implications. Furthermore, SSL VPN is not supported on FortiGate 7.6.3 and above. However, you can still configure SSL VPN on EMS remote access profiles by manually enabling this feature visibility:

  1. Go to System Settings > Feature Select, under Remote Access, enable SSL VPN:
Enabling SSL VPN feature visibility on FortiClient EMS
  1. Accept the warning message clicking on Yes:
Enabling SSL VPN feature visibility warning on FortiClient EMS
  1. Now it’s possible to configure SSL VPN tunnels on remote access profiles and apply security tag posture on them. However, the warning regarding the support of SSL VPN on FortiGate is still valid:
EMS SSL VPN not supported warning on FortiGate 7.6.3

References
#