Closed bobvanderlinden closed 1 year ago
I've found that this solution isn't great. It'll crash programs that were linked to a different glibc version, so using any executables that aren't defined in the shell can be affected.
It showed up on Debian, which has an older version of glibc. git
crashed because the LD_PRELOAD of userhosts resulted in an incompatible glibc version being loaded first.
@bobvanderlinden yes, NSS isn't great. I wrote about this stuff in https://flokli.de/posts/2022-11-18-nsncd/.
This however speaks about per-host NSS config.
I'd probably recommend using *.localhost hostnames when you want to have multiple vhosts pointing back to your own machine. That should work on most linux systems using nss-systemd.
https://serverfault.com/a/1103995 suggests it might work on MacOS too, but i didn't check.
Yea, if I could change all applications at my workplace to use *.localhost
I would, but it's not trivial to do so atm :sweat_smile: nsncd
sounds good though, I'll enable it on my system.
Thanks! Please reach out if you encounter any issues, I'm very interested in them :-)
The userhosts module allows changing DNS lookups within the shell. Where usually you'd change /etc/hosts, it is now possible to change these entries within the shell without root.
This uses LD_PRELOAD to let ld.so load the libuserhosts.so library and the HOSTS_FILE is set to a Nix-generated hosts file containing the hosts entries from the devshell configuration.
This PR is similar to https://github.com/numtide/devshell/pull/75, but is based on
userhosts
instead ofhostctl
.Example:
Which allows: