Created
August 10, 2022 06:55
-
-
Save quanhua92/59842f55829ff0b125ef9e005cf9ce3e to your computer and use it in GitHub Desktop.
Add Bunny.net Edge Server IP Address to UFW firewall
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
#!/bin/sh | |
curl -s https://bunnycdn.com/api/system/edgeserverlist -H "Accept: application/json" | jq -r .[] > /tmp/bunny_ips | |
echo "" >> /tmp/bunny_ips | |
curl -s https://bunnycdn.com/api/system/edgeserverlist/ipv6 -H "Accept: application/json" | jq -r .[] >> /tmp/bunny_ips | |
for ip in `cat /tmp/bunny_ips`; do ufw allow proto tcp from $ip comment 'Bunny IP'; done; |
Here is a repo with Github Action to run the script everyday https://github.com/quanhua92/bunnycdn_edge_servers_list
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script adds the Bunny Edge Server IPs to the UFW firewall.
You will need to schedule this to run every day to add any new IP address. Need to install
jq
withsudo apt install jq
to parse the JSON