Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Jun 06, 2008 7:31 pm 
Offline
Senior Newbie

Joined: Fri Jun 06, 2008 7:25 pm
Posts: 10
Website: http://thesoonergeek.com
Location: Norman, OK
I am trying to create a few simple rules to cut down on the number of SSH bruteforce attempts and am having issues. After I create the rules I am attempting to use "iptables --list" to make sure they are there/correct, but am receiving the following.

Code:
$ iptables --list
iptables v1.3.8: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.


I probably overlooked something easy, but still can't get it :S


Last edited by treybrown on Tue Jun 10, 2008 12:55 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Fri Jun 06, 2008 8:12 pm 
Offline
Senior Newbie

Joined: Thu May 15, 2008 7:58 pm
Posts: 17
use a different port. The second I changed my port to something other then 22 all that activity stopped.

I would also suggest knockd if u really wanna hide your sshd.


edit: I think the error is because u have yet to save the rules file. You create the rules file, but until u save it and restart daemon nothing will happen. What distro are u using?? In arch the command is
Code:
/etc/rc.d/iptables save


Last edited by jacko on Fri Jun 06, 2008 8:18 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Fri Jun 06, 2008 8:15 pm 
Offline
Senior Newbie

Joined: Thu May 15, 2008 7:58 pm
Posts: 17
my bad, I always like to leave links to the info I use... arch wiki is one to none if u ask me.

http://wiki.archlinux.org/index.php/Sim ... ith_knockd


Top
   
 Post subject:
PostPosted: Fri Jun 06, 2008 8:55 pm 
Offline
Senior Newbie

Joined: Fri Jun 06, 2008 7:25 pm
Posts: 10
Website: http://thesoonergeek.com
Location: Norman, OK
I am using Ubuntu Hardy. Thanks for the info on knockd will check it out.


Top
   
 Post subject:
PostPosted: Fri Jun 06, 2008 10:06 pm 
Offline
Senior Member
User avatar

Joined: Sun Feb 08, 2004 7:18 pm
Posts: 562
Location: Austin
My preferred solution is the relatively new "recent" feature in iptables. It can block any new SSH attempt from an IP which has made 3 in the previous five minutes. It really puts the brakes on the brute force attacks.

Code:
iptables -N SSHSCAN
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSHSCAN
iptables -A SSHSCAN -m recent --set --name SSH
iptables -A SSHSCAN -m recent --update --seconds 300 --hitcount 3 --name SSH -j DROP


See http://www.ducea.com/2006/06/28/using-iptables-to-block-brute-force-attacks/

You probably want to whitelist your own home IP first.


Top
   
 Post subject:
PostPosted: Fri Jun 06, 2008 10:38 pm 
Offline
Senior Newbie

Joined: Fri Jun 06, 2008 7:25 pm
Posts: 10
Website: http://thesoonergeek.com
Location: Norman, OK
Thanks Xan, problem is I can enter the rules, but can't list them and it doesn't appear to be working, though I really don't want to lock myself out to test. :?


Top
   
 Post subject:
PostPosted: Sat Jun 07, 2008 6:46 am 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
treybrown wrote:
I really don't want to lock myself out to test. :?


Just use the console from your members login if you do. Don't underestimate the power of the console. I don't even run sshd.


Top
   
 Post subject: Re: iptables problem
PostPosted: Sun Jun 08, 2008 11:19 am 
Offline
Senior Member
User avatar

Joined: Mon Dec 10, 2007 4:30 pm
Posts: 341
Website: http://markwalling.org
treybrown wrote:
I am trying to create a few simple rules to cut down on the number of SSH bruteforce attempts and am having issues. After I create the rules I am attempting to use "iptables --list" to make sure they are there/correct, but am receiving the following.

Code:
$ iptables --list
iptables v1.3.8: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.


I probably overlooked something easy, but still can't get it :S


are you root?


Top
   
 Post subject:
PostPosted: Sun Jun 08, 2008 1:52 pm 
Offline
Senior Member

Joined: Sun Nov 30, 2003 2:28 pm
Posts: 245
That message usually means that the appropriate iptables modules haven't been loaded...but Linode kernels have these built in. But even weirder, it seems that you should have gotten errors while creating the rules, not just when listing. I just tried this at home, and just running 'iptables --list" caused the modules to load...Hmmmm. Is your linode Xen or UML?

_________________
The irony is that Bill Gates claims to be making a stable operating system and Linus Torvalds claims to be trying to take over the world.
-- seen on the net


Top
   
 Post subject:
PostPosted: Sun Jun 08, 2008 2:23 pm 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
jacko wrote:
You create the rules file, but until u save it and restart daemon nothing will happen.


Would it be more consistent to write:

U create the rules file, but until u save it...

than to mix "you" and "u"?

James


Top
   
 Post subject: Re: iptables problem
PostPosted: Tue Jun 10, 2008 12:55 pm 
Offline
Senior Newbie

Joined: Fri Jun 06, 2008 7:25 pm
Posts: 10
Website: http://thesoonergeek.com
Location: Norman, OK
mwalling wrote:
are you root?


:oops: OK, wow...I can't imagine why I didn't do this as root :oops:

Thanks for all the help everyone.


Top
   
 Post subject:
PostPosted: Sun Jun 15, 2008 12:30 pm 
Offline
Junior Member

Joined: Fri Mar 05, 2004 12:30 am
Posts: 39
ICQ: 181450
Website: http://tkatch.com
AOL: TMHChacham
Location: Oak Park, MI
kangaby wrote:
Don't underestimate the power of the console. I don't even run sshd.


I never thought of that. Just don't run sshd and use the website to login. If i wanted to use putty, i could login to turn sshd on.

Are the any perceived downsides to that? The only one i can think of is if i didn't have a browser available.


Last edited by chacham on Tue Jun 17, 2008 4:36 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Sun Jun 15, 2008 5:23 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
You don't even need to use the website; you can ssh directly to the console; eg if you are on host72 then "ssh host72.linode.com -l your_linode_username" (or use putty or whatever) will get you direct access to the lish interface, which connects you to the console port.

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Sun Jun 15, 2008 10:47 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
chacham wrote:
The only one i can think of is if i didn.t have a browser available.

I use Putty to connect directly to the lish console on the host of my Linode. (Members area has details on how to do this for your account)
Sometimes it will slowdown, when the host is doing lots of stuff I guess, but other than that, it works a treat.
I've only ever used the Ajax console once from work, where putty (ssh) is blocked by our firewall, and that worked as well.


Top
   
 Post subject:
PostPosted: Tue Jun 17, 2008 4:38 pm 
Offline
Junior Member

Joined: Fri Mar 05, 2004 12:30 am
Posts: 39
ICQ: 181450
Website: http://tkatch.com
AOL: TMHChacham
Location: Oak Park, MI
Wow, thanx for the great idea.

I just installed fail2ban, to see how that works out. I may just use this idea instead.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group