Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 12-18-2007, 10:49 AM   #1
Registered: Nov 2007
Distribution: Ubuntu 9.10
Posts: 36

Rep: Reputation: 15
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?
Old 12-18-2007, 11:15 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678Reputation: 678
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.

Last edited by jschiwal; 12-18-2007 at 11:19 AM.
Old 12-18-2007, 12:58 PM   #3
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590
Originally Posted by joe2748 View Post
I have an old powermac G4 set up on my home network that I just installed lenny on. Nothing else on it. (..) I don't think I need a full fledged honeypot like honeyd.
A baitbox should remain controllable and auditable by the admin at all times so that does mean a trusted and well-configurable router, a DMZ and a dedicated honeypot setup. You'll also want to review and reinforce the other LAN segment(s) in case something goes wrong (or not, regular auditing should be done anyway) and have a worst case scenario procedure in place. You may find all of that over the top but what if the cracker does access your other boxen? How do you find out? When do you find out? What if the cracker finds out she's sandboxed and DDoSes you? For a prolonged period? What do you 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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail -s command not working appropriately dphe Linux - Software 3 01-09-2007 12:13 AM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 09:25 AM
NEED HELP - - Yum is not executing appropriately Fedora 2 09-06-2005 09:37 PM
SSH - Logging out r4merlin Linux - Networking 1 11-02-2003 12:50 PM
logging onto SSH robmainella Linux - Newbie 5 08-26-2003 02:21 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:57 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration