Search code examples
linuxasp.net-coresecurityssl-certificateidentityserver4

How to configure Key for IdentityServer4 on Linux


I have an asp.net core app with IdentityServer4. In production it requires a key.

On Windows Server, I deployed it OK - created a self-signed certificate and added LocalMacine/my as the key location.

How can I do the same on Linux?

appsettings.json config on Windows - need syntax for Linux:

  "IdentityServer": {
    "Clients": {
      "MyDemoApp": {
        "Profile": "IdentityServerSPA"
      }
    },
    "Key": {
      "Type": "Store",
      "StoreName": "My",
      "StoreLocation": "LocalMachine",
      "Name": "CN=my-demo"
    }
  },

Solution

  • Can you not just refer to your certificate as a .pfx file using a appsettings file like:

    {
      "Kestrel": {
        "Endpoints": {
          "Https": {
            "Url": "https://identityservice.local:6001",
            "Certificate": {
              "Path": "identityservice.local.pfx",
              "Password": "changeit"
            }
          }
        }
      }
    }
    

    Alternatively, when I deploy IdentityServer as a Linux container, I store my certificate in Azure Key Vault.