I have a simple question.
I use this iptable for denying and IP accessing me in anyway:
iptables -A INPUT -s XX.XXX.XX.XX-j DROP
iptables -I FORWARD -d XX.XXX.XX.XX-j DROP
So my question is: Is there a way to make a script that automatically checks for IP added in a file. Example:
I create a script in Firewall>Custom Rules and a file blockedips.txt and put it in /etc/config/ (for example, could be anywhere). So it there a way to make a script that will read the IPs from this particular txt file and the only thing i must do is add the IP in the same txt file.
P.S:
So I managed to do something like this and it's working.
for x in $(cat /etc/config/blacklistips)
do
iptables -A INPUT -s $x -j DROP
iptables -I FORWARD -d $x -j DROP
done
The question now is: Is there a way for the firewall automatically (somehow) to restart when I add/remove and IP.