Skip to content
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

Initial app start certificate error #293

Open
adambajguz opened this issue Jan 20, 2024 · 0 comments
Open

Initial app start certificate error #293

adambajguz opened this issue Jan 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@adambajguz
Copy link

Describe the bug
Hello, when the application starts for the first time e.g. in Docker, and there's no certificate to fallback I receive this error:

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'.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
   at Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(ListenOptions listenOptions, Action`1 configureOptions)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func`2 useHttps, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at PackSite.Library.Logging.BootstrappedHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)

To Reproduce
Steps to reproduce the behavior:

  1. Run https://github.com/natemcmaster/LettuceEncrypt/tree/main/samples/Web in an environemnt that doesn't have any fallback certificate (developer ceertificate).

Expected behavior
I'd expect that Kestrel will expose HTTP endpoing and not throw any exception until the certificate is generated by the library.

@adambajguz adambajguz added the bug Something isn't working label Jan 20, 2024
Viir added a commit to pine-vm/pine that referenced this issue Mar 22, 2024
To avoid crashes due to race condition as described at <natemcmaster/LettuceEncrypt#293>
Viir added a commit to pine-vm/pine that referenced this issue Mar 23, 2024
Work around the problem with ASP.NET crashing because SSL certificates arrive ordered via LetsEncrypt arrive after starting the app.
A similar issue was discussed at <natemcmaster/LettuceEncrypt#293>
Also, update the LetsEncrypt library and Certes to integrate various  recent upstream improvements.
Viir added a commit to pine-vm/pine that referenced this issue Mar 23, 2024
Work around the problem with ASP.NET crashing because SSL certificates arrive ordered via LetsEncrypt arrive after starting the app: Disable HTTPS for a first start, if we find the certificate is not available. Later, if the HTTPS certificate has arrived, restart the ASP.NET host with the HTTPS URLS.
For discussion of this issue, see:

+ <ffMathy/FluffySpoon.AspNet.EncryptWeMust#151>
+ <natemcmaster/LettuceEncrypt#293>

Also, update the LetsEncrypt library and Certes to integrate various  recent upstream improvements.
Viir added a commit to pine-vm/pine that referenced this issue Mar 24, 2024
Work around the problem with ASP.NET crashing because SSL certificates arrive ordered via LetsEncrypt arrive after starting the app: Disable HTTPS for a first start, if we find the certificate is not available. Later, if the HTTPS certificate has arrived, restart the ASP.NET host with the HTTPS URLS.
For discussion of this issue, see:

+ <ffMathy/FluffySpoon.AspNet.EncryptWeMust#151>
+ <natemcmaster/LettuceEncrypt#293>
+ <dotnet/aspnetcore#26258>
+ <dotnet/aspnetcore#45801>

Also, update the LetsEncrypt library and Certes to integrate various  recent upstream improvements.
Viir added a commit to Viir/FluffySpoon.AspNet.EncryptWeMust that referenced this issue Mar 24, 2024
To help apps avoid crashing on race conditions as described at <natemcmaster/LettuceEncrypt#293>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant