Bug 1374228 - glibc: Not possible for nss modules to say "not authoritative for this name" (new glibc API for NSS)
Summary: glibc: Not possible for nss modules to say "not authoritative for this name" ...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
Assignee: glibc team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1238628
TreeView+ depends on / blocked
 
Reported: 2016-09-08 09:52 UTC by Carlos O'Donell
Modified: 2023-07-09 12:57 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1319285
Environment:
Last Closed: 2018-11-30 17:46:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github https://github.com/systemd systemd issues 2026 0 None None None 2020-09-18 10:57:52 UTC

Comment 1 Carlos O'Donell 2016-09-08 09:55:17 UTC
Description of problem:
When the DNS server is unreachable, getaddrinfo is expected to return EAI_AGAIN.  This was fixed in RHEL-6 with bug 1044628 but the same fix is useless in RHEL-7. This is because a default RHEL-7 install also has myhostname plugin, which returns NODATA, resulting in getaddrinfo returning EAI_NONAME.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
See reproducer in bug 1098042.

Actual results:
getaddrinfo returns EAI_NONAME

Expected results:
getaddrinfo returns EAI_AGAIN

Notes:

Just to be clear the problem is a fundamental design flaw in nss_myhostname which violates the expectations of the NSS plugin framework, but because the behaviour has shown to be useful we are going to extend the glibc API to support it and we hope that upstream supports this new behaviour.

Raised issue upstream to have a conversation about the notion of supporting NSS service plugins that only answer a subset of requests in an authoritative way.

https://www.sourceware.org/ml/libc-alpha/2016-05/msg00554.html

Comment 2 Florian Weimer 2016-09-08 14:44:49 UTC
I don't think glibc changes are required if nss_myhostname is moved to the front and nss_myhostname uses _gateway instead of gateway for the name it injects.  _gateway is not in the IANA namespace for host names, so collisions with DNS are not possible, and no public names can be shadowed.

This needs to be fixed in systemd.

Comment 3 Fedora End Of Life 2017-02-28 10:13:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 4 Zbigniew Jędrzejewski-Szmek 2017-07-24 03:32:32 UTC
I *really* let the ball drop here... Sorry for that.

Anyway, I filed a pull-request in systemd to rename to _gateway. Hopefully it go in soon. But I don't think this actually solves the problem.

The issue is that glibc does not provide support for nss modules which only are authoritative only for a subset of names, unless they are at the beginning of the "hosts:". Carlos explains it better than I could in https://www.sourceware.org/ml/libc-alpha/2016-05/msg00554.html, so let me just add an example:

  Let's say I want to use "files" as a backup, letting "sss" and "dns"
  take precedence. If I put "hosts: sss dns files", and the first two
  modules return NSS_STATUS_UNAVAIL/EAGAIN, the last one returns
  NSS_STATUS_NOTFOUND/ENOENT, and the user sees "No such host" even
  though "Temporary failure in name resolution" would be more appropriate
  (and would not poison nscd cache).

A module like "files" knows that it is only authoritative for the few names which are listed in /etc/hosts, and cannot say anything useful about other names. So it should be able to make itself ignored, and let the return value from previous modules propagate. (So this is independent from any _gateway vs gateway considerations.)

In https://bugzilla.redhat.com/show_bug.cgi?id=1238628#c13 Carlos proposes to add __nss_last_service_result(), to allow the modules to "propagate" the return value from preceding modules.

I can also see an alternative solution: adding a new return code, that
would tell the resolver function that this module cannot provide an authoritative answer. If any other module provides an authoritative answer, that answer it returned. In no other module provides an authoritative answer, EAI_NONAME is returned. This could be implemented as either a new NSS_STATUS code (NSS_STATUS_NONAUTHORITATIVE without *errnop and *h_errnop being set).

The advantage of a new return code is that it puts the logic in glibc, and allows the modules to be kept simple. But either option would work from nss-myhostname's point of view, so I'd defer to glibc maintainers to decide what is easier/more backwards compatible/etc.

Comment 5 Jan Kurik 2017-08-15 08:09:49 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 6 Ben Cotton 2018-11-27 18:33:40 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Ben Cotton 2018-11-30 17:46:35 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 8 Zbigniew Jędrzejewski-Szmek 2018-11-30 20:30:07 UTC
FWIW, systemd in F28+ uses _gateway. But the more general issue still exists for nss-resolve and other modules. I'll retitle the bug accordingly.

Comment 9 Carlos O'Donell 2018-11-30 20:38:07 UTC
DJ published a blog post asking for developer feedback about improving nsswicth.conf, and it is directly related to this issue and how to handle the description of what a service is authoritative for:

https://developers.redhat.com/blog/2018/11/26/etc-nsswitch-conf-non-complexity/


Note You need to log in before you can comment on or make changes to this bug.