I am not able to run the backup command so that the fortinet backup can upload to a sftp server. Please note, I am able to ping and connect/login to sftp server successfully when I use winscp or other tool to connect with sftp server
200F-HA1 # execute backup config sftp FortinetBKP%date%.cfg 10.10.40.8:822 fortinet fortinet1
Please wait...
Connect to sftp server 10.10.40.8:822 ...
Please wait...
Connect to sftp server 10.10.40.8:822 ...
Send config file to sftp server via vdom root failed.
Command fail. Return code -1
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
Hello
This needs more investigation.
Please run this command: diag sniffer packet any " host 10.10.40.8 and port 822" for like 10 seconds while you try again and share the output
I replaced the ftp server internal name with external name and get successful result . Below is the example command.
execute backup config sftp FortinetBKP-%%date%%.cfg sftp.domainname.com:822 fortinet fortinet1
However when I use the command with time, it gets failed
execute backup config sftp FortinetBKP-%%time%%.cfg sftp.domainname.com:822 fortinet fortinet1. Actually if we schedule backup on hourly basis then the same backup file gets overwrite. I don't want to overwrite the backup file instead make a new file
You can find some solutions discussed here:
https://community.fortinet.com/t5/Fortinet-Forum/Automated-config-backup-with-date/m-p/73003?m=19502...
https://community.fortinet.com/t5/Fortinet-Forum/Auto-script-override/td-p/67388
FortiGate is not responsible for storing/managing these configurations. You can use FortiManager for a more complete management solution.
cant we use simply this -> %%time%% like below command
execute backup config sftp FortinetBKP-%%time%%.cfg sftp.domainname.com:822 username password
Does the command work? (do you get the timestamp in the filename?)
yes > no problem
no > not implemented (or bug, if this feature was documented somewhere).
All you can do is ask for NFR (new feature request through your local sales representative). But this has already been requested last year (NFR 684857) and not implemented (yet).
Hi @ZAHIDHASEEB,
I hope below points will help you to address the resolution.
"Send config file to sftp server via vdom root failed.
Command fail. Return code -1"
Above error will mostly show due to SFTP server reachability, wrong credentials or permission error.
Actually, why that was worked, when you tried with same cmd after replacing server name? Because previously the SFTP Internal hostname was not resolved by your FortiGate/Internal DNS server. While you have replacing with External SFTP hostname, it was resolved by public DNS server. Otherwise, your mentioned commands are fine.
For updating DNS domain& hostname, please use below CLI cmds,
config system dns-database
edit "domain.local"
set domain "domain.local"
set authoritative disable
config dns-entry
edit 5
set hostname "fpx222"
set ip 10.4.62.222
next
end
end
And you have mentioned, after used %%time%% argument file got overwrite. If the script is manually run, 'execute backup config sftp FortinetBKP-Backup%%time%%.cfg sftp.domainname.com:822 fortinet fortinet1', would be saved as by same given character on the server, and it will never update with time details. Try with triggering the Automation stitch, only then, the actual time of the FortiGate will update and old file could not overwrite.
For try automation stich, please use below link FYR,
1- timestamp is not printing when I run the command from CLI (below result is for reference) and no backup generate when the script run from trigger
I know that %%date%% can be used, but I can't find any reference about %%time%% variable. Can you reference any document where this is presented as a "feature"?
The question is not about what works and not - it is about what is supposed to work and what not.
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 |
---|---|
1641 | |
1069 | |
751 | |
443 | |
210 |
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.