Skip to content

Commit

Permalink
[KYUUBI #3047] Fallback krb5 conf to OS if not configured
Browse files Browse the repository at this point in the history
### _Why are the changes needed?_

We should not assume that the default `krb5.conf` is located at `/etc/krb5.conf`, it OS-depended.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #3047 from pan3793/kinit.

Closes #3047

16b5d93 [Cheng Pan] Revert "Check kinit in GA"
8e465e1 [Cheng Pan] Check kinit in GA
d53ea1f [Cheng Pan] Fallback krb5 conf to OS if not configured

Authored-by: Cheng Pan <chengpan@apache.org>
Signed-off-by: Cheng Pan <chengpan@apache.org>
  • Loading branch information
pan3793 committed Jul 12, 2022
1 parent 32970ce commit a5f733b
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -47,10 +47,9 @@ class KinitAuxiliaryService() extends AbstractService("KinitAuxiliaryService") {
UserGroupInformation.loginUserFromKeytab(principal.get, keytab.get)
val krb5Conf = Option(System.getProperty("java.security.krb5.conf"))
.orElse(Option(System.getenv("KRB5_CONFIG")))
.getOrElse("/etc/krb5.conf")
val commands = Seq("kinit", "-kt", keytab.get, principal.get)
val kinitProc = new ProcessBuilder(commands: _*).inheritIO()
kinitProc.environment().put("KRB5_CONFIG", krb5Conf)
krb5Conf.foreach(kinitProc.environment().put("KRB5_CONFIG", _))
kinitTask = new Runnable {
override def run(): Unit = {
val process = kinitProc.start()
Expand Down

0 comments on commit a5f733b

Please sign in to comment.