99 lines
4.8 KiB
Markdown
99 lines
4.8 KiB
Markdown
# KidTime
|
|
|
|
## What this add-on does
|
|
|
|
KidTime is a parental control server for your home network. It stores the time
|
|
limits and usage of your children's Windows devices, tells the KidTime client on
|
|
each device when to warn, lock or log off, and serves the admin web page. The
|
|
add-on runs on the host network so the devices find it as `kidtime.local`
|
|
(mDNS) without any extra setup. The add-on takes its timezone from Home
|
|
Assistant, and the server runs as the container's main process, so a crash or a
|
|
failed port makes the add-on stop with a clear line in its log.
|
|
|
|
## Ports
|
|
|
|
| Port | Used for |
|
|
| ---- | ----------------------------------------------------------- |
|
|
| 8080 | Admin web page and its API (plain HTTP, "Open Web UI") |
|
|
| 8443 | Connection from the kids' devices (gRPC over TLS) |
|
|
| 8444 | Admin web page and API over HTTPS (used by the mobile app) |
|
|
|
|
The add-on uses the host network, so these ports are open on the Home Assistant
|
|
machine itself. Do not run another KidTime server on the same network at the
|
|
same time: both would claim `kidtime.local`.
|
|
|
|
## Your data and the certificate
|
|
|
|
The add-on keeps everything in its config folder (the folder ending in
|
|
`_kidtime` in the `app_configs` share, older versions: `addon_configs`):
|
|
|
|
| Folder | Holds |
|
|
| ---------- | --------------------------------------------- |
|
|
| `db` | the database (`db.sqlite`) |
|
|
| `certs` | the TLS certificate and key |
|
|
| `secrets` | the JWT secret |
|
|
| `client` | the client installers used for updates |
|
|
|
|
On its first start the add-on creates a new server with its own certificate.
|
|
Every provisioned device remembers that certificate and rejects a server that
|
|
shows a different one. Losing `certs` therefore means setting up every device
|
|
again, so keep a backup of the config folder.
|
|
|
|
## Backups contain secrets
|
|
|
|
Home Assistant backups of this add-on contain the TLS private key
|
|
(`certs/server.key`) and the JWT secret (`secrets/jwt.secret`), together with the
|
|
database. Anyone who holds a backup can impersonate your server to the kids'
|
|
devices and sign in as an admin session. Store backups privately and do not share
|
|
them. The add-on is stopped while a backup runs (cold backup), so the database is
|
|
copied consistently.
|
|
|
|
## Do not change the repository URL
|
|
|
|
In Home Assistant, add the repository
|
|
`https://git.nc.kreapptivo.de/KidTime/home-assistant-addon`. It is
|
|
public, and so is the add-on's image
|
|
(`git.nc.kreapptivo.de/kidtime/kidtime-addon-aarch64`): neither needs a token,
|
|
an account or a registry login.
|
|
|
|
The repository URL you entered in Home Assistant, including any `#branch`, is
|
|
the add-on's identity. Supervisor's repository id is the first 8 hex characters
|
|
of the SHA-1 of the lowercased URL as entered, and the slug is `<id>_kidtime`.
|
|
Changing the URL or adding `#branch` gives a different add-on with an empty
|
|
config folder, which would generate a new certificate when started. So do not
|
|
change the URL.
|
|
|
|
If you must change it, move the data over by hand (see "Copying the data into
|
|
a new install" below) from the old `<old-id>_kidtime` folder, and remove the
|
|
old entry only after the new one runs.
|
|
|
|
## Uninstalling deletes the certificate
|
|
|
|
When you uninstall the add-on, Home Assistant asks whether to delete its data. If
|
|
you let it, the certificate, key and database are gone, and a new certificate
|
|
would be generated on the next start. Every device would then reject the
|
|
server. Keep an up-to-date copy of the four folders, or a Home Assistant backup,
|
|
before uninstalling. To recover, restore the add-on from the Home Assistant
|
|
backup, or reinstall it and copy the folders back in by hand.
|
|
|
|
## Copying the data into a new install
|
|
|
|
Home Assistant may create the config folder only on the add-on's first start,
|
|
and that start generates a new certificate. Copy the data in afterwards:
|
|
|
|
1. Stop the old add-on (or keep it uninstalled) and leave it stopped, so that
|
|
only one server claims `kidtime.local`.
|
|
2. Install the new add-on, turn off "Start on boot" and the watchdog, start it
|
|
once and stop it again. The kids' devices reject its new certificate for that
|
|
moment; they keep the one they know.
|
|
3. Delete everything inside its config folder: `db`, `certs`, `secrets` and
|
|
`client`, including any `-wal` and `-shm` files in `db`.
|
|
4. Copy the four folders in from the old folder or your copy. Include the
|
|
`-wal` and `-shm` files next to `db.sqlite`.
|
|
5. Check that `certs/server.pem`, `certs/server.key` and `secrets/jwt.secret`
|
|
have the same SHA-256 hashes as the source (for example with `sha256sum` in
|
|
the Home Assistant terminal).
|
|
6. Start the add-on. Its log must say "Certificates loaded"; if it says
|
|
"Certificates not found, generating new ones", stop it and copy again.
|
|
7. Turn "Start on boot" and the watchdog back on.
|