Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Umesh
Contributor

IPv4 policy export in fortigate firewall

Hello everyone,

 

I need your support for exporting the IPv4 policy in the FortiGate firewall if you have any idea how to write the script for it.

I am new here that's why I would to know how to write it, could you please write here script for it.

 

thank you

2 REPLIES 2
seshuganesh
Staff
Staff

Hi Team,

 

For 7.0.2 and above versions, you can directly download from the firewall policy tab.

For the below versions you can use below article:

https://community.fortinet.com/t5/FortiGate/Technical-Tip-How-to-export-IPv4-Policies-from-FortiGate...

 

Please check and give us update

xsilver_FTNT
Staff
Staff

Hi Umesh,

besides using something like PuTTY to connect to FortiGate via SSH and execute some commands like 'show firewall policy' and then parsing output in whatever language you like.
There is also possibility to simply backup config from GUI in top-right corner. And process that in any text editor as it is plain-text config. So any AWK/Python/sed/Perl .. whatever is possible/usable.

Another, option is exec backup from CLI .. and new feature is export of the config as a YAML structure for automated tasks.
https://docs.fortinet.com/document/fortigate/7.2.0/new-features/787595/backing-up-and-restoring-conf...

Yet another option is to use REST API and gather policy list for example as JSON via your code or as simply as through WGET.

There is plenty of options and not a single best or right way.

Simply choose the way which fits your coding tools and style the best.

 

Tomas Stribrny - NASDAQ:FTNT - Fortinet Inc. - TAC Staff Engineer
AAA, MFA, VoIP and other Fortinet stuff

Labels
Top Kudoed Authors