FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
jera
Staff
Staff
Article Id 307260
Description This article describes that an automation stitch can be used to run a CLI script and bounce the FortiGate interface right after the FortiGate restart
Scope FortiGate.
Solution

To configure the Automation Stitch, go To Security Fabric -> Automation and select 'Create New Automation Stitch'.

 

  1. Define an Automation Trigger: It can be an event, scenario, threshold, log ID, or schedule that will activate the action defined in Automation Stitch.

 

In this guide, a specific FortiOS event log will be used.

To create the trigger select Add Trigger  and  then + Create. Under Miscellaneous, choose the FortiOS Event Log then add an event.

Choose the log 'FortiGate started'. This log is generated every time the FortiGate boots up. Select 'OK' to Save.

 

Untitled.png

 

Select OK to Save.

 

  1. Create the CLI Script: To create the action select Add Action  and + Create. Under General, choose CLI script. Fill out the Script Name. Under the script, input the exact commands to execute the interface reset. In the Administrator Profile, choose Super_Admin. Select OK to save.

 

 Screenshot 2024-03-29 154502.png

 

Apply the Trigger and Action created:

 

Final.png

 

Configure a delay (in seconds) in case the automation does not run. The delay is the interval between the start-up process of FortiGate and the CLI command execution.

 

In CLI:

 

config system automation-trigger

    edit "FORTIGATE_BOOTUP"
        set event-type event-log
        set logid 32009
    next
end

 

config system automation-action

    edit "Interface_Reset"
        set action-type cli-script
        set script "config system interface
            edit port2
                set status down
            end


config system interface
    edit port2
        set status up
    end"
        set accprofile "super_admin"
    next
end

 

config system automation-stitch
    edit "Interface_Reset_FortiGate_starts"
        set trigger "FORTIGATE_BOOTUP"
        config actions
            edit 1
                set action "Interface_Reset"
                set required enable
            next
        end
    next
end

Contributors