Restricting IPsec VPN Access by Geo-Location on FortiGate

Restricting IPsec VPN Access by Geo-Location on FortiGate


In this article, i’ll show you how to restrict IPsec tunnel access on a FortiGate firewall so that only predefined geographic locations (or IP address groups) are allowed.

Background

Until now, we’ve been using SSL-VPN connections on FortiGate firewalls for remote access to customer networks. In the SSL-VPN settings of the GUI, you could easily add an address-group object containing the allowed geo-locations from which users could connect.

However, the FortiGate GUI does not yet support geo-filtering for IPsec tunnels. Fortunately, you can achieve the same result via the CLI.

Step 1: Define Geographic Address Objects

First, create individual address objects for each country you want to allow, then group them:

Here, we’ve created an address group named ipsec_allow_locations that includes Belgium and the Netherlands. We’ll reference this group in our local-in policy.

Step 2: Configure the Local-In Policy

Next, define a local-in policy that applies the address group to IPsec traffic on your WAN interface:

  • Rule 1 permits IKE and ESP traffic sourced from our ipsec_allow_locations group.
  • Rule 2 (placed below) denies all other IPsec traffic—acting as an implicit deny.

Note: Make sure you’re using the correct WAN interface name for your setup (in this example, wan1).

And that’s it! With just a few CLI commands, you’ve locked down your IPsec VPN so only connections from Belgium and the Netherlands are accepted—greatly enhancing your network’s security posture.

Source: (https://community.fortinet.com/t5/FortiGate/Technical-Tip-Restrict-IPsec-VPN-access-to-certain-countries/ta-p/192328) - archived link: https://archive.ph/rrC1Y