This article describes how to extract IPv4 Policies on the FortiGate and convert them to CSV files with good visibility.
Note that Fortinet Technical Support does not provide any troubleshooting assistance for extracting IPv4 Policies from your FortiGate config file to a CSV file.
For versions 7.0.2 and above versions, the steps are pretty straight forward.
Click Policy & Objects >> Firewall Policy >> Export >> CSV
Download and convert your file using the step described below [ How I split text by space/comma/delimiter in Excel Data Obtained? ]
To export the firewall policy list to a CSV or JSON file:
- Go to Policy & Objects > Firewall Policy.
- In the toolbar above the list, click Export.
- Select CSV or JSON.
For versions 6.0.14 and above version follow the below steps, it will be much longer..
1). Use this script fgpoliciestocsv.py.
Download it via the link below:
https://github.com/maaaaz/fgpoliciestocsv/find/master?q=
2). Export the configuration of the FortiGate, by the backup or command line (FortiGate configuration file: ‘Fortinet_2019121….conf’).
3). In the configuration file, search the ‘config firewall policy’, then copy and paste IPv4 policies to cfg file (cfg file: ‘fgfw.cfg’).
4). Execute the script fgpolciestocsv.py.
– Upload files (fgfw.cfg, fgpoliciestocsv.py) to Unix or Linux based OS.
Upload these files via https://winscp.net/eng/download.php if WinSCP is used.
5). Input the command of ‘fgpoliciestocsv.py -i [cfg file name].cfg’ find ‘policies-out.csv’ file.
Use WINSCP to move the file to the Windows OS and run it in Excel.
How I split text by space/comma/delimiter in Excel Data Obtained?
If you have a column list of data and you want to split them into several columns by a specific delimiter just like the below screenshots shown, how can you split them in Excel? Maybe some of users think of the Text to Column function only, but now I will introduce not only Text to Columns function, but also a VBA code for you.
Split text strings into multiple columns by space/comma/delimiter by Text to Columns feature
Text to Columns feature is very useful to split a list to multiple columns in Excel. This method is talking about how to split data by specified delimiter with Text to Column feature in Excel. Please do as follows:
1. Select the column list you want to split by delimiter, and click Data > Text to Columns. See screenshot:
2. Then a Convert Text to columns Wizard dialog pops out, and check Delimited option, and click Next button. See screenshot:
3. In the opening Convert to Text to Columns Wizard – Step 2 of 3 dialog box, please check the delimiter you need to split the data by.
Note: If you need to split your text string by a special delimiter, please check the Other option, and then type the delimiter into following box.
4. Click Finish. Now you can see the column list in selection has been split into multiple columns by the specified delimiter.
It is possible to use the below method for the below 6.4 versions.
Be the first to comment