Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

sshd brute force protection.

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
15 posts • Page 1 of 1
Author
Message
XenoTerraCide
Veteran
Veteran
User avatar
Posts: 1418
Joined: Sun Jan 18, 2004 1:22 pm
Location: MI, USA
Contact:
Contact XenoTerraCide
Website

sshd brute force protection.

  • Quote

Post by XenoTerraCide » Sun Jun 10, 2007 4:43 pm

I'm wondering if anyone knows of a pam or sshd hack that would allow me to run a command after so many failed login attempts from a certain host. I'm hoping for something better than grep-ing through logs.
I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help.
Top
AaronPPC
Guru
Guru
Posts: 522
Joined: Sun May 29, 2005 8:22 am
Location: Tucson, AZ

  • Quote

Post by AaronPPC » Sun Jun 10, 2007 5:27 pm

No hack needed. Take a look at fail2ban or denyhosts. I use fail2ban and love it.
--Aaron
Top
XenoTerraCide
Veteran
Veteran
User avatar
Posts: 1418
Joined: Sun Jan 18, 2004 1:22 pm
Location: MI, USA
Contact:
Contact XenoTerraCide
Website

  • Quote

Post by XenoTerraCide » Mon Jun 11, 2007 3:00 am

those both seem to be log analysis tools which is something I'm hoping to avoid. if there isn't something that does it perhaps I should attempt to write it myself. I just don't want to re-invent the wheel. however the current wheel seems to be made of wood.... parsing logs is horribly inefficient when pam has the ability to keep track of the number of failed logins so it _shouldn't_ be to difficult to have it execute commands. the biggest problem I have is that I've started using ipset. 90% of the automated log scanning scripts have either crappy or ineffecient firewall rules on top of it.
I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help.
Top
dsegel
Tux's lil' helper
Tux's lil' helper
Posts: 127
Joined: Fri Jan 31, 2003 8:41 pm

  • Quote

Post by dsegel » Mon Jun 11, 2007 5:00 am

Running sshd on a non-standard port is all you need to avoid most scripted attacks.
Top
XenoTerraCide
Veteran
Veteran
User avatar
Posts: 1418
Joined: Sun Jan 18, 2004 1:22 pm
Location: MI, USA
Contact:
Contact XenoTerraCide
Website

  • Quote

Post by XenoTerraCide » Mon Jun 11, 2007 11:43 am

I'm not actually worried about anyone ever succeeding... I don't allow root or any users in wheel to log in with a password. I figure most of the machines attacking mine probably do other "naughty" things... which means I can use the IP address I get from the attempts to block all access to the machine to keep them from trying to break other area's of the server which may not be protected and as well audited as ssh is.
I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help.
Top
Naib
Watchman
Watchman
User avatar
Posts: 6101
Joined: Fri May 21, 2004 9:42 pm
Location: Removed by Neddy
Contact:
Contact Naib
Website

  • Quote

Post by Naib » Mon Jun 11, 2007 12:03 pm

I use to run on the default port-22 and I use to get about 3 attacks a day
I used to use blockhosts (which act on every ssh login/attempt).
Denyhost is great as well but as stated non-standard port is the biggest thing you can do
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Mon Jun 11, 2007 12:08 pm

I have to agree with XenoTerraCide that log monitoring is not state of the art. Currently I am not allowing SSH access from the outside.
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
XenoTerraCide
Veteran
Veteran
User avatar
Posts: 1418
Joined: Sun Jan 18, 2004 1:22 pm
Location: MI, USA
Contact:
Contact XenoTerraCide
Website

  • Quote

Post by XenoTerraCide » Mon Jun 11, 2007 12:53 pm

actually I want them to attack ssh. better they attack that than a more vulnerable service. this is a web server so I have to have lots of stuff open, stealthing the ssh port is not an option.
I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help.
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Mon Jun 11, 2007 1:07 pm

well... most kiddies 'scan' for specific services based on open ports. They try to exploit every open port on their list.
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
XenoTerraCide
Veteran
Veteran
User avatar
Posts: 1418
Joined: Sun Jan 18, 2004 1:22 pm
Location: MI, USA
Contact:
Contact XenoTerraCide
Website

  • Quote

Post by XenoTerraCide » Mon Jun 11, 2007 1:24 pm

exactly which would include 22,25,53,80,110,143,443, ... of all the services listening the only one I deem something I don't have to worry about it's ssh. although I'm sure apache and bind are well audited they can't say only 2 remotely exploitable flaws ever.
I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help.
Top
ToeiRei
Veteran
Veteran
User avatar
Posts: 1191
Joined: Mon Jan 03, 2005 10:50 am
Location: Austria
Contact:
Contact ToeiRei
Website

  • Quote

Post by ToeiRei » Mon Jun 11, 2007 1:32 pm

I am running a couple of honeypots to see the incoming hits... it's really a pain.
But let's have a look at pam if there's a blacklist/blocker module;
Please stand by - The mailer daemon is busy burning your messages in hell...
Top
XenoTerraCide
Veteran
Veteran
User avatar
Posts: 1418
Joined: Sun Jan 18, 2004 1:22 pm
Location: MI, USA
Contact:
Contact XenoTerraCide
Website

  • Quote

Post by XenoTerraCide » Mon Jun 11, 2007 1:49 pm

the only thing I've found is pam_abl, however it doesn't seem to add hosts to the firewall... I think it just keeps them from logging in.
I don't hang out here anymore, try asking on http://unix.stackexchange.com/ if you want my help.
Top
hermanng
Apprentice
Apprentice
Posts: 175
Joined: Wed Jan 28, 2004 1:36 pm
Location: Nussberg,Germany,Earth

  • Quote

Post by hermanng » Tue Jun 12, 2007 12:25 am

XenoTerraCide wrote:the only thing I've found is pam_abl, however it doesn't seem to add hosts to the firewall... I think it just keeps them from logging in.
Yes, pam_abl is designed to maintain some automated host blacklists, requests from these will then be denied. But I don't think it will work with sshd (due to the way it is designed).
Hermann
Top
javeree_work
Tux's lil' helper
Tux's lil' helper
Posts: 84
Joined: Wed Apr 13, 2005 9:22 am

  • Quote

Post by javeree_work » Tue Jun 12, 2007 8:49 am

I use iptables with the 'recent' module to catch brute force attempts

I don't have access to my system now, but it's something similar
# $IPTABLES -A INPUT -p tcp -i eth0 --dport 22 -m state --state NEW -m recent --name sshprobe --set -j ACCEPT
# $IPTABLES -A INPUT -p tcp -i eth0 --dport 22 -m state --state NEW -m recent --name sshprobe --update --seconds 60 --hitcount 3 -j LOGDROP # LOGDROP is a chain that first logs the attacker and then drop him.

This is limited to sropping someone from retyring ssh brute force, but it can be generalized. A google with 'iptables recent' showed me this link: http://www.stearns.org/doc/adaptive-fir ... rrent.html

Which shows an example of an attacker of a mail server being blocked for several minutes after 3 attempts.

Hope this helps
Top
hermanng
Apprentice
Apprentice
Posts: 175
Joined: Wed Jan 28, 2004 1:36 pm
Location: Nussberg,Germany,Earth

  • Quote

Post by hermanng » Fri Jun 22, 2007 11:02 am

You may also want to have a look at sshguard, which is quite new in portage.
Hermann
Top
Post Reply

15 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic