In order to enable the use of scripts, you have to enable it in FortiManager. You can run scripts directly to a FortiGate, Device Database or you can run it on a policy package.
The following guide is for version 5.4
Contents
Enable script in FortiManager
Go to System Settings > Admin Settings and tick off “show scripts”
Write a script
Go to Device Manager > Script > Create New Script
Point the script to Policy Package, ADOM Database and script whatever to your liking
Sample Script
config firewall address
edit ” test-address-1″
set subnet 10.1.1.0 255.255.255.0
set color 1
next
edit “test-address-2”
set subnet 10.2.2.0 255.255.255.0
set associated-interface “port2”
next
edit “test-address-3”
set subnet 10.3.3.0 255.255.255.0
set associated-interface “port2”
next
edit “test-address-host-1”
set subnet 10.1.1.10 255.255.255.255
set associated-interface “port2”
set comment “This is a host object”
next
end
config firewall addrgrp
edit “grp.my-test-addresses”
set member “test-address-1” “test-address-2” “test-address-3” “test-address-host-1”
set comment “Group object”
next
end
Run the script
When done editing, just simply right click and run the script against default values.
Hay there,
Thanks for your awesome article, I used it on FMG 5.2.7 and manager to import stuff that wouldve taken me 3 days to manually do.
Regards
No problem. Happy to hear you found it useful! =)