Skip to content

WinRM certificate implementation in HTTPs is very strange #2282

@1RedOne

Description

@1RedOne

Steps to reproduce

  • Use an internal CA to deploy a Cert template valid for WinRM
  • Deploy the cert with an 8 hour validity period and renewal at 2 hours
  • Deploy a script to auto-renew certs once every hour (b/c the default renewal period is 8 hours and ain't nobody got time for that)
  • Enable WinRM w/ Https using winrm qc -transport:https
  • Wait for cert to expire

Expected behavior

We would expect to see one of two things happen here:

Cert Auto Renews and UI correctly reports this

or

WinRM never notices that cert has been replaced and all remoting fails

Actual behavior

In actuality, it appears that WinRM somehow does note that the certificate has been renewed, because it continues to accept WinRM connections over HTTPS with no issues, even after the certificate referenced under WSman\Listener has expired.

However, everything in the UI reports outdated certificate information, for instance.

On the left, the current valid cert, on the right, what PowerShell reports
On the left, the current valid cert, on the right, what PowerShell reports

These inconsistencies are all over the place. WSman:\Service\CertificateThumbprint contains (in my case) the Thumbprint of the very first cert ever used with this machine, more than a week ago, also expired.

The built in winrm command also seems to report the same cert, which was present when winrm qc -transport:https was first conducted.


Looking under wsman:\Service, a Cert thumbprint from a previous test is visible

The strangest part of the whole thing is that even though WinRM References out of date and invalid certificate information all over, somehow only the correct and new cert is being presented when new Winrm connections come in (such as via Enter-PSSession -UseSsl.

Desired Change

The UI should correctly reflect the certificate thumbprint being used with WinRM, not refer to the original cert used to enable WinRM, as it does today.

Environment data

> 
Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.0.10586.117                                                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.10586.117                                                                          
CLRVersion                     4.0.30319.34011                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 



Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-WindowsResolution-ExternalThe issue is caused by external component(s).WG-RemotingPSRP issues with any transport layer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions