LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 12-12-2005, 10:57 PM   #1
teddymills
LQ Newbie
 
Registered: Jun 2004
Location: The Far side of Charon
Posts: 15

Rep: Reputation: 0
stop ssh attempts with limitssh


The only problem with this script, is that you will no longer see
hundreds of endless ssh attempts in your logs. It is quite sad to
seeing all those attempts being DROPPED like a bad habit.

This script I think came another source, perhaps the Linux Journal website? I forget. Anyways I did not make up these iptable rules, but they sure work mighty fine.



-------------------

#!/bin/sh
#limit incoming connections to port 22 to 2 per minute

iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 3 -j DROP
 
Old 12-13-2005, 06:08 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
'-m recent' should be usable, except it doesn't keep state in a reusable way, nor does it allow for logging. I would suggest using any of the already 'combat proven' apps around.

OT, and not to spread FUD, but from my experience what it definately is *not* good for is when you're tracking a *huge* amount of SYN's per IP per second. Even with adequate memory on board, adjusted module loading arguments, lowering lifespan for entries and applied to specific Iptables rules it became CPU and memory intensive to the point the box needed a three finger salute.
 
Old 12-14-2005, 07:24 PM   #3
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
Quote:
Originally Posted by unSpawn
'-m recent' should be usable, except it doesn't keep state in a reusable way, nor does it allow for logging.
You can log with the recent module i have set up logging rules a few days ago and works fine.
 
  


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
SSH login attempts Capt_Caveman Linux - Security 225 11-07-2009 09:55 AM
SSH Alert when root attempts to log gamehack Linux - Software 3 06-03-2009 06:44 AM
Failed SSH login attempts Capt_Caveman Linux - Security 38 01-03-2006 03:22 PM
ssh login attempts from localhost?! sovietpower Linux - Security 2 05-29-2005 01:19 AM
numerous ssh attempts archdev Linux - Security 14 08-10-2004 04:14 PM

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

All times are GMT -5. The time now is 04:24 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