WinRb / WinRM

Ruby library for Windows Remote Management
Apache License 2.0
412 stars 117 forks source link

Getting `WinRM::WinRMAuthorizationError` with server certificate sha384 or sha512 #348

Open amel-kcl opened 1 month ago

amel-kcl commented 1 month ago

The WinRM SSL connection works when the certificate is signed with SHA1 or SHA256, but does not work with SHA384 or SHA512 :

This is the error I get:

/var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/http/response_handler.rb:59:in `raise_if_auth_error': WinRM::WinRMAuthorizationError (WinRM::WinRMAuthorizationError)
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/http/response_handler.rb:51:in `raise_if_error'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/http/response_handler.rb:34:in `parse_to_xml'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/http/transport.rb:188:in `send_request'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/http/transport.rb:183:in `send_request'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:149:in `max_envelope_size_kb'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:74:in `max_fragment_blob_size'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:198:in `fragmenter'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:162:in `block in open_shell_payload'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:161:in `map'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:161:in `open_shell_payload'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/power_shell.rb:119:in `open_shell'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/base.rb:174:in `block in open'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/retryable.rb:35:in `retryable'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/base.rb:172:in `open'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/base.rb:132:in `with_command_shell'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/shells/base.rb:79:in `run'
        from test.rb:13:in `block in <main>'
        from /var/lib/gems/3.0.0/gems/winrm-2.3.8/lib/winrm/connection.rb:42:in `shell'
        from test.rb:12:in `<main>'
pcai commented 1 month ago

can you provide a more complete repro please? apologies if this is obvious but I don't use winrm so I'm not familiar with the exact options you're passing that cause this issue