如何从 Node JS 上的 Kerboros 密钥表文件中读取主体和加密密钥?

How to read principals and encrypted keys from Kerboros keytab file on Node JS?

我需要拦截进入我的节点服务器的特定请求并在那里引入 Kerberos 身份验证。

假设如果一个请求来自 /names/ ,我需要先对它进行 Kerberos 验证,只有验证成功,我才会继续完成请求。

我有一个 .keytab 文件,据我所知,该文件包含身份验证所需的主体和加密密钥。

问题:如何在 Node JS 上读取 .keytab 加密文件? 我查看了 node-krb5 和 node-passport 等节点包,但找不到读取我的密钥表文件的方法

如果您做过类似的事情,请提供帮助。 谢谢。

我查看了 node-krb5 的源代码,发现它毫无用处。它所做的一切 或多或少是 kinit 所做的。

我的猜测是您需要 SPNEGO 的节点实现,它是一种使用 kerberos 的 Web 身份验证协议。 None 个列表中的内容 做到这一点,这不是一件小事。

我建议你考虑在前面放置一个支持 SPNEGO 的服务器 您的节点应用程序。

您应该查看节点 passport-negotiate module which implements server side kerberos ticket authentication checking. There's a sample "login" app in the module which demonstrates how to use the module, and if you look at the strategy.js 如果您想绕过护照并直接进行身份验证,您应该了解如何使用底层 kerberos 支持。

实际的服务器端 kerberos 功能是 npm kerberos 模块的一部分。