Workaround useless DNS lookup of "UNKNOWN" when connecting with vsock
Description:
Since a while now, systemd will check if it's running inside a VM and bind a listener socket for sshd on the vsock interface. When connections come in on that interface, openssh doesn't know what IP address they have (since it's not familiar with the address family) so it uses the string "UNKNOWN". Unfortunately, it also sets this as the PAM RHOST, resulting in a DNS lookup of "UNKNOWN" which ends up timing out after a long pause.
This issue has been filed upstream since years without a reply: https://github.com/openssh/openssh-portable/pull/388 Fedora carries a patch meanwhile: https://src.fedoraproject.org/rpms/openssh/pull-request/71
Additional info:
- package version(s): openssh 10.0p1-4
- config and/or log files: stock config, directly from
Arch-Linux-x86_64-basic.qcow2 - link to upstream bug report, if any: https://github.com/openssh/openssh-portable/pull/388
Steps to reproduce:
- get
test.thingor a similar framework which connects via vsock: https://codeberg.org/lis/test.thing - get
Arch-Linux-x86_64-basic.qcow2: https://geo.mirror.pkgbuild.com/images/latest/ - run
tt Arch-Linux-x86_64-basic.qcow2or your VM runner of choice. The important thing: networking needs to be enabled, because otherwise the DNS lookup fails immediately because no DNS server is known. - notice that attempting to ssh to the guest is met with a long pause.