LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 01-09-2022, 10:21 AM   #1
amateur_intermediate
LQ Newbie
 
Registered: Jan 2022
Posts: 15

Rep: Reputation: 0
I thought Linux was SAFER than Windows?


Hello, everyone!

I have a small web-server and wanted to tighten up security by adding some recommended iptable rules online, but this looks dubious.

My question is about the -limit module in iptables in combination with the LOG target.

I understand the drop rules below, but it seems to me that -m limit portions are screwing up the rules.
Code:
$IPT -t mangle -A PREROUTING -p tcp --tcp-flags FIN,RST FIN,RST -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
$IPT -t mangle -A PREROUTING -p tcp --tcp-flags FIN,RST FIN,RST -j DROP

$IPT -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
$IPT -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP

$IPT -t mangle -A PREROUTING -p tcp --tcp-flags ALL FIN,PSH,URG -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
$IPT -t mangle -A PREROUTING -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP

$IPT -t mangle -A PREROUTING -p tcp ! --syn -m state --state NEW -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
$IPT -t mangle -A PREROUTING -p tcp ! --syn -m state --state NEW -j DROP

$IPT -t mangle -A PREROUTING -p tcp --tcp-flags ALL ALL -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
$IPT -t mangle -A PREROUTING -p tcp --tcp-flags ALL ALL -j DROP
Reading the manpage, the principle of only matching the rule n times and thus only logging it n times is fine, but these rules include special instructions where this cannot work I believe and it will actually interfere with each DROP rule below.

For example this makes perfect sense:
(Logging incoming tcp packets on port 80 / 25 packets per minute, i.e 25 log entries per minute)
Code:
$IPT -A INPUT -p tcp -m tcp --dport 80 -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
But this just seems really wrong and I can't make any sense of it:
Code:
$IPT -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -m limit --limit 25/min -j LOG --log-prefix "BLOCKING-TCP"
 
Old 01-09-2022, 12:21 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

This matches your update here from this other thread, please continue in that original thread to avoid confusion.
 
  


Closed Thread



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
İs Linux safer than Windows or not? UnbalancedSkunk Linux - Newbie 11 11-22-2020 12:50 PM
LXer: Dell removes "Ubuntu is safer than Microsoft® Windows® " statement from website LXer Syndicated Linux News 2 06-18-2010 11:56 AM
LXer: Dell removes "Ubuntu is safer than Microsoft® Windows® " statement from website LXer Syndicated Linux News 0 06-17-2010 02:41 PM
LXer: Memo From Dell: Ubuntu Linux Safer Than Microsoft Windows LXer Syndicated Linux News 0 06-11-2010 03:20 PM
how is linux safer than windows? learnfast Linux - Newbie 3 03-10-2005 10:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:56 AM.

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