Palo Alto防火牆是一個很好用的設備但是?

Palo Alto 的設定檔備份無法排程匯出
且需要Panorama這種管理軟裡才能備份
但是備份的檔案是.gz跟PA的XML又不一樣所以無法透過PA匯入

2020-01-20_160438.png

 


所以要想要完成自動備份只能靠第三方軟體

2020-01-20_164930.png
首選是 : solarwinds NCM 有完整的報表 但是所有的中文都是亂碼無法看出來匯回去也不知道會怎樣

 

第二方案 : 靠自己

還好谷歌大神是萬能的那就!!先準備以下工具

1. curl 官網:https://curl.haxx.se/download.html

2020-01-20_161309.png
用curl指令應該是最簡單的,但windows沒有內建此指令所以需要下載。
按照自己的系統選,這邊選擇  Windows 64 bit    7.68.0    binary    the curl project
解壓縮到到自己指定的資料夾 EX:C:\curl-7.68.0-win32-mingw\
使用命令提示字元 CMD「C:\curl-7.68.0-win32-mingw\bin\curl.exe -help」看指令用法!
最簡單的用法就是執行「C:\curl-7.68.0-win32-mingw\bin\curl.exe 192.168.1.1」便可以很容易讀取網頁HTML的內容。

 

2. 需要得到 API 的金鑰
Access the firewall using XML API:

For accessing the firewall using XML API, we need to generate the API key first. To generate, see the following:

  https://<firewall-ip>/api/?type=keygen&user=<username>&password=<password>

 

2020-01-20_162730.png

The response for that should be in form of an XML with the API Key printed as below:

3.建立一個備份批次檔案

Open a Notepad and type the following :
批處理文件的內容:

 cd C:\curl-7.68.0-win32-mingw\bin\
curl -kG "https://192.168.1.1/api/?type=export&category=configuration&key=<api_key>" >  D:\PaloAltoBackup\running-config.xml

 

 

要將日期附加到備份檔案文件名:

set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%
echo %dt%
curl -kG "https://<Firewall ip>/api/?type=export&category=configuration&key=<api_key>" > D:\PaloAltoBackup\running-config_%dt%.xml

 

4.使用Windows Server的工作排程建立自動備份

這沒什麼好寫的就自己來吧

2020-01-20_155751.png

2020-01-20_163934.png

2020-01-20_163841.png

5.得到一個備份檔案

 

 

2020-01-20_164607.png

 

大概就這樣!!

 

參考文章!!

HOW TO BACKUP OF CONFIG FILES PERIODICALLY WITHOUT PANORAMA

Automated configuration backup of Palo Alto Firewalls without using a Panorama.

在windows底下用cmd命令開啟網頁(讀取HTML內容)


arrow
arrow

    sungshu 發表在 痞客邦 留言(0) 人氣()