Created on 12-31-2021 03:06 AM Edited on 08-20-2024 02:31 AM By Jean-Philippe_P
Description | This article describes another way on how to get the backup configuration file on FortiGate using HTTPS RestAPI calls from a Python script. |
Scope | FortiGate. |
Solution |
config system api-user
Import requests:
api_url = 'https:/10.191.20.122/api/v2/monitor/system/config/backup?scope=global&access_token=Nbcyjfgb....'
requests.packages.urllib3.disable_warnings() data = requests.get(api_url, verify=False) with open('/home/api_configbackup.conf' ,'wb') as f: for line in data: f.write(line)
Where 10.191.20.122 is the IP of the FortiGate.
The scope is global for the global configuration of the FortiGate.
Access_token is the value of the token we previously generated. /home/api_configbackup.conf is the place in the Linux machine where to save the backup file.
The file api_configbackup will be created in the specified directory with the configurations of the Fortigate included.
For chassis-based products (such as 6K - 7K) it may be necessary to set the scope to Global in the account profile to make this work as expected:
config system accprofile |
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.