Python script for creating Fortigate Rules and Objects from a CSV file.
Dependencies: Python-Paramiko is needed for ssh connection and command sending to the machine.
installation:
Ubuntu sudo apt-get install python-paramiko
CentOS yum install python-paramiko
The script gets 2 csv files:
- Rules
- Objects
With the following format:
Rules.csv:
Source Address,Destination Address,Source Interface,Destination Interface,Service,Schedule,Action,NAT
Objects.csv:
Object Name,Type,Subnet
Usage:
forti_cmd.py --file <RULES_FILE_PATH> <OBJECTS_FILE_PATH> <-a OR --add>
forti_cmd.py --file <RULES_FILE_PATH> <OBJECTS_FILE_PATH> <-d OR --delete> <RULE_ID>
Examples:
forti_cmd.py --file /tmp/Rules.csv /tmp/Objects.csv -a --> add all rules in csv rules file
forti_cmd.py --file /tmp/Rules.csv /tmp/Objects.csv -d 3 --> delete rule No. 3