RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1724672 - ssh_session_has_known_hosts_entry() regressed in 0.8.91
Summary: ssh_session_has_known_hosts_entry() regressed in 0.8.91
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libssh
Version: 8.1
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: rc
: 8.1
Assignee: Anderson Sasaki
QA Contact: Ivan Nikolchev
URL:
Whiteboard:
Depends On:
Blocks: 1720267
TreeView+ depends on / blocked
 
Reported: 2019-06-27 13:57 UTC by Martin Pitt
Modified: 2020-11-14 07:17 UTC (History)
4 users (show)

Fixed In Version: libssh-0.9.0-3.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 22:36:03 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
reproducer (980 bytes, text/x-csrc)
2019-06-27 13:57 UTC, Martin Pitt
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3657 0 None None None 2019-11-05 22:36:15 UTC

Description Martin Pitt 2019-06-27 13:57:51 UTC
Created attachment 1585180 [details]
reproducer

Description of problem: The latest version 0.8.91 in RHEL 8.1 (and now also Fedora Rawhide) breaks known hosts handling. Hosts are now considered unknown even when 


Version-Release number of selected component (if applicable):

libssh-0.8.91-0.1.el8

How reproducible: Always


Steps to Reproduce:
1. Generate a local ./knownhosts file with
   ssh -o UserKnownHostsFile=./knownhosts 127.0.0.1
   No need to log in, just confirm the host key.
2. Build and run the attached reproducer, which exercises ssh_session_has_known_hosts_entry:
   gcc -Wall -o client-knownhost client-knownhost.c  -lssh && ./client-knownhost

Actual results:

Validate that with libssh up to 0.8.7, the host is known, i. e. that you did the ./knownhosts

[2019/06/27 15:27:32.815499, 2] ssh_connect:  libssh 0.8.7 (c) 2003-2018 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_pthread
[2019/06/27 15:27:32.815815, 2] ssh_socket_connect:  Nonblocking connection socket: 3
[2019/06/27 15:27:32.815883, 2] ssh_connect:  Socket connecting, now waiting for the callbacks to work
[2019/06/27 15:27:32.815931, 1] socket_callback_connected:  Socket connection callback: 1 (0)
[2019/06/27 15:27:32.829473, 1] ssh_client_connection_callback:  SSH server banner: SSH-2.0-OpenSSH_8.0
[2019/06/27 15:27:32.829528, 1] ssh_analyze_banner:  Analyzing banner: SSH-2.0-OpenSSH_8.0
[2019/06/27 15:27:32.829554, 1] ssh_analyze_banner:  We are talking to an OpenSSH client version: 8.0 (80000)
[2019/06/27 15:27:32.829747, 1] ssh_known_hosts_read_entries:  Failed to open the known_hosts file '/builddir/.ssh/known_hosts': No such file or directory
[2019/06/27 15:27:32.832632, 2] ssh_kex_select_methods:  Negotiated curve25519-sha256,ecdsa-sha2-nistp256,aes256-ctr,aes256-ctr,hmac-sha2-256,hmac-sha2-256,none,none,,
[2019/06/27 15:27:32.844292, 2] ssh_packet_dh_reply:  Received SSH_KEXDH_REPLY
[2019/06/27 15:27:32.848752, 2] ssh_client_curve25519_reply:  SSH_MSG_NEWKEYS sent
[2019/06/27 15:27:32.848811, 2] ssh_packet_newkeys:  Received SSH_MSG_NEWKEYS
[2019/06/27 15:27:32.849191, 2] ssh_packet_newkeys:  Signature verified and valid
[2019/06/27 15:27:32.849289, 1] ssh_known_hosts_read_entries:  Failed to open the known_hosts file '/builddir/.ssh/known_hosts': No such file or directory
host known: 1


with libssh 0.8.91, it is not known:

[2019/06/27 15:29:50.895746, 1] ssh_config_parse_line:  line 3: Unsupported Match keyword 'final', skipping
[2019/06/27 15:29:50.895880, 2] ssh_config_parse_line:  Unapplicable option: ForwardX11Trusted, line: 12
[2019/06/27 15:29:50.895957, 2] ssh_config_parse_line:  Unapplicable option: SendEnv, line: 15
[2019/06/27 15:29:50.895997, 2] ssh_config_parse_line:  Unapplicable option: SendEnv, line: 16
[2019/06/27 15:29:50.896033, 2] ssh_config_parse_line:  Unapplicable option: SendEnv, line: 17
[2019/06/27 15:29:50.896056, 2] ssh_config_parse_line:  Unapplicable option: SendEnv, line: 18
[2019/06/27 15:29:50.896097, 2] ssh_connect:  libssh 0.8.91 (c) 2003-2019 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_pthread
[2019/06/27 15:29:50.896312, 2] ssh_socket_connect:  Nonblocking connection socket: 3
[2019/06/27 15:29:50.896379, 2] ssh_connect:  Socket connecting, now waiting for the callbacks to work
[2019/06/27 15:29:50.896430, 1] socket_callback_connected:  Socket connection callback: 1 (0)
[2019/06/27 15:29:50.908453, 2] ssh_client_connection_callback:  SSH server banner: SSH-2.0-OpenSSH_8.0
[2019/06/27 15:29:50.908497, 2] ssh_analyze_banner:  Analyzing banner: SSH-2.0-OpenSSH_8.0
[2019/06/27 15:29:50.908517, 2] ssh_analyze_banner:  We are talking to an OpenSSH client version: 8.0 (80000)
[2019/06/27 15:29:50.908684, 1] ssh_known_hosts_read_entries:  Failed to open the known_hosts file '/builddir/.ssh/known_hosts': No such file or directory
[2019/06/27 15:29:50.910906, 2] ssh_kex_select_methods:  Negotiated curve25519-sha256,ecdsa-sha2-nistp256,aes256-gcm,aes256-gcm,hmac-sha2-256-etm,hmac-sha2-256-etm,none,none,,
[2019/06/27 15:29:50.924347, 2] ssh_init_rekey_state:  Set rekey after 4294967296 blocks
[2019/06/27 15:29:50.924399, 2] ssh_init_rekey_state:  Set rekey after 4294967296 blocks
[2019/06/27 15:29:50.924417, 2] ssh_packet_client_curve25519_reply:  SSH_MSG_NEWKEYS sent
[2019/06/27 15:29:50.924433, 2] ssh_packet_newkeys:  Received SSH_MSG_NEWKEYS
[2019/06/27 15:29:50.924743, 2] ssh_packet_newkeys:  Signature verified and valid
host known: -1

(The /builddir is because I'm running this in mock).

-1 means SSH_KNOWN_HOSTS_NOT_FOUND. This happens also with specifying an absolute instead of relative path, and also with SSH_OPTIONS_KNOWNHOSTS instead of _GLOBAL_KNOWNHOSTS.

Expected results: Host is known with 0.8.91


Additional info:

Comment 2 Martin Pitt 2019-06-27 19:57:18 UTC
Thanks Anderson! This affects package builds, where my .spec can't just create an /etc/ssh/ssh_known_hosts. But fixing this in the next days is certainly fast enough, we still have some time in RHEL 8.1 to land stuff. Thanks!

Comment 3 Anderson Sasaki 2019-07-01 15:17:59 UTC
This should be fixed by libssh-0.9.0-1 in current Fedora rawhide.

Comment 12 errata-xmlrpc 2019-11-05 22:36:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3657


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