Skip to content

Hostname lookups favour DNS before hosts file #75

Description

@defau1t

Good day,

We have a network environment wherein sometimes "localhost.domain" appears in our DNS records. This has caused some issues with our PandABox attempting to resolve localhost to itself and, instead, attempting to connect to a random host on our network.

It appears that the /etc/nsswitch.conf file currently shipped with the PandABox firmware is set to the following

hosts: dns files
networks: files

I propose the following change be made. I don't have a dev environment to attempt to build the image myself so I didn't want to blindly submit a PR without being able to test. That being said, it does follow already established patterns (replacing an /etc file with another one as in rootfs/skeleton/etc/profile) so I do not expect issues. Let me know if I can go ahead and submit a PR. Thanks!

diff --git a/rootfs/skeleton/etc/nsswitch.conf b/rootfs/skeleton/etc/nsswitch.conf
new file mode 100644
index 0000000..0321a7f
--- /dev/null
+++ b/rootfs/skeleton/etc/nsswitch.conf
@@ -0,0 +1,2 @@
+hosts:      files dns
+networks:   files
diff --git a/rootfs/skeleton/file-list b/rootfs/skeleton/file-list
index ba85dac..db14353 100644
--- a/rootfs/skeleton/file-list
+++ b/rootfs/skeleton/file-list
@@ -19,5 +19,10 @@ f 644 /usr/lib/python3.8/site-packages/defaults.pth defaults.pth
 rm - /etc/profile
 f 555 /etc/profile
 
+# Copy in nsswitch.conf file that conforms with vendor and glibc
+# defaults
+rm - /etc/nsswitch.conf
+f 644 /etc/nsswitch.conf
+
 # link firmware folder
 l 777 /lib/firmware /opt/firmware

EDIT: localhost description didn't translate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions