Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@melalj
Created January 6, 2017 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melalj/65423118bb7acc64c03cfc131ed8cf9c to your computer and use it in GitHub Desktop.
Save melalj/65423118bb7acc64c03cfc131ed8cf9c to your computer and use it in GitHub Desktop.
Insert in batch firewall rules to Cloudflare Raw
iplist=("104.155.110.139" "104.155.77.122" "107.21.113.149" "107.21.247.114" "146.148.119.250" "146.148.41.163" "146.148.59.114" "23.251.144.62" "54.232.81.104" "54.232.88.155" "54.232.88.172" "54.235.161.191" "54.244.253.127" "54.245.81.104" "54.245.81.193" "54.251.48.52" "54.251.48.53" "54.251.48.56")
for ip in "${iplist[@]}"
do
echo "\n$ip\n"
curl -X POST "https://api.cloudflare.com/client/v4/zones/xxxxxxxxxxx/firewall/access_rules/rules" \
-H "X-Auth-Email: user@example.com" \
-H "X-Auth-Key: xxxxxxxxxxx" \
-H "Content-Type: application/json" \
--data '{"mode":"whitelist","configuration":{"target":"ip","value":"'${ip}'"},"notes":"GoogleStackdriverMonitoring"}'
sleep 0.5;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment