Jira (BOLT-1323) Support WinRM with Kerberos (from Windows node)

12 views
Skip to first unread message

Ethan Brown (JIRA)

unread,
May 20, 2019, 1:07:03 PM5/20/19
to puppe...@googlegroups.com
Ethan Brown created an issue
 
Puppet Task Runner / New Feature BOLT-1323
Support WinRM with Kerberos (from Windows node)
Issue Type: New Feature New Feature
Assignee: Unassigned
Components: Windows, WinRM
Created: 2019/05/20 10:06 AM
Priority: Normal Normal
Reporter: Ethan Brown

BOLT-126 was originally intended to be for supporting Kerberos authentication over WinRM.

After working on that effort, it was uncovered that the winrm gem only supports the MIT GSSAPI. While this is fine on Linux, where installation of the relevant packages is straightforward, it is a non-standard approach on Windows (even given the Windows installer for GSSAPI). No Windows admin wants to install an additional 3rd party library to access Kerberos functionality that is already built into the OS.

Supporting Windows to Windows authentication using Kerberos and WinRM should use built-in Windows API calls, and should default to using the credentials from the active domain login (as a starting point).

This will require adding support to the WinRM gem to provide encryption / decryption using Windows APIs.

There are some useful details in https://docs.microsoft.com/en-us/windows/desktop/secauthn/sspi-kerberos-interoperability-with-gssapi about translating gssapi calls to equivalent Windows APIs:

_iov functions may already be supported with the above APIs, but may require the *Ex versions.

Code changes to winrm gem will need to be made to replicate the behavior of the HttpGSSAPI class at https://github.com/WinRb/WinRM/blob/master/lib/winrm/http/transport.rb#L287-L461 in a new class, HttpSSPI

Ruby already has some limited helper code available around the Win32 SSPI layer, namely support for the AcquireCredentialsHandle and {{InitializeSecurityContext)) APIs - see https://github.com/ruby/ruby/blob/d48783bb0236db505fe1205d1d9822309de53a36/ext/win32/lib/win32/sspi.rb

The code from gssapi simple that will need to be ported to a Windows API equivalent is at https://github.com/zenchild/gssapi/blob/master/lib/gssapi/simple.rb

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Ethan Brown (JIRA)

unread,
May 20, 2019, 1:17:04 PM5/20/19
to puppe...@googlegroups.com
Ethan Brown updated an issue
Change By: Ethan Brown
BOLT-126 was originally intended to be for supporting Kerberos authentication over WinRM.

After working on that effort, it was uncovered that the {{winrm}} gem only supports the MIT {{GSSAPI}}. While this is fine on Linux, where installation of the relevant packages is straightforward, it is a non-standard approach on Windows (even given the Windows installer for GSSAPI). No Windows admin wants to install an additional 3rd party library to access Kerberos functionality that is already built into the OS.


Supporting Windows to Windows authentication using Kerberos and WinRM should use built-in Windows API calls, and should default to using the credentials from the active domain login (as a starting point).

This will require adding support to the WinRM gem to provide encryption / decryption using Windows APIs.

There are some useful details in https://docs.microsoft.com/en-us/windows/desktop/secauthn/sspi-kerberos-interoperability-with-gssapi about translating gssapi calls to equivalent Windows APIs:

* gss_get_mic -> MakeSignature
* gss_verify_mic -> VerifySignature
* gss_init_sec_context -> [InitializeSecurityContext (Kerberos)|https://msdn.microsoft.com/en-us/library/windows/desktop/aa375507%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396]
* GSS_Wrap -> [EncryptMessage (Kerberos)|https://msdn.microsoft.com/en-us/library/Aa375385(v=VS.85).aspx]
* GSS_Unwrap -> [DecryptMessage (Kerberos)|https://msdn.microsoft.com/en-us/library/Aa375215(v=VS.85).aspx]

{{_iov}} functions may already be supported with the above APIs, but may require the {{*Ex}} versions.



Code changes to winrm gem will need to be made to replicate the behavior of the {{HttpGSSAPI}} class at https://github.com/WinRb/WinRM/blob/master/lib/winrm/http/transport.rb#L287-L461 in a new class, {{HttpSSPI}}

Ruby already has some limited helper code available around the Win32 SSPI layer, namely support for the {{AcquireCredentialsHandle}} and {{InitializeSecurityContext )) }} APIs - see https://github.com/ruby/ruby/blob/d48783bb0236db505fe1205d1d9822309de53a36/ext/win32/lib/win32/sspi.rb


The code from gssapi simple that will need to be ported to a Windows API equivalent is at https://github.com/zenchild/gssapi/blob/master/lib/gssapi/simple.rb

Ethan Brown (JIRA)

unread,
May 20, 2019, 1:17:04 PM5/20/19
to puppe...@googlegroups.com

Ethan Brown (JIRA)

unread,
Jul 24, 2019, 2:28:08 PM7/24/19
to puppe...@googlegroups.com
Ethan Brown updated an issue
BOLT-126 was originally intended to be for supporting Kerberos authentication over WinRM.

After working on that effort, it was uncovered that the {{winrm}} gem only supports the MIT {{GSSAPI}}. While this is fine on Linux, where installation of the relevant packages is straightforward, it is a non-standard approach on Windows (even given the Windows installer for GSSAPI). No Windows admin wants to install an additional 3rd party library to access Kerberos functionality that is already built into the OS.

Supporting Windows to Windows authentication using Kerberos and WinRM should use built-in Windows API calls, and should default to using the credentials from the active domain login (as a starting point).

This will require adding support to the WinRM gem to provide encryption / decryption using Windows APIs.

There are some useful details in
[ https://docs.microsoft.com/en-us/windows/desktop/secauthn/sspi-kerberos-interoperability-with-gssapi ] about translating gssapi calls to equivalent Windows APIs:

* gss_get_mic -> MakeSignature
* gss_verify_mic -> VerifySignature
* gss_init_sec_context -> [InitializeSecurityContext (Kerberos)|https://msdn.microsoft.com/en-us/library/windows/desktop/aa375507%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396]
* GSS_Wrap -> [EncryptMessage (Kerberos)|https://msdn.microsoft.com/en-us/library/Aa375385(v=VS.85).aspx]
* GSS_Unwrap -> [DecryptMessage (Kerberos)|https://msdn.microsoft.com/en-us/library/Aa375215(v=VS.85).aspx]

{{_iov}} functions may already be supported with the above APIs, but may require the {{*Ex}} versions.


Code changes to winrm gem will need to be made to replicate the behavior of the {{HttpGSSAPI}} class at [ https://github.com/WinRb/WinRM/blob/master/lib/winrm/http/transport.rb#L287-L461 ]
in a new class, {{HttpSSPI}}

Ruby already has some limited helper code available around the Win32 SSPI layer, namely support for the {{AcquireCredentialsHandle}} and {{InitializeSecurityContext}} APIs - see
[ https://github.com/ruby/ruby/blob/d48783bb0236db505fe1205d1d9822309de53a36/ext/win32/lib/win32/sspi.rb ]

The code from gssapi simple that will need to be ported to a Windows API equivalent is at
[ https://github.com/zenchild/gssapi/blob/master/lib/gssapi/simple.rb ]

 

Some other ideas tossed around for consuming the MIT dep:

- compile / build / redistribute Windows binaries in MSI from https://github.com/krb5/krb5
    - build once / stash as a "static" dep in Artifactory
    - build via some kind of build step in puppet-runtime
    - not great solution for testing "source"
- drag in older prebuilt binaries from upstream somehow
- provide docs on how to install deps in Windows

Yasmin Rajabi (JIRA)

unread,
Aug 27, 2019, 2:48:03 PM8/27/19
to puppe...@googlegroups.com
Yasmin Rajabi updated an issue
Change By: Yasmin Rajabi
Labels: closed-github-move eyu

Yasmin Rajabi (JIRA)

unread,
Aug 27, 2019, 2:49:02 PM8/27/19
to puppe...@googlegroups.com
Yasmin Rajabi updated an issue
Change By: Yasmin Rajabi
Labels: closed-github-move eyu ghm
Reply all
Reply to author
Forward
0 new messages