将 --negotiate 与 curl 一起使用时,是否需要密钥表文件? [英] When using --negotiate with curl, is a keytab file required?

查看:142
本文介绍了将 --negotiate 与 curl 一起使用时,是否需要密钥表文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档描述如何连接到 kerberos 安全端点显示以下内容:

The documentation describing how to connect to a kerberos secured endpoint shows the following:

curl -i --negotiate -u : "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=..."

-u 标志必须提供,但被 curl 忽略.

The -u flag has to be provided but is ignored by curl.

--negotiate 选项是否会导致 curl 查找使用 kinit 命令预先创建的密钥表,或者 curl 会提示输入凭据?

Does the --negotiate option cause curl to look for a keytab that was created beforehand with the kinit command, or will curl prompt for credentials?

如果它查找密钥表文件,该命令将查找什么文件名?

If it looks for a keytab file, what filename will the command be looking for?

推荐答案

成为该领域 curl 的一次性贡献者.您需要了解以下内容:

Being a once-in-a-while-contributor to curl in that area. Here is what you need to know:

curl(1) 本身对 Kerberos 一无所知,并且不会与您的凭据缓存或密钥表文件进行交互.它将所有调用委托给一个 GSS-API 实现,这将为您带来魔力.什么魔法取决于库、Heimdal 和 MIT Kerberos.

curl(1) itself knows nothing about Kerberos and will not interact neither with your credential cache nor your keytab file. It will delegate all calls to a GSS-API implementation which will do the magic for you. What magic depends on the library, Heimdal and MIT Kerberos.

根据您的问题,我假设您对 Kerberos 知之甚少,并且只想自动调用由 SPNEGO 保护的 REST 端点的 API.

Based on your question, I assume that you have little knowledge about Kerberos and want simply automate API calls to a REST endpoints secured by SPNEGO.

这是您需要做的:

  1. 拥有类似 Unix 的操作系统
  2. 至少安装 MIT Kerberos 1.11
  3. 针对 MIT Kerberos 至少安装 curl 7.38.0
  4. 使用 curl --version 提及 GSS-API SPNEGO 以及与您的 MIT Kerberos 版本链接的 ldd 验证这一点.
  5. 使用ktutilmskutil
  6. 为服务主体创建客户端 密钥表
  7. 尝试通过 kinit -k -t <path-to-keytab> 使用该 client 密钥表获取 TGT;
  8. 使用 klist 验证您是否有票证缓存
  1. Have a Unix-like OS
  2. Install at least MIT Kerberos 1.11
  3. Install at least curl 7.38.0 against MIT Kerberos
  4. Verify this with curl --version mentioning GSS-API and SPNEGO and with ldd linked against your MIT Kerberos version.
  5. Create a client keytab for the service principal with ktutil or mskutil
  6. Try to obtain a TGT with that client keytab by kinit -k -t <path-to-keytab> <principal-from-keytab>
  7. Verify with klist that you have a ticket cache

环境现已准备就绪:

  1. 导出 KRB5CCNAME=
  2. 导出 KRB5_CLIENT_KTNAME=
  3. 调用 curl --negotiate -u :

MIT Kerberos 将检测到两个环境变量都已设置,检查它们,使用您的密钥表自动获取 TGT,请求服务票证并传递给 curl.大功告成.

MIT Kerberos will detect that both environment variables are set, inspect them, automatically obtain a TGT with your keytab, request a service ticket and pass to curl. You are done.

注意:这不适用于 Heimdal.

Note: this will not work with Heimdal.

这篇关于将 --negotiate 与 curl 一起使用时,是否需要密钥表文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆