Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
June 30, 2008 - Submit Your Site for the July 08 Site of the Month Award!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 22, 2008, 08:49:28 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Invalid Users: in log watch  (Read 1486 times)
vrr
Newbie
*
Offline Offline

Posts: 2


« on: January 04, 2006, 07:19:31 AM »

Hello,
I observed in my logs that somebody was trying to login to shell. Does this is hacking or it is something else i dont know, i m just curious about this. Do you know what it might be trying to do. i am including small part of the log.
Thanks for your reply;

Quote
sshd:
   Invalid Users:
      Unknown Account: 154 Time(s)
   Authentication Failures:
      root (220-130-128-148.hinet-ip.hinet.net ): 91 Time(s)
      netdump (61-218-32-172.hinet-ip.hinet.net ): 1 Time(s)
      unknown (61-218-32-172.hinet-ip.hinet.net ): 151 Time(s)
      unknown (220-130-128-148.hinet-ip.hinet.net ): 3 Time(s)
      daemon (61-218-32-172.hinet-ip.hinet.net ): 2 Time(s)
      cpanel (61-218-32-172.hinet-ip.hinet.net ): 1 Time(s)
      mysql (61-218-32-172.hinet-ip.hinet.net ): 1 Time(s)
      root (61-218-32-172.hinet-ip.hinet.net ): 3 Time(s)
Logged

Adelante
Chief Systems Administrator
Pong! (the videogame) Master
*****
Offline Offline

Posts: 23


i see a kitty!!!!


WWW
« Reply #1 on: January 04, 2006, 08:13:56 AM »

Yeah, those are scripts which are used by hackers to try and brute force attack a ssh user login, it cycles through uses and a list of passwords hoping to get a match.

There are a number of things you can do about this.

1) Secure, but not the best:

make sure all none login user accounts on ur system have a shell of /dev/null or /sbin/nologin or /bin/false

look in your /etc/passwd file, and make sure of the above, this should stop any actual logins from occuring.

Also make sure you use nice secure passwords on your login users like root and so on.

This won't stop these attempts, but it should put your mind at ease.

2) The More Secure way - Long way

You can use iptables to block all the ip's of the people trying to brute force attack your server, there are some scripts out there which help automate this process, but i think it's a complete waste of time.

3) The more secure way - Short cut (my personal favourite)

3.1) If you access our server from fixed ip's the whole time then use iptables to only allow connections to port 22 of your server from these fixed iptables, like this:

Code:
iptables -A INPUT -p TCP -s 123.45.678.9 --dport 22 -j ACCEPT
iptables -A INPUT -p TCP -s 192.243.223.23 --dport 22 -j ACCEPT
iptables -A INPUT -p TCP --dport 22 -j DROP

This would ensure that you can only connect to your ssh port on ur server if you coming from the ip's specified.

3.2) If you have a dynamic ip with something like ADSL, and you know the network ranges your ISP uses (or you could phone and ask them) you could do something like:

Code:
iptables -A INPUT -p TCP -s 165.165.0.0/16 --dport 22 -j ACCEPT
iptables -A INPUT -p TCP -s 165.146.0.0/16 --dport 22 -j ACCEPT
iptables -A INPUT -p TCP --dport 22 -j DROP

This would only allow connections to the ssh port if you are coming from those network ranges.


3.3) If your ISP doesn't use set ranges, then you can use the GEOIP option.
Follow this to get GEOIP support into your kernel and iptables:

Code:
download the latest patch-o-matic-ng-XXXXXX.tar.gz

----------------------
cd /usr/src
tar -xvjpf iptables-1.3.2.tar.bz2
mv iptables-1.3.2 iptables
tar xfz patch-o-matic-ng-XXXXXX.tar.gz
cd patch-o-matic-ng
IPTABLES_DIR=/usr/src/iptables KERNEL_DIR=/usr/src/linux ./runme geoip
------------------------

Then recompile your kernel with the geoip support (it will be in your iptables section of the kernel at the bottom)
Reboot to use the new kernel

------------------------
cd /usr/src/iptables
------------------------
compile iptables

and thats it, some examples on how to use it can be found here:

http://people.netfilter.org/peejix/geoip/howto/geoip-HOWTO-3.html

then you could include something like this in your iptables scripts:

Code:
iptables -A INPUT -p tcp -m geoip --src-cc UK --dport 22 -j ACCEPT
iptables -A INPUT -p TCP --dport 22 -j DROP

This would only allow connections to the ssh port of the server if you were coming from a UK connection (should stop those attempts from the Asia countries)


Personally i use 3.1 with my servers, works like a charm, and i never have those ssh attempt problems Smile

Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM