This script will get as argument the file that may contain the IPs list and the reason of the whitelist in a second column. Something like this:
1.1.1.1 uncle Ben
1.1.1.2 MyTv
1.1.1.3 Client1
1.1.1.5 Client2
This is the script itself:
#!/bin/bash
# Check if the input file is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <input_file>"
exit 1
fi
input_file="$1"
# Read the input file line by line
while IFS=' ' read -r col1 col2; do
echo "Processing: $col1 : $col2"
imunify360-agent whitelist ip add "$col1" --comment "$col2" --full-access
done < "$input_file"
Now you need to save your list and your script. Let’s say that you will call your script whloader.sh and your whitelist, whitelist.txt. You would need to run the following commands once you have both at the same folder:
bash whloader.sh whitelist.txt
