Hello,
As per the technical tip: https://community.fortinet.com/t5/FortiGate/Technical-Tip-How-to-send-automated-backups-of-the-confi... , we have configured automated system backup to an FTP site.
Eg: execute backup config ftp /net-devices-auto-bkp/BACKUP.conf ftp ftp-server-name ftp-username ftp-password
We want the backups to be like:
BACKUP-File-Name= FGT-HOSTNAME-date-timestamp.conf
- Here
HOSTNAME = Fortigate Firewall Hostname
Date = Date of backup
timestamp = timestamp
Hence we are trying to execute the script as :
execute backup config ftp /net-devices-auto-bkp/bkp-FGT-HOSTNAME-%%date%%-%%time%%.conf ftp-server-name ftp-username ftp-password
However the file that gets saved in FTP server folder is : bkp-FGT-HOSTNAME-%%date%%-%%time%%.conf
It should have saved it as : bkp-FGT-HOSTNAME-actual-date-actual-time.conf
How do we resolve this ?
The configuration looks fine.
How are you testing the configuration? Please use "Test automation stitch" option from "stitch" tab /right click on stitch. If you directly run the command on CLI, it won't have the event date/time parameters and the file name will be what you see now.
If the FTP server is windows based, then we cannot use "%%time%%" as windows don't allow file name with ":".
date and time works fine with linux based FTP server.
Even it does not work through automation stich and the FTP server runs on *NIX OS
Also have a look at https://community.fortinet.com/t5/Support-Forum/backup-via-ftp/td-p/256544
Automation Stich is
config system automation-action
edit "automation script"
set action-type cli-script
set minimum-interval 0
set delay 0
set required enable
set script "execute backup config ftp /net-devices-auto-bkp-to-g-drive/bkp-%%hostname%%-%%date%%_%%time%%.conf FTP-Server FTP-user FTP-user-pwd"
next
end
config system automation-trigger
edit "test"
set trigger-type scheduled
set trigger-frequency daily
set trigger-hour 5
set trigger-minute 5
next
end
config system automation-stitch
edit "test"
set status enable
set trigger "test"
set action "automation script"
next
end
System Info is:
# get system status
Version: FortiGate-100E v6.2.3,build1066,191218 (GA)
# execute date
current date is: 2023-06-07
# execute time
current time is: 05:56:32
last ntp sync:Fri Mar 31 11:06:42 2023
The backup file that gets stored in FTP server is :
bkp-%%hostname%%-%%date%%_%%time%%.conf
Hence, the hostname, date and time are not at all substituted by actual values
Also, we tried the same in versions 6.4.8 , 7.0.5 and the results are the same
Does this script work for SFTP as well?
Hi guys,
I tested on firmware 7.4 and 7.2.5 to automate to send to ftp is working for %%date%% but if add the time script %%time%% , it failed. I using filezilla server on Win Server. The action I had set is using the CLI Script.
CLI Script
/fgt-%%date%%-%%time%%_config.conf
The message stated in the ftp server:
Server Log
STOR fgt-2023-09-20-16:25:00_backup.conf
550 Invalid file name or path
CLI Script
/fgt-%%date%%_config.conf
The message stated in the ftp server:
Server Log
STOR fgt-2023-09-20_backup.conf
150 150 Starting data transfer
226 operation successful
I suspect is the semi-colon cause it on the file name.
Does anyone know if there is any possible to add a cli script like a counter CLI?
It is because windows don't accept file names with ":"
Hi @itsupport-amagi,
Please try %%log.date%% and %%log.time%% instead. Please refer to https://community.fortinet.com/t5/FortiGate/Technical-Tip-Automated-configuration-backups-with-varia...
Regards,
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1737 | |
1107 | |
752 | |
447 | |
240 |
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.