Iptables - I have 2 Iptables?

networe

New member
Joined
Jul 8, 2012
Messages
15
Hi

I think i've installed iptables over directadmin iptables.

When I do in ssh : iptables -L INPUT -v -n it display the iptables i've blocked manually in SSH.

When I go in Directadmin BruteForce monitor, I see completely other IPs.

Is there a way to see which one is really blocking IPs ? Both are blocking ? How can I uninstall mine ?
 
Ok,

From what i've noticed, Directadmin get ip blocked from the .txt blocked_ips

But when i am trying to block an random IP, it doesnt display in the text ares after a manual blocking in Directadmin.

What can be the problem?
 
I've modified the script block_ips.sh which seems to do nothing to :

Code:
BF=/root/blocked_ips.txt
EF=/root/exempt_ips.txt

curriptables()
{
        echo "<br><br><textarea cols=160 rows=60>";
        /sbin/iptables -nL
        echo "</textarea>";
}

if [ "$ip" = "" ]; then
        echo "No ip has been passed via env.";
        exit 1;
fi

### Do we have a block file?
if [ ! -e "$BF" ]; then
        echo "Cannot find $BF";
        exit 1;
fi

### Do we have an exempt file?
if [ ! -e "$EF" ]; then
        echo "Cannot find $EF";
        exit 1;
fi

### Make sure it's not exempt
COUNT=`grep -c "^${ip}\$" $EF`;
if [ "$COUNT" -ne 0 ]; then
        echo "$ip in the exempt list ($EF). Not blocking.";
        curriptables
        exit 2;
fi

### Make sure it's not alreaday blocked
COUNT=`grep -c "^${ip}=" $BF`;
if [ "$COUNT" -ne 0 ]; then
        echo "$ip already exists in $BF ($COUNT). Not blocking.";
        curriptables
        exit 2;
fi
iptables -A INPUT -s $ip -j DROP
service iptables save
echo "Blocking $ip ...<br>";
echo "$ip=dateblocked=`date +%s`" >> $BF;

echo "Restarting iptables ...<br>";
/etc/init.d/iptables restart

echo "<br><br>Result:";

curriptables

exit 0;

The only problem : I need to block one ip at once.
 
Note : I can block as many ip as I want.

Problem resolved by me,

If i helps anyone.. :)
 
Back
Top