Skip to content

viviol-lu/FGT_BackupConfig_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FortiGate Configuration Backup Tool

安裝說明

需求

  • Python 3.9
  • Install libary
    cd FGT_BackupConfig_API
    pip install -r requirements.txt
    

使用方式

  1. git clone https://github.com/viviol-lu/FGT_BackupConfig_API.git 將檔案下載
  2. 將 fortigate 的 IP & API key 寫到 fgt_info.csv
  3. 程式已設定每日 15:10 進行備份,若要修改時間,backup.py 第 38 行,將 15:10 改成想要的時間
  4. 執行程式 python backup.py,由於程式會持續執行,若想中斷則按 Ctrl+C or control+C

設定

CSV 格式

FGT_IP,FGT_API_KEY

如果 port 號不是 443,FGT_IP 的欄位寫 : 的格式,例如 192.168.1.99:8443

產生 API Key

  • System > Administrators > Created New > REST API Admin 設定 API Account
    CleanShot 2023-03-22 at 09 18 32
  • 設定 UsernameAdministrator ProfileTrusted Hosts,完成後按下 OK,其中,Administrator Profile 需要是 read/write 權限
    CleanShot 2023-03-22 at 09 24 29 CleanShot 2023-03-22 at 13 57 47
  • 按下完成後會取得一組 API key,該 key 要儲存好
    CleanShot 2023-03-22 at 09 27 26
  • 如果是 vdom 環境,要登入下以下指令
config system accprofile
edit api_read_write
set scope global
  • PC 上 curl -k -i -X POST https://x.x.x.x/logincheck -d "username=api_test&secretkey=zzz" --dump-header headers.txt -c cookies.txt 可以測試 api 連線狀態
    • x.x.x.x:FortiGate 帳號
    • zzz:API key
    • headers.txt:header 資訊儲存
    • cookies.txt:cookie 資訊儲存

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages