Bug 2857 - ssh 7.7p1 does not find SSHFP records unless you supply the canonical hostname
Summary: ssh 7.7p1 does not find SSHFP records unless you supply the canonical hostname
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: -current
Hardware: All FreeBSD
: P5 major
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 14:03 AEST by Craig Leres
Modified: 2021-04-23 15:10 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres 2018-04-12 14:03:06 AEST
After upgrading from 7.6p1 to 7.7p1 via the FreeBSD port I found SSHFP records were not being found unless the canonical, fully qualified domain is used. Looking at dns queries, 7.6p1 correctly uses my the dns search path and once it figures out the FQDN, it uses it to look up A, AAAA and SSHFP records. 7.7p1 finds the FQDN and is able to look up the A and AAAA records but uses the non-canonical version of the hostname when looking up the SSHFP records.

I see that this block moved from main() to ssh_session2():

        /* Find canonic host name. */
        if (strchr(host, '.') == 0) {
                struct addrinfo hints;
                struct addrinfo *ai = NULL;
                int errgai;
                memset(&hints, 0, sizeof(hints));
                hints.ai_family = options.address_family;
                hints.ai_flags = AI_CANONNAME;
                hints.ai_socktype = SOCK_STREAM;
                errgai = getaddrinfo(host, NULL, &hints, &ai);
                if (errgai == 0) {
                        if (ai->ai_canonname != NULL)
                                host = xstrdup(ai->ai_canonname);
                        freeaddrinfo(ai);
                }
        }

I'm not sure why it was moved but it's the cause of this issue.
Comment 1 Craig Leres 2018-04-12 14:11:44 AEST
Oops. It looks like the real issue is with a broken FreeBSD port patch and not with openssh-portable 7.7p1. Sorry for the noise!
Comment 2 Damien Miller 2021-04-23 15:10:03 AEST
closing resolved bugs as of 8.6p1 release