LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-20-2009, 10:51 PM   #1
spaceageliving
Member
 
Registered: Aug 2007
Distribution: CentOS
Posts: 48

Rep: Reputation: 17
sshd key id changed


I have two clients set up for public key auth only to a server...tonight, both clients indicated that the id/key of the server had changed.

I checked the mod dates for the key files in /etc/ssh on the server and they haven't changed...

I did change the groups that the login account is a member of just before I started getting the notice on the two clients...could this change possibly cause the client to report a change in the sshd id?

I'm running fail2ban on sshd and have password login and root login disabled...watching the secure log carefully, I pretty certain (ie. 99.999%) nobody has logged in via ssh. What else would possibly be causing this?
 
Old 10-20-2009, 11:04 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Yikes. You're saying your ssh client reported that the sshd server's host keys changed, right?

Quote:
Originally Posted by spaceageliving
I did change the groups that the login account is a member of just before I started getting the notice on the two clients...could this change possibly cause the client to report a change in the sshd id?
Nope. IMO, the timing is a coincidence.

Is there anything else you've changed recently on the server side? (Was the server's hostname or IP previously assigned to a different host at some point?)

---

BTW, what distro / version? (And what sshd version?)
 
Old 10-20-2009, 11:11 PM   #3
spaceageliving
Member
 
Registered: Aug 2007
Distribution: CentOS
Posts: 48

Original Poster
Rep: Reputation: 17
Yes, two separate clients are both reporting the server host key changed...

The server is OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-fhel5

Server is running CentOS 5.3...
 
Old 10-20-2009, 11:40 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
I would definitely not take the warning lightly, unless you can explain the change. (i.e. This protection is in place for a good reason.)

Is it possible the contents of your clients' ~/.ssh/known_hosts file could have become altered / corrupted somehow?
 
Old 10-21-2009, 12:25 AM   #5
spaceageliving
Member
 
Registered: Aug 2007
Distribution: CentOS
Posts: 48

Original Poster
Rep: Reputation: 17
Yeah, my thoughts as well...Given that both clients reported the problem within an hour of each other, I have to pin it on the server changing and not a client corruption or the like. But, both clients are on the same dhcp lan, so maybe somehow that could affect things?

I scanned /var/log/secure, /var/log/messages and the apache logs and didn't see anything odd...rkhunter doesn't detect anything.
 
Old 10-21-2009, 12:53 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Got a backup copy of the server keys? Try a comparison.
 
Old 10-21-2009, 12:57 AM   #7
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
There has to be a satisfactory explanation here. Try to think hard about any other recent changes at the server level. Are you the only sysadmin? Is this a 'net-facing host? Do you monitor system activity regularly?

You didn't answer about any hostname / IP trading among servers, so I'm assuming that is not the case.

It would be nice if you were running a HIDS so that you could verify host key SHA256 / MD5 sums. Mtime alone is not enough to verify file integrity. [ edit: Or a known good backup would help, as mentioned above. ]

I'll reiterate what I said earlier: until you can explain the problem, the server you're logging in to (possibly MITM) is suspect and should be treated with caution.

Last edited by anomie; 10-21-2009 at 01:00 AM.
 
Old 10-22-2009, 10:23 AM   #8
spaceageliving
Member
 
Registered: Aug 2007
Distribution: CentOS
Posts: 48

Original Poster
Rep: Reputation: 17
Yes, I am the only admin. This is a new replacement system (net facing) which has the same host name as the previous (plus new ip)...I did change the hostname from its original when it was brought up, but that happened about a week before this event, and I had been logging in fine with the new (changed) hostname.

Unfortunately, I don't have backups of /etc at this point to check the keys...
 
Old 10-22-2009, 01:12 PM   #9
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
We haven't identified the root cause here. These are the options, IMO:
  • Bite the bullet and rebuild the system, so that you're starting with a known clean slate. (I'm leaning toward "this host has not been cracked, and there just hasn't been enough investigation"...)
  • Physically sit in front of the server and log in to a tty. Then log in over ssh and confirm that you see those remote connections from the physical server. (This would help alleviate the main concern, namely another host posing as you.) Once confirmed, remove the known_hosts entries from your ssh clients and go on with life.

In the future please take regular backups and consider running a HIDS.
 
  


Reply



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
SSHD could not load host key nanodano Linux - Server 2 04-30-2009 11:03 AM
Installed Freenx. Changed sshd config. Can't ssh root. CrewXp Linux - Software 1 08-13-2007 04:52 AM
sshd - host key jamna17 *BSD 3 06-16-2004 08:20 AM
sshd won't read my host key Travis86 Linux - Networking 0 07-30-2003 10:48 AM
Changed my hostname and broke sshd Itzac Linux - Networking 7 03-23-2003 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:31 PM.

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