使用 ODBC 驱动程序在服务中实现 kerberos 委派
我正在尝试扩展我编写的 Windows 服务,以接受来自客户端的 kerberos 票证,然后将该票证委托给 ODBC 驱动程序,以便它可以使用它连接到另一台服务器。
ODBC 驱动程序在独立场景中可以很好地与 kerberos 身份验证配合使用。也就是说,它可以很好地为当前用户请求并转发票证。但在我的服务中,我可能会同时与多个用户打交道。如何接受票证,以便在连接到 ODBC 驱动程序时它发现并使用正确的用户票证?
我能想到的一种可能性是使用票证作为所需用户创建一个新流程。但是,如果可能的话,我真的很想避免这种情况,因为它不太适合我的服务的当前架构。
(注意:我的服务是用 C/C++ 使用 Win32 api 编写的)
I'm trying to extend a windows service I've written to accept a kerberos ticket from a client and then delegate that ticket to an ODBC driver so it can connect to another server with it.
The ODBC driver works with kerberos authentication fine in a standalone scenario. That is, it can request and forward on a ticket for the current user just fine. But in my service, I may be dealing with multiple users at once. How do I accept a ticket so that when I connect to the ODBC driver it discovers and uses the correct user's ticket?
One possibility I can think of is to create a new process as the desired user by using the ticket. However, I would really like to avoid this if possible as it does not fit well within the current architecture of my service.
(Note: My service is written in C/C++ with the Win32 api)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了我自己问题的答案。
验证安全上下文后,我可以使用
ImpersonateSecurityContext
函数。这将导致当前线程作为启动安全上下文的客户端运行。我可以从该线程调用 ODBC 驱动程序的连接函数,它将作为正确的用户进行身份验证。http://msdn.microsoft.com/en -us/library/aa375497%28v=vs.85%29.aspx
I found the answer to my own question.
After authenticating a security context, I can use the
ImpersonateSecurityContext
function. This will cause the current thread to run as client who initiated the security context. From that thread I can call the connection functions for the ODBC driver and it will authenticate as the correct user.http://msdn.microsoft.com/en-us/library/aa375497%28v=vs.85%29.aspx