Currently in AWS Cloud, we have the HTTPS-SSL terminated at the ALB, I am trying to Forward the HTTS SSL/TLS till the Container.
I can configure the SSL at the Start up
builder.WebHost.ConfigureKestrel(options =>
{
options.Listen(IPAddress.Any,5002, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
listenOptions.UseHttps(<CERTPATH>, <PASSPHRASE>);
});
});
I tried getting the AWS Certificate Manager Cert, using the following code
var exportCertificateResponse = await acmClient.GetCertificateAsync(new GetCertificateRequest()
{
CertificateArn = builder.Configuration["AWS:CertificateArn"],
});
But this certificate doesn't have the private key, so can't use this directly.
SO I guess I might be using the incorrect type of cert. Appreciate any help
Current dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 5002
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WebApi/WebApi.csproj", "WebApi/"]
RUN dotnet restore "WebApi/WebApi.csproj"
COPY . .
WORKDIR "/src/WebApi"
RUN dotnet build "WebApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApi.dll"]
Should i just add a self signed cert to the docker?