home-assistant / home-assistant/android
Problem setting up mutual tls (client certificate)
- Dominant language
- Kotlin
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 81
Description
**Home Assistant Android app version(s):** 2023.8.2-full
**Android version(s):** Android 12
**Device model(s):** Galaxy S10
**Home Assistant version:** 2023.9.2
**Last working Home Assistant release (if known):**
**Description of problem, include YAML if issue is related to notifications:**
I've been trying to setup TLS Client Authentication after I found out the feature from [this PR](https://github.com/home-assistant/android/pull/2526) is available in the Android companion app.
I've setup the mTls rules and certificates in Traefik and when testing the feature using the Chrome browser on Windows, i get prompted to select the certificate for verification. After selecting the one I've installed the frontend just works as expected.
The same certificate is installed on Android. This took some effort due to toast messages popping up stating a private key was required to install the certificate, but the p12 format cert file allowed installation and was also verified to work on Windows.
When going for a fresh install HomeAssistant with a fresh install Companion App, when first adding the server URL and attempting connection I get a `Failed to perform SSL handshake` error popup. Instead I expected to be presented with the certificate selection dialog as shown in the above mentioned PR. Looking at Traefik logs I see errors telling that the Companion App does not provide certificates:
```
time="2023-09-14T15:19:36+02:00" level=debug msg="http: TLS handshake error from 192.168.1.50:47010: EOF"
time="2023-09-14T15:19:37+02:00" level=debug msg="http: TLS handshake error from 192.168.1.50:47012: tls: client didn't provide a certificate"
time="2023-09-14T15:19:42+02:00" level=debug msg="http: TLS handshake error from 192.168.1.50:47014: EOF"
time="2023-09-14T15:19:42+02:00" level=debug msg="http: TLS handshake error from 192.168.1.50:47016: tls: client didn't provide a certificate"
```
Looking at the available documentation for this feature on the [companion app website](https://companion.home-assistant.io/docs/getting_started/#tls-client-authentication) does not give me much to go on.
**Companion App Logs:**
```
Can't get through the setup process, so I cannot get to the app settings to export companion app logs...
```
**Screenshot or video of problem:**
**Additional information:**
Contributor guide
Assessment
This issue has not been assessed yet.