Created on
08-14-2024
09:24 AM
Edited on
05-08-2025
12:45 PM
By
Stephen_G
Description | This article describes how to set up automation to block invalid login attempts for an IPsec dialup tunnel with an automation stitch. |
Scope | FortiGate. |
Solution |
To block the invalid login attempts on IPsec dialup tunnel, check for VPN events with result = XAUTH failure:
If there are multiple XAUTH failure events for unknown IP addresses, an automation stitch can be configured to further block these attempts.
To configure this in the CLI, run the following:
config firewall addrgrp
config system automation-trigger set event-type event-log set logid 37121 config fields edit 1 set name "result" set value "XAUTH authentication failed" next end next end
To configure this in the CLI:
config system automation-action edit "Block remote IP" set action-type cli-script set script "config firewall address edit IP-Block-%%log.remip%% set color 6 set subnet %%log.remip%%/32 end config firewall addrgrp edit VPN_Failed_Login append member IP-Block-%%log.remip%% end" set accprofile "super_admin" next end
Note: If the FortiGate has multi-VDOM enabled, the script also needs to specify the VDOM that the Address Group and IPsec are located in.
To configure this in the CLI:
config system automation-stitch edit "Block IPsec malicious IP" set trigger "ipsec_xauth_failure" config actions edit 1 set action "Block remote IP" set required enable next end next end
The local-in policy (which filters incoming traffic destined for the FortiGate itself) denies traffic sourced from the specified Address Group.
config firewall local-in-policy edit 1 set intf <wan Listening interface> <----- The interface under IPSec VPN settings. next end
Note: If the connection is from a legitimate user who entered the wrong password, the user's IP will need to be manually removed from the group in order to allow them to reconnect. |
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.