[SAC] [OSGeo] #644: DNS resolution issue with CURL on AdHoc VM

#644: DNS resolution issue with CURL on AdHoc VM
---------------------------+------------------------------------------------
Reporter: dmorissette | Owner: sac@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Systems Admin | Keywords:
---------------------------+------------------------------------------------
Some DNS resolution issues with programs using the CURL library have been
reported on the AdHoc VM recently: CURL is unable to resolve any hostname.
OTOH, dig on the same hostname does work:

{{{
dmorissette@adhoc:/tmp$ curl -v http://www.google.com/
* getaddrinfo(3) failed for www.google.com:80
* Couldn't resolve host 'www.google.com'
* Closing connection #0
curl: (6) Couldn't resolve host 'www.google.com'

dmorissette@adhoc:/tmp$ dig www.google.com
[...]
;; ANSWER SECTION:
www.google.com. 604759 IN CNAME www.l.google.com.
www.l.google.com. 259 IN A 74.125.155.106
[...]
}}}

Based on a quick web search, it seems that this kind of problem is related
to the "hosts" setting in the /etc/nsswitch.conf.

We currently have the following line in /etc/nsswitch.conf:
{{{
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
}}}

... and I verified that if I put "dns" before "mdns4_minimal" then CURL
works fine:
{{{
hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4
}}}

I would also note that I checked two other VMs (projects and backup) and
none of them has the mdsn4 stuff, only a simple
{{{
hosts: files dns
}}}
... so it seems that someone intentionally changed this in the AdHoc VM
since it was created.

Unfortunately I don't know enough about the nsswitch.conf and mdns4 to be
sure that the proposed fix above won't have other bad side-effects.
Hopefully whoever added the mdns4 stuff will see this ticket and can
confirm that the change to put "dns" right after "files" would be fine.

--
Ticket URL: <http://trac.osgeo.org/osgeo/ticket/644&gt;
OSGeo <http://www.osgeo.org/&gt;
OSGeo committee and general foundation issue tracker.

#644: DNS resolution issue with CURL on AdHoc VM
---------------------------+------------------------------------------------
Reporter: dmorissette | Owner: sac@…
     Type: defect | Status: closed
Priority: normal | Milestone:
Component: Systems Admin | Resolution: fixed
Keywords: |
---------------------------+------------------------------------------------
Changes (by dmorissette):

  * status: new => closed
  * resolution: => fixed

Comment:

I applied the proposed fix in /etc/nsswitch.conf on the AdHoc VM and
included a comment referring to this ticket:
{{{
# 2010-10-18: Moved dns right after files, see SAC ticket #644
hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4
}}}

Closing ticket. Please re-open if this change caused some side-effects.

--
Ticket URL: <http://trac.osgeo.org/osgeo/ticket/644#comment:1&gt;
OSGeo <http://www.osgeo.org/&gt;
OSGeo committee and general foundation issue tracker.

#644: DNS resolution issue with CURL on AdHoc VM
---------------------------+------------------------------------------------
Reporter: dmorissette | Owner: sac@…
     Type: defect | Status: closed
Priority: normal | Milestone:
Component: Systems Admin | Resolution: fixed
Keywords: |
---------------------------+------------------------------------------------

Comment(by martin):

I think we can firmly assume every appliation which does _not_ work with
"files dns" to be broken (as long as the 'hosts' file is correct :wink:

--
Ticket URL: <http://trac.osgeo.org/osgeo/ticket/644#comment:2&gt;
OSGeo <http://www.osgeo.org/&gt;
OSGeo committee and general foundation issue tracker.