first commit
This commit is contained in:
28
scripts/iptables2.sh
Normal file
28
scripts/iptables2.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# syntax of user list file
|
||||
# sourceIPAdress:DestinationIPAddress:Port
|
||||
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "Syntax: ./`basename $0` <file name>"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Parameters
|
||||
USER_DATA_FILE=$1
|
||||
|
||||
|
||||
_input=/path/to/text.db
|
||||
IPT=/sbin/iptables
|
||||
$IPT -N droplist
|
||||
egrep -v "^#|^$" x | while IFS= read -r ip
|
||||
do
|
||||
$IPT -A droplist -i eth1 -s $ip -j LOG --log-prefix " myBad IP BlockList "
|
||||
$IPT -A droplist -i eth1 -s $ip -j DROP
|
||||
done < "$_input"
|
||||
# Drop it
|
||||
$IPT -I INPUT -j droplist
|
||||
$IPT -I OUTPUT -j droplist
|
||||
$IPT -I FORWARD -j droplist
|
Reference in New Issue
Block a user