aspnetcore: don't expose a localhost https endpoint when there is no developer certificate
By default kestrel exposes an HTTPS endpoint for localhost using a development certificate.
On Linux, the dotnet dev-certs https --trust
doesn’t work well leading to a bricked development experience.
It would be nice if there was a global way to opt-out of the HTTPS localhost bind.
One option may be to not bind localhost HTTPS when there is no development certificate.
I think the reason for having the HTTPS endpoint is to be secure by default, though not having it on localhost
does not make things insecure by default.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 37 (37 by maintainers)
Links to this issue
- Appliquer HTTPS dans ASP.NET Core | Microsoft Learn
- 在 ASP.NET Core 中强制使用 HTTPS | Microsoft Learn
- Enforce HTTPS in ASP.NET Core | Microsoft Learn
- Принудительное применение HTTPS в ASP.NET Core | Microsoft Learn
- 在 ASP.NET Core 中強制執行 HTTPS | Microsoft Learn
- Enforce HTTPS in ASP.NET Core | Microsoft Learn
- ASP.NET Core で HTTPS を適用する | Microsoft Learn
- Applicare HTTPS in ASP.NET Core | Microsoft Learn
- Erzwingen von HTTPS in ASP.NET Core | Microsoft Learn
- 在 ASP.NET Core 中强制使用 HTTPS | Microsoft Learn
- [.NET5] The SSL connection could not be established on login in blazor app.
@tmds I’m glad that we sorted this out
The openssl issue that was fixed is this one: https://github.com/openssl/openssl/issues/1418
WRT to Firefox the problem with not setting it up at the system level is that it might impact automation tools. We could do it at the user profile level, however it will have to be “smarter” than looking at the
*.default-release
. There is a profiles.ini file or something like that and we would need to find the default profile in there.This is a good idea, though not sure how many devs use the same machine with multiple users for development.
This might be the case, we would need to test this out, since I read something about a bug requiring this when I did this the first time.
With regards to supporting this on .NET Core I think we would be open to it, however I want to set expectations here, since it’s not just about making
--trust
work. We would need to put in the work to make sure that--trust
,--clean
and--check
options work within the expectations as well as do all the necessary work to ensure that we can maintain support and prevent regressions moving forward without this being a constant source of issues.In addition to that, we wouldn’t support
--trust
on a single distro. Our support matrix for 6.0 looks as follows:If we add support for this, we would need to try and cover as many distros as possible.
We would need to make a list of the following per distro:
--trust
,--clean
, etc.--clean
to make sure we undo everything we do on a per-distro basis.--check
to support determining if the certificate is already trustedcertutil
is available.Implementation wise, we could potentially divide this into 3 areas:
I would avoid us having distro specific code where possible. It would be neat if we could embed distro/version specific scripts/metadata to drive the process so that there’s only one path available for Linux that is largely driven by distro specific resources. That way, when something changes we just need to update a resource for a specific distro/version which greatly limits the chances of regressing other distros (and creates an implicit boundary of the scenarios to revalidate).
All this is to say that this is a LOT of work and nothing that is planned for 6.0.
We would be open to getting this done in 6.0 provided that this goes through the right feature design/process if someone wants to tackle it, however its not something we will ourselves tackle.
The first thing we would require would be manual steps to setup and validate HTTPS on all distros and once we have that we could look at supporting it in
dotnet dev-certs
.There is a big chance that this will bring in tons of new issues and maintenance work to the repo, and if we can’t ensure that we have a low cost story for validating that it works on each specifically supported distro and that we can make changes easily, we won’t want to sign up for owning this.
@tmds If this is something you are interested in contributing we would be open to accept it provided is based on the expectations set above. Let us know if this is the case and we can open a new issue for it.
Given the size of it, there might be some things that could be “parallelized” or split between folks to enable other people from the community to contribute. I wouldn’t expect you to tackle on all this work, since as you can tell this is a really large effort in terms of cost and maintenance for us.