From owner-freebsd-python@freebsd.org Mon Jan 15 15:18:15 2018 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AD0AEB3CFE for ; Mon, 15 Jan 2018 15:18:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id E7A067B6AE for ; Mon, 15 Jan 2018 15:18:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id E5C9EEB3CFD; Mon, 15 Jan 2018 15:18:14 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4951EB3CFC for ; Mon, 15 Jan 2018 15:18:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DC2D7B6AA for ; Mon, 15 Jan 2018 15:18:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 8176F1CD7A for ; Mon, 15 Jan 2018 15:18:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w0FFIEr3079212 for ; Mon, 15 Jan 2018 15:18:14 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w0FFIEuJ079211 for python@FreeBSD.org; Mon, 15 Jan 2018 15:18:14 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: python@FreeBSD.org Subject: [Bug 204899] security/py-kerberos: authGSSClientStep raises GSSError UNKNOWN_SERVER Date: Mon, 15 Jan 2018 15:18:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: needs-qa X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: john@saltant.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: dvl@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2018 15:18:15 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D204899 --- Comment #18 from John W. O'Brien --- The problem lies in how the principal name type in the main call to gss_import_name is patched from MIT to Heimdal. py-kerberos uses [0] gss_krb5_nt_service_name, which krb5 defines as [1] gss_nt_service_name. That symbol is, in turn, set to [2] the OID defined as= [3] 1.2.840.113554.1.2.1.4, a.k.a. GSS_C_NT_HOSTBASED_SERVICE. This is consiste= nt with the API docs for authGSSClientInit [4] and the standard for that name type [5]: "service@hostname". Under the hood, both heimdal and krb5 parse n= ames of that type by splitting on '@' and producing a krb5 principal with two components, the left and right sides. The adaptation [6] from krb5 to heimdal erroneously pivoted on the "krb5" p= art of the name instead of the "service" part of the name, and ends up using GSS_KRB5_NT_PRINCIPAL_NAME [7] as a result, which expects a principal of a different form. That name type treats '@' as the separator between multiple '/'-separated components and the realm ("service/hostname@REALM"), not as t= he separator of two principal components. This explains why, as revealed in the KDC logs for the failing test cases, the client tries to traverse a cross r= ealm trust (krbtgt/hostX.example.com@EXAMPLE.COM) as if the intended hostname we= re a foreign realm. I have prepared a patch that I will test and post shortly. [0] https://github.com/apple/ccs-pykerberos/blob/PyKerberos-1.2.5/src/kerberosg= ss.c#L153 [1] https://github.com/krb5/krb5/blob/krb5-1.15.2-final/src/lib/gssapi/krb5/gss= api_krb5.h#L101 [2] https://github.com/krb5/krb5/blob/krb5-1.15.2-final/src/lib/gssapi/generic/= gssapi_generic.c#L182 [3] https://github.com/krb5/krb5/blob/krb5-1.15.2-final/src/lib/gssapi/generic/= gssapi_generic.c#L93 [4] https://github.com/apple/ccs-pykerberos/blob/PyKerberos-1.2.5/pysrc/kerbero= s.py#L150 [5] https://tools.ietf.org/html/rfc2743#page-85 Section 4.1 [6] https://svnweb.freebsd.org/ports/head/security/py-kerberos/files/extra-patc= h-src_kerberosgss.h?view=3Dmarkup&pathrev=3D401816 [7] https://tools.ietf.org/html/rfc1964#page-13 Section 2.1.1 --=20 You are receiving this mail because: You are on the CC list for the bug.=