While the .NET Core SDK includes an HTTPS development certificate and also has a tool to install and trust it
dotnet dev-certs https --trust
this unfortunately does not work on Ubuntu. The reason why it does not work on Ubuntu, or more specific on Linux in general, is that there is no standard location or api to store certificates on Linux. The paths may change from distribution to distribution. In addition application may have their own store (e.g. Chromium).
On the other side not having a trusted development certificate leads to issues, starting from warnings and errors in browsers or tools like postman up to not be able to have service-to-service communication with
That is why I create a bash script which creates a self-signed certificate, trusts it in various locations and imports it into the .NET Core SDK so it will be actually used as a development certificate. Currently the certificate will be trusted in the following location
- System certificates - to enable service-to-service communication
- User nssdb - to trust the certificate in supported application like Chromium or Microsoft Edge
- Snap Chromium nssdb - to trust the certificate in Chromium if installed via snap
- Snap Postman nssdb - to trust the certificate in Postman if installed via snap
In addition the certificate will be imported into dotnet so that it will be used as a development certificate in ASP.NET Core.
You can find the script on Github https://github.com/BorisWilhelms/create-dotnet-devcert. Feel free to open issues when you have an application that will not recognize the cert, so I will be able to extend the script.