IPtables rules dont work

Support for security such as Firewalls and securing linux
Post Reply
hensap
Posts: 4
Joined: 2016/02/09 13:32:21

IPtables rules dont work

Post by hensap » 2016/02/09 13:47:03

Hey guys,

I have a strange problem. My virtual server run on CentOS Linux 7.1.1503. I closed an IP Range via iptables. For example this way:

Code: Select all

iptables -A INPUT -s 99.0.0.0/8 -j DROP
And yet the IPAdress 99.25.211.119 try to bruteforce.

Code: Select all

Feb  9 12:46:58 xxx postfix/smtpd[7628]: warning: static-ip-99-25-211-119.inaddr.ip-pool.com[99.25.211.119]: SASL LOGIN authentication failed: authentication failure
Why/how did he ever pass? The IP 99.25.211.119 should be blocked on all ports right? Why is this happening? Someone has an idea, I'm really desperate.

greets Henry

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: IPtables rules dont work

Post by TrevorH » 2016/02/09 19:14:06

The default ruleset ends with a -j REJECT and if you -A append any rules then they will go after that and never be reached.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hensap
Posts: 4
Joined: 2016/02/09 13:32:21

Re: IPtables rules dont work

Post by hensap » 2016/02/13 14:32:15

You suggest i should take -j Reject anstead -j DROP ? I took DROP because the sender gets no answer, otherwise he knows there is a target.
I thought -A adds a new rule to the chain INPUT. Which syntax would you take?

Sry my english is not the best

greets >Henry

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: IPtables rules dont work

Post by TrevorH » 2016/02/13 15:59:29

No, I'm telling you that if you use -A it appends the new rule _after_ the existing one that rejects all traffic so the new rule is never reached. You need to -I insert the new rule at a specific line number so that it appears in the chain before the rule that rejects the traffic.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply