Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenSSL 3.0 Support] - Current WinRM version does not support the latest OpenSSL version #340

Closed
D3vil0p3r opened this issue Dec 6, 2022 · 7 comments

Comments

@D3vil0p3r
Copy link

Hello @pmorton @sneal @mwrock
after the latest update of OpenSSL version to OpenSSL 3.0.x, WinRM component is not working anymore as intended. It occurs because with the latest OpenSSL version, maintainers decided to keep disable by default legacy protocols.

In particular, for some tools leveraging WinRM, as Evil-WinRM, when they call the WinRM component, an OpenSSL error arises.

The detailed explanation and reproduction of the issue is here: BlackArch/blackarch#3593

According to https://bugs.archlinux.org/task/76653?project=1&order=dateopened&sort=desc the user "loqs" states the following:

"NTLM v1 Authentication uses md4 [1]. The ruby ntlm gem as used by winrm uses the openssl gem to provide md4 [2]. With OpenSSSL 3 md4 in the legacy provider which is not enabled by default.
The ruby openssl gem does not currently provide a method to load a provider [3] so the provider has to be loaded using OpenSSL's configuration file.
Assuming evil-winrm / winrm are not run set-user-ID or set-group-ID the environment variable the environment variable OPENSSL_CONF can be used to specify an alternate location for OpenSSL's config. This avoids changing the default configuration. The variable can in set in a script file that then calls the real executable.

[1] https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/464551a8-9fc4-428e-b3d3-bc5bfb2e73a5?redirectedfrom=MSDN
[2] https://github.com/macks/ruby-ntlm/blob/323ef447c04e130a31940fa6dabe96607677c22b/lib/ntlm/util.rb#L77
[3] https://github.com/ruby/openssl/issues/567"

Could you please add the support to OpenSSL 3.0.x for WinRM component please?

Thank you in advance.

@thesamesam
Copy link

FWIW, OpenSSL 1.1.x is EOL in September.

@mglogowski1
Copy link

Any updates on this fix?

@cwegener
Copy link

@mglogowski1 I don't think anything in the winrm gem will change until Ruby's openssl supports OpenSSL 3

ruby/openssl#369

@hlein
Copy link

hlein commented Dec 10, 2023

If I've caught up correctly, Ruby's openssl has supported OpenSSL 3.x for a while. But the main/lingering problem with openssl-3.x for winrm was a need for an interface by which to enable non-default providers (to get access to md4). That seems to have been added here: ruby/openssl#635, included in v3.2.0 released a few months ago: https://github.com/ruby/openssl/releases/tag/v3.2.0

So, I think it should be possible to update winrm to work with OpenSSL 3.x providing you're using v3.2.0 of the openssl gem?

@smallfield
Copy link

While using Ruby 3.3, I was able to resolve the issue with the gem by following these steps:

  • Install the openssl gem (version 3.2.0).
  • Write following code: OpenSSL::Provider.load("legacy") to enable legacy certificates.

This process made the gem functional again for me.

@lmayorga1980
Copy link

@smallfield i need to test this with the new AWS Codebuild Images.

mhashizume added a commit to mhashizume/puppetlabs-puppet_agent that referenced this issue Apr 2, 2024
When running on stock Ruby >= 3.1, Bolt (running as a gem) cannot
connect to Windows via WinRM. This is due to one of Bolt's dependencies,
the WinRM gem, using a legacy cryptographic algorithm (MD4) no longer
supported by newer versions of Ruby and OpenSSL.[1]

Because of this incompatibility and the general recommendation to use a
Bolt package rather than using Bolt as a gem[2], this commit removes
Bolt from the project Gemfile and updates the environment variable used
for task tests from GEM_BOLT to BOLT_TESTS.

[1] WinRb/WinRM#340
[2] https://www.puppet.com/docs/bolt/latest/bolt_installing#install-bolt-as-a-gem
mhashizume added a commit to mhashizume/puppetlabs-puppet_agent that referenced this issue Apr 2, 2024
When running on stock Ruby >= 3.1, Bolt (running as a gem) cannot
connect to Windows via WinRM. This is due to one of Bolt's dependencies,
the WinRM gem, using a legacy cryptographic algorithm (MD4) no longer
supported by newer versions of Ruby and OpenSSL.[1]

Because of this incompatibility and the general recommendation to use a
Bolt package rather than using Bolt as a gem[2], this commit removes
Bolt from the project Gemfile and updates the environment variable used
for task tests from GEM_BOLT to BOLT_TESTS.

[1] WinRb/WinRM#340
[2] https://www.puppet.com/docs/bolt/latest/bolt_installing#install-bolt-as-a-gem
mhashizume added a commit to mhashizume/puppetlabs-puppet_agent that referenced this issue Apr 2, 2024
Internally, we have seen task acceptance tests start to fail when
running Bolt as a gem on newer versions of Ruby with Windows targets.

When running on stock Ruby >= 3.1, Bolt (running as a gem) cannot
connect to Windows via WinRM. This is due to one of Bolt's dependencies,
the WinRM gem, using a legacy cryptographic algorithm (MD4) no longer
supported by newer versions of Ruby and OpenSSL.[1]

Because of this incompatibility and the general recommendation to use a
Bolt package rather than using Bolt as a gem[2], this commit removes
Bolt from the project Gemfile and updates the environment variable used
for task tests from GEM_BOLT to BOLT_TESTS.

[1] WinRb/WinRM#340
[2] https://www.puppet.com/docs/bolt/latest/bolt_installing#install-bolt-as-a-gem
@pcai
Copy link
Contributor

pcai commented Jun 7, 2024

This should be addressed in rubyntlm v0.6.4 which was released yesterday. Thanks

@pcai pcai closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants