Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,21 @@ jobs:
exit 1
fi
.venv/bin/python -c 'from PIL import Image; import sys; im=Image.open(sys.argv[1]); assert im.size == tuple(map(int,sys.argv[2].split("x"))) and any(lo < hi for lo,hi in im.convert("RGB").getextrema())' "$out/shot.png" "$size"
- name: Build and exercise the Ubuntu rack host
if: runner.os == 'Linux'
run: |
.venv/bin/python -m pytest -q tests/test_linux_host_policy.py tests/test_host_key_approval.py
.venv/bin/python packaging/linux-host/build.py
bash packaging/linux-host/check-package.sh
- name: Keep the verified Ubuntu host package
if: runner.os == 'Linux' && success()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: EtherlightingEvolved-rack-host-${{ github.sha }}
retention-days: 30
compression-level: 0
if-no-files-found: error
path: outputs/native/EtherlightingEvolved-*-linux-host-amd64.deb
- name: Keep native verification evidence
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
Expand All @@ -339,6 +354,7 @@ jobs:
outputs/native-check/*.png
outputs/native-check/package/shot.png
outputs/native-check/package/shot-error.txt
outputs/native-check/rack/shot.png
outputs/native/*.log
- name: Keep verified desktop client archives
if: success()
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ jobs:
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
if: runner.os == 'Linux'
with:
node-version-file: .node-version
package-manager-cache: false
- name: Install pinned dependencies
shell: bash
run: |
Expand All @@ -165,6 +170,12 @@ jobs:
run: |
$platform = if ($IsMacOS) { 'osx' } else { 'linux' }
./desktop/publish.ps1 -Runtime @("$platform-x64", "$platform-arm64") -PythonExe "$PWD/.venv/bin/python"
- name: Build and exercise the Ubuntu rack host
if: runner.os == 'Linux'
shell: bash
run: |
.venv/bin/python packaging/linux-host/build.py
bash packaging/linux-host/check-package.sh
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: release-${{ matrix.runner }}
Expand All @@ -174,6 +185,7 @@ jobs:
path: |
outputs/native/EtherlightingEvolved-*-osx-*.zip
outputs/native/EtherlightingEvolved-*-linux-*.tar.gz
outputs/native/EtherlightingEvolved-*-linux-host-amd64.deb

release:
name: Release
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Ubuntu 24.04 x64 can host switch lighting and the rack touchscreen on the same machine. The host starts at boot and checks the enrolled switch's SSH fingerprint at each connection.

## 0.7.3

- When live updates slow down, the desktop and browser port maps show each new color as soon as the switch confirms it. Smooth transitions resume when updates arrive more frequently.
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The Profiles page with three saved profiles:

## Requirements

- A computer with 64-bit Windows 10 or later. EE controls switches from Windows only.
- A computer with 64-bit Windows 10 or later, or an Ubuntu 24.04 x64 server with the [rack host](docs/LINUX-HOST.md).
- A switch from the [hardware list](docs/HARDWARE.md), its IP address, and the SSH username and password set for your devices in UniFi Network. EE signs in with that username and password; no SSH key is needed.
- UniFi Network, if you want device names and port telemetry.
- Tailscale on the Windows computer and on each other device, only if you want to open EE from elsewhere over an encrypted connection. LAN access works on your own network without Tailscale.
Expand All @@ -68,6 +68,7 @@ Download the files from the [releases page](https://github.com/Views2k/etherligh
| `EtherlightingEvolved-Setup-<version>.exe` | Windows installer: the desktop app, the workspace service and the lighting engine |
| `EtherlightingEvolved-<version>-osx-arm64.zip`, `EtherlightingEvolved-<version>-osx-x64.zip` | macOS client for Apple silicon and for Intel |
| `EtherlightingEvolved-<version>-linux-x64.tar.gz`, `EtherlightingEvolved-<version>-linux-arm64.tar.gz` | Linux client |
| `EtherlightingEvolved-<version>-linux-host-amd64.deb` | Ubuntu switch host and rack client |
| `SHA256SUMS` | SHA-256 checksums of the installer and the client archives |
| `package-verification.json` | Record of the checks the release build ran on the Windows package |

Expand Down Expand Up @@ -200,7 +201,7 @@ $env:EE_PREVIEW_LIVE = '0'
npm start
```

Open [the local workspace](http://127.0.0.1:4180). `npm start` also prints an administration link that works once; a browser that opens it can change the Tailscale and LAN access settings until the browser session ends or `npm start` stops. The simulator keeps its own data in `outputs/browser-preview-data/`. Set `EE_PREVIEW_LIVE` to `1` to log in to a switch instead; live mode runs on Windows only. The [development guide](docs/DEVELOPMENT.md) covers macOS and Linux, tests and the [Windows installer build](docs/DEVELOPMENT.md#windows-installer). The [desktop guide](desktop/README.md#build-and-test) covers the desktop app.
Open [the local workspace](http://127.0.0.1:4180). `npm start` also prints an administration link that works once; a browser that opens it can change the Tailscale and LAN access settings until the browser session ends or `npm start` stops. The simulator keeps its own data in `outputs/browser-preview-data/`. On Windows, set `EE_PREVIEW_LIVE` to `1` to log in to a switch. For Ubuntu live control, install the [rack host](docs/LINUX-HOST.md). The [development guide](docs/DEVELOPMENT.md) covers macOS and Linux, tests and the [Windows installer build](docs/DEVELOPMENT.md#windows-installer). The [desktop guide](desktop/README.md#build-and-test) covers the desktop app.

## Repository layout

Expand Down
4 changes: 4 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ On a USW-Pro-XG-8-PoE, two programs can keep running after EE closes:

Both directories are readable only by the SSH user and live in the switch's memory, so a switch restart removes them. **Handoff to UniFi** in Settings stops both, and **Switch control** on the Fans page stops fan control.

## Ubuntu rack host

The Ubuntu host runs with a dedicated dynamic user, a private state directory, and hidden user home directories. The enrolled rack user opens a mode-0600 Unix socket. SSH connects to the enrolled switch address and port and checks the administrator-pinned host key before authentication. User SSH keys and agents are disabled for this connection. Switch and controller logins use separate encryption contexts with a systemd-protected service credential. The administrator enrolls an optional local controller HTTPS origin. See the [rack host guide](docs/LINUX-HOST.md).

## Access model

The engine listens on `127.0.0.1` on a port chosen at each start and accepts only requests that carry the engine token. The workspace gateway listens on `127.0.0.1:4180`. When that port is taken, the desktop app uses the next free port up to 4199; its demo starts at port 4190. The gateway adds the token to the requests it forwards. It accepts only requests addressed to `127.0.0.1` or `localhost` on its own port, refuses API and WebSocket requests that a browser marks as coming from another website (`Origin` and `Sec-Fetch-Site`), and refuses request bodies over 1 MiB.
Expand Down
22 changes: 21 additions & 1 deletion desktop/EtherlightingEvolved.Native/WorkspaceTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ namespace EtherlightingEvolved.Native;

internal static class WorkspaceTransport
{
internal static bool UsesSystemHost(Uri workspace) =>
OperatingSystem.IsLinux() && Environment.GetEnvironmentVariable("EE_SYSTEMD_CLIENT") == "1" &&
workspace.Scheme == "http" && workspace.Host == "127.0.0.1" && workspace.Port == 4180;

internal static bool UsesPeerLookup(Uri workspace, bool linux) =>
linux && workspace.Scheme == Uri.UriSchemeHttps && workspace.UserInfo.Length == 0 &&
workspace.HostNameType == UriHostNameType.Dns && workspace.IdnHost.EndsWith(".ts.net", StringComparison.OrdinalIgnoreCase) &&
Expand All @@ -16,6 +20,22 @@ internal static bool UsesPeerLookup(Uri workspace, bool linux) =>
internal static SocketsHttpHandler CreateHandler(Uri workspace, DecompressionMethods decompression = DecompressionMethods.None)
{
var handler = new SocketsHttpHandler { UseProxy = false, AutomaticDecompression = decompression };
if (UsesSystemHost(workspace))
{
handler.AllowAutoRedirect = false;
handler.ConnectCallback = async (context, token) =>
{
if (!IsWorkspaceEndpoint(workspace, context.DnsEndPoint)) throw new IOException("Invalid local workspace address.");
var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified);
try
{
await socket.ConnectAsync(new UnixDomainSocketEndPoint("/run/etherlighting-host.sock"), token).ConfigureAwait(false);
return new NetworkStream(socket, ownsSocket: true);
}
catch { socket.Dispose(); throw; }
};
return handler;
}
// A LAN workspace gets its device key only from EeApi, and no redirect can take the key to another address.
if (Core.WorkspaceAddress.IsLan(workspace))
{
Expand Down Expand Up @@ -111,7 +131,7 @@ internal static Task ConnectStreamAsync(ClientWebSocket socket, Uri workspace, H
socket.Options.KeepAliveInterval = TimeSpan.FromSeconds(20);
var address = new UriBuilder(workspace) { Scheme = workspace.Scheme == "https" ? "wss" : "ws", Path = "/api/ws" }.Uri;
// A LAN stream carries the device key, so it uses the request handler, which has no proxy and no redirects.
return UsesPeerLookup(workspace, OperatingSystem.IsLinux()) || Core.WorkspaceAddress.IsLan(workspace)
return UsesSystemHost(workspace) || UsesPeerLookup(workspace, OperatingSystem.IsLinux()) || Core.WorkspaceAddress.IsLan(workspace)
? socket.ConnectAsync(address, http, token)
: socket.ConnectAsync(address, token);
}
Expand Down
2 changes: 1 addition & 1 deletion desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Fans controls the fans of a USW-Pro-XG-8-PoE. EE saves the fan mode for each swi

The first connection to a switch that has no saved SSH key signs in with the username and password and saves the switch's key. Settings > Connection shows the connected switch's SSH key fingerprint and key type as selectable text. If a switch presents a different key, the Connect page shows the saved and the new fingerprints, and **Accept new key** appears only in the window on the computer that runs the workspace service. A window connected through a Tailscale or LAN address shows a message to review the key on that computer instead. If the key changes while EE is connected, choose **Quit** from the tray menu and open EE again to review it.

For macOS, extract the archive for your processor and open `EtherlightingEvolved.app`. On Linux, extract the archive into a folder and run `./EtherlightingEvolved` in that folder. Keep the application and its libraries together. These archives contain the desktop client and the .NET runtime, but no workspace service, and only the Windows app connects to a switch. Connect to the workspace of a Windows computer that runs EE through its Tailscale private HTTPS address, through its LAN address with a pairing code (see [Connect over your network without Tailscale](#connect-over-your-network-without-tailscale)), or to a simulator started from a source checkout on the same computer. Choose **Change workspace address** on the connection error screen or in Settings to save the address. An explicit `--url` argument takes precedence over the saved address, and the `EE_WORKSPACE_URL` environment variable sets the same address with lower precedence than `--url`. Each source accepts only the addresses the dialog accepts: an HTTPS origin, an HTTP origin on this computer, or an HTTP origin at a private IPv4 address, one that starts with 10, 172.16 to 172.31 or 192.168, with a port other than 80, without account details, a path or a query. Host names such as `.local` names and IPv6 addresses are not accepted for LAN access. A `--url` value that does not qualify opens the connection error screen with **Change workspace address**, and an environment value that does not qualify is ignored. The default local address is `http://127.0.0.1:4180/`.
For macOS, extract the archive for your processor and open `EtherlightingEvolved.app`. On Linux, extract the archive into a folder and run `./EtherlightingEvolved` in that folder. Keep the application and its libraries together. These archives contain the desktop client and the .NET runtime. The separate [Ubuntu rack host package](../docs/LINUX-HOST.md) runs the switch service and touchscreen together. Connect to the workspace of a Windows computer that runs EE through its Tailscale private HTTPS address, through its LAN address with a pairing code (see [Connect over your network without Tailscale](#connect-over-your-network-without-tailscale)), or to a simulator started from a source checkout on the same computer. Choose **Change workspace address** on the connection error screen or in Settings to save the address. An explicit `--url` argument takes precedence over the saved address, and the `EE_WORKSPACE_URL` environment variable sets the same address with lower precedence than `--url`. Each source accepts only the addresses the dialog accepts: an HTTPS origin, an HTTP origin on this computer, or an HTTP origin at a private IPv4 address, one that starts with 10, 172.16 to 172.31 or 192.168, with a port other than 80, without account details, a path or a query. Host names such as `.local` names and IPv6 addresses are not accepted for LAN access. A `--url` value that does not qualify opens the connection error screen with **Change workspace address**, and an environment value that does not qualify is ignored. The default local address is `http://127.0.0.1:4180/`.

A window connected through a Tailscale or LAN address can use lighting, effects, automation, profiles, schedules, port names and fans, and can reconnect to the switch whose login is saved on the Windows computer. Its Connect page shows **Connect with saved login**, **Retry handoff** when a handoff waits, and **Change workspace address** instead of the login form, and Settings leaves out **Forget saved switch login** and UniFi Network setup. **Change workspace address** stays available on the Connect page while a connection or handoff is pending. A client connected by address, including the Windows app opened with `--url` or `EE_WORKSPACE_URL`, cannot change the Tailscale or LAN access settings or close a workspace it did not start. Use the Windows computer for those.

Expand Down
2 changes: 2 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ and port-name refusals carry `message` without `code`.
| 403 | `private_access_denied` | The Tailscale identity is not approved, or the path cannot be opened through private access |
| 403 | `lan_access_denied`, `lan_pairing_required`, `lan_pairing_failed` | LAN access refusals; see [LAN access](#lan-access) |
| 404 | `not_found` | No such zone, rule, preset, schedule, history entry or paired device |
| 403 | `host_policy` | The Ubuntu host administrator manages the switch's SSH identity and the permitted controller HTTPS origin |
| 403 | `local_only` | The Ubuntu rack host uses the local socket for workspace access |
| 409 | `not_logged_in` | Not logged in to a switch |
| 409 | `workspace_changed` | The `X-EE-Workspace` header names another switch session than the current one |
| 409 | `handoff_unconfirmed` | A Handoff to UniFi has not been confirmed; lighting changes and connections wait for it |
Expand Down
2 changes: 1 addition & 1 deletion docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Start-Process "http://127.0.0.1:4180/?admin_code=$code"

To use another existing Python environment, set `EE_PREVIEW_PYTHON` to its absolute executable path before starting. The runtime also searches the checkout's `.venv` and the existing `PATH`. The desktop app, run from a source checkout, passes `EE_PREVIEW_PYTHON` to the gateway it starts; a packaged app ignores it.

For a live workspace, set `EE_PREVIEW_LIVE` to `1` and start the same command. Enter credentials through the login screen. Close another live EE instance first; the live workspace takes the Windows application instance lock, so live mode runs on Windows only. Source startup does not automatically log in to the switch.
For a live Windows workspace, set `EE_PREVIEW_LIVE` to `1` and start the same command. Enter credentials through the login screen. Close another live EE instance first; the Windows workspace takes the application instance lock. On Ubuntu, use the [rack host service](LINUX-HOST.md). Source startup does not automatically log in to the switch.

| Setting | Purpose |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The effect catalog includes parameter types, ranges, units, choices, independent

The workspace subscribes before restoring initial state so delayed connection results reach the login screen. Connecting, recovery, pending handoff, and failure states have separate handling. A successful HTTP response alone does not establish that cleanup or a physical lighting change occurred; use the corresponding engine result and device acceptance checks.

Source mode starts in an isolated simulator by default. Live mode uses the existing engine settings and credential store. It needs the Windows application instance lock, so live mode runs on Windows only. On macOS and Linux only the simulator works; with `EE_PREVIEW_LIVE=1` the engine cannot take the lock and the gateway stops at startup. Gateway preferences, engine data, and simulator data have separate locations described in [DEVELOPMENT.md](DEVELOPMENT.md#data-and-generated-files).
Source mode starts in an isolated simulator by default. Live mode uses the existing engine settings and credential store. Windows uses its named application mutex. On Ubuntu, the [system service](LINUX-HOST.md) holds a Linux instance lock and serves the rack account over a systemd-owned Unix socket. Gateway preferences, engine data, and simulator data have separate locations described in [DEVELOPMENT.md](DEVELOPMENT.md#data-and-generated-files).

Closing the web session uses `/api/workspace/close` to coordinate engine shutdown, private access cleanup and the LAN listener. The gateway answers its Tailscale settings, LAN access settings and workspace close routes itself.

Expand Down
Loading
Loading