help setting up ssh logging appropriately
Hi guys, a couple days ago my office laptop was broken into via ssh password guessing (girlfriend was amanda/amanda!)
I have reinstalled ubuntu on that machine and have locked down(I hope) by using the UsersAllow option, PermitRootLogin option, changing the ssh port, and in the event of a compromise restricting the outgoing connections so I at least wont cause more trouble. So I think I have that machine in good shape, does anyone have more suggestions?
However, I'm interested in what was done to that machine. So I have an old powermac G4 set up on my home network that I just installed lenny on. Nothing else on it. I want to set this machine up with a few easy to guess usernames, open up the ssh port, close down the outgoing connections, and see what happens when people break in (I figure it shouldn't take long).
How can I do this? Specifically, I want to know what usernames were guessed,what the passwords guessed were, all successes/failures, times etc.
In the event of success, I want to be able to see all the commands executed, along with times.
So, I want a little more info than auth.log and .bash_history will give me, but I don't think I need a full fledged honeypot like honeyd. Plus most of the honeypot software looks fairly complicated to manage. I'm just curious.
Does anyone have suggestions for me?
You might want to use key based authentication and not allow username/password authentication. Or use a stronger password.
When you configure the ssh key, you can include a passphrase, which would be an entire sentence.
When you mentioned the root login option, did you disable root logins? Since someone guessed your password, they also knew your username, unless that was your root password. So "AllowUsers" while a good idea to prevent against brute force attacks on known system users won't help in itself ( unless you use the form "user@host" so you also control where you can connect from, but if you are connecting from various locations are have a dynamic IP this won't work ) if the attacker knows your username.
You might consider changing your username as well.
If the hacker obtained root access, it's game over. You need to re-install. Using sudo you can control what commands can be run and each command would be logged. If there are any holes, like allowing "sudo su" or not using an option in vim that disables escaping to the shell, it will be easy to get around this restriction. Plus you will be restricting what you can do legitimately. These are more useful for controlling what wheel members are allowed to do.
Let me help you focus on what you're doing: you're explicitly allowing anyone to enter and subvert your network. Allowing hostiles in without taking proper precautions is like denying hard hats, seatbelts or prophylactics where ever necessary. Do invest time in making sure your setup does what you want it to do and nothing more.
|All times are GMT -5. The time now is 01:45 PM.|