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

For https url getting certificate error. not sure where to configure #731

Open
tech-ind-02 opened this issue Jan 6, 2025 · 2 comments
Open
Labels
needs author feedback Waiting for additional feedback from the author

Comments

@tech-ind-02
Copy link

image

We are getting below error when we are sending trace data to https endpoint

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:358)
at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1131)
at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1086)
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:873)
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:744)
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:709)

Can anyone help me where and how to configure the certificate

If possible please provide complete code for
https://github.com/open-telemetry/opentelemetry-android/blob/main/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt

@breedx-splk
Copy link
Contributor

Ideally, the server you are sending data to would have a legit cert that tracks back to one of the standard/common root CAs, but I know that's not always possible....especially in test or ephemeral environments. So, please read this link for documentation on how to configure the OkHttp client, and then you can call

OtlpHttpSpanExporter.builder()
      .setEndpoint(spansIngestUrl)
      .setSslContext(context, trustManager)
      .setTrustedCertificates(trustedCertsPem)
      .build()

It'll take a little bit of effort to get things squared up, but it's definitely possible, and we expose those methods on the exporters for exactly this reason. Cheers!

@breedx-splk breedx-splk added the needs author feedback Waiting for additional feedback from the author label Jan 7, 2025
@LikeTheSalad
Copy link
Contributor

It might also be worth checking Android's official network security config options on how to trust additional CAs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs author feedback Waiting for additional feedback from the author
Projects
None yet
Development

No branches or pull requests

3 participants