I need to import a few hundred IP addresses into a FortiGate 60E firmware 6.0.7 and put them into a single address group. I can get the IPv4 addresses into a csv file. Is there an easy way to import them and to put them into the group. I see a document here: https://kb.fortinet.com/kb/documentLink.do?externalID=FD45633 describing the script needed to import the addresses and groups but it would take quite a while to build the script file. Is there a script that I could use to populate the script file?
Is it correct then that I can upload the script into the FortiGate via: System / Advanced / Configuration Scripts / Upload and Run a New Script?
May I humbly refer you to my website at https://www.beneicke-edv.de/support/tools/#ext_blacklists where I have published a python script some time ago which tackles exactly this problem.
Given a simple text file with one IP address per line, it will create a FortiOS batch command file suitable for importing into a running config.
Script options allow to customize the output for small/medium/big FGT models (as the maximum number of addresses per address group varies among these), split the output into several batch command files etc. You can even supply FQDNs instead of IP addresses and the script will resolve them before creating the address object.
It's written in python 2.7 but should (not tested) run in python 3.x with minor changes, if any.
Thank you for the help. I will review your suggestions.
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1751 | |
1114 | |
766 | |
447 | |
241 |
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 2025 Fortinet, Inc. All Rights Reserved.