Fortinet FortiGate Activate

Fortinet FortiGate Activate

Certified
Enterprise Edition

Validate a FortiGate firmware upgrade without changing the device

FortiOS writes the new image to the alternate partition and reboots in the same API call, so the activate and reload steps cannot be separated on the device. Activate is the safe half: it changes nothing and is safe to retry. It records the running version and checks that the target is a single supported hop from it (system/firmware/upgrade-paths). Multi-hop upgrades are a loop in the flow.

With source: FORTIGUARD it resolves the image ID of the target from the images FortiGuard offers to the device (system/firmware). With source: FILE it checks the SHA-256 of the Kestra file against sha256 before anything is uploaded.

Reload then uploads or downloads the image and reboots. There is no commit step: the previous image stays on the other partition. There is no rollback task: going back is the CLI command execute set-next-reboot, and re-flashing an older image can drop configuration. The returned currentVersion tells a manual rollback what to go back to.

yaml
type: io.kestra.plugin.ee.fortinet.fortigate.Activate

Check that a FortiGate can upgrade to a version through FortiGuard

yaml
id: fortigate_activate
namespace: company.network

tasks:
  - id: activate
    type: io.kestra.plugin.ee.fortinet.fortigate.Activate
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    targetVersion: 7.4.5
    source: FORTIGUARD

Validate an image file kept in Kestra

yaml
id: fortigate_activate_file
namespace: company.network

inputs:
  - id: image
    type: FILE

tasks:
  - id: activate
    type: io.kestra.plugin.ee.fortinet.fortigate.Activate
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    targetVersion: 7.4.5
    source: FILE
    image: "{{ inputs.image }}"
    sha256: 4a1c0e8b5d2f7e93a6b1c4d8e0f2a3b5c7d9e1f3a5b7c9d1e3f5a7b9c1d3e5f7

Upgrade a FortiGate: pre-check, validate, reload, wait, post-check

yaml
id: fortigate_upgrade
namespace: company.network

inputs:
  - id: target_version
    type: STRING
    defaults: 7.4.5

tasks:
  - id: pre_check
    type: io.kestra.plugin.ee.fortinet.fortigate.Check
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    caCertificate: "{{ secret('FORTIGATE_CA_PEM') }}"
    phase: PRE

  - id: gate
    type: io.kestra.plugin.core.flow.If
    condition: "{{ outputs.pre_check.status != 'ok' }}"
    then:
      - id: stop
        type: io.kestra.plugin.core.execution.Fail
        errorMessage: "Pre-check failed: {{ outputs.pre_check.checksFailed }}"

  - id: activate
    type: io.kestra.plugin.ee.fortinet.fortigate.Activate
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    caCertificate: "{{ secret('FORTIGATE_CA_PEM') }}"
    targetVersion: "{{ inputs.target_version }}"
    source: FORTIGUARD

  - id: reload
    type: io.kestra.plugin.ee.fortinet.fortigate.Reload
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    caCertificate: "{{ secret('FORTIGATE_CA_PEM') }}"
    targetVersion: "{{ inputs.target_version }}"
    source: FORTIGUARD
    imageId: "{{ outputs.activate.imageId }}"
    snapshot: "{{ outputs.pre_check.snapshot }}"

  - id: wait
    type: io.kestra.plugin.ee.fortinet.fortigate.WaitForReturn
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    caCertificate: "{{ secret('FORTIGATE_CA_PEM') }}"
    snapshot: "{{ outputs.pre_check.snapshot }}"
    targetVersion: "{{ inputs.target_version }}"

  - id: post_check
    type: io.kestra.plugin.ee.fortinet.fortigate.Check
    host: fgt1.example.com
    apiToken: "{{ secret('FORTIGATE_API_TOKEN') }}"
    caCertificate: "{{ secret('FORTIGATE_CA_PEM') }}"
    phase: POST
    snapshot: "{{ outputs.pre_check.snapshot }}"
Installation

This Enterprise plugin requires an Enterprise image and access to the plugin registry. Install it with the following command:

kestractl plugins get io.kestra.plugin.ee:plugin-ee-fortinet --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

Properties

Target version

FortiOS version to upgrade to, for example 7.4.5.

API token

Key of a REST API administrator (execute api-user generate-key). It is sent in the Authorization: Bearer header only, never in the URL. Use {{ secret('FORTIGATE_API_TOKEN') }}. Set a trusthost on the API administrator to the egress range of your worker group. Configuration backup, restore and firmware upgrade need the super_admin profile, the other tasks work with a read profile (read-write for the tasks that change configuration).

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

CA certificate

PEM encoded CA certificate(s) used to validate the FortiGate certificate. When set, only this CA is trusted. When empty, the JVM trust store is used.

Connect timeout

Maximum time to open the connection. Must be greater than zero. Defaults to 10 seconds.

Managed device

Name of the FortiGate in FortiManager. Only used with fortiManager.

FortiManager proxy

Reach the FortiGate through a FortiManager when the worker can only connect to the manager. Reads only: the call goes through exec /sys/proxy/json. Tasks that write (ApplyConfig, RestoreConfig, Reload) and GetConfig backups need a direct connection: on a managed FortiGate, change configuration with policy packages. Needs device.

Definitions
host*string

FortiManager host

Host name or IP address of the FortiManager management interface.

adomstring

ADOM

Administrative domain that holds the managed device. Defaults to root.

apiKeystring

API key

REST API key of a FortiManager API user (FortiManager 7.2.2 and later), sent in the Authorization header. Use {{ secret('FORTIMANAGER_API_KEY') }}.

caCertificatestring

CA certificate

PEM encoded CA certificate(s) used to validate the FortiManager certificate. When empty, the JVM trust store is used.

connectTimeoutstring

Connect timeout

Maximum time to open the connection. Must be greater than zero. Defaults to 10 seconds.

insecureSkipVerifybooleanstring

Skip TLS verification

Disables certificate and host name validation. Only for labs with self-signed certificates. Defaults to false.

passwordstring

Password

Administrator password. Use {{ secret('FORTIMANAGER_PASSWORD') }}.

portintegerstring

FortiManager port

HTTPS port. Defaults to 443.

requestTimeoutstring

Request timeout

Maximum time to wait for one answer. Must be greater than zero. Defaults to 60 seconds.

usernamestring

Username

Administrator name, used with password when no apiKey is set.

FortiGate host

Host name or IP address of the FortiGate management interface. Required unless fortiManager and device are set.

Image

Internal storage URI of the firmware image. Required with source: FILE.

Skip TLS verification

Disables certificate and host name validation. Only for labs with self-signed certificates. Defaults to false.

FortiGate port

HTTPS port of the management interface. Defaults to 443.

Request timeout

Maximum time to wait for one answer. Must be greater than zero. Defaults to 60 seconds.

SHA-256

Expected SHA-256 of the image, in hexadecimal. Required with source: FILE.

Possible Values
FORTIGUARDFILE

Image source

FORTIGUARD (default): the FortiGate downloads the image itself. FILE: the image comes from Kestra internal storage.

VDOM

VDOM the call applies to. Defaults to root. Global tables (system/...) ignore it.

Boot timestamp

Epoch seconds of the last boot, the baseline for the Reload guard, when the device reports it.

Current version

FortiOS version running before the upgrade. Keep it for a manual rollback.

Image ID

FortiGuard image ID to give to Reload. Only set with source: FORTIGUARD.

SHA-256

SHA-256 of the image file. Only set with source: FILE.