Automate whitelisting ip addresses in iptables in bash

view story

http://serverfault.com – I am looking for the best way to automate whitelisting IP addresses into iptables. The list of ip addresses and ports comes from a JSON file which is formatted like: [ { "ip": "", "protocol": "tcp", "port": 3306 }, { "ip": "", "protocol": "tcp", "port": 80 }, { "ip": "", "protocol": "tcp", "port": 443 }, { "ip": "", "protocol": "tcp", "port": 53 } ] I need a BASH script which reads the json file and creates ALLOW iptables rules. Example allow rules based on the json above looks like: iptables -A INP (HowTos)