Created
January 6, 2017 21:58
-
-
Save melalj/65423118bb7acc64c03cfc131ed8cf9c to your computer and use it in GitHub Desktop.
Insert in batch firewall rules to Cloudflare Raw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [email protected]" \ | |
-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