This article describes how to indicate the date in the file name in relation to FortiGate's automatic backup.
FortiGate v7.0, v7.2, v7.4.
Step 1: Configure the automation trigger.
Settings to schedule automatic backup every 2 AM.
config system automation-trigger
edit "backup_test"
set trigger-type scheduled
set trigger-hour 02
set trigger-minute 00
next
end
Step 2: Configure automation-action.
Settings to perform backup using ‘CLI script’. check the below.
To back up the configuration in FortiOS format using the CLI:
For FTP, note that port number and username are optional depending on the FTP site:
execute backup config ftp <backup_filename> <ftp_server>[<:ftp_port>] [<user_name>] [<password>] [<backup_password>]
Or for TFTP:
execute backup config tftp <backup_filename> <tftp_servers> [<backup_password>]
Or for SFTP:
execute backup config sftp <backup_filename> <sftp_server>[<:sftp_port>] <user> <password> [<backup_password>]
config system automation-action
edit "date_backup_test"
set action-type cli-script
set script "execute backup config sftp %%date%%.conf 10.0.3.225 admin qwe123"
set accprofile "super_admin"
next
end
Step 3: Configure automation-stitch.
Combine step 1 and step 2 settings to create one automation configuration.
config system automation-stitch
edit "backup_test"
set status enable
set trigger "backup_test"
config actions
edit 1
set action "date_backup_test"
set required enable
next
end
next
end
Step 4: Result.
If the file name of the script set in step 2 includes '%%date%%', it includes the name of the backup date.
When performing a backup, the format of the variable changes to 'YYYY-MM-DD'.
For example 1:
set script "execute backup config sftp %%date%%.conf 10.0.3.225 admin qwe123"
2023-09-19.conf
2023-09-20.conf
For example 2:
set script "execute backup config ftp FGT_%%date%%_backup.conf 10.0.3.225 admin qwe123"
FGT_2023-09-19_backup.conf
FGT_2023-09-20_backup.conf
Caution:
To check if the script containing the date variable is correct, if the execute command via CLI Console or SSH is executed, it will not change.
It is necessary to check the results with the automation function.
%%date%%.conf
FGT_%%date%%_backup.conf
Related documents:
Technical Tip: Automated configuration backups with variable names based on the date
Configuration ba...
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 2024 Fortinet, Inc. All Rights Reserved.