Skip to content

libtailscale: bridge user-installed CA certificates from Android to G…#757

Open
LoganRupe wants to merge 1 commit intotailscale:mainfrom
LoganRupe:android-user-ca-certs
Open

libtailscale: bridge user-installed CA certificates from Android to G…#757
LoganRupe wants to merge 1 commit intotailscale:mainfrom
LoganRupe:android-user-ca-certs

Conversation

@LoganRupe
Copy link
Copy Markdown

libtailscale: bridge user-installed CA certificates from Android to Go TLS

Go's crypto/x509 on Android only reads system CAs from /system/etc/security/cacerts/ and does not read user-installed CAs from the Android trust store. This causes TLS connections to fail with "x509: certificate signed by unknown authority" when connecting to servers using custom/self-signed CAs (e.g. Headscale with a private CA).

Add GetUserCACertsPEM() to the AppContext gomobile interface, implemented in App.kt using KeyStore.getInstance("AndroidCAStore"). At startup, user CA certs are written to the app's data directory and SSL_CERT_DIR is set to include both the system and user cert directories, allowing Go's TLS stack to trust user-installed certificates.

Fixes tailscale/tailscale#8085

…o TLS

Go's crypto/x509 on Android only reads system CAs from
/system/etc/security/cacerts/ and does not read user-installed CAs from
the Android trust store. This causes TLS connections to fail with
"x509: certificate signed by unknown authority" when connecting to
servers using custom/self-signed CAs (e.g. Headscale with a private CA).

Add GetUserCACertsPEM() to the AppContext gomobile interface, implemented
in App.kt using KeyStore.getInstance("AndroidCAStore"). At startup, user
CA certs are written to the app's data directory and SSL_CERT_DIR is set
to include both the system and user cert directories, allowing Go's TLS
stack to trust user-installed certificates.

Fixes tailscale/tailscale#8085

Signed-off-by: Logan Rupe <logan@coldtap.io>
@LoganRupe LoganRupe force-pushed the android-user-ca-certs branch from 2d4079e to 9e4c757 Compare March 14, 2026 06:52
@pureyuri
Copy link
Copy Markdown

Tried this PR out and it worked! Was able to connect to my Headscale instance which give out its own self signed CA Cert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Android app does not check user trusted self-signed certificates

2 participants