Fortinet Document Library

Version:

Version:

Version:


Table of Contents

Administration Guide

Download PDF
Copy Link

CLI script action

CLI scripts can run when an automation stitch is triggered. The output of the script can be sent as an email action.

In this example, the script sets the idle timeout value to 479 minutes, and sends an email with the script output.

To configure a stitch with a CLI script action in the GUI:
  1. Go to Security Fabric > Automation and click Create New.
  2. Enter the stitch name (auto-cli-1).
  3. Configure the trigger:
    1. Click Add Trigger.
    2. Click Create and select Security Rating Summary.
    3. Enter the following:

      Name

      auto-cli-1

      Report

      Security Posture

    4. Click OK.
    5. Select the trigger in the list and click Apply.
  4. Configure the CLI Script action:
    1. Click Add Action.
    2. Click Create and select CLI Script.
    3. Enter the following:

      Name

      admintimeout

      Required

      Enable

      Script

      config system global
          set admintimeout 479
      end

      Administrator profile

      Select a profile

    4. Click OK.
    5. Select the action in the list and click Apply.
  5. Configure the Email notification action:
    1. Click Add Action.
    2. Click Create and select Email.
    3. Enter the following:

      Name

      auto-cli-1_email

      To

      Enter an email address

      Subject

      CSF stitch alert

      Body

      %%results%%

    4. Click OK.
    5. Select the action in the list and click Apply.
  6. Click OK.
To configure a stitch with a CLI script action in the CLI:
  1. Create the automation trigger:
    config system automation-trigger
        edit "auto-cli-1"
            set event-type security-rating-summary
        next
    end
  2. Create the automation actions:
    config system automation-action
        edit "admintimeout"
            set action-type cli-script
            set minimum-interval 0
            set delay 0
            set required enable
            set script "config system global
                set admintimeout 479
                end"
            set accprofile "super_admin"
        next
        edit "auto-cli-1_email"
            set action-type email
            set email-to "admin@fortinet.com"
            set email-subject "CSF stitch alert"
            set message "%%results%%"
            set minimum-interval 0
        next
    end
    
  3. Create the automation stitch:
    config system automation-stitch
        edit "auto-cli-1"
            set status enable
            set trigger "auto-cli-1"
            set action "admintimeout" "auto-cli-1_email"
        next
    end

Sample email

The email sent by the action will look similar to the following:

CLI script action

CLI scripts can run when an automation stitch is triggered. The output of the script can be sent as an email action.

In this example, the script sets the idle timeout value to 479 minutes, and sends an email with the script output.

To configure a stitch with a CLI script action in the GUI:
  1. Go to Security Fabric > Automation and click Create New.
  2. Enter the stitch name (auto-cli-1).
  3. Configure the trigger:
    1. Click Add Trigger.
    2. Click Create and select Security Rating Summary.
    3. Enter the following:

      Name

      auto-cli-1

      Report

      Security Posture

    4. Click OK.
    5. Select the trigger in the list and click Apply.
  4. Configure the CLI Script action:
    1. Click Add Action.
    2. Click Create and select CLI Script.
    3. Enter the following:

      Name

      admintimeout

      Required

      Enable

      Script

      config system global
          set admintimeout 479
      end

      Administrator profile

      Select a profile

    4. Click OK.
    5. Select the action in the list and click Apply.
  5. Configure the Email notification action:
    1. Click Add Action.
    2. Click Create and select Email.
    3. Enter the following:

      Name

      auto-cli-1_email

      To

      Enter an email address

      Subject

      CSF stitch alert

      Body

      %%results%%

    4. Click OK.
    5. Select the action in the list and click Apply.
  6. Click OK.
To configure a stitch with a CLI script action in the CLI:
  1. Create the automation trigger:
    config system automation-trigger
        edit "auto-cli-1"
            set event-type security-rating-summary
        next
    end
  2. Create the automation actions:
    config system automation-action
        edit "admintimeout"
            set action-type cli-script
            set minimum-interval 0
            set delay 0
            set required enable
            set script "config system global
                set admintimeout 479
                end"
            set accprofile "super_admin"
        next
        edit "auto-cli-1_email"
            set action-type email
            set email-to "admin@fortinet.com"
            set email-subject "CSF stitch alert"
            set message "%%results%%"
            set minimum-interval 0
        next
    end
    
  3. Create the automation stitch:
    config system automation-stitch
        edit "auto-cli-1"
            set status enable
            set trigger "auto-cli-1"
            set action "admintimeout" "auto-cli-1_email"
        next
    end

Sample email

The email sent by the action will look similar to the following: