Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to block SSH Access to my server and only allow 192.168.0.0/24 subnet.
But for some reason, it isn't working quite right. Any machines from 192.168.1.0/24 can access.
I've already tried "iptables -A C-RULES -s 192.168.0.0/24 -p tcp --dport 22 -j ACCEPT" which should only accept ssh connections from 192.168.0.* subnet.
Can someone tell me what's wrong with my firewall rules? I'm using RHEL5.5
Here is my /etc/sysconfig/iptables:
[root@ws5 ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.3.5 on Wed Nov 10 23:25:10 2010
*filter
:INPUT ACCEPT [100:8477]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [98:8676]
:C-RULES - [0:0]
-A C-RULES -i lo -j ACCEPT
-A C-RULES -p icmp -j ACCEPT
-A C-RULES -p tcp -m tcp --dport 631 -j ACCEPT
-A C-RULES -p udp -m udp --dport 631 -j ACCEPT
-A C-RULES -m state --state RELATED,ESTABLISHED -j ACCEPT -A C-RULES -p tcp -m tcp --dport 22 -s 192.168.1.0/24 -j REJECT
-A C-RULES -j LOG
-A C-RULES -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Wed Nov 10 23:25:10 2010
I normally use the INPUT chain so I never had to send it to a new chain. Since this rule is used on a new subnet, I did not know that we need to send the packets to the new chain.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.