Skip to content

Outbound HTTPS requests fail on Linux because Aspire replaces SSL_CERT_DIR with temporary certificate directory #18066

Description

@axies20

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

On Linux, Aspire appears to replace the SSL_CERT_DIR environment variable for hosted projects with an Aspire-generated temporary directory.

Example value observed inside the hosted application:

SSL_CERT_FILE=
SSL_CERT_DIR=/tmp/aspire-*//certs

As a result, outbound HTTPS requests may fail with certificate validation errors even though the same requests work correctly outside Aspire.

Environment

  • Fedora Linux
  • .NET 10
  • Aspire CLI 13.4.3

Related issue

This issue appears closely related to:

However, that issue is closed and the behavior can still be reproduced.

Expected Behavior

Aspire should preserve access to the system OpenSSL trust store when configuring development certificates.

Possible approaches:

  • Append Aspire certificates to the existing trust directories.
  • Preserve the system SSL_CERT_DIR.
  • Merge Aspire-generated certificates with the system trust configuration.

Hosted applications should be able to use Aspire development certificates without breaking outbound HTTPS requests to external services.

Steps To Reproduce

  1. Create a simple Aspire application on Linux.
  2. Print SSL_CERT_FILE and SSL_CERT_DIR from the hosted project.
  3. Observe that SSL_CERT_DIR points to an Aspire-generated temporary directory.
  4. Make an outbound HTTPS request to an external service.
  5. Certificate validation fails while the same request succeeds outside Aspire.

Exceptions (if any)

System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: NotSignatureValid, UntrustedRoot

Aspire doctor output

Aspire Environment Check

Aspire
✅ Aspire CLI version 13.4.3 (channel: stable)

.NET SDK
✅ .NET 10.0.300 installed (x64)

Container Runtime
⚠️ Docker: installed but not running
Start Docker daemon
✅ Podman v5.8.2: running (auto-detected (only runtime running)) ← active

Environment
⚠️ HTTPS development certificate is only partially trusted
Set SSL_CERT_DIR in your shell profile: export
SSL_CERT_DIR="$SSL_CERT_DIR:/etc/pki/tls/certs:/home/axi/.aspnet/dev-certs/trust"
See: https://aka.ms/aspire-prerequisites#dev-certs
Details:
The certificate is in the trusted store, but SSL_CERT_DIR is not configured to
include '/home/axi/.aspnet/dev-certs/trust'. Some applications may not trust the
certificate. 'aspire run' will configure this automatically.

Summary: 3 passed, 2 warnings, 0 failed
For detailed prerequisites: https://aka.ms/aspire-prerequisites

Aspire CLI Installations

Path Version Channel Route PATH status
/home/axi/.aspire/bin/aspire (current) 13.4.3+4f218933552e18ff2874d 1b6d5dc3fe671e3b6d9 stable script active

Anything else?

Running:

aspire certs trust

returns:

Developer certificates may not be fully trusted (trust exit code was:
PartiallyFailedToTrustTheCertificate).
❌ Failed to trust HTTPS development certificate. Certificate trust operation returned:
PartiallyFailedToTrustTheCertificate

and logs contain:

The certificate is not trusted by OpenSSL.
Ensure that the SSL_CERT_DIR environment variable is set correctly.

Metadata

Metadata

Assignees

Labels

area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationinternal-customer-impactImpact has been observed by Microsoft-internal product teams; details may be tracked privately.triage:bot-seenAspire triage bot has seen this issue

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions