Score:0

Configure winrm https certificate from non-admin user

us flag

Using letsencrypt as a CA, a non-admin user automatically requests a new certificate to be used by the winrm https listener once the old one is about to expire. To make winrm actually use the certificate, the CertificateThumbprint of the listener needs to be set to the new certificates thumbprint.

This can be done like this:

Set-WSManInstance -ResourceURI winrm/config/Listener `
                   -SelectorSet @{Address="*";Transport="HTTPS"} `
                   -ValueSet @{CertificateThumbprint=$thumbprint}

However, our non-admin user obviously is not allowed to do this (yet):

Set-WSManInstance : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="5"
Machine="localhost"><f:Message>Access is denied. </f:Message></f:WSManFault>
At line:1 char:1
+ Set-WSManInstance -ResourceURI winrm/config/Listener `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (winrm/config/Listener:Uri) [Set-WSManInstance], InvalidOperationExcep
   tion
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManInstanceCommand

How do I assign permissions to a non-admin user to update the CertificateThumbprint?

Update: The thumbprint is apparantly stored in HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Listener\*+HTTPS\certThumbprint.

Unfortunately, changing that registry key and restarting WinRM service does result in the old cert still being served. Actually, even after removing the cert from the cert store and restarting WinRM, it is still served. So there must be some cache or auxiliary process which needs to be cleared/restarted.

cn flag
Since the WinRM is an administrative service, you must be a local administrator in order to configure WinRM settings or grant explicit permissions to service: https://serverfault.com/a/993516/251012
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.