Kestrel, https and trumbprint

Product: PowerShell Universal
Version: 3.5.5

Hello!
I have fresh install of PowerShell Universal 3.5.5 (msi)
I try to create dashboard with https. If i try to use thumbprint i get error:

Application: Universal.Server.exe
CoreCLR Version: 6.0.1122.52304
.NET Version: 6.0.11
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.

My config file (C:\ProgramData\PowerShellUniversal\appsettings.json)

{
  "Kestrel": {
    "Endpoints": {
      "HTTPS": {
         "Url": "https://*:443",
         "Certificate": {
		   "Thumbprint": "3CB0F8C63C45F71007F926C4C807C98FD66676AB",
           "Store": "My",
           "Location": "LocalMachine",
           "AllowInvalid": "true"
         }
      }
    }
  },
  "Plugins": [
    "UniversalAutomation.LiteDBv5"
  ],
  "Data": {
    "RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
    "ConnectionString": "%ProgramData%\\UniversalAutomation\\database.db"
  },
}

If i change “Thumbprint” to “Subject” all works:

{
  "Kestrel": {
    "Endpoints": {
      "HTTPS": {
         "Url": "https://*:443",
         "Certificate": {
		   "Subject": "Executor3.avp.ru_webInterface",
           "Store": "My",
           "Location": "LocalMachine",
           "AllowInvalid": "true"
         }
      }
    }
  },
  "Plugins": [
    "UniversalAutomation.LiteDBv5"
  ],
  "Data": {
    "RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
    "ConnectionString": "%ProgramData%\\UniversalAutomation\\database.db"
  },
}

I can’t use subject because there are several certificates on the server with the same cn.
I created a special research certificate with a special cn to make it different. The browser throws an error when connecting, so I can’t leave it like that.

I think this is a bug. I’ll open an issue for it.

In version 3.6.0 all work fine. Thanks!

2 Likes