fix: the root CA is created by the server, an offline CA or a Simple CA service, chosen at setup; the shell can stay open in a tab of its own, the Docker page is offered only with Docker, and the test scripts are in bin/.
Release / release (push) Failing after 14m20s

This commit is contained in:
slawek committed 2026-11-23 06:45:23 +01:00
1 parent ff0c93ed73
commit a649331aa2
49 files changed
+1597 -637

No files matched your search

+114 -45
View File
@@ -1,7 +1,10 @@
# Remote tests
`run.py` installs the newest `out/linux-manager_*_all.deb` into instances of an LXD remote and
checks the router and VPN components in three scenarios:
The scripts are in `bin/` of the repository; this directory holds their data: `scenarios/`,
`configs/`, `cloud-init/`, `repo/` and the files copied into instances.
`bin/lm-dev-run.py` installs the newest `out/linux-manager_*_all.deb` into instances of an LXD
remote and checks the router and VPN components in three scenarios:
- `core`: one interface, router and VPN off;
- `nat`: VPN on, router off, one interface; WireGuard and OpenVPN clients reach a target through
@@ -11,7 +14,7 @@ checks the router and VPN components in three scenarios:
`site_to_site` is set, which setup refuses.
Servers are virtual machines, clients and LAN hosts containers, all from `ubuntu:26.04`. Each
scenario is a module in `scenarios/` whose `run(lab)` uses the `Lab` class of `run.py`.
scenario is a module in `scenarios/` whose `run(lab)` uses the `Lab` class of `lm-dev-run.py`.
`wireguard_peer.py` and `echo.py` are copied into the instances: the first gives the test user a
WireGuard peer on the server, the second answers HTTP with the client's address.
@@ -22,11 +25,11 @@ export LXD_POOL=...
```sh
./build.sh
tests/remote/run.py core nat s2s
bin/lm-dev-run.py core nat s2s
```
```sh
tests/remote/run.py all
bin/lm-dev-run.py all
```
Options:
@@ -35,14 +38,16 @@ Options:
|---|---|---|---|
| `--remote` | `LXD_REMOTE` | required | The `lxc` remote |
| `--pool` | `LXD_POOL` | required | The storage pool of the project's root disks |
| `--project` | `LXD_PROJECT` | `lm-test` | The project the instances live in; it must not exist |
| `--project` | `LXD_TEST_PROJECT` | `lm-test` | The project the instances live in; it must not exist |
| `--image` | `LXD_IMAGE` | `ubuntu:26.04` | The image of every instance |
| `--keep` | | off | Leaves the project and the networks in place; run one scenario then |
Each scenario creates the project and its networks (`lmt-<scenario>-<net>`) and removes them at
its end. The administrator password and the pre-shared key are generated per run and written to
`tmp/remote-test.env`. The run prints PASS, FAIL or SKIP per check and exits non-zero on a
failure; WireGuard is skipped when the host kernel has no WireGuard module.
its end. The administrator password and the pre-shared key are generated per run. The
administrator's name and password are set as `ADMIN_USERNAME` and `ADMIN_PASSWORD` in the
repository's `.env`, keeping its other lines, and the key is written to `tmp/remote-test.env`.
The run prints PASS, FAIL or SKIP per check and exits non-zero on a failure; WireGuard is skipped
when the host kernel has no WireGuard module.
The configurations in `configs/` have placeholders that are filled in for each server:
@@ -52,53 +57,56 @@ The configurations in `configs/` have placeholders that are filled in for each s
## A VM to work with
`vm.py` launches one server VM, `lm-dev` by default, on the LXD remote and leaves it
running. The VM is created in a project, `default` by default, with that project's default
profile, and takes its address from DHCP. It gets the newest package with the administrator
`admin` and a generated password, written to `tmp/vm-<name>.env`, and a configuration from
`configs/`, `core.json` by default; `@ETH0@` is the interface of the VM's default route.
`lm-dev-vm.py create` launches one server VM, `lm-dev` by default, on the LXD remote and leaves
it running. The VM is created in a project, the test project `lm-dev` by default, with that
project's default profile, and takes its address from DHCP. It gets the package with the
administrator `admin` and a generated password, set as `ADMIN_USERNAME` and `ADMIN_PASSWORD` in the
repository's `.env`, and a configuration from `configs/`, `core.json` by default; `@ETH0@` is the
interface of the VM's default route.
The leased address is pinned on the VM's NIC, as NAT proxy devices require a static address.
Proxy devices then forward ports of the LXD host address `--listen` to the VM; by default that is
the IPv4 address of the host in the remote's URL (`lxc remote list`), which must be an address of
the LXD host itself:
In a test project made by `lm-dev-lxd-project.py`, the VM installs the package from the project's
repository, so later dev builds reach it as updates; in another project it installs the newest
`out/linux-manager_*_all.deb`. The leased address is pinned on the VM's NIC, and these ports lead
to the VM:
- `7080` to the Manager;
- `7081` to the status web service;
- `2222` to SSH, port `22`.
The script prints the VM's address, the administrator's password, the proxied URLs, the command
of a shell in it and the command that removes it.
In a test project they lead through a network forward on the project's `wan`, whose listen address
LXD allocates from the uplink's `--routes`, as LXD refuses NAT proxy devices in a project with
networks of its own. In another project NAT proxy devices listen on the LXD host address
`--listen`, by default the IPv4 address of the host in the remote's URL (`lxc remote list`), which
must be an address of the LXD host itself.
The script prints the VM's address, the administrator's password, the URLs, the command of a
shell in it and the command that removes it.
```sh
tests/remote/vm.py
bin/lm-dev-vm.py create
```
```sh
tests/remote/vm.py --remove
bin/lm-dev-vm.py remove
```
`--remove` deletes the VM and its env file. Options:
`remove` deletes the VM, its forward and `tmp/vm-<vm>.env`, its pre-shared key; `.env` is left as
it is. Options:
| Option | Variable | Default | Meaning |
|---|---|---|---|
| `--remote` | `LXD_REMOTE` | required | The `lxc` remote |
| `--project` | | `default` | The project of the VM |
| `--name` | | `lm-dev` | The name of the VM; it must not exist |
| `--project` | `LXD_PROJECT` | `lm-dev` | The project of the VM |
| `--vm` | | `lm-dev` | The name of the VM; it must not exist for `create` |
| `--image` | `LXD_IMAGE` | `ubuntu:26.04` | The image of the VM |
| `--config` | | `core.json` | The configuration from `configs/` |
| `--listen` | `LXD_LISTEN` | the remote URL's host | An address of the LXD host the proxies listen on |
In a test project made by `lxd-project.py`, `vm.py` installs the package from the project's
repository instead of `out/`, so later dev builds reach the VM as updates. LXD refuses NAT proxy
devices in a project with networks of its own, so there the ports lead through a network forward
on the project's `wan`, whose listen address LXD allocates from the uplink's `--routes`;
`--listen` does not apply, and `--remove` deletes the forward with the VM.
| `--listen` | `LXD_LISTEN` | the remote URL's host | Outside a test project, the address the proxies listen on |
## A test project with dev builds
`lxd-project.py create` makes a project for manual tests that stays until
`lxd-project.py remove`; `run.py` keeps making and removing its own projects. The project has:
`lm-dev-lxd-project.py create` makes a project for manual tests that stays until
`lm-dev-lxd-project.py remove`; `lm-dev-run.py` keeps making and removing its own projects. The
project has:
- networks of its own (`features.networks`), OVN networks on the physical uplink `--uplink`:
`wan`, with NAT and DHCP on a subnet LXD picks, and `lana` and `lanb`, on subnets LXD picks
@@ -127,19 +135,19 @@ OVN answers ARP for its routers' and forwards' addresses on the LAN (`ovn.ingres
of that name as it is; `uplink remove` deletes it.
```sh
tests/remote/lxd-project.py uplink setup
bin/lm-dev-lxd-project.py uplink setup
```
```sh
tests/remote/lxd-project.py uplink remove
bin/lm-dev-lxd-project.py uplink remove
```
```sh
tests/remote/lxd-project.py create
bin/lm-dev-lxd-project.py create
```
```sh
tests/remote/lxd-project.py remove
bin/lm-dev-lxd-project.py remove
```
| Option | Variable | Default | Meaning |
@@ -155,21 +163,82 @@ tests/remote/lxd-project.py remove
| `--ovn-ranges` | `LXD_UPLINK_OVN_RANGES` | required by `uplink setup` | LAN addresses for OVN routers |
| `--routes` | `LXD_UPLINK_ROUTES` | required by `uplink setup` | A LAN subnet for network forwards |
`dev-build.py` builds and publishes the next dev build. Its version is the newest changelog
`lm-dev-build.py` builds and publishes the next dev build. Its version is the newest changelog
entry's with `~dev<N>` before the Debian revision, `0.41.0~dev7-1` for `0.41.0-1`, so the release
of that entry is newer than its dev builds. `N` is kept in `tmp/test-number` and goes up with each
build that succeeds. `./build.sh` builds it, with `CONTAINER_RUNTIME` and `DOCKER_CONTEXT` from the
of that entry is newer than its dev builds. `N` is that of the last dev build, kept in
`.dev-build.serial` of the repository; each build that succeeds writes its own, one higher, and
`release.py` writes 0 when it releases, so the next entry's builds start at `~dev1`. `./build.sh` builds it, with `CONTAINER_RUNTIME` and `DOCKER_CONTEXT` from the
environment; the build is moved to `out/dev/`, copied into the repository and published there. A
VM of the project then gets it with Check update and Upgrade in the Manager, or `apt-get update`
and `apt-get upgrade`.
```sh
tests/remote/dev-build.py
bin/lm-dev-build.py
```
`--project` (`LXD_PROJECT`, `lm-dev` by default) names the project.
`--project` (`LXD_PROJECT`, `lm-dev` by default) names the project; the remote is the project's,
read from its state file, so the script takes no `--remote`.
## A TOTP token for a user of a test VM
`bin/lm-dev-otp-register.py` enrols a new TOTP token for a user of a VM, `admin` of `lm-dev` by
default, through `lxc exec`: in the VM, as root, the package's `linuxmanager_users` makes a new
secret and stores it once a code the script computes from it verifies, replacing a token the user
had. The secret, base32, is then written to the file `--secret-file` or `OTP_FILE` names,
readable by its owner only; `otp.py code` prints its codes (see below).
```sh
export OTP_FILE=tmp/admin.otp
bin/lm-dev-otp-register.py
```
| Option | Variable | Default | Meaning |
|---|---|---|---|
| `--secret-file` | `OTP_FILE` | required | The file the secret is written to |
| `--remote` | `LXD_REMOTE` | required | The `lxc` remote |
| `--project` | `LXD_PROJECT` | `lm-dev` | The project of the VM |
| `--vm` | | `lm-dev` | The name of the VM |
| `--user` | | `admin` | The user to enrol |
## A command-line authenticator app
`bin/otp.py` is an authenticator app on the command line, in place of one on a phone, not tied to
Linux Manager or LXD. It keeps a base32 secret in the file `--secret-file` or `OTP_FILE` names,
readable by its owner only. The codes are
RFC 6238's, SHA-1, 6 digits and 30 seconds by default.
Options of both actions:
| Option | Variable | Default | Meaning |
|---|---|---|---|
| `--secret-file` | `OTP_FILE` | required | The file of the base32 secret |
| `--algorithm` | | `sha1` | `sha1`, `sha256` or `sha512` |
| `--digits` | | `6` | The digits of a code, 6 to 10 |
| `--period` | | `30` | The seconds a code is valid |
`new` makes a new secret of 20 random bytes in the file and prints its `otpauth://` URI, with the
algorithm, digits and period, for a server or an app that enrols a given secret:
```sh
bin/otp.py new --account admin --issuer lm-dev
```
| Option | Default | Meaning |
|---|---|---|
| `--account`, `--issuer` | none | The label of the URI |
| `--force` | off | Replace an existing secret |
`code` prints the current code of the secret, for the Manager's sign-in, SSH or `sudo`:
```sh
bin/otp.py code
```
| Option | Default | Meaning |
|---|---|---|
| `--at` | now | The Unix time of the code |
## Scope of the tests
Not covered by `run.py`: IKEv2 client access, HTTPS with Let's Encrypt, the OpenID Provider and
passkeys, PowerDNS answering from outside, and the Azure and GCP platform modules.
Not covered by `lm-dev-run.py`: IKEv2 client access, HTTPS with Let's Encrypt, the OpenID
Provider and passkeys, PowerDNS answering from outside, and the Azure and GCP platform modules.