LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   script problem loading blacklist in iptables (https://www.linuxquestions.org/questions/linux-newbie-8/script-problem-loading-blacklist-in-iptables-671210/)

Rob_G_ 09-20-2008 07:41 AM

script problem loading blacklist in iptables
 
Hi, I'm trying to load a blacklist in iptables rules through my firewall script. When I run the script, it tells me that the mask is invalid???

I have a list of networks that I want to blacklist. The entries in the list follow this format "xx.xx.xx.xx/xx" (without quotes of course); one per line...


examples:
58.22.0.0/15
58.56.0.0/15
58.58.0.0/16

Here is the script:
#---------------------------
grep -v "#" /etc/firewall/blacklist | sed -e '/^$/d' > /tmp/temp

while read source garbage
do
$IPT -A BLACKLIST -s $source -j DROP
done < /tmp/temp
#----------------------------

when I run the script, it outputs this to the console:
' specified.3.8: invalid mask `14
Try `iptables -h' or 'iptables --help' for more information.


However, I can successfully type the command in the console.

Any idea what is wrong?

Thx,

..Rob

Rob_G_ 09-20-2008 09:55 AM

Resolved ...
 
OK, seems it was a source file problem.

The text was copied from notepad and for some reason, it didn't like it.

I re-did the file (again copied from notepad) and it is now loading.

Not sure what hapenned... it's the exact same content.

..Rob


All times are GMT -5. The time now is 11:19 PM.