[SERVER-38067] Write JSTest for bind_ip=localhost with /etc/host override Created: 09/Nov/18  Updated: 04/Jun/19  Resolved: 20/May/19

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Spencer Jackson Assignee: Jonathan Reams
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Sprint: Security 2019-05-06, Security 2019-05-20, Security 2019-06-03
Participants:

 Description   

There is code in bind_ip configuration which depends on hostname resolution. However, we currently can't define different sets of ip->hostname mappings in tests.

However, it appears there is a glibc environment variable called HOSTALIASES that allows a process to define a filepath to a hosts file, overriding the default of /etc/hosts.



 Comments   
Comment by Jonathan Reams [ 20/May/19 ]

I believe this works as designed. ASIO isn't doing anything weird with name resolution (it just calls ::getaddrinfo), but I think there are a bunch of caveats around using HOSTALIASES. It looks like you can have your HOSTALIASES file contain aliases to "localhost" or a DNS-resolvable name and both bind_ip and the shell will respect it. Non-DNS-resolvable names do not appear to work. Since HOSTALIASES seems like an implementation detail of glibc, I don't think we need to test it.

Generated at Thu Feb 08 04:47:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.