Initial commit: DNClient Home Assistant add-on

This commit is contained in:
Jarvis 2026-02-19 07:22:25 +00:00
commit 05079fb24a
8 changed files with 122 additions and 0 deletions

32
README.md Normal file
View file

@ -0,0 +1,32 @@
# Home Assistant Add-on: DNClient (Defined Networking)
Run [Defined Networking's DNClient](https://www.defined.net/) (Managed Nebula) as a Home Assistant add-on to provide overlay network connectivity to your Home Assistant OS instance.
## Installation
1. In Home Assistant, go to **Settings → Add-ons → Add-on Store**
2. Click the **⋮** menu (top right) → **Repositories**
3. Add this repository URL: `https://github.com/johnmaguire/homeassistant-addon-dnclient`
4. Find **DNClient** in the store and click **Install**
## Configuration
| Option | Description |
|--------|-------------|
| `enrollment_code` | Your enrollment code from the [Defined Networking Admin Panel](https://admin.defined.net). Only needed for first run. |
### First Run
1. Generate an enrollment code from [admin.defined.net](https://admin.defined.net)
2. Paste it into the add-on configuration
3. Start the add-on
4. Once enrolled, you can clear the enrollment code — the host identity is persisted
## How It Works
The add-on runs `dnclient` with host networking and `NET_ADMIN` capability so it can create the Nebula tun interface directly on the Home Assistant host. Configuration is persisted in the add-on's data directory, so the host only needs to enroll once.
## Supported Architectures
- `amd64`
- `aarch64`

8
dnclient/CHANGELOG.md Normal file
View file

@ -0,0 +1,8 @@
# Changelog
## 0.1.0
- Initial release
- Runs dnclient with host networking and NET_ADMIN capability
- Persistent enrollment across restarts
- Supports amd64 and aarch64

24
dnclient/DOCS.md Normal file
View file

@ -0,0 +1,24 @@
# DNClient Add-on for Home Assistant
## About
This add-on runs [Defined Networking's DNClient](https://www.defined.net/) on your Home Assistant OS instance, giving it connectivity to your Managed Nebula overlay network.
## Setup
1. Go to [admin.defined.net](https://admin.defined.net) and create a host for your Home Assistant instance
2. Generate an enrollment code for the host
3. Paste the enrollment code into this add-on's configuration
4. Start the add-on
After the first successful enrollment, the host identity is persisted. You can clear the enrollment code from the configuration — it won't be needed again unless you re-enroll.
## Network
The add-on uses **host networking** so the Nebula tun interface is created directly on the Home Assistant host. This means other add-ons and Home Assistant itself can communicate over the Nebula network.
## Troubleshooting
- Check the add-on logs for enrollment or connection errors
- Ensure the enrollment code hasn't expired (they are single-use)
- If you need to re-enroll, stop the add-on, clear the persistent data, set a new enrollment code, and restart

7
dnclient/Dockerfile Normal file
View file

@ -0,0 +1,7 @@
ARG BUILD_FROM=definednet/dnclient:latest
FROM ${BUILD_FROM}
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

3
dnclient/build.yaml Normal file
View file

@ -0,0 +1,3 @@
build_from:
amd64: definednet/dnclient:latest
aarch64: definednet/dnclient:latest

17
dnclient/config.yaml Normal file
View file

@ -0,0 +1,17 @@
name: DNClient
version: "0.1.0"
slug: dnclient
description: "Run Defined Networking's DNClient (Managed Nebula) on Home Assistant OS"
url: "https://github.com/johnmaguire/homeassistant-addon-dnclient"
arch:
- amd64
- aarch64
startup: system
boot: auto
host_network: true
privileged:
- NET_ADMIN
options:
enrollment_code: ""
schema:
enrollment_code: "str?"

26
dnclient/run.sh Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env sh
set -e
CONFIG_DIR="/data/defined"
SYSTEM_DIR="/etc/defined"
# Ensure persistent config directory exists
mkdir -p "${CONFIG_DIR}"
# Symlink /etc/defined -> /data/defined for persistence across restarts
if [ ! -L "${SYSTEM_DIR}" ]; then
rm -rf "${SYSTEM_DIR}"
ln -s "${CONFIG_DIR}" "${SYSTEM_DIR}"
fi
# Read enrollment code from HA options
ENROLLMENT_CODE="$(cat /data/options.json | sed -n 's/.*"enrollment_code" *: *"\([^"]*\)".*/\1/p')"
# Only set enrollment code if non-empty and host is not already enrolled
if [ -n "${ENROLLMENT_CODE}" ] && [ ! -f "${CONFIG_DIR}/config.yml" ]; then
export DN_ENROLLMENT_CODE="${ENROLLMENT_CODE}"
echo "Enrolling host with provided enrollment code..."
fi
echo "Starting dnclient..."
exec dnclient

5
repository.json Normal file
View file

@ -0,0 +1,5 @@
{
"name": "Defined Networking Add-ons",
"url": "https://github.com/johnmaguire/homeassistant-addon-dnclient",
"maintainer": "John Maguire"
}