If you use a service that requires you to allowlist multiple IP addresses or you have multiple IP addresses that are blocked currently in your current firewall or in any other way and you wish to transition them to the BitNinja ipsets.
Bulk actions can be done via the BitNinja CLI, or you can also add IP addresses to the blocklist and the allow list from the Dashboard.
Bulk Allowlist and Blocklist from the Dashboard
For this feature open the Firewall menu and click on the Block list or Allow list menu and click on the “ADD MANY” button.
And add the IP addresses separated by enter. Each IP address or IP address range should be in a new line.
You can also set an expiration date for the IP address after that it gets delisted from the blocklist or allowlist.
You can also select the server where you would like to allowlist/ blocklist the IP addresses. If there is no chosen server the IP addresses will be added to all servers’ allowlist or blocklist. The servers cannot be specified afterward.
Bulk challenge listing, blocklisting, and allow listing from the BitNinjaCLI
Example of a script that adds a list of IP addresses to your allowlist, blocklist or challenge list:
- Create a file called iplist.txt and insert the Ip addresses you would like to check/add
e.g.:nano iplist.txt
and paste the IP addresses and then pressctrl+ x
theny
then enter - Make a file called
AddToChallengelist.sh
and paste the text below into it
e.g.:nano AddToChallengelist.sh
#!/bin/bash
while read line; do echo $line;
#bitninjacli --greylist/ --blacklist/ --whitelist --add/ --del/ --check = IPaddress
#e.g.:
#greylisting
bitninjacli --greylist --add=$line
#blacklisting
#bitninjacli --blacklist --add=$line
#whitelisting
#bitninjacli --whitelist --add=$line
done < $1
- Issue the command
chmod +x AddToChallengelist.sh
so it will be executable - Run the command and pass the
iplist.txt
file as a parameter to it with./AddToChallengelist.sh iplist.txt