Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Have any of your guys noticed a lot of brute force attempts on your sshd?
I get about 10 hits a day or so trying our users 'test,' 'guest,' 'user,' and 'root.' None of these can get access to my box via ssh, so I don't care so much, but with only these usernames always tried and the time between attempts a second or two between tries makes me think script kiddies or like someone's box was compromised.
I have reported some of it to the orginating domain, but when I get like 3 or different IP's in a day, I just get lazy.
Anyway, second question: can you fake the IP that these attemps would come from, so that in your /var/log/secure file, the IP's of the originating computer are in fact wrong?
Originally posted by Jedyte Yes, I get a lot of these too! Is there a way to automatically blacklist when someone tries these? No-one should ever login with 'test','guest' or 'admin' so I can safely assume they're malicious.
You can parse and add the IP's into a list but there are so many people connectiong internet thorugh dial-up and taking dynamic IP. So when you blacklist an IP, it can be given to another user and lamer one can get a fresh-and-clean IP that isn't in your blacklist. But i think you can decide up to ssh attempt frequency; i mean if you're getting attempts from an IP for a long time then it can be a static lamer :-)
First your second question, archdev; yes, it is possible to spoof the IP address, so that you don't see the proper one in the log. However, the attack would be blind since the responses from your sshd will go to the "apparent" IP address, i.e. the logged IP. To carry through such as attack requires more knowledge than I believe the average script-kiddie possesses.
As barisdemiray said, it is perhaps not very useful to block specific IPs, but if you often see the same IP then it might be worth it. However, it is better to set up a whitelist and deny access from IP's and users not in that list. You have a number of places where you can put these whitelists.
1) In the sshd config file (/etc/ssh/sshd_config) you can use the AllowUsers entry to whitelist users. Other entries of interest in this file are PermitRootLogin, LoginGraceTime, MaxStartups, and maybe some others. See the manpage of sshd_config for more info.
2) Use tcpwrappers as mentioned above. Whitelist allowed IP's in /etc/hosts.allow using the syntax sshd:allowed.ip.here - one for each line. Groups of IPs can be allowed with the notation sshd:192.168.52. which would allow IPs in the range 192.168.52.0-255. The file should end with a line like all:all:deny . Your /etc/hosts.deny should contain the rule all:all .
3) Setup iptables to allow connection requests from certain IPs and block the rest. If you know there will be few connection requests and not very often, you can limit the number of connection requests to one per minute or whatever; that would slow brute-forcing.
4) Change the sshd port from 22 to something else, like 50897. This is security by obscurity and is certainly not good enough on it's own, but might confuse an attacker.
Oh yes, and look up the Protocol entry in /etc/ssh/sshd_config. Make sure it says Protocol 2 and not Protocol 2,1.
The Protocol 2,1 in the sshd_config means that the server should use version 1 as a fallback if protocol 2 fails. I don't know if it's an issue any more, but protocol version 1 has been flawed in the past. Version 2 is newer and said to be more secure, so I think that a fallback to something less secure should be avoided. Version 1 is almost obsolete since it's only used by very old ssh versions, and I would not trust anyone who still uses it. Correct me if I'm wrong please
I've forgotten where I read that one should skip Protocol 1, so I'm doing some searches. I just found the following here:
Use only ssh protocol 2; version 1.33 and 1.5 of ssh protocol is not completely cryptographically safe (according to Nessus probe)