身份验证成功后,Kerberos 缓存文件是否应保持为空?

Should Kerberos cache file remain empty after successful authentication?

我正在努力连接到 Impala,它是通过 JDBC 驱动程序的 kerberised CDH 集群的一部分。为了进行身份验证,我需要在我的机器上获取 Kerberos 票证。 kinit 很有魅力。奇怪的是,当我设置 KRB5CCNAME 指向文件的变量时,文件在成功验证后仍然为空,但 klist 显示我已通过身份验证。这是预期的行为吗?

我问这个的原因是,我的 java 应用程序无法连接到 Impala,错误消息表明空文件可能是问题所在。但是,python 脚本可以从同一台机器连接到同一个 Impala。

这是 Mac 2018 年。

不应该。

Apple 有自己的捆绑 kerberos 实现 (Heimdal),它可以执行这种奇怪的空文件操作。

我从 brew 安装了 krb5 包,相应地修改了 PATH,它工作正常。

myself@mymachine:~$ brew info krb5
krb5: stable 1.16.2 (bottled) [keg-only]
Network authentication protocol
https://web.mit.edu/kerberos/
/usr/local/Cellar/krb5/1.16.2 (160 files, 3.7MB)
  Poured from bottle on 2018-12-18 at 15:20:46
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/krb5.rb
==> Dependencies
Required: openssl ✔
==> Caveats
krb5 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have krb5 first in your PATH run:
  echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.bash_profile

For compilers to find krb5 you may need to set:
  export LDFLAGS="-L/usr/local/opt/krb5/lib"
  export CPPFLAGS="-I/usr/local/opt/krb5/include"

For pkg-config to find krb5 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig"

==> Analytics
install: 198 (30 days), 614 (90 days), 1,986 (365 days)
install_on_request: 182 (30 days), 557 (90 days), 1,768 (365 days)
build_error: 0 (30 days)

myself@mymachine:~$ /usr/bin/klist --version
klist (Heimdal 1.5.1apple1)
Copyright 1995-2011 Kungliga Tekniska Högskolan
Send bug-reports to heimdal-bugs@h5l.org

Windows 会出现类似的问题,其中 Kerberos 不考虑是否设置了 KRB5CCNAME 环境变量。解决方案是使用旧版本。 This page mentions 4.0.1 version, however on the Kerberos page 你可以找到 4.1。第一个将使用文件缓存,后者将使用 API 并且很难要求它不使用它。