Description of problem: If the libvirt_guest NSS module is configured in /etc/nsswitch.conf to provide hostname -> IP mapping _and_ a VM name is used that is not all lowercase, the mapping will fail when used with e.g. "ssh" because it automatically lowercases hostnames and libvirt_guest maps the original case only. Version-Release number of selected component (if applicable): 5.1.0 Steps to Reproduce: 1. Configure /etc/nsswitch.conf to use "libvirt_guest" for "hosts" lookups 2. Define and start am VM with a uppercase name such as "FooBar" connected to the NATed "default" network 3. Verify VM is running with "virsh -c qemu:///system list" 4. Verify expected lease with "virsh -c qemu:///system net-dhcp-leases default" 5. "ssh -v FooBar" Actual results: "ssh -v FooBar" will fail and show that connecting fails because the actual lookup is done on "foobar" for which "getent hosts foobar" does not provide a host -> IP mapping as NSS lookups are case-sensitive. Expected results: Either libvirt_guest should also add lower-cased host -> IP mapping so that "getent hosts foobar" and thus "ssh -v FooBar" work _or_ the documentation at https://libvirt.org/nss.html should be updated that libvirt_guest explictly works with all lower-cased VM names only.
Patch posted on the list: https://listman.redhat.com/archives/libvir-list/2022-May/231871.html
Merged as: commit 7f463b4c0d9c7f07c335b44fc47432414222f209 Author: Michal Prívozník <mprivozn> AuthorDate: Fri May 27 09:00:59 2022 +0200 Commit: Michal Prívozník <mprivozn> CommitDate: Fri May 27 13:43:14 2022 +0200 nss: Compare hostname case insensitive There are some tools that convert hostname to lowercase before resolving it (e.g. ssh). In a way it makes sense because DNS is case insensitive and in case of ssh the lowercase version is then used to find matching record in its config file. However, our NSS module performs case sensitive comparison, which makes it useless with ssh. Just consider a machine named FooBar. Therefore, switch to case insensitive string comparison. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1777873 Signed-off-by: Michal Privoznik <mprivozn> Reviewed-by: Martin Kletzander <mkletzan> v8.4.0-rc1-11-g7f463b4c0d