Whitelisting Googlebot

Is there a proper way to load Googlebot’s lists into firewalld to make sure these never get banned? Also, is there a smart way to keep the lists updated too?

Building off this example, Mod evasive adjustment - per site? - #2 by msaladna

curl -o- https://developers.google.com/static/search/apis/ipranges/googlebot.json | jq '.prefixes[][]' | while read IP ; do
    echo $IP
    cpcmd rampart:whitelist $IP
done
1 Like

Is there a way to purge all “manually” whitelisted IPs too? That could be useful when refreshing the ranges, making sure no previously whitelisted and now decommissioned remain dangling in firewalld.

Like keeping a copy of the file, then re-running something along the lines of:

cat googlebot.json | jq '.prefixes[][]' | while read IP ; do
    echo "Removing $IP"
    cpcmd rampart:whitelist $IP remove
done

This should do the trick, right?

Yes, that would remove from the whitelist.

1 Like