LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-15-2023, 04:34 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 568

Rep: Reputation: 10
Post Normal iptables rules


Hello,
Suppose your computer is in the internal network of an organization where a number of technicians and hackers are working there, are the following firewall rules sufficient?
Code:
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -N SYN_FLOOD
iptables -A INPUT -p tcp --syn -j SYN_FLOOD
iptables -A SYN_FLOOD -m limit --limit 5/s --limit-burst 10 -j RETURN
iptables -A SYN_FLOOD -j DROP
I know there are many parameters to consider, but I wanted to know what rules are enough for a firewall. I use Tor on my Debian box.


Thank you.

Last edited by Jason.nix; 02-15-2023 at 04:36 AM.
 
Old 02-15-2023, 06:44 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,347

Rep: Reputation: Disabled
Seems reasonable enough; all inbound traffic is rejected except ESTALISHED and RELATED, and you've remembered to ACCEPT everything going to "lo".

The SYN_FLOOD chain is redundant as you've already defined DROP as the default policy, but if it's intended as a framework for later rules that may accept certain inbound traffic, it makes sense.
 
1 members found this post helpful.
Old 02-15-2023, 08:37 AM   #3
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,628

Rep: Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557

The netfilter wiki has various example default configs.

 
2 members found this post helpful.
Old 03-14-2023, 12:47 AM   #4
Jason.nix
Member
 
Registered: Feb 2023
Posts: 568

Original Poster
Rep: Reputation: 10
Hello,
Thank you so much for all replies.
 
Old 03-15-2023, 01:33 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
I will be the first to admit that I have no confidence in my own ability to set up "iptables rules" correctly. Namely, that I would not expose myself to some vulnerability that I did not know about. Or, "patch" some vulnerability but actually fail to do so [correctly].

Instead, I use open tools such as Shorewall to do the heavy-lifting for me. (And I have been very surprised at the complex set of rules that such tools have put in place.)

Shorewall allows me to describe "what I want," in terms that I can understand, and it then undertakes to do the "voodoo" for me. I like it that way. Because, to me, "iptables is(!) 'voodoo!'"

Last edited by sundialsvcs; 03-15-2023 at 01:34 PM.
 
Old 03-22-2023, 07:06 AM   #6
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,834
Blog Entries: 17

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
Originally Posted by Jason.nix View Post
Hello,
I know there are many parameters to consider, but I wanted to know what rules are enough for a firewall. I use Tor on my Debian box.
Does that work well without a conntrack rule?
 
Old 03-31-2023, 07:49 PM   #7
ForestuX
LQ Newbie
 
Registered: Oct 2019
Location: /bin/bash
Distribution: slackware
Posts: 25

Rep: Reputation: Disabled
Hello all.
There are sereval "iptables rules generators" in the web.
I still use this Slackware adaptation:
http://www.slackware.com/~alien/efg/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/udev/rules.d/40-libsane.rules and /etc/udev/rules.d/S99-2000S1.rules missing LABEL=libsane_rules_end mumahendras3 Slackware 6 03-09-2020 02:27 AM
auditctl -l not showing any rules even though i have rules written in audit.rules alphaguy Linux - Security 1 02-07-2014 05:28 PM
iptables 1.27a still loading rules after installing iptables 1.3.0 yawe_frek Linux - Software 1 06-07-2007 09:50 PM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
IPTABLES - rules in /etc/sysconfig/iptables The_JinJ Linux - Newbie 6 11-20-2004 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration