8fb8f02 Only set PAM_RHOST if the remote host is not "UNKNOWN"

Authored and Committed by daandemeyer 24 days ago
    Only set PAM_RHOST if the remote host is not "UNKNOWN"
    
    When using sshd's -i option with stdio that is not a AF_INET/AF_INET6
    socket, auth_get_canonical_hostname() returns "UNKNOWN" which is then
    set as the value of PAM_RHOST, causing pam to try to do a reverse DNS
    query of "UNKNOWN", which times out multiple times, causing a
    substantial slowdown when logging in.
    
    To fix this, let's only set PAM_RHOST if the hostname is not "UNKNOWN".
    
    The upstream PR (https://github.com/openssh/openssh-portable/pull/388)
    has gone unreviewed for more than a year, even after multiple pings on
    the PR and the mailing list.
    
    This greatly improves the experience of using systemd's new ssh-generator
    (https://github.com/systemd/systemd/pull/30777) which allows connecting
    to VMs via VSOCK.
    
        
file modified
+4 -1