GuíasGuides · Nivel 4Level 4

Fortinet FortiGate: políticas con mínimo privilegio, VPN con Entra ID, túneles entre sedes y un usuario que no llegaFortinet FortiGate: least-privilege policies, VPN with Entra ID, site tunnels and a user who can't get through

Interfaces, zonas y objetos con nombre, una política que solo deja pasar lo necesario y lo registra, la VPN de usuarios autenticada contra Entra ID con grupos que deciden qué ve cada uno, un túnel IPsec entre sedes, dos circuitos con SD-WAN, la actualización de firmware y el diagnóstico de un usuario de VPN que no llega a una aplicación.Interfaces, zones and named objects, a policy that lets through only what is needed and logs it, user VPN authenticated against Entra ID with groups deciding what each person sees, a site-to-site IPsec tunnel, two circuits with SD-WAN, firmware upgrades and diagnosing a VPN user who can't reach an application.

Qué vas a conseguir

Un FortiGate (FortiOS 7.4 o 7.6) que se lee de un vistazo: interfaces agrupadas en zonas, objetos con nombre en lugar de IP sueltas, políticas que dejan pasar lo justo y lo registran, y una VPN de usuarios en la que el grupo de cada persona en Entra ID decide qué aplicaciones alcanza. Y la forma de responder en minutos al ticket "estoy en la VPN y no llego a la aplicación".

Antes de empezar

  • Acceso de administración por HTTPS o SSH solo desde la red de gestión (trusted hosts en el administrador), con usuario nominal y MFA. La cuenta admin local, solo para emergencias.
  • Una copia de la configuración antes de cada cambio, y el cambio aprobado.
  • El plano: qué puerto es cada interfaz, qué redes hay detrás de cada una, qué circuitos tiene la sede y qué aplicaciones internas deben ver los usuarios remotos.

1. Interfaces, zonas y objetos

Las políticas se escriben entre zonas, no entre puertos (si la red de servidores crece a otro puerto, se añade a la zona y ninguna política cambia), y hacia objetos y grupos con nombre, no hacia IP sueltas.

FW-SEDE-01 · zonas, objetos y una política
config system zone    edit "LAN-SERVIDORES"        set interface "port3" "port4"        set intrazone deny    nextendconfig firewall policy    edit 0        set name "VPN-RRHH-a-apps-RRHH"        set srcintf "vpn-usuarios"        set dstintf "LAN-SERVIDORES"        set srcaddr "VPN-POOL-USUARIOS"        set dstaddr "GRP-APPS-RRHH"        set groups "VPN-RRHH"        set service "HTTPS"        set schedule "always"        set action accept        set ssl-ssh-profile "certificate-inspection"        set logtraffic all    nextend
  • GRP-APPS-RRHH es un grupo de direcciones (Policy & Objects › Addresses) con un objeto por servidor, como SRV-APP-NOMINAS (10.50.20.15/32).
  • Mínimo privilegio es origen concreto, destino concreto y servicio concreto. all en destino o ALL en servicio solo se aceptan con fecha de caducidad y un motivo en el comentario.
  • set logtraffic all registra también lo permitido: sin él, una investigación no sabe quién llegó a dónde.
  • El orden importa: se evalúa de arriba abajo y gana la primera que coincide. Al final siempre está la política implícita 0, que deniega.

Inspección SSL. certificate-inspection solo lee el certificado del servidor; deep-inspection descifra y necesita que los equipos confíen en la CA del FortiGate (distribuida por Intune o GPO), con excepciones para banca, salud y aplicaciones que fijan su certificado.

2. La VPN de usuarios: Entra ID, grupos y lo que ve cada uno

El cambio de dirección de Fortinet. En FortiOS 7.6.3 y posteriores el modo túnel de SSL-VPN ya no existe; el modo web sobrevive con el nombre de Agentless VPN, desactivado por defecto. En los modelos con poca memoria la retirada llegó antes (incluso en ramas 7.2 y 7.4). La recomendación del fabricante es IPsec en modo dial-up con IKEv2 y FortiClient. Si aún tienes SSL-VPN, planifica la migración.

La autenticación contra Entra ID por SAML en IPsec IKEv2 necesita FortiClient 7.2 o posterior. El esquema:

  1. En Entra ID, una aplicación empresarial con el FortiGate como proveedor de servicio, una notificación username con el UPN y la de grupos con el ID de objeto de los grupos asignados.
  2. En el FortiGate, el servidor SAML (config user saml) y un grupo de usuarios por perfil de acceso que mapea ese ID de objeto.
  3. El servidor SAML en la interfaz WAN y el túnel dial-up con IKEv2, EAP y un rango para los clientes:
FW-SEDE-01 · VPN dial-up IKEv2 con SAML
config system interface    edit "wan1"        set ike-saml-server "entra-vpn"    nextendconfig vpn ipsec phase1-interface    edit "vpn-usuarios"        set type dynamic        set interface "wan1"        set ike-version 2        set mode-cfg enable        set ipv4-start-ip 10.212.134.1        set ipv4-end-ip 10.212.134.254        set eap enable        set eap-identity send-request        set proposal aes256gcm-prfsha384        set dhgrp 20    nextend
  • Los grupos deciden qué ve cada usuario: VPN-RRHH tiene una política hacia las aplicaciones de RRHH, VPN-IT otra hacia la red de gestión. Un usuario que está en dos grupos alcanza la suma de ambos, nada más.
  • Pon los grupos en las políticas, no en authusrgrp de la fase 1, si quieres un perfil por grupo. Fortinet advierte de no mezclar ambos sitios.
  • Con SAML, el MFA y las reglas de Conditional Access los aplica Entra ID antes de que el túnel se levante.
  • Con LDAP (o RADIUS con NPS) el esquema es el mismo: grupos del FortiGate que apuntan a grupos de AD y las mismas políticas.

3. Un túnel IPsec entre sedes

Dos sedes, 10.10.0.0/16 y 10.30.0.0/16, un túnel IKEv2 con clave precompartida larga (o certificados), dos políticas (una en cada sentido) y las rutas:

FW-SEDE-01 · túnel a la sede de Bilbao
config vpn ipsec phase1-interface    edit "a-sede-bio"        set interface "wan1"        set ike-version 2        set proposal aes256-sha256        set dhgrp 20        set remote-gw 198.51.100.20        set psksecret <clave-larga-del-gestor-de-secretos>    nextendconfig vpn ipsec phase2-interface    edit "a-sede-bio-p2"        set phase1name "a-sede-bio"        set proposal aes256-sha256        set dhgrp 20        set src-subnet 10.10.0.0 255.255.0.0        set dst-subnet 10.30.0.0 255.255.0.0    nextendconfig router static    edit 0        set dst 10.30.0.0 255.255.0.0        set device "a-sede-bio"    next    edit 0        set dst 10.30.0.0 255.255.0.0        set blackhole enable        set distance 254    nextend

La ruta blackhole con distancia 254 evita que, con el túnel caído, el tráfico hacia la otra sede salga a internet por la ruta por defecto. Propuestas y grupos DH iguales en los dos extremos, o el túnel no sube; get vpn ipsec tunnel summary dice si está arriba.

Dos circuitos con SD-WAN. En Network › SD-WAN se añaden wan1 y wan2 como miembros con su puerta de enlace, un Performance SLA que mide latencia, jitter y pérdida contra un destino fiable, y reglas que mandan cada tipo de tráfico por el circuito que cumple el SLA (por ejemplo, Microsoft 365 y voz por el de menor latencia). Las políticas de salida apuntan a la zona SD-WAN.

4. Firmware y copias de configuración

  • La ruta de actualización no se improvisa: la herramienta Upgrade Path de Fortinet indica las versiones intermedias obligatorias entre la tuya y la de destino. Saltarse una puede dejar parte de la configuración sin convertir.
  • Antes de actualizar: copia de configuración, notas de versión (cambios incompatibles y funciones retiradas) y ventana de cambio. En HA se actualiza el clúster y los nodos van por turnos.
  • Las copias se sacan desde el menú del administrador (Configuration › Backup, cifradas con contraseña) o por CLI con execute backup config sftp hacia un servidor de copias, programadas a diario y guardadas fuera del propio equipo.

5. El ticket: "estoy en la VPN y no llego a la aplicación de nóminas"

Javier Ruiz se conecta a la VPN sin problema, pero https://nominas.contoso.local no carga. Primero, qué dice el propio FortiGate de él y de la política que debería dejarle pasar:

FW-SEDE-01 · diagnóstico
diagnose firewall auth list10.212.134.19, javier.ruiz  server: entra-vpn  group_name: VPN-COMERCIALdiagnose debug resetdiagnose debug flow filter cleardiagnose debug flow filter addr 10.50.20.15diagnose debug flow filter dport 443diagnose debug flow show function-name enablediagnose debug flow trace start 10diagnose debug enableid=65308 trace_id=1 func=print_pkt_detail line=5939 msg="vd-root:0 received a packet(proto=6, 10.212.134.19:51544->10.50.20.15:443) from vpn-usuarios.  flag [S]"id=65308 trace_id=1 func=vf_ip_route_input_common line=2612 msg="find a route: flag=04000000 gw-10.50.20.15 via port3"id=65308 trace_id=1 func=fw_forward_handler line=989 msg="Denied by forward policy check (policy 0)"diagnose debug disable
Lo que vesQué significaQué haces
Denied by forward policy check (policy 0)Ninguna política coincide: cae en la denegación implícitaRevisar grupo, origen, destino y servicio de la política que debería aplicar
find a route ... via una interfaz inesperadaEl FortiGate enruta el paquete por otro sitioTabla de rutas (get router info routing-table all) y SD-WAN

Aquí el registro de autenticación lo dice todo: Javier está en VPN-COMERCIAL y la política hacia las aplicaciones de RRHH solo admite VPN-RRHH. No es una avería, es una petición de acceso: se tramita con su responsable y, si se aprueba, se le añade al grupo en Entra ID. No se amplía la política.

Si la política sí coincide y la aplicación no responde, diagnose sniffer packet any 'host 10.50.20.15 and port 443' 4 20 l muestra 20 paquetes con su interfaz: si sale el SYN por port3 y no vuelve el SYN-ACK, el problema está en el servidor, en su cortafuegos o en su ruta de vuelta al rango de la VPN.

diagnose debug flow sin filtros consume CPU en un equipo cargado: filtra por dirección y puerto, limita la traza y termina con diagnose debug disable.

6. Lo que revisas cada mes

  • Políticas sin tráfico en 90 días (columna Hit count / Last used): se desactivan y, si nadie las reclama, se borran.
  • Políticas con all en destino o servicio y su fecha de caducidad.
  • Miembros de los grupos de VPN en Entra ID frente a lo que necesita cada persona.
  • Versión de FortiOS frente a los avisos de seguridad del PSIRT de Fortinet: los equipos expuestos a internet con un aviso crítico se actualizan esa semana, no en el siguiente trimestre.

Siguientes pasos

  • La guía de Cisco: switches y routers cubre lo que hay detrás del FortiGate en la sede: VLANs, troncales y el router con circuito de respaldo.
  • Entra ID: SSO/SAML explica la aplicación empresarial y las notificaciones que usa la VPN, y Entra ID: Conditional Access las reglas que se aplican antes de que el túnel suba.
  • Microsoft Sentinel: los registros del FortiGate enviados por syslog (CEF) permiten correlacionar conexiones VPN con inicios de sesión de Entra ID.

¿Falta algo o en tu entorno es distinto? Escríbeme y lo corrijo.

What you'll get

A FortiGate (FortiOS 7.4 or 7.6) that reads at a glance: interfaces grouped into zones, named objects instead of loose IPs, policies that let through just enough and log it, and a user VPN where each person's group in Entra ID decides which applications they reach. And the way to answer the ticket "I'm on the VPN and can't reach the app" in minutes.

Before you start

  • Admin access over HTTPS or SSH only from the management network (trusted hosts on the administrator), with a named account and MFA. The local admin account for emergencies only.
  • A copy of the configuration before every change, and the change approved.
  • The map: which port is each interface, which networks sit behind each, which circuits the site has and which internal applications remote users must see.

1. Interfaces, zones and objects

Policies are written between zones, not ports (if the server network grows onto another port, it is added to the zone and no policy changes), and towards named objects and groups, not loose IPs.

FW-SITE-01 · zones, objects and a policy
config system zone    edit "LAN-SERVERS"        set interface "port3" "port4"        set intrazone deny    nextendconfig firewall policy    edit 0        set name "VPN-HR-to-HR-apps"        set srcintf "vpn-users"        set dstintf "LAN-SERVERS"        set srcaddr "VPN-POOL-USERS"        set dstaddr "GRP-APPS-HR"        set groups "VPN-HR"        set service "HTTPS"        set schedule "always"        set action accept        set ssl-ssh-profile "certificate-inspection"        set logtraffic all    nextend
  • GRP-APPS-HR is an address group (Policy & Objects › Addresses) with one object per server, such as SRV-APP-PAYROLL (10.50.20.15/32).
  • Least privilege means a specific source, a specific destination and a specific service. all as destination or ALL as service is only accepted with an expiry date and a reason in the comment.
  • set logtraffic all logs allowed traffic too: without it, an investigation can't tell who reached what.
  • Order matters: policies are evaluated top down and the first match wins. At the bottom there is always implicit policy 0, which denies.

SSL inspection. certificate-inspection only reads the server's certificate; deep-inspection decrypts and needs devices to trust the FortiGate's CA (deployed through Intune or GPO), with exemptions for banking, health and applications that pin their certificate.

2. The user VPN: Entra ID, groups and what each user sees

Fortinet's change of direction. In FortiOS 7.6.3 and later, SSL-VPN tunnel mode no longer exists; web mode survives under the name Agentless VPN, disabled by default. On low-memory models the removal came earlier (even on the 7.2 and 7.4 branches). The vendor's recommendation is dial-up IPsec with IKEv2 and FortiClient. If you still run SSL-VPN, plan the migration.

Authenticating against Entra ID over SAML on IKEv2 IPsec needs FortiClient 7.2 or later. The outline:

  1. In Entra ID, an enterprise application with the FortiGate as service provider, a username claim with the UPN and the groups claim with the object ID of the assigned groups.
  2. On the FortiGate, the SAML server (config user saml) and one user group per access profile mapping that object ID.
  3. The SAML server on the WAN interface and the dial-up tunnel with IKEv2, EAP and a range for the clients:
FW-SITE-01 · IKEv2 dial-up VPN with SAML
config system interface    edit "wan1"        set ike-saml-server "entra-vpn"    nextendconfig vpn ipsec phase1-interface    edit "vpn-users"        set type dynamic        set interface "wan1"        set ike-version 2        set mode-cfg enable        set ipv4-start-ip 10.212.134.1        set ipv4-end-ip 10.212.134.254        set eap enable        set eap-identity send-request        set proposal aes256gcm-prfsha384        set dhgrp 20    nextend
  • Groups decide what each user sees: VPN-HR has a policy to the HR applications, VPN-IT another to the management network. A user in two groups reaches the sum of both, nothing more.
  • Put the groups in the policies, not in phase 1's authusrgrp, if you want one profile per group. Fortinet warns against mixing both places.
  • With SAML, MFA and Conditional Access rules are enforced by Entra ID before the tunnel comes up.
  • With LDAP (or RADIUS with NPS) the outline is the same: FortiGate groups pointing at AD groups and the same policies.

3. A site-to-site IPsec tunnel

Two sites, 10.10.0.0/16 and 10.30.0.0/16, an IKEv2 tunnel with a long pre-shared key (or certificates), two policies (one each way) and the routes:

FW-SITE-01 · tunnel to the Bilbao site
config vpn ipsec phase1-interface    edit "to-site-bio"        set interface "wan1"        set ike-version 2        set proposal aes256-sha256        set dhgrp 20        set remote-gw 198.51.100.20        set psksecret <long-key-from-the-secrets-manager>    nextendconfig vpn ipsec phase2-interface    edit "to-site-bio-p2"        set phase1name "to-site-bio"        set proposal aes256-sha256        set dhgrp 20        set src-subnet 10.10.0.0 255.255.0.0        set dst-subnet 10.30.0.0 255.255.0.0    nextendconfig router static    edit 0        set dst 10.30.0.0 255.255.0.0        set device "to-site-bio"    next    edit 0        set dst 10.30.0.0 255.255.0.0        set blackhole enable        set distance 254    nextend

The blackhole route with distance 254 stops traffic for the other site leaking to the internet through the default route while the tunnel is down. Proposals and DH groups must match at both ends or the tunnel won't come up; get vpn ipsec tunnel summary says whether it is up.

Two circuits with SD-WAN. Under Network › SD-WAN you add wan1 and wan2 as members with their gateway, a Performance SLA that measures latency, jitter and loss against a reliable target, and rules that send each kind of traffic over the circuit that meets the SLA (for example, Microsoft 365 and voice over the lowest-latency one). Outbound policies point to the SD-WAN zone.

4. Firmware and configuration backups

  • The upgrade path is not improvised: Fortinet's Upgrade Path tool lists the mandatory intermediate versions between yours and the target. Skipping one can leave part of the configuration unconverted.
  • Before upgrading: a configuration backup, the release notes (incompatible changes and removed features) and a change window. In HA you upgrade the cluster and the nodes go in turn.
  • Backups are taken from the administrator menu (Configuration › Backup, encrypted with a password) or from the CLI with execute backup config sftp to a backup server, scheduled daily and kept off the device itself.

5. The ticket: "I'm on the VPN and can't reach the payroll app"

Javier Ruiz connects to the VPN without trouble, but https://payroll.contoso.local won't load. First, what the FortiGate itself says about him and about the policy that should let him through:

FW-SITE-01 · diagnosis
diagnose firewall auth list10.212.134.19, javier.ruiz  server: entra-vpn  group_name: VPN-SALESdiagnose debug resetdiagnose debug flow filter cleardiagnose debug flow filter addr 10.50.20.15diagnose debug flow filter dport 443diagnose debug flow show function-name enablediagnose debug flow trace start 10diagnose debug enableid=65308 trace_id=1 func=print_pkt_detail line=5939 msg="vd-root:0 received a packet(proto=6, 10.212.134.19:51544->10.50.20.15:443) from vpn-users.  flag [S]"id=65308 trace_id=1 func=vf_ip_route_input_common line=2612 msg="find a route: flag=04000000 gw-10.50.20.15 via port3"id=65308 trace_id=1 func=fw_forward_handler line=989 msg="Denied by forward policy check (policy 0)"diagnose debug disable
What you seeWhat it meansWhat you do
Denied by forward policy check (policy 0)No policy matches: it falls into the implicit denyCheck group, source, destination and service of the policy that should apply
find a route ... via an unexpected interfaceThe FortiGate routes the packet somewhere elseRouting table (get router info routing-table all) and SD-WAN

Here the authentication list says it all: Javier is in VPN-SALES and the policy to the HR applications only admits VPN-HR. It isn't a fault, it's an access request: it goes through his manager and, if approved, he is added to the group in Entra ID. The policy is not widened.

If the policy does match and the application doesn't respond, diagnose sniffer packet any 'host 10.50.20.15 and port 443' 4 20 l shows 20 packets with their interface: if the SYN leaves on port3 and no SYN-ACK comes back, the problem is the server, its firewall or its return route to the VPN range.

diagnose debug flow without filters eats CPU on a busy device: filter by address and port, limit the trace and finish with diagnose debug disable.

6. What you review each month

  • Policies with no traffic in 90 days (Hit count / Last used column): disabled and, if nobody claims them, deleted.
  • Policies with all as destination or service, and their expiry date.
  • Members of the VPN groups in Entra ID against what each person needs.
  • FortiOS version against Fortinet PSIRT advisories: internet-facing devices with a critical advisory are upgraded that week, not next quarter.

Next steps

  • The Cisco: switches and routers guide covers what sits behind the FortiGate at the site: VLANs, trunks and the router with a backup circuit.
  • Entra ID: SSO/SAML explains the enterprise application and claims the VPN uses, and Entra ID: Conditional Access the rules applied before the tunnel comes up.
  • Microsoft Sentinel: FortiGate logs sent over syslog (CEF) let you correlate VPN connections with Entra ID sign-ins.

Is something missing, or different in your environment? Get in touch and I'll fix it.

Tech Career Lab · newsletter

¿Te ha servido? Cada dos semanas envío una idea práctica para perfiles IT: LinkedIn, proyectos, networking y procesos de selección.Found this useful? Every two weeks I send one practical idea for IT professionals: LinkedIn, projects, networking and hiring processes.

Apúntate y llévate las 33 ideasSign up and get the 33 ideas →