Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1109102 - Kerberos does not handle incorrect Active Directory DNS SRV entries correctly
Kerberos does not handle incorrect Active Directory DNS SRV entries correctly
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: krb5 (Show other bugs)
7.1
All Linux
medium Severity medium
: rc
: ---
Assigned To: Nalin Dahyabhai
Patrik Kis
: Regression
Depends On: 1059730
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-13 05:11 EDT by Patrik Kis
Modified: 2015-03-05 05:00 EST (History)
3 users (show)

See Also:
Fixed In Version: krb5-1.12.2-7.el7
Doc Type: Bug Fix
Doc Text:
Cause: When attempting to locate Kerberos servers using DNS service location, the Kerberos client library did not recognize some of the result codes which could be returned by the resolver libraries. Consequence: Instead of treating some non-fatal result codes as non-fatal errors, in many instances the library would treat them as fatal errors, and fail to locate any servers. Fix: Patches were added to help ensure that these specific result codes could be interpreted properly. Result: These errors no longer occur.
Story Points: ---
Clone Of: 1059730
Environment:
Last Closed: 2015-03-05 05:00:54 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0439 normal SHIPPED_LIVE Moderate: krb5 security, bug fix and enhancement update 2015-03-05 09:38:14 EST

  None (edit)
Description Patrik Kis 2014-06-13 05:11:34 EDT
This bug also exists on RHEL-7.
krb5-libs-1.11.3-49.el7

+++ This bug was initially created as a clone of Bug #1059730 +++

Description of problem:

I have been trying to connect Samba to an Active Directory forest(A), which has a trust to another forest(B).
The connection to AD forest A works, but the connection to forest B, did not work.

Forest B consist of a domain with 3 AD servers present in SRV records in DNS (external DNS provided by Infoblox).
However one of these three AD server does not exist anymore.

After debugging the connection between Samba and the cross-forest AD trust, I found the reason for the connection to fail in the Kerberos library (krb5-libs).

The AD servers are contacted through the function k5_sendto(), which uses the function resolve_server() which tries to find an IP address for each AD (Kerberos) server.
resolve_server() calls the system function getaddrinfo(), which returns EAI_NODATA (-5) for the nonexisting AD server on my Linux server.

To determine whether getaddrinfo() encounters a critical error, the function translate_ai_error() is called, which contains a case statement for each possible return code for getaddrinfo(). When a critical error is found, translate_ai_error returns a system error code, not equal to 0. Since the return code EAI_NODATA is not a critical error, it should return 0, so k5_sendto() can try to contact the next AD/Kerberos server found.

However, since the Kerberos library (or sendto_kdc.c) is compiled without _GNU_SOURCE being defined, EAI_NODATA is not defined, causing the case statement in translate_ai_error() to hit the default: option and return EINVAL, instead of 0. This in turn, causes k5_sendto() to stop trying to contact any other AD/Kerberos server and fail with an error code.

When compiling sendto_kdc.c with _GNU_SOURCE being defined, EAI_NODATA is defined and the case statement correctly returns 0, which will let the k5_sendto() continue to try the next AD/Kerberos server, which can be contacted succesfully. Samba is then able to contact both AD forests and everything works.


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

CentOS 6.5:
krb5-libs-1.10.3-10.el6_4.6

How reproducible:

Create an AD forest with a number of AD domain servers, where 1 (or more) of the AD servers does not have an A record in DNS, but does have the correct SRV records present in DNS. Then connect Samba to this domain (security=ads) (a cross-forest trust to another domain is probably not necessary) and try to list users from the domain using:

$ id 'DOMAIN\user'

Steps to Reproduce:
1. Set up an AD domain with a number of AD domain servers
2. Install a RedHat Linux server, with Samba
2. Connect Samba to this domain (security=ads)
3. Configure the Linux server to get user information from winbind and authenticate through Kerberos (using authconfig-tui)
4. Remove the DNS A record for one or more of the AD domain servers
5. Try to fetch the information for this user, using: id 'DOMAIN\user'

Actual results:

id: DOMAIN\user: No such user

Expected results:

uid=10000000(DOMAIN\user) gid=10000000(DOMAIN\domain users) groups=10000000(DOMAIN\domain users)

Additional info:

I added 2 preprocessed listings of the translate_ai_error() function, 1 with _GNU_SOURCE being defined and the other file not having _GNU_SOURCE defined.

I also attached a diff file for the krb5.spec file, which results in a Kerberos library which I tested and works in my environment.
Comment 7 errata-xmlrpc 2015-03-05 05:00:54 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0439.html

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