What this setting affects
For advanced users: this option is only for users who are comfortable creating and managing their own certificates. When certificates expire, you can lose all access to Home Assistant, and getting back in requires a terminal connection to the host. For most setups, a strong password and two-factor authentication give good protection on their own. For more ways to protect your system, see Securing your Home Assistant (opens in a new tab).
Your remote access URL is listed in public certificate logs (see Remote access - security aspects (opens in a new tab)). With client certificates turned on, any client without one of your certificates, including bots and scanners that find the URL, can’t reach your login page. Those clients also can’t trigger failed-login notifications.
- Remote access through Home Assistant Link: requires a client certificate.
- Amazon Alexa, Google Assistant, and other Home Assistant Link features: work as before. The setting only applies to remote access.
- Your local address: works as before, without a certificate. If Home Assistant serves HTTPS itself (SSL certificate path is set), setting the SSL peer certificate path makes local connections require a client certificate too.
Before you turn this on
- You manage the certificates. When a device’s certificate expires, that device can no longer connect remotely until you create a new certificate for it. When your certificate authority (CA) expires, all your device certificates stop working. Note the expiry dates and renew in time.
- Locking out one device means replacing all certificates. If a device is lost or stolen, create a new CA and new certificates for your other devices.
- If Home Assistant can’t load your CA file, the result depends on your setup:
- Home Assistant doesn’t serve HTTPS itself (SSL certificate path is empty): a repair appears and remote access stays off. Fix the file, or use the repair to turn off the client certificate requirement.
- Home Assistant serves HTTPS itself: Home Assistant blocks all connections, local and remote. To get back in, follow If you can’t access Home Assistant anymore.
- iPhone and iPad: The Home Assistant app supports client certificates. Widgets and Apple Watch complications may not update in the background while you’re away from home.
Set it up
Step 1: Prepare a way back in
Set this up first, so you can recover if your certificates stop working.
Create a full backup, and check that it’s stored as your off-site backup (opens in a new tab) with Home Assistant Link.
Set up SSH access to the Home Assistant host, for example with the Terminal & SSH app (opens in a new tab).
From another computer, connect to the host over SSH to check that it works.
The app’s web terminal runs inside the Home Assistant interface. When you’re locked out of Home Assistant, only an SSH connection from another computer still works.
Step 2: Create a certificate authority and client certificates
You need three kinds of files:
ca.key: The private key of your CA. It signs your device certificates. Keep it on the computer where you created it, with a backup somewhere safe. Anyone with this file can create certificates that Home Assistant accepts.ca.crt: The public certificate of your CA. This file goes to Home Assistant.- One
.p12file per device, for examplephone.p12. It holds that device’s certificate and key, protected with a password.
The commands below use OpenSSL 3 on macOS or Linux. On Windows, run them in Windows Subsystem for Linux (WSL) (opens in a new tab). Run them on your own computer, not on the Home Assistant host, so the CA key stays off the system that trusts it. The commands create ECDSA keys, which work on Apple devices as well as Android.
Create the CA, valid for 10 years:
mkdir -p ~/ha-certs && cd ~/ha-certs openssl ecparam -name prime256v1 -genkey -noout -out ca.key openssl req -x509 -new -key ca.key -days 3650 \ -subj "/CN=My Home Assistant CA" \ -addext "basicConstraints=critical,CA:TRUE" \ -addext "keyUsage=critical,keyCertSign,cRLSign" \ -out ca.crtCreate a certificate for a device, valid for 2 years. Replace
phoneandMy phonewith a name for each device:cd ~/ha-certs printf "basicConstraints=CA:FALSE\nkeyUsage=critical,digitalSignature\nextendedKeyUsage=clientAuth\n" > client.ext openssl ecparam -name prime256v1 -genkey -noout -out phone.key openssl req -new -key phone.key -subj "/CN=My phone" -out phone.csr openssl x509 -req -in phone.csr -CA ca.crt -CAkey ca.key -CAcreateserial \ -days 730 -extfile client.ext -out phone.crt openssl pkcs12 -export -in phone.crt -inkey phone.key -name "My phone" -out phone.p12The last command asks for a password for the
.p12file. Use a strong password and store it in a password manager.For devices on iOS 17, iPadOS 17, macOS 14, or older, add
-certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -macalg sha1to the last command. Without these options, those versions can’t open the.p12file and report a wrong password.Repeat the previous step for each device.
Step 3: Copy the CA certificate to Home Assistant
Copy ca.crt into your Home Assistant configuration folder, for example to /config/mtls/ca.crt. You can use the File editor or Samba share app for this. The File editor shows the configuration folder as /homeassistant, which is the same folder as /config.
Step 4: Turn on the client certificate requirement
Make this change from your local address, so you keep access while you test.
If Home Assistant serves HTTPS itself, first install a certificate in the browser or app you’re using, as described in Step 5. Without it, you can’t reconnect after the restart to confirm the change, and Home Assistant goes back to the previous settings.
In Home Assistant, go to Settings > System > Network (opens in a new tab).
Under HTTP server, expand SSL/TLS.
In SSL peer certificate path, enter the path to your CA certificate, for example
/config/mtls/ca.crt.Turn on Require client certificates for remote access.
Select Save. Home Assistant restarts to apply the settings.
After the restart, confirm the change when Home Assistant asks. If you don’t confirm in time, Home Assistant goes back to the previous settings.
Step 5: Install the certificates on your devices
Each device gets its own .p12 file. On a device, the Home Assistant app and each browser need the certificate installed separately.
- Home Assistant app (Android, iPhone, iPad, Mac): Import the
.p12file as described in TLS client authentication (opens in a new tab). - Browsers: Import the
.p12file into the certificate store of the operating system or browser. When you open your remote access URL, the browser asks which certificate to use.
Step 6: Test the connection
Test from outside your home network, for example on mobile data. On your home network, the Home Assistant app uses your local address, which doesn’t check for a certificate.
- Device with a certificate: You see the login page after choosing the certificate.
- Device without a certificate: Opening your remote access URL shows a connection error instead of the login page.
If a device without a certificate still reaches the login page, check that you saved the setting in Step 4.
Renewing or replacing certificates
- A device certificate expired or is about to expire: If your CA is still valid, create a new certificate for that device, as in Step 2, and import the new
.p12file. - Your CA expired, or a device is lost or stolen: Create a new CA and new certificates for your devices, replace
ca.crtin Home Assistant, restart Home Assistant, and import the new.p12files. All old certificates stop working.
Turning it off
Go to Settings > System > Network (opens in a new tab) and expand SSL/TLS under HTTP server.
Turn off Require client certificates for remote access and select Save.
After the restart, confirm the change when Home Assistant asks.
If Home Assistant serves HTTPS itself, also clear SSL peer certificate path to stop requiring certificates on local connections.
If you can’t access Home Assistant anymore
If you can’t reach Home Assistant in the browser or app, for example because your certificates expired, remove the CA setting directly on the Home Assistant host. Home Assistant stores these HTTP settings itself, so editing configuration.yaml doesn’t change them.
From another computer, connect to the Home Assistant host over SSH, as set up in Step 1.
Make a backup copy of the file
/config/.storage/http:cp /config/.storage/http /config/http.backupOpen
/config/.storage/httpin a text editor. The file is in JSON format.Under
data>stable, remove thessl_peer_certificateline. If it was the last entry in that block, also remove the comma at the end of the line before it, so the JSON stays valid.Save the file and restart Home Assistant:
ha core restart
After the restart, you can reach Home Assistant without a client certificate. To use client certificates again, start from Step 2 with a new CA and new device certificates.