Bug 666977 - SSH generates misleading errors when using public key authentication
SSH generates misleading errors when using public key authentication
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: openssh (Show other bugs)
14
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Petr Lautrbach
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-03 16:23 EST by mec74mer
Modified: 2012-08-16 15:50 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 15:50:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description mec74mer 2011-01-03 16:23:25 EST
Description of problem:
SSH server generates misleading error message when using public key authentication and authorized_keys.  In particular, the server logs the following error message 26 times in /var/log/secure:

    Authentication tried for root with correct key but not from a permitted host

These messages are immediately followed by the following message:

    Accepted publickey for root from xx.xx.xx.xx port 39160 ssh2

The script that is specified in the "command" option in authorized_keys runs successfully.

Note:  We receive the "not from a permitted host" error even if there is no "from" option in authorized_keys.  If we put in a "from" option (name, IP address, or both) we still receive the error messages.


Version-Release number of selected component (if applicable):
openssh-server-5.5p1-24.fc14.2.x86_64

How reproducible:
Very


Steps to Reproduce:
1.  On client computer, generate keys:

        su
        cd ~root/.ssh
        ssh-keygen -t rsa -C crfile -f crfile

2.  On server computer, copy crfile.pub from client computer to server computer.  Append crfile.pub to ~root/.ssh/authorized_keys.  Add the following option to the key in authorized_keys.

        command="/opt/test/crfile"

3.  On server computer, create a file called /opt/test/crfile.  The file contents should be:

        #! /bin/bash
        touch /opt/test/itworked

Set ownership to root:root.  Set permissions to 744.

4.  On client computer, run the command:

        su
        ssh -T -i ~root/.ssh/crfile <servername>

  
Actual results:
1.  The script /opt/test/crfile should run on the server computer.  The file /opt/test/itworked should be created on the server computer.  THIS IS WHAT WE WANT.

2.  The server computer logs the following messages in /var/log/secure.  (ginblossoms is the server, wilburys is the client.)

Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Authentication tried for root with correct key but not from a permitted host (host=wilburys.corp.onlinemeridian.com, ip=10.110.0.34).
Jan  3 13:55:06 ginblossoms sshd[11988]: Accepted publickey for root from 10.110.0.34 port 39160 ssh2
Jan  3 13:55:06 ginblossoms sshd[11988]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan  3 13:55:06 ginblossoms sshd[11988]: Received disconnect from 10.110.0.34: 11: disconnected by user
Jan  3 13:55:06 ginblossoms sshd[11988]: pam_unix(sshd:session): session closed for user root

Expected results:
1.  The script /opt/test/crfile should run on the server computer.  The file /opt/test/itworked should be created on the server computer.

2.  The server should log the following messages in /var/log/secure.

Jan  3 13:55:06 ginblossoms sshd[11988]: Accepted publickey for root from 10.110.0.34 port 39160 ssh2
Jan  3 13:55:06 ginblossoms sshd[11988]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan  3 13:55:06 ginblossoms sshd[11988]: Received disconnect from 10.110.0.34: 11: disconnected by user
Jan  3 13:55:06 ginblossoms sshd[11988]: pam_unix(sshd:session): session closed for user root


Additional info:
1.  Public key authentication worked on Fedora 13 with openssh-server-5.4p1-3.fc13.i686.

2.  I have captured network packets and it appears normal.  Specifically, there do not appear to be 26 attempts to authenticate.  There is one TCP connection established, one negotiation, one key exchange, a few encrypted packets passed back-and-forth, and a clean disconnect.
Comment 1 Jan F. Chadima 2011-05-24 00:46:00 EDT
please attach your /etc/ssh/sshd_config from the server and the /etc/ssh/ssh_config and ~/.ssh/config from the client (remove sensitive data before attaching) If you have any configuration items in the used authorized keys send them as well.
Comment 2 redhat.1998 2011-06-12 04:50:02 EDT
I'm seeing this bug even if I explicitly add both the IP and the name of the client host to the "correct key" on the host ~username/.ssh/authorized_keys:

from="CLIENT.IP, CLIENT_NAME" ssh-dss .....pub-key-comes-here....  comment

Adding the client IP explicitly to /etc/hosts.allow:
sshd: CLIENT.IP

Doesn't help either.  I keep getting this bogus message logged on every ssh connection by username from CLIENT.IP:

"Authentication tried for username with correct key but not from a permitted host"

It seems wrong.  How can one set a permitted host besides being explicit in the relevant authorized_keys  'from=...' clause?

/etc/ssh/sshd_config on the server side, has these host or otherwise possibly related settings:
------------------------------------------------------
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
------------------------------------------------------
Since I do trust ~/.ssh/known_hosts I didn't uncomment that line.
Comment 3 Fedora Admin XMLRPC Client 2011-11-30 07:26:21 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 4 Fedora End Of Life 2012-08-16 15:50:16 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.