|
|
ac7d03 |
From 341d5790afb01e9d99c73ba336103e38e2b30091 Mon Sep 17 00:00:00 2001
|
|
|
ac7d03 |
From: Simo Sorce <simo@redhat.com>
|
|
|
ac7d03 |
Date: Mon, 22 May 2017 10:56:41 -0400
|
|
|
ac7d03 |
Subject: [PATCH] Fix rare race condition with missing ccache file
|
|
|
ac7d03 |
|
|
|
ac7d03 |
In some circumstances the ccache file may disappear while
|
|
|
ac7d03 |
mod_auth_gssapi still has a valid cookie and the client is performing a
|
|
|
ac7d03 |
json server call.
|
|
|
ac7d03 |
|
|
|
ac7d03 |
This may lead to credentials getting sourced from the keytab.
|
|
|
ac7d03 |
Make sure we enforce what GSS NAME we want to resolve so HTTP creds are
|
|
|
ac7d03 |
never mistakenly sourced.
|
|
|
ac7d03 |
|
|
|
ac7d03 |
Ticket: #6972
|
|
|
ac7d03 |
|
|
|
ac7d03 |
Signed-off-by: Simo Sorce <simo@redhat.com>
|
|
|
ac7d03 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
ac7d03 |
---
|
|
|
ac7d03 |
ipaserver/rpcserver.py | 11 ++++++++++-
|
|
|
ac7d03 |
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
ac7d03 |
|
|
|
ac7d03 |
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
|
|
|
ac7d03 |
index 4cde2815a0fe9332d67c84b531f573ff88b1a302..32f286148bbdf294f941116b4bdca85714a52837 100644
|
|
|
ac7d03 |
--- a/ipaserver/rpcserver.py
|
|
|
ac7d03 |
+++ b/ipaserver/rpcserver.py
|
|
|
ac7d03 |
@@ -777,8 +777,17 @@ class jsonserver_session(jsonserver, KerberosSession):
|
|
|
ac7d03 |
self.debug('no ccache, need login')
|
|
|
ac7d03 |
return self.need_login(start_response)
|
|
|
ac7d03 |
|
|
|
ac7d03 |
+ # If we have a ccache, make sure we have a GSS_NAME and use
|
|
|
ac7d03 |
+ # it to resolve the ccache name (Issue: 6972 )
|
|
|
ac7d03 |
+ principal = environ.get('GSS_NAME')
|
|
|
ac7d03 |
+ if principal is None:
|
|
|
ac7d03 |
+ self.debug('no GSS Name, need login')
|
|
|
ac7d03 |
+ return self.need_login(start_response)
|
|
|
ac7d03 |
+ gss_name = gssapi.Name(principal, gssapi.NameType.kerberos_principal)
|
|
|
ac7d03 |
+
|
|
|
ac7d03 |
# Redirect to login if Kerberos credentials are expired
|
|
|
ac7d03 |
- creds = get_credentials_if_valid(ccache_name=ccache_name)
|
|
|
ac7d03 |
+ creds = get_credentials_if_valid(name=gss_name,
|
|
|
ac7d03 |
+ ccache_name=ccache_name)
|
|
|
ac7d03 |
if not creds:
|
|
|
ac7d03 |
self.debug('ccache expired, deleting session, need login')
|
|
|
ac7d03 |
# The request is finished with the ccache, destroy it.
|
|
|
ac7d03 |
--
|
|
|
ac7d03 |
2.9.4
|
|
|
ac7d03 |
|