Impersonation of Kyuubi Spark Authz plugin #3620
-
How does spark ranger plugin migrated to Kyuubi work for impersonation? will such a code work when using Kyuubi: val ugi = UserGroupInformation.loginUsingKeytab(blah blah)
val proxy = UserGroupInformation.createProxyUser("some.user", ugi)
UsergroupInformation.setLoginUser(ugiProxy)
given that keytab file was generated for super user - would this impersonation work so that kyuubi sends audit logs to elastic search (ranger audits) as the proxy user? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 11 replies
-
it works on client mode, but not cluster mode |
Beta Was this translation helpful? Give feedback.
-
/**
* Get the active session user
* @param spark spark context instance
* @return the user name
*/
def getAuthzUgi(spark: SparkContext): UserGroupInformation = {
// kyuubi.session.user is only used by kyuubi
val user = spark.getLocalProperty("kyuubi.session.user")
if (user != null && user != UserGroupInformation.getCurrentUser.getShortUserName) {
UserGroupInformation.createRemoteUser(user)
} else {
UserGroupInformation.getCurrentUser
}
} the snippet above is how the plugin handles users. IIUC, you can set the proxy user via |
Beta Was this translation helpful? Give feedback.
-
I wish to get this going on EMR on EKS - if we ignore EMR on EKS and just consider spark on kubernetes - do you @yaooqinn or @pan3793 think it can work? |
Beta Was this translation helpful? Give feedback.
-
We made it to work on EMR on EKS by using Kyuubi authz plugin as spark sql extension and adding all jars on spark usr lib and setting appropriate hadoop configurations. Essentially we did this:
val ugiProxy = ugi.createProxyUser("username", loggedInUserUgi)
ugiProxy.doAs( spark sql goes here)
All stuff works with above changes, Posting for other folks if they hit this issue or need. |
Beta Was this translation helpful? Give feedback.
-
Hello, I used Apache Ranger to control the access policy of the Hadoop cluster, and kyuubi sync the policy of hive. When I config the properties using the instroduction of "https://kyuubi.apache.org/docs/latest/security/authorization/spark/install.html", some problem arised: So I changed the code of org.apache.ranger.admin.client.RangerAdminRESTClient, add username and password to be authenticated by Ranger Admin. Both on client mode and cluster mode, kyuubi spark can successful sync the policy from Ranger Admin. |
Beta Was this translation helpful? Give feedback.
-
@AnirudhVyas @yaooqinn @pan3793 @xiaozhch5 I am currently trying to submit a spark sql job through zeppelin (using livy interpreter) to Spark Engine. I am just using the Kyuubi Authz module as an extension while initializing the spark session. Note that I am not using any other module of Kyuubi. My Ranger and Spark engine is Kerberos enabled. Kyuubi version - 1.8.0 While submitting a query from Zeppelin to Spark, livy impersonates the domain user and submits the spark-sql job as --proxy-user Is there no way to pass the delegation token of the domain user when RangerAdminRESTClient tries to authenticate to Ranger. I am also getting the same error as mentioned by @xiaozhch5 and I am blocked on this for a couple of weeks. Pasted below. Can someone please help here. I am very new to Kyuubi and Spark. Will really appreciate it. |
Beta Was this translation helpful? Give feedback.
-
Hi @pan3793 Thanks a lot for your quick reply. Yes I match 4. The query is submitted in cluster mode. |
Beta Was this translation helpful? Give feedback.
We made it to work on EMR on EKS by using Kyuubi authz plugin as spark sql extension and adding all jars on spark usr lib and setting appropriate hadoop configurations. Essentially we did this:
0. Customize EMR EKS build image
and then do
All stuf…