-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add host.docker.internal and host.containers.internal to the dev cert SAN #61265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add new SAN for dev cert + json output for the tool
Looks good so far! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the certificate generation functionality to include "host.docker.internal" and "host.containers.internal" in the SAN, bumps the certificate version to 3, and adds a new command for JSON output of certificate information.
- Introduces the new --check-json-output option and its logic
- Refactors certificate version handling by separating generated version and minimum acceptable version
- Updates tests and adjusts access modifiers in platform-specific certificate managers
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Tools/dotnet-dev-certs/src/Program.cs | Adds new JSON output option and updates certificate filtering on OSX |
src/Tools/FirstRunCertGenerator/test/CertificateManagerTests.cs | Updates tests to use the new MinimumAspNetHttpsCertificateVersion property |
src/Shared/CertificateGeneration/WindowsCertificateManager.cs, UnixCertificateManager.cs, MacOSCertificateManager.cs | Adjusts access modifiers for the IsExportable method |
src/Shared/CertificateGeneration/CertificateManager.cs | Bumps certificate version constants, adds new SAN entries, and introduces the MinimumAspNetHttpsCertificateVersion property |
@@ -110,6 +114,10 @@ public static int Main(string[] args) | |||
"Display warnings and errors only.", | |||
CommandOptionType.NoValue); | |||
|
|||
var checkJsonOutput = c.Option("--check-json-output", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name isn't great... it sounds like it's checking some JSON.
Since we only expect this to be used by tools it feels like a more verbose name is okay... maybe --check-trust-machine-readable
or something?
@@ -387,7 +387,7 @@ public void EnsureCreateHttpsCertificate_ReturnsExpiredCertificateIfVersionIsInc | |||
Output.WriteLine(creation.ToString()); | |||
ListCertificates(); | |||
|
|||
_manager.AspNetHttpsCertificateVersion = 2; | |||
_manager.MinimumAspNetHttpsCertificateVersion = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect to see tests here for various permutations of minimum version vs actual version. For instance:
- Multiple certificates with version 1, 2, 3 and minimum set to 2.
- Downgrade scenario where there's a newer cert (say v3) and then the minimum is 2.
Add host.docker.internal and host.containers.internal to the dev cert SAN
Add necessary SAN for dev container scenario and add an easy to parse output to the dev-certs command.
Description
host.docker.internal
andhost.containers.internal
to the dev cert SAN.3
--check --trust
but with json output:--check-json-output
The notion of minimum version is important if/when we backport this feature into dotnet 8 and 9: the runtime in 8 or 9 should be able to run perfectly fine without the new SAN in the cert.
Example of output for a v2 certificate (generated with .NET 9):
Example of output for a v3 certificate:
Fixes #61155