This is an Add-On for Home Assistant that enables your Home Assistant server to tunnel its communication with the world through a secure OpenVPN connection. It is especially useful for users who want to integrate Google Home, Amazon Alexa, or other cloud services with Home Assistant, but do not want to expose their server directly to the internet.
- Provides a web interface (Flask-based) for uploading VPN configuration files.
- Supports two configuration methods:
- Upload a single
.ovpnfile containing all OpenVPN client configuration and certificates. - Upload individual certificate and key files (
ca.crt,client.crt,client.key,ta.key).
- Upload a single
- Automatically starts OpenVPN using the uploaded
.ovpnfile, or generates one from Home Assistant options if not provided. - Designed to run as a Home Assistant add-on in a Docker container.
- Upload Configuration:
- Access the web UI at
http://<server>:8090(or via the Home Assistant sidebar if you usepanel_iframe). - You can upload either:
- A single
.ovpnfile (recommended, as it contains all necessary configuration and certificates), or - All required certificate/key files individually (
ca.crt,client.crt,client.key, and optionallyta.key).
- A single
- Access the web UI at
- OpenVPN Startup:
- If a
.ovpnfile is uploaded, it is used directly to start the OpenVPN client. - If not, the add-on will attempt to generate a configuration from Home Assistant options (if configured).
- The add-on waits for the necessary files before starting the VPN connection.
- If a
-
Build and Install the Add-On:
- SSH into your Home Assistant server:
ssh <user>@<server>
- Clone this repository into your
/addonsdirectory:cd /addons && git clone https://github.com/larsklitzke/homeassistant-openvpn-client.git
- SSH into your Home Assistant server:
-
Enable the Web UI in Home Assistant:
- Add the following to your
configuration.yaml:panel_iframe: openvpn: title: OpenVPN icon: mdi:cloud-check url: http://<server>:8090
- Replace
<server>with the address of your Home Assistant server.
- Add the following to your
-
Restart Home Assistant:
- After restarting, you can access the add-on from the Home Assistant add-on page. There, you can view the add-on's configuration, README, and logs.
- If you have set up the
panel_iframeas described above, you may see an "OpenVPN" panel in the sidebar for direct access to the web UI. (Note: In some Home Assistant installations, the panel may not appear automatically. You can always access the web UI directly athttp://<server>:8090.)
-
Upload VPN Configuration:
- Open the OpenVPN web UI by visiting
http://<server>:8090in your browser (or use the sidebar panel if configured). - Upload either a
.ovpnfile or all required certificate/key files as described above.
- Open the OpenVPN web UI by visiting
-
VPN Connection:
- The add-on will automatically start the OpenVPN client using your uploaded configuration.
- If you upload a
.ovpnfile, it will be used directly. If you upload individual files, ensure your Home Assistant options are configured to generate a valid OpenVPN config. - The web UI supports both upload methods and provides feedback on upload success.
- The add-on will not overwrite an uploaded
.ovpnfile. - Configuration Persistence: To ensure your VPN configuration persists across Home Assistant or container reboots, place your
client.ovpnfile in the/share/directory. On startup, the add-on will copy/share/client.ovpnto/data/client.ovpnif no configuration is present. This is useful for automated deployments or when you want to avoid re-uploading the configuration after every restart.
The initial version of the Dockerfile to install the OpenVPN client was created by TheSkorm. This fork of the add-on by larsklitzke that built on that work and added a web interface and Home Assistant integration now provides support for OpenVPN .ovpn configuration files.