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 tried to configure my firewall (under RH 9.0) to allow secure access only from one computer and also to permit ping from that machine, but didn't work! :-(
here is the example:
...
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp -s 192.168.1.1/32 --dport 22 --syn -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 22 --syn -j REJECT
...
-A RH-Lokkit-0-50-INPUT -p icmp -s 192.168.1.1/32 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p icmp -j REJECT
...
what's wrong here? there is a syntax problem? have somebody any sugestion? do you know some usefull links with some RH-Lokkit-0-50 firewall examples?
Distribution: Fedora, Debian, OpenSuSE and Android
Posts: 1,820
Rep:
RH-Lokkit, or Gnome-Lokkit is only used if you have really simple needs. It is just a script generator for iptables. The way you would write that first rule would be
From the command line enter the following
iptables -A INPUT -p tcp -s ! 192.168.1.1 --destination-port 22 -j DROP
(This will accept port 22 connections only from that ip address).
And the second rule
iptables -A INPUT -p icmp -s ! 192.168.1.1 -j DROP
Distribution: Fedora, Debian, OpenSuSE and Android
Posts: 1,820
Rep:
Don't use the path /sbin/ in your script. If Iptable is running it is not needed and clutters up the script.
Using custom tables (like ssh above) can make iptables more confusing than it needs to be. Are you using this firewall to protect against machines on your internal network? I see the rule
/sbin/iptables -A ftp -s 192.168.1.0/24 -j ACCEPT
and I wonder why not just say
iptables -A INPUT -i $INTINT -s 192.168.1.0/24 -j ACCEPT
which would accept ALL connections on the internal interface from the ip range 192.168.1.0/24
I try to stick with just the following tables
INPUT
OUTPUT
FORWARD
PREROUTING
POSTROUTING
Tends to make things easier and cleaner in the scripting.
I would check out "Red Hat Linux Firewalls" from your local library if they have it. It's the greatest book ever on iptables.
I hope this helps. Describe exactly what connections you want to allow from the Internet and from the local network and we'll take another stab at this.. :-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.