|
|
84ae89 |
From a0928fe164712303a7c24ee61500ac7326bd9e4a Mon Sep 17 00:00:00 2001
|
|
|
84ae89 |
From: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
84ae89 |
Date: Tue, 23 Aug 2022 16:58:07 +0300
|
|
|
84ae89 |
Subject: [PATCH] fix canonicalization issue in Web UI
|
|
|
84ae89 |
|
|
|
84ae89 |
When Kerberos principal alias is used to login to a Web UI, we end up
|
|
|
84ae89 |
with a request that is authenticated by a ticket issued in the alias
|
|
|
84ae89 |
name but metadata processed for the canonical user name. This confuses
|
|
|
84ae89 |
RPC layer of Web UI code and causes infinite loop to reload the page.
|
|
|
84ae89 |
|
|
|
84ae89 |
Fix it by doing two things:
|
|
|
84ae89 |
|
|
|
84ae89 |
- force use of canonicalization of an enterprise principal on server
|
|
|
84ae89 |
side, not just specifying that the principal is an enterprise one;
|
|
|
84ae89 |
|
|
|
84ae89 |
- recognize that a principal in the whoami()-returned object can have
|
|
|
84ae89 |
aliases and the principal returned by the server in the JSON response
|
|
|
84ae89 |
may be one of those aliases.
|
|
|
84ae89 |
|
|
|
84ae89 |
Fixes: https://pagure.io/freeipa/issue/9226
|
|
|
84ae89 |
|
|
|
84ae89 |
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
84ae89 |
Reviewed-By: Armando Neto <abiagion@redhat.com>
|
|
|
84ae89 |
---
|
|
|
84ae89 |
install/ui/src/freeipa/ipa.js | 8 +++++++-
|
|
|
84ae89 |
ipaserver/rpcserver.py | 1 +
|
|
|
84ae89 |
2 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
84ae89 |
|
|
|
84ae89 |
diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
|
|
|
84ae89 |
index 758db1b00..a08d632e9 100644
|
|
|
84ae89 |
--- a/install/ui/src/freeipa/ipa.js
|
|
|
84ae89 |
+++ b/install/ui/src/freeipa/ipa.js
|
|
|
84ae89 |
@@ -271,7 +271,13 @@ var IPA = function () {
|
|
|
84ae89 |
var cn = that.whoami.data.krbcanonicalname;
|
|
|
84ae89 |
if (cn) that.principal = cn[0];
|
|
|
84ae89 |
if (!that.principal) {
|
|
|
84ae89 |
- that.principal = that.whoami.data.krbprincipalname[0];
|
|
|
84ae89 |
+ var principal = data.principal;
|
|
|
84ae89 |
+ var idx = that.whoami.data.krbprincipalname.indexOf(principal);
|
|
|
84ae89 |
+ if (idx > -1) {
|
|
|
84ae89 |
+ that.principal = principal;
|
|
|
84ae89 |
+ } else {
|
|
|
84ae89 |
+ that.principal = that.whoami.data.krbprincipalname[0];
|
|
|
84ae89 |
+ }
|
|
|
84ae89 |
}
|
|
|
84ae89 |
} else if (entity === 'idoverrideuser') {
|
|
|
84ae89 |
that.principal = that.whoami.data.ipaoriginaluid[0];
|
|
|
84ae89 |
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
|
|
|
84ae89 |
index 1f85e9898..4e8a08b66 100644
|
|
|
84ae89 |
--- a/ipaserver/rpcserver.py
|
|
|
84ae89 |
+++ b/ipaserver/rpcserver.py
|
|
|
84ae89 |
@@ -1109,6 +1109,7 @@ class login_password(Backend, KerberosSession):
|
|
|
84ae89 |
ccache_name,
|
|
|
84ae89 |
armor_ccache_name=armor_path,
|
|
|
84ae89 |
enterprise=True,
|
|
|
84ae89 |
+ canonicalize=True,
|
|
|
84ae89 |
lifetime=self.api.env.kinit_lifetime)
|
|
|
84ae89 |
|
|
|
84ae89 |
if armor_path:
|
|
|
84ae89 |
--
|
|
|
84ae89 |
2.37.3
|
|
|
84ae89 |
|