From 6911d16fa3dce5827be46829bc5b97e897460c29 Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Tue, 24 Nov 2026 06:51:04 +0100 Subject: [PATCH] update: the history of the package is CHANGELOG.md, from which the build writes debian/changelog, the build, publish and development scripts are in Python, and the development tools keep their settings and credentials in .lm-dev-config. --- .gitea/workflows/release.yml | 6 +- .gitignore | 2 +- ADR.md | 47 +- CHANGELOG.md | 1320 +++++++++++++ Dockerfile | 6 +- README.md | 47 +- bin/changelog.py | 119 ++ bin/lm-dev-build.py | 42 +- bin/lm-dev-lxd-project.py | 52 +- bin/lm-dev-otp-code.py | 5 +- bin/lm-dev-otp-register.py | 13 +- bin/lm-dev-run.py | 24 +- bin/lm-dev-vm.py | 44 +- bin/lm_dev.py | 75 +- build.py | 46 + build.sh | 20 - debian-package/debian/changelog | 1754 ----------------- .../usr/lib/linux-manager/linuxmanager_ui.py | 2 +- dev.py | 73 + dev.sh | 65 - examples/azure/README.md | 6 +- examples/gcp/README.md | 4 +- publish.py | 68 + publish.sh | 48 - release.py | 130 +- tests/remote/README.md | 53 +- 26 files changed, 1966 insertions(+), 2105 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 bin/changelog.py create mode 100755 build.py delete mode 100755 build.sh delete mode 100644 debian-package/debian/changelog create mode 100755 dev.py delete mode 100755 dev.sh create mode 100755 publish.py delete mode 100755 publish.sh diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 063eeb4..60d8928 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -15,13 +15,11 @@ jobs: uses: actions/checkout@v6 - name: Build package - working-directory: debian-package - run: ./build.sh + run: ./build.py - name: Publish package - working-directory: debian-package env: SERVER_URL: ${{ secrets.CI_URL }} OWNER: ${{ secrets.CI_OWNER }} PACKAGES_TOKEN: ${{ secrets.CI_TOKEN }} - run: ./publish.sh + run: ./publish.py diff --git a/.gitignore b/.gitignore index f1d2a1e..5534de5 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,6 @@ node_modules web/dist .venv dev.json -/.dev-build.serial **/.env /.lm-dev-config/ +/debian-package/debian/changelog diff --git a/ADR.md b/ADR.md index 47c490c..45cca6d 100644 --- a/ADR.md +++ b/ADR.md @@ -1408,19 +1408,30 @@ one line with its type and message. Consequences: The logs hold one line per failure, without its stack. A failure that reaches the last line of defence is found by its message and fixed where it occurs, with its own handling. -## ADR-49: A changelog summary is a paragraph wrapped at 80 columns +## ADR-49: CHANGELOG.md is the history, and debian/changelog is written from it by the build Status: Accepted -Context: The summary of an entry of `debian/changelog` is the commit message of its release, -which `release.py` reads from the changelog. Summaries are often longer than the 80 columns -Debian's tools expect of a changelog line. +Context: The history of the package is also the source of each release's commit message and tag: +`release.py` commits with the summary of the newest entry and tags its version. A Debian changelog +needs a package name, a maintainer, an RFC 2822 date and lines of at most 80 columns in every entry, +which a history written by hand gets wrong and which repeat in every entry. Summaries are often +longer than one line. -Decision: The summary is the entry's first paragraph, indented by two spaces and wrapped at 80 -columns. `release.py` joins its lines with single spaces into the commit message. +Decision: `CHANGELOG.md` at the repository's root is the only history kept by hand. An entry is a +`## x.y.z` heading, a summary paragraph wrapped at 100 columns and `-` items; `release.py` writes +the release time into the heading, `## x.y.z - YYYY-MM-DD HH:MM:SS +ZZZZ`, when it commits the +entry, joining the summary's lines with single spaces into the commit message. `bin/changelog.py` +writes `debian/changelog` from it in the build image, with the package name and the maintainer of +`debian/control`, the time of the build for an entry without a date, and `DEB_VERSION` as the +newest entry's version for a dev build. `x.y.z` is the Debian version `x.y.z-1`, and `x.y.z-n` is +itself. `debian/changelog` is not kept in the repository. -Consequences: The commit message is one line however the summary is wrapped, so a summary -rewrapped later still matches the commit of its release. +Consequences: The commit message is one line however the summary is wrapped, so a summary rewrapped +later still matches the commit of its release, and an entry with a date in its heading is +released. Every entry of the generated `debian/changelog` has the current package name and +maintainer, also the entries made under the package's earlier name. The builder image has Python +for the script. ## ADR-50: The help is Markdown rendered in the browser, in a panel that pushes the page @@ -1473,7 +1484,7 @@ Status: Accepted Context: With `terraform_dir`, the manager built `http://:7081`. The port of the server's web service is `web.port` and the interfaces it listens on are `web.listen`, -which the platform sets from its variables; the manager that `dev.sh` runs on a workstation cannot read them. +which the platform sets from its variables; the manager that `dev.py` runs on a workstation cannot read them. Decision: `router_url` is the output `router_web_url` of the platform, which derives the URL from the same variables that configure the server. @@ -1559,7 +1570,7 @@ programs are in `/usr/lib/linux-manager`, the Manager's application and help in state of the upgrades in `/var/lib/linux-manager`. The Manager's unit is `linux-manager-ui.service`. The debconf questions of its first administrator are `linux-manager/admin_username` and `admin_password`. The server's bootstrap page shows the -Manager, which has no bootstrap service of its own. `dev.sh` runs the Manager on a workstation, +Manager, which has no bootstrap service of its own. `dev.py` runs the Manager on a workstation, with `terraform_dir` and `bind`. Consequences: The repository holds the Manager's `web/` and `docs/`, and its build runs from the @@ -1621,16 +1632,16 @@ own (`features.networks`), a WAN and two LANs, and a container `repo` that serve repository, `resolute main`, built with `apt-ftparchive` and signed by its own key. The networks are OVN networks on an uplink bridge of the remote, as OVN is the only network type LXD creates inside a project; they belong to the project and go with it. `bin/lm-dev-build.py` builds the newest -changelog entry as `~dev-`, `N` counted in `.dev-build.serial`, which a -release sets to 0, by passing `DEB_VERSION` to the build, which rewrites the version in the image -only, and publishes the build in that repository. `bin/lm-dev-vm.py` gives a VM of the project -that repository as its apt source. The project also has a Vault, through which secrets reach its -instances (ADR-61). The scripts keep their state in `.lm-dev-config/`, which outlives clean-ups of -`tmp/`. The automated tests (`lm-dev-run.py`) keep their own project for one run and install from a -file. +changelog entry as `~dev-`, `N` counted in `LXD_DEV_BUILD_SERIAL` of +`.lm-dev-config/settings.json`, which a release sets to 0, by passing `DEB_VERSION` to the build, +which rewrites the version in the image only, and publishes the build in that repository. +`bin/lm-dev-vm.py` gives a VM of the project that repository as its apt source. The project also +has a Vault, through which secrets reach its instances (ADR-61). The scripts keep their state in +`.lm-dev-config/`, which outlives clean-ups of `tmp/`. The automated tests (`lm-dev-run.py`) keep +their own project for one run and install from a file. Consequences: Every dev build is an apt update of the one before, and the release of the entry, -which sorts above all of its `~dev` builds, is an update of them all. The changelog is not +which sorts above all of its `~dev` builds, is an update of them all. `CHANGELOG.md` is not changed by a dev build. Dev builds go to `out/dev/`, so `out/` holds only release builds. ## ADR-59: A Simple CA root signs the issuing CAs through a sign-ca token of its issuing CA diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..78ffe27 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1320 @@ +# Changelog + +## 0.42.0-2 - 2026-11-24 06:51:04 +0100 + +update: the history of the package is CHANGELOG.md, from which the build writes debian/changelog, +the build, publish and development scripts are in Python, and the development tools keep their +settings and credentials in .lm-dev-config. + +- CHANGELOG.md at the repository's root is the package's history; the build writes + debian/changelog from it with bin/changelog.py, and debian/changelog is no longer in the + repository. +- release.py releases the newest entry of CHANGELOG.md: it writes the release time into the entry's + heading and commits with its summary; --push tags the version and pushes main and the tag, and + --no-tag makes an internal release, pushing main alone. +- The lm-dev scripts read the defaults of their options from the environment, else from + .lm-dev-config/settings.json, and stop naming a required setting that neither has; the + repository's .env is no longer used. +- lm-dev-vm.py keeps the administrator of a VM, its password and the otpauth URL of its TOTP + token, in .lm-dev-config/vm-PROJECT-VM.json. +- The serial of the last dev build is LXD_DEV_BUILD_SERIAL in .lm-dev-config/settings.json. +- build.py, publish.py and dev.py replace build.sh, publish.sh and dev.sh, with the same arguments + and environment variables; publish.py reads the version from CHANGELOG.md, and the release + workflow runs build.py and publish.py from the repository's root. + +## 0.42.0 - 2026-11-23 08:20:31 +0100 + +feature: the VPN, the router, the name server and WebDAV are components switched on the System tab +and installed on demand, Caddy from the Ubuntu archive is a dependency and serves every HTTP and +HTTPS port, HTTPS is chosen at install, its certificate is of the Servers Issuing CA or self-signed +by default, of ACME or of another CA, the issuing CAs are in one tab, a locked account is unlocked +again, the name of a CA is fixed once the CA exists, and a run of setup is no longer cut short by a +change. + +- The Manager's System tab has a Components panel: the VPN, the router, the name server and WebDAV, + each switched on and off there, with GET and PUT /components; the router is offered only with a + second network interface, and its Enable asks for the internal interface and, in manual mode, its + address and gateway. The DNS and sites settings dialogs no longer switch the name server and + WebDAV. +- The Overview's Addresses panel lists each address of the status page once, and the Manager's plain + HTTP addresses while Caddy does not redirect it; /api/info gives the port and listen of the + Manager's site. +- Every page and tab with more than one panel has Edit layout and Panels, its layout kept in the + browser. +- The name server has a DNS page of its own, in the page menu while it is on, instead of a tab of + Web Sites; its secondary name server is optional, and without it the server is the domains' only + name server, with no warning at each setup run. +- The VPN's and the router's packages are suggested, not depended on, and linux-manager-install@vpn + and @router install them from the Ubuntu archive while the component is on; setup also has + packages of a component that is on, marked as installed automatically, marked as installed by + hand, so apt autoremove keeps them. +- A change made in the Manager, with the package's commands or by the installation of a component no + longer restarts a run of linux-manager-setup in progress, which could leave the firewall, the VPN + or the routes half applied; the run runs once more when it ends instead. linux-manager-config-edit + apply runs setup and waits for it, and --restart of set and remove does the same. +- The package depends on caddy from the Ubuntu archive, which serves web.port, the Manager's port + and metrics.port over plain HTTP as well as the HTTPS ports; the web service, the Manager and the + metrics service listen on 127.0.0.1 only, on ports 7091, 7090 and 9474, and the firewall opens + each plain HTTP port on the interfaces its listen setting names. +- The Manager's sign-in page and /api/info without a session no longer show the package's version, + and Caddy removes the Server header of every answer, which named Caddy and the services' Python + version. +- https.caddy_source, the upstream Caddy repository and linux-manager-caddy are removed; a + configuration that names https.caddy_source is refused. +- The installer asks whether to serve over HTTPS, https.enabled, and with HTTPS whether to keep the + Manager on plain HTTP, https.disable_auto_redirect; while HTTPS is on, Caddy redirects the + Manager's plain HTTP port to its HTTPS address, and the status page never redirects. +- https.certificate is self-signed when the configuration does not set it, and acme only when set; a + new installation's first setup chooses ca when the root CA and the Servers Issuing CA are + available, else self-signed, and writes it into the configuration file. A server whose + configuration did not set it moves from acme to self-signed. +- https.certificate, self-signed, ca, acme or external, says where the certificate of wan.local_fqdn + comes from; while the chosen one is not available, the server serves a self-signed one and warns. +- With external, linux-manager-ca https csr, import and import-pfx, POST /https/csr, PUT + /https/certificate and PUT /https/pfx, and Generate CSR, Import certificate and Import PFX of the + Certificates page's Server tab make a CSR and take the certificate another CA signed, or a PFX + file. +- https.acme_provider, letsencrypt, zerossl or custom with acme_url and optional EAB, is the ACME CA + of the server and of the sites with TLS acme; https.zerossl_api_key is optional. +- PUT /https/settings changes the source and the ACME settings; the Certificates page's first tab, + Server, shows HTTPS, the certificate, the ACME CA and Caddy, which the Overview no longer shows; + its HTTPS row's button changes the source and its ACME CA row's button the ACME CA, which the web + sites with TLS ACME also use; port 80 is opened for the challenge only with acme. +- The built-in Servers Issuing CA servers, named pki.servers_name, issues mTLS certificates and the + server's HTTPS certificate with ca; the site-to-site template is mtls, and the s2s CA issues it. +- The Certificates page shows the built-in and the custom issuing CAs in one Issuing CAs tab, with + the certificates of all of them; a built-in CA whose component is off is off, not missing. +- Every test instance gets an AppRole of its own in a Vault of the test project, with /etc/vault and + the helper lm-dev-vault, and reads its secrets with it, never as an argument or on standard input; + lm-dev-lxd-project.py vault create, unseal and remove manage the Vault, and the scripts' state is + in .lm-dev-config/. +- lm-dev-vm.py takes --forward-address, and enrols a TOTP token for admin when the VM is created + unless --no-otp is given. +- The TOTP tokens of test VMs are keys of the Vault's TOTP engine; lm-dev-otp-code.py prints their + codes, and lm-dev-otp-register.py takes no --secret-file. bin/otp.py stores its secret without a + line end, or with --url its otpauth URI, so Vault imports the file as it is, and reads codes from + either. +- linux-manager-user unlock, POST /users//unlock and the metrics account's new password end a + lockout again; they failed when the user had failed binds. +- Setup refuses a CA name that differs from the common name of the CA's certificate or CSR, and + linux-manager-ca ca import a certificate whose common name differs from the CSR's; the PKI + settings dialog edits the P2S and S2S names only until their CA exists, and the issuing CA dialog + no longer edits the common name of an existing CA. +- lm-dev-run.py keeps the lab's admin password in the scenario's Vault and no longer replaces + ADMIN_PASSWORD in .env. +- lm-dev-run.py and lm-dev-vm.py install the package built last, in out/ or out/dev/, or the one + --deb names; lm-dev-vm.py no longer prints the admin password. +- The build retries failed downloads of the image's packages. + +## 0.41.1 - 2026-11-22 20:13:38 +0100 + +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/. + +- The Manager's browser settings have Open the shell in a new tab, off by default; with it the shell + button opens the shell in a tab of its own. +- The page menu leaves the Docker page out while Docker is not installed; /config has + docker.installed. +- The test scripts are bin/lm-dev-run.py, lm-dev-vm.py, lm-dev-lxd-project.py and lm-dev-build.py, + their data stays in tests/remote; bin/otp.py is a command-line authenticator app, and + bin/lm-dev-otp-register.py enrols a token for a user of a test VM. +- The lm-dev scripts default to the project lm-dev, read from LXD_PROJECT, and name the VM with + --vm; lm-dev-run.py reads its project from LXD_TEST_PROJECT; lm-dev-vm.py takes create and remove. +- lm-dev-build.py keeps the serial of the last dev build in .dev-build.serial, which release.py + writes as 0 when it releases. +- pki.root, local by default, offline or simple-ca, says where the root CA comes from, and is fixed + once the root exists; the debconf question linux-manager/pki_root sets it. +- With pki.root offline, setup makes the CSRs of the issuing CAs and waits; linux-manager-ca ca + import root, and Import root certificate on the Root tab, take the root certificate before the + issuing CAs. +- With pki.root simple-ca, setup exchanges a setup code, debconf linux-manager/pki_setup_code or + linux-manager-ca root setup-code, for a sign-ca token of a Simple CA issuing CA at + pki.simple_ca_url, has the issuing CAs signed by it, and fetches the CRLs of the root and that CA, + which joins every chain the server gives; the CA of the service's HTTPS certificate is installed + in the system's trust store before setup. +- The root key is no longer exported, removed or imported: linux-manager-ca root export-key, + remove-key and import-key, pki.root_key_warning, and a root placed in /etc/linux-manager/pki/root + are gone. +- The Root tab shows the source of the root, and with Simple CA its issuing CA and the expiry of the + token, with Enter setup code. +- examples/cloud-init-with-pki.yaml.tpl and the Azure and GCP examples give the router a Simple CA + root with simple_ca_url and simple_ca_setup_code, and both cloud-init examples add the CAs of + trusted_ca_files to the trust store. +- The name server settings describe TTL as the default TTL of the records, used where neither the + record nor its domain has one. + +## 0.41.0 - 2026-11-21 23:39:03 +0100 + +feature: the package is linux-manager, the Ubuntu Linux Manager, whose router and VPN are components +switched on in the configuration. + +- The package, its paths, units, commands, Python modules, debconf questions, LDAP base DN + dc=linux-manager,dc=local, schema, database and metric names are linux-manager instead of + vpn-router; the Manager's unit is linux-manager-ui.service, vpn-config-edit is + linux-manager-config-edit and vre is lme. +- The Manager is the Ubuntu Linux Manager, its first page Server. +- router.enabled and vpn.enabled, false by default, switch the router and the VPN; the debconf + questions linux-manager/router_enabled and vpn_enabled set them, and only the questions of the + components on are asked. +- With the router off the server needs only interfaces.external, which is also the internal side of + the listen choices, and site_to_site must be empty; with the VPN off p2s, openvpn and wireguard + must be off. +- With the router off and the VPN on, the VPN pools are masqueraded out of the external interface, + so the clients reach local.cidrs through NAT. +- linux-manager-setup writes /etc/sysctl.d/99-linux-manager.conf while the router or the VPN is on + and removes it while both are off; the package ships no sysctl file. +- The firewall is enabled once any service of the core is configured; the IPsec rules are written + only while site-to-site or IKEv2 is ready, and MSS clamping while the router or the VPN is on; + strongSwan is stopped while neither needs it. +- The P2S CA is created while the VPN is on and the site-to-site CA while the router is on; + switching the VPN on issues the missing certificates of the VPN users. +- While the VPN is off, a VPN user is created without a certificate, and WireGuard peers and the VPN + profiles are refused. +- The Manager hides the Remote Access page while the VPN is off, and shows only the Network tab of + the Connectivity page while the router is off. +- The Network tab lists every interface but loopback by name, with its type, external when it holds + the IPv4 default route and internal otherwise, state, addresses and MAC address; the internal + gateway and the local CIDRs are in a Router panel shown while the router is on. /config has the + interfaces in network.interfaces. +- The LDAP schema is under 1.3.6.1.4.1.67380.10.1.2, the arc listed in OID-REGISTRY.txt. +- Ubuntu 26.04 (resolute) is the only supported release: the build image and the published + distribution are resolute, the Azure and GCP examples install from resolute, and the Azure example + boots the 26.04 image. +- The examples switch the router and the VPN on. +- A NAT rule that the configuration no longer needs is removed from the running firewall at once, + not only at the next boot. +- The last enabled member of admins can no longer be disabled, through the API, the Manager or + linux-manager-user (409, status 4). +- The Users, Groups, Service accounts, Web Sites and Files pages keep a refused change's message + above the list after they read it again. +- tests/remote/run.py tests the components on Ubuntu 26.04 instances of an LXD remote, and + tests/remote/vm.py starts and removes one server VM there to work with, reached through ports + 7080, 7081 and 2222 (SSH) of the LXD host, by default at the address of the remote's URL. +- tests/remote/lxd-project.py creates and removes a project for manual tests with its own OVN + networks, a WAN and two LANs, and a signed apt repository; tests/remote/dev-build.py publishes + numbered dev builds, version ~devN-, to it, and vm.py installs from it there. + +## 0.40.0 - 2026-11-13 20:15:15 +0100 + +feature: the package installs the Router Manager, which is no longer a package of its own. + +- The Router Manager, vpn-router-manager.service, is installed and started with the router; its + programs are in /usr/lib/vpn-router, its application and help in /usr/share/vpn-router/manager. +- Its settings are /etc/vpn-router/manager.json, its database password + /etc/vpn-router/manager-database.secret and the state of its upgrades + /var/lib/vpn-router/upgrade.json and system-upgrade.json. +- The debconf questions vpn-router/admin_username and admin_password give its first administrator, + written to /etc/vpn-router/manager-admin.json. +- The Overview tab and the upgrade helper know the package vpn-router alone. +- The bootstrap page on port 17081 shows the manager's service and log; port 17080 and + vpn-router-manager-bootstrap are gone. +- The status has no manager_version; the manager's unit is always among the services. +- The package cannot be installed beside the package vpn-router-manager, which has to be removed + first. +- A purge also removes the manager's settings, its database and role, and the record of its + upgrades. +- build.sh, publish.sh and the Dockerfile are in the repository root, the build also builds the + application in web/, and CONTAINER_RUNTIME chooses the container runtime. +- The README and the ADR call the product that deploys the router Cloud Manager, also where they + named manage-ui, and the docstring of the GCP platform names Google Cloud. + +## 0.39.1 - 2026-11-06 20:16:57 +0100 + +fix: the web service starts again after its first start with 0.39.0, and the name server's domains +can be changed from any process. + +- The schemas of the web sites and of the name server can be applied any number of times, so the web + service no longer keeps retrying with 'function "site_put" already exists' and never listening, + and vpn-router-site and setup no longer fail the same way. + +## 0.39.0-2 - 2026-11-06 20:08:29 +0100 + +update: vpn-router is published in the koszewscy package registry. + +- publish.sh uploads to the owner koszewscy unless OWNER names another. +- repo_url of the Azure and GCP examples defaults to + https://gitea.koszewscy.waw.pl/api/packages/koszewscy/debian. + +## 0.39.0 - 2026-10-30 21:30:01 +0100 + +feature: the name server's domains have wan.local_fqdn and dns.secondary as their name servers, and +a site with dns router gets records of the router's public, internal or external address. + +- The SOA and the first NS of every domain are wan.local_fqdn, and the second NS is dns.secondary, a + host name, whose addresses are notified of every change and may transfer the domains; + dns.nameserver is gone. +- wan.local_fqdn gets no record in the domains; its record is kept in the DNS of its own domain. +- A site has dns, user (the default), served elsewhere, or router, whose host names get an A or AAAA + record in their closest domain, with dns_address public (wan.public_address, new), internal or + external. dns.addresses, the domains' site records switch and the per-domain secondaries with + their routes are gone; dns.nameserver and dns.addresses of an earlier configuration are left out + when read. +- A site may use wan.local_fqdn as a host name on a port of its own. +- GET /dns answers nameserver, wan.local_fqdn, and public_address, which PUT /dns changes. +- The summaries of the changelog entries are wrapped at 80 columns, and release.py joins the lines + of a summary into the commit message. + +## 0.38.1 - 2026-10-30 02:43:22 +0100 + +fix: /https/settings shows the https section and switches https.acme_staging, for the Router +Manager. + +- GET /https/settings shows the https section, and PUT /https/settings changes acme_staging; the + other settings of the section stay with vpn-config-edit. + +## 0.38.0 - 2026-10-30 02:34:01 +0100 + +feature: https.acme_staging takes Caddy's certificates from Let's Encrypt's staging environment. + +- While https.acme_staging is true, Caddy's only CA is Let's Encrypt's staging environment, for the + router's services and the web sites with tls acme; its certificates are not trusted by browsers. + +## 0.37.3 - 2026-10-30 02:03:26 +0100 + +fix: an answer whose client went away ends quietly, and a shell whose client left before it opened +is stopped. + +- The web service, the metrics service and the bootstrap server stop writing an answer when its + client closes the connection, and a site file whose download is left no longer gets a second + answer. +- A shell whose client closed the connection before it opened is stopped and its end is logged, + instead of running on. + +## 0.37.2 - 2026-10-30 01:59:19 +0100 + +fix: the web service, the metrics service and the bootstrap server log a failure in one line instead +of a traceback, and nothing when a client goes away. + +- A request whose client closed the connection is no longer logged. +- Any other failure of a request, a thread or the service is logged in one line with the exception's + type and message. + +## 0.37.1 - 2026-10-30 01:53:55 +0100 + +fix: /config answers the OpenID Provider's state and issuer. + +- /config has oidc: enabled, and issuer, the issuer URL, null while the provider is disabled. + +## 0.37.0 - 2026-10-30 00:57:11 +0100 + +feature: the OpenID Provider has the client credentials and device authorization grants, public +clients, and service accounts as resources with roles and scopes in JWT access tokens. + +- A client may have the grants client_credentials, by which a confidential client gets an access + token as its own service account, and the device code (RFC 8628): POST /oidc/device_authorization + gives a device code and a user code, the user enters the code on /oidc/device, signs in and allows + or denies the device, and the device polls /oidc/token. A public client has no secret. +- An http loopback redirect URI matches with any port. +- Every service account is a resource: it defines scopes, which clients ask for as + : when their client scopes allow them, and roles, assigned to groups, users and + service accounts. A token request names its resource with resource (RFC 8707) or by its scopes. +- Access tokens are RS256 JWTs of RFC 9068 for the resource, or the client, with client_id, scope, + roles and the claims of the scopes; ID tokens and /oidc/userinfo carry the user's roles of the + client. +- vpn-router-user takes --grant, --public-client, --client-scope and --resource-scope; the new + vpn-router-role manages the roles; and /service-accounts takes and answers grants, public_client, + client_scopes, resource_scopes and roles. +- Changing the password of a service account, disabling, unlocking or removing it through + /service-accounts revokes its tokens. +- POST /oidc/device and /oidc/device_authorization are rate limited as /oidc/login is. + +## 0.36.0 - 2026-10-29 23:09:43 +0100 + +feature: a shell opens with one of the user's passkeys in place of the password and the TOTP code. + +- POST /shell/passkey begins a proof for one of the signed-in user's own passkeys, with user + verification; POST /shell takes the browser's answer as {"passkey": {"id", "credential"}} in place + of the password and the code, and gives the ticket of the shell. +- A passkey that is not accepted is refused with 403. The shell still needs the user's TOTP + enrolment, which its login session and sudo in it need. + +## 0.35.2-2 - 2026-10-29 21:41:32 +0100 + +update: the package is published for Ubuntu 26.04 (resolute) as well as 24.04 (noble). + +- publish.sh uploads the package to the distributions noble and resolute of the repository, + component main, skipping a distribution that has the version already; DISTRIBUTIONS names others. + A router on Ubuntu 26.04 installs vpn-router from the distribution resolute. + +## 0.35.2 - 2026-10-29 19:03:16 +0100 + +fix: the web service answers /, /status and /status/full again while IKEv2 runs. + +- The status of IKEv2 clients is collected again; the requests that collect the status were dropped + with a NameError since 0.35.1. + +## 0.35.1 - 2026-10-29 18:20:50 +0100 + +update: the router web service is split into the package vpnrouter_web, with one module per family +of paths. + +- /usr/lib/vpn-router/web initializes and serves; the package /usr/lib/vpn-router/vpnrouter_web/ + answers the requests, with a module for the status, the sign-in, the identities, the connections, + backups, the PKI, logs, web sites, DNS, metrics and the shell. The paths, the answers and the log + messages are the same. + +## 0.35.0 - 2026-10-29 18:02:27 +0100 + +feature: vre opens files from the Router Manager's shell in the editor of its Shell page. + +- vpn-router-editor FILE..., or vre, in the shell of the Router Manager opens the files in the + editor of the Shell page and returns at once; outside that shell it exits with status 2. +- GET, PUT and DELETE /shell/editor// read, save and close a file opened so, as the + shell's console account; a save is refused with 409 when the file changed since it was read. +- The editor takes regular files of UTF-8 text up to 1 MiB, at most 20 per shell, while the shell + lives. + +## 0.34.0 - 2026-10-28 22:00:00 +0100 + +feature: the web service shows and changes the settings of the metrics service at /metrics/settings, +and OpenVPN starts on a new router, as setup installs CRLs that revoke nothing. + +- GET and PUT /metrics/settings show and change the metrics section; otlp_password is never shown, + an empty one keeps it, and an empty otlp_username removes it. +- A CRL without revoked certificates is installed for strongSwan and OpenVPN. + +## 0.33.3 - 2026-10-28 21:00:00 +0100 + +fix: vpn-router-setup runs on a new installation once libpq can be found. + +- The vpn-router-setup unit waits, with wait-for-libpq, until libpq is in the linker cache before it + runs setup. +- The package starts vpn-router-setup without waiting for it. + +## 0.33.2 - 2026-10-27 23:00:00 +0100 + +fix: the router's IPsec remote access is called IKEv2 instead of road-warrior. + +- The README, the package description, the installer's questions, the status page, the messages of + the web service and the examples say IKEv2 access and IKEv2 clients; the strongSwan connection + keeps its name, road-warrior. + +## 0.33.1 - 2026-10-27 20:00:00 +0100 + +fix: the name server is the primary of any number of domains, each with secondary name servers and a +switch for the records of the sites. + +- The domains, their secondaries and manual records are kept in the vpn-router-dns database and + changed through /dns/domains; dns.zone is removed. +- Each domain is served as a primary zone: the router and its secondaries are its NS, and each + secondary's address is notified of changes and may transfer the zone. +- A domain with site records gives the host names of the enabled sites in it A and AAAA records of + dns.addresses; a domain inside another is delegated from it. +- Manual records belong to a domain; those of the single zone are dropped. + +## 0.33.0 - 2026-10-27 18:00:00 +0100 + +feature: road-warrior clients resolve the domains of the new setting p2s.dns_domains with the +router's resolver. + +- p2s.dns_domains lists up to 16 domains; setup pushes them to IKEv2 clients as INTERNAL_DNS_DOMAIN + (RFC 8598, attribute 25) of the road-warrior pool. +- The Apple VPN profile names them as match domains of the router's resolver, which macOS and iOS + use for those domains. + +## 0.32.1 - 2026-10-27 16:00:00 +0100 + +fix: a VPN user downloads the own OpenVPN client profile through /account, with the current password +and code. + +- POST /account/profile answers the user's OpenVPN client profile; it needs the current password + and, when enrolled, a code. + +## 0.32.0 - 2026-10-27 14:00:00 +0100 + +feature: the web service gives Apple VPN profiles that set up IKEv2 road-warrior access on macOS, +iOS and iPadOS. + +- POST /users//apple-profile and POST /account/apple-profile answer an unsigned .mobileconfig + with the P2S CA and the root CA, the user's certificate and key as a PKCS#12 encrypted with the + password of the request, and an IKEv2 VPN to wan.local_fqdn with EAP-TLS and the proposals of the + road-warrior connection. +- A user's own profile needs the current password and, when enrolled, a code. + +## 0.31.3 - 2026-10-27 12:00:00 +0100 + +fix: WireGuard clients may use the router's DNS resolver, which runs while WireGuard does, and +/remote-access names its addresses for their configuration. + +- The firewall opens port 53 of the remote access clients' resolver for the WireGuard network, as it + does for the IKEv2 and OpenVPN pools. +- The resolver runs while WireGuard is the only remote access enabled. +- GET /remote-access answers the resolver's addresses as wireguard_server.dns. +- dns.listen may not share an interface with p2s.dns_listen while WireGuard is enabled either. + +## 0.31.2 - 2026-10-27 11:00:00 +0100 + +fix: dnsmasq answers the remote access clients' DNS queries, so they no longer get the router's own +host name with all its addresses from systemd-resolved. + +- vpn-router-resolver.service runs dnsmasq on the addresses of p2s.dns_listen, forwarding to + systemd-resolved's stub on 127.0.0.53; names without a dot are not forwarded. The package depends + on dnsmasq-base. +- systemd-resolved keeps its loopback stubs only; setup removes the drop-in that made it listen for + the clients. +- /logs shows the journal of vpn-router-resolver, vpn-router-webdav and pdns. + +## 0.31.1 - 2026-10-26 23:00:00 +0100 + +fix: the remote access clients' resolver answers on the internal address by default, chosen by +p2s.dns_listen, so the name server can take port 53 of the external addresses. + +- The new setting p2s.dns_listen chooses the addresses of the resolver the road-warrior and OpenVPN + clients are given: internal, the default, external or both. The firewall opens port 53 for the + client pools on those addresses only. +- dns.listen is refused only when it shares an interface with p2s.dns_listen while IKEv2 or OpenVPN + is enabled. + +## 0.31.0 - 2026-10-26 21:00:00 +0100 + +feature: Caddy serves static web sites from folders on the router, defined in their own database, +with files uploaded through the web service or WebDAV, and an optional PowerDNS name server answers +for a zone of the sites. + +- The new database vpn-router-sites holds the web sites: host names, port, interfaces, TLS (none, + Let's Encrypt, an issuing CA or a certificate and key), index file, single-page fallback and the + group whose members change the files. sites.enabled serves them from + /var/lib/vpn-router/sites/; setup writes their blocks into the Caddyfile and opens their + ports, and Caddy also runs without HTTPS of the router while a site is served. +- vpn-router-site lists, shows, adds, changes and removes the sites, and bash completes it. +- /sites manages the sites and the settings of the sites section, and under /sites//files/ + lists, downloads, uploads, extracts zip archives into, creates, renames and removes the files of a + site, up to sites.upload_max_mb; members of the site's editors group may use its files. +- sites.webdav runs rclone's WebDAV server of the sites' folders behind Caddy on sites.webdav_port, + signing users in with the directory and showing each the sites it may change. +- dns.enabled runs PowerDNS with its PostgreSQL backend in the new database vpn-router-dns for + dns.zone on the addresses of dns.listen: SOA, NS, the A and AAAA records of dns.addresses for the + zone, the name server and the sites' host names in the zone, and manual records added with /dns. +- rclone and PowerDNS are installed from the Ubuntu archive by vpn-router-install@.service + when their feature is on. +- Backups hold the sites' folders and the dumps of both databases; a restore puts them back. Purge + removes the databases, their roles and password files, and the settings of PowerDNS. +- Renaming a group renames it in the sites; a group a site has cannot be removed. + +## 0.30.0 - 2026-10-26 19:00:00 +0100 + +feature: the web service serves the last lines of the journal of the router's units and of the log +files web.log_files lists, at /logs. + +- GET /logs lists the units whose journal and the files whose lines it serves; GET + /logs/journal?unit=&lines= and /logs/file?path=&lines= answer the last lines, 200 by default and + at most 1000, a file read from its last MiB. Units and files outside the lists are refused. +- The new setting web.log_files lists the absolute paths of the log files, at most 32. + +## 0.29.0 - 2026-10-26 17:00:00 +0100 + +feature: vpn-config-edit set and remove take --restart, which applies the change with +vpn-router-setup and waits for it. + +- vpn-config-edit set --restart and remove --restart restart vpn-router-setup after writing the + configuration and wait until it has applied the change; a failed run exits with status 1 and + points to its journal. Bash completes --restart. + +## 0.28.0 - 2026-10-26 16:00:00 +0100 + +feature: bash completes the vpn-* commands, their options and the names they take. + +- Bash completes the commands, options and arguments of vpn-router-user, vpn-router-group, + vpn-router-token, vpn-config-edit, vpn-router-backup, vpn-router-ca and vpn-router-caddy, from + /usr/share/bash-completion/completions; for root also the users, groups, issuing CAs, templates, + settings and site-to-site connections. +- The package recommends bash-completion. + +## 0.27.0 - 2026-10-26 14:00:00 +0100 + +feature: the web service is an OpenID Provider, which signs the directory's users in to other +systems, the clients being service accounts with redirect URIs. + +- oidc.enabled turns on the OpenID Provider at the issuer https://:, + with discovery, JWKS, authorize, token, userinfo and RP-initiated logout under /oidc/, answered + only through Caddy. The authorization code flow with PKCE S256 and refresh tokens are offered; ID + tokens are RS256, signed with /etc/vpn-router/oidc.key, which the web service makes on its first + run. +- Users sign in on the provider's page with the password and the TOTP code or with a passkey; the + session lasts 8 hours. The scopes openid, profile, email and groups give sub (the entry's + entryUUID), the names, the e-mail address and the user's groups. +- A service account with redirect URIs is a client: its name is the client ID and its password the + secret. Its redirect URIs, post-logout redirect URIs and allowed groups are set with + vpn-router-user add/update --redirect-uri, --post-logout-redirect-uri and --allowed-group, and in + /service-accounts as redirect_uris, post_logout_redirect_uris and allowed_groups; GET + /service-accounts also answers the issuer. vpn-router-user list shows them. +- Changing a user's password, disabling, unlocking or removing the user also revokes the user's + codes, tokens and sessions of the provider. +- Renaming a group renames it in the clients that allow it, and a group a client allows cannot be + removed. +- The package depends on python3-oauthlib and python3-jwt. + +## 0.26.2 - 2026-10-26 10:00:00 +0100 + +fix: a service account may be named by a GUID in lowercase, as the Router Manager proposes for a new +one. + +- vpn-router-user add --service and POST /service-accounts take a GUID in lowercase as the name, + besides a user name; users and groups keep the rules of user names. + +## 0.26.1 - 2026-10-26 08:45:00 +0100 + +fix: the package installs vpnrouter_passkeys, without which the web service and vpn-router-user do +not start. + +- /usr/lib/vpn-router/vpnrouter_passkeys.py is part of the package. + +## 0.26.0 - 2026-11-03 08:00:00 +0100 + +feature: users sign in to the Router Manager with passkeys, and console login needs a TOTP token, so +a user without one is refused the shell, SSH and sudo. + +- Console login is switched on only for a user enrolled for TOTP. A user whose console login is on + without a token is refused POST /shell, the shell's WebSocket, SSH and sudo; an open shell ends + within a minute of the token's removal or of console login being switched off, and removing the + token ends the sessions of the user's own POSIX account. +- POST /auth/passkey and /auth/passkey/complete sign a user in with a passkey of wan.local_fqdn, + giving the tokens of /auth; POST /auth also answers the user's name. +- POST, PUT /account/passkeys and DELETE /account/passkeys/ add, with the current password and + code, and remove the user's passkeys, at most 10, kept in the new attribute vpnRouterPasskey; + DELETE /users//passkeys and vpn-router-user passkeys-remove remove all passkeys of a user. +- Users have passkeys, [{"id", "label", "created"}], in /users and /account; vpn-router-user list + shows their number and a console login refused for want of a TOTP token. +- The package depends on python3-fido2. + +## 0.25.4 - 2026-11-03 06:00:00 +0100 + +fix: a shell opens without the password and code again while the user's last use of a shell is +within web.shell_auth_timeout minutes. + +- New setting web.shell_auth_timeout, 15 minutes by default, 0 to 1440: POST /shell without a + password gives a ticket while the user's last sign-in of POST /shell or keystroke in a shell is + within it, and a null ticket otherwise; 0 asks for the password and code every time. + +## 0.25.3 - 2026-11-03 05:00:00 +0100 + +fix: /config gives the state of caddy.service with the installed Caddy, for the Router Manager's Web +page. + +- caddy of /config is {"version", "source", "service"}. + +## 0.25.2 - 2026-11-03 02:30:00 +0100 + +fix: wireguard.address must be the router's own address in its network, not the network or broadcast +address, from which the peers' addresses are told apart. + +- A wireguard.address that is the network or the broadcast address of a network larger than /31, + such as 192.168.232.0/24, is refused with the first address of the network as the example. + +## 0.25.1 - 2026-11-03 01:30:00 +0100 + +fix: /remote-access gives the router's WireGuard public key, endpoint and allowed IPs, which a +peer's configuration needs. + +- GET /remote-access answers wireguard_server: {"public_key", "endpoint", "allowed_ips"}. + +## 0.25.0 - 2026-11-03 00:00:00 +0100 + +feature: a VPN user has WireGuard peers, each a device with its public key and IPs, kept in the +directory and written into wg0.conf by setup. + +- PUT /users/ takes wireguard_peers, [{"public_key", "ips"}], which replaces the user's peers; + keys are unique and IPs may not overlap another peer's or cover the router's WireGuard address. +- GET /users answers each user's wireguard_peers and the WireGuard endpoint's enabled and address. +- Setup writes a [Peer] section into wg0.conf for each peer of a user who is not disabled, in a + marked block, and keeps the peers added by hand; changing a user's peers, disabling, enabling or + removing a user with peers applies at once. + +## 0.24.1 - 2026-11-02 23:30:00 +0100 + +fix: the status gives the number of connected OpenVPN clients at most 5 seconds old instead of up to +a minute. + +- The OpenVPN server writes its status file every 5 seconds, so a refresh of the status shows + clients that connected or left since. + +## 0.24.0 - 2026-11-02 23:00:00 +0100 + +feature: /remote-access of the web service shows and changes the settings of IKEv2 road-warrior, +OpenVPN and WireGuard access and whether each runs, for the Router Manager's Remote access page. + +- GET /remote-access answers the p2s, openvpn and wireguard sections, which of them setup runs, and + wan.local_fqdn; PUT /remote-access/ changes one section and restarts setup. +- p2s.enabled and openvpn.enabled need their address_pool, and wireguard.enabled its address. + +## 0.23.2 - 2026-11-02 22:00:00 +0100 + +fix: the shell of a user's own POSIX account opens on the first setup that sets up console login, +and the journal records each refused shell with the reason. + +- Setup restarts vpn-router-web when it adds ldap to the name service switch, so the web service + finds the POSIX accounts of the directory. +- The journal of vpn-router-web records each refused ticket and shell, with the user, the address + and the reason. + +## 0.23.1 - 2026-11-02 21:00:00 +0100 + +fix: the shell runs as the console account of each member of admins, a local account or the user's +own POSIX account in the directory, which also signs in with SSH and sudo, instead of one +web.shell_user. + +- vpn-router-user console --posix | --account LOCAL | --off, and PUT /users//console + with a token of vpn-router-token, switch a member of admins' console login; leaving admins + switches it off. +- The user's own POSIX account is served by nslcd from the directory, with a uid from 20000, the + group vpn-router-console, which may use sudo, and a home created at the first login; its password + is the directory password, followed by the code once enrolled for TOTP. +- ssh.ldap_login (false) lets sshd accept that password. +- POST /shell and the shell need the user's console login; web.shell_user is gone. +- Depends on nslcd, libnss-ldapd, libpam-ldapd and sudo. + +## 0.23.0 - 2026-11-02 20:00:00 +0100 + +feature: web.shell lets /shell of the web service open a login shell of web.shell_user over a +WebSocket for the Router Manager's Shell page, after the user signs in again. + +- web.shell (false), web.shell_user and web.shell_idle_minutes (15). +- POST /shell takes the password and the TOTP code and answers a one-time ticket; GET /shell with it + is a WebSocket carrying the terminal, closed after web.shell_idle_minutes without a keystroke. +- The journal of vpn-router-web records each shell opened and ended. + +## 0.22.1 - 2026-11-02 18:00:00 +0100 + +fix: the status gives the number of site-to-site connections set up and established, not each +connection by name. + +- site_to_site of the status document is {"connections", "established"}, and the status page shows + "Site to site: N of M established". + +## 0.22.0 - 2026-11-02 14:00:00 +0100 + +feature: pki.extended_key_usages adds custom extended key usages by their OIDs, which templates give +by name, and a template's policies put certificate policy OIDs into its certificates. + +- pki.extended_key_usages maps a name to the OID of a custom extended key usage; a template's + extended_key_usage takes the built-in and the custom names. +- The template option policies lists certificate policy OIDs, written into a Certificate Policies + extension. +- GET /ca answers extended_key_usages, each usage with its OID and whether it is built in. + +## 0.21.5 - 2026-11-02 12:00:00 +0100 + +fix: /status/full of the status web service gives an authenticated client the whole status, whatever +web.status_content says. + +- /status/full takes the token of /config and answers the status document as web.status_content full + shows it. + +## 0.21.4 - 2026-11-02 10:00:00 +0100 + +fix: vpn-router-setup, vpn-router-ca and /ca read a CA's key and CRL from the directory each as +itself, instead of failing on a CA with a CRL. + +- A CA's CRL was read as its key and its key as its CRL, so every operation on a CA with a CRL + failed with "Could not deserialize key data". + +## 0.21.3 - 2026-11-01 10:00:00 +0100 + +fix: the PKI is kept in ou=pki of the router's directory instead of files under /etc/vpn-router/pki, +and the router's site-to-site certificate names only the identities its connections present, and +/ca/bundle gives the certificate bundle of a CA. + +- The CAs with their certificates, keys, CSRs and CRLs, and every certificate issued with its + revocation, are entries of the package's schema in ou=pki; a user's certificate is also the + userCertificate of the user's entry, and only root reads a key. +- slapcat puts the PKI into every backup with the users. +- A root CA supplied as /etc/vpn-router/pki/root/cert.pem and key.pem before the first setup is + imported into the directory, and the files are removed; vpn-router-ca root import-cert is gone. +- Setup provisions the directory before the configuration; without it, the PKI and its files are + left as they are. +- The router's site-to-site certificate names wan.local_fqdn and the public or internal address a + connection with auth certificate uses as its identity, not every address of the router, and is + issued again when those names change. +- GET /ca/bundle/ of the status web service answers the PEM certificates a client trusts a CA + with: the root alone, or an issuing CA followed by the root. + +## 0.21.2 - 2026-10-31 10:00:00 +0100 + +fix: pki.root_key_warning silences the warning of vpn-router-ca status and /ca about the root key on +the router. + +- pki.root_key_warning, true by default, set to false silences the warning that the root key is on + the router. + +## 0.21.1 - 2026-10-30 10:00:00 +0100 + +fix: vpn-router-ca status and /ca warn about a CRL the router signs only once vpn-router-pki.timer +has not renewed it in time. + +- A CRL whose CA key is on the router is reported once past half of its validity, when the timer + should have signed it again; a root CRL signed offline is still reported 30 days before it + expires. + +## 0.21.0 - 2026-10-29 10:00:00 +0100 + +feature: the router has a two-level CA with an optional offline root, issuing CAs for P2S, +site-to-site and general use, templates, published certificates and CRLs and an ACME server, +site-to-site connections authenticate with certificates, and setup installs Caddy from Ubuntu or +Caddy's repository. + +- The root CA signs the issuing CAs p2s, which issues the router's VPN server certificate and the + users' certificates, s2s, which issues the site-to-site certificates, and the general-purpose CAs + of pki.issuing_cas; road-warrior and OpenVPN accept certificates of p2s only. +- The pki section of vpn-router.json sets the names, lifetimes and key type of the CAs, the validity + of the CRLs, where certificates and CRLs are published, the general-purpose CAs and the + certificate templates; p2s.ca_name and the vpn-router/p2s_ca_name question are replaced by + pki.root_name and vpn-router/pki_root_name. +- Without the root key on the router, new issuing CAs wait with a CSR for an offline signature; + vpn-router-ca exports, removes and imports the root key, imports the signed certificates and a + root CRL, issues certificates from a CSR or into a PFX file, lists and revokes them. +- Certificates name their issuer's certificate and CRL at the endpoints of pki.publish: the status + port over HTTP, or Caddy on port 80, on the HTTPS status port or on port 443; the CRLs are signed + again at every revocation and by vpn-router-pki.timer. +- A general-purpose CA with acme backs an ACME server of Caddy. +- The router renews its own certificates before they expire. +- A site-to-site connection with auth certificate authenticates with the router's site-to-site + certificate and trusts the s2s CA or the connection's remote_ca. +- /ca of the status web service shows and changes the PKI; /pki/ serves the published certificates + and CRLs; /config shows the installed Caddy and its source; request bodies may be 64 KiB. +- vpn-router no longer depends on caddy: vpn-router-setup installs it from https.caddy_source, the + Ubuntu archive or Caddy's repository, and vpn-router-caddy use-upstream switches an installed + router to Caddy's repository for good. +- The package depends on python3-cryptography instead of openssl, and simple-ca is gone. + +## 0.20.0 - 2026-10-28 10:00:00 +0100 + +feature: the router makes scheduled backups to a local folder, copied to the cloud with rclone, or +to a Proxmox Backup Server, and vpn-router-backup restores them. + +- The backup section of vpn-router.json switches on backups and sets the schedule (hourly, daily or + weekly), the target (local or pbs), the folder, the retention of local archives, whether the + metrics database is included, the rclone remote and mode, and the Proxmox Backup Server + repository, token secret, fingerprint, namespace and key file. +- A backup holds /etc/vpn-router, /etc/wireguard, the ufw rules, the Router Manager's settings, PSK + files outside /etc/vpn-router, the user directory as slapcat writes it and, optionally, the + database as pg_dump writes it, copied while the configuration and the users are locked. +- Local backups are tar archives compressed with zstd. Archives the retention settings no longer + keep are deleted by the rules of Proxmox Backup Server's prune, and rclone can sync or copy the + archives to a remote of /etc/vpn-router/rclone.conf. +- Backups to a Proxmox Backup Server are made with proxmox-backup-client-static, which the package + suggests; the server keeps them. +- vpn-router-backup runs a backup, lists the backups and restores a local archive or a snapshot; + vpn-router-backup.timer runs it on the schedule. +- /backup of the status web service shows and changes the backup settings, shows the last run, the + local archives and the next run, and starts a backup. +- The package depends on zstd and suggests rclone and proxmox-backup-client-static. + +## 0.19.1-3 - 2026-10-27 10:00:00 +0100 + +update: ADR-24 names Ubuntu's apt-daily timer, not a cron job, as what updates the package lists. + +- ADR-24 says that Ubuntu's apt-daily timer updates the package lists twice a day, and that + apt-daily or unattended-upgrades may hold the dpkg lock the upgrade waits for. + +## 0.19.1-2 - 2026-10-27 09:00:00 +0100 + +update: ADR-24 says that the Router Manager checks for updates on demand. + +- ADR-24 describes Check update of the Router Manager, which updates apt's package lists in the + transient unit vpn-router-manager-check. + +## 0.19.1 - 2026-10-26 21:00:00 +0100 + +fix: /metrics/history gives the availability of each site-to-site connection as the percentage of +time it was up in slots of the view. + +- site_to_site_up of /metrics/history divides the view into slots of 5 minutes for an hour, 1 hour + for a day, 1 day for a month and 1 month for a year, and gives for each slot and connection the + percentage of the samples in which the connection was up. + +## 0.19.0 - 2026-10-26 20:00:00 +0100 + +feature: service accounts have a display name and a description, which the router sets for its +internal ones. + +- vpnRouterAccount of the package's schema also takes displayName and description; vpn-router-setup + updates the schema of an existing directory. +- /service-accounts shows display_name and description, takes them when adding a service account and + changes them with PUT; "" removes one. /users shows them as null. +- vpn-router-user add --service and update take --display-name and --description. +- vpn-router-setup gives the metrics service's internal account the display name Metrics and its + description, and sets them again when they differ. + +## 0.18.3 - 2026-10-26 19:00:00 +0100 + +fix: internal service accounts are the router's own, of which the metrics service's is the one at +present, and the documentation says what a service account is. + +- /service-accounts, /groups and the internal field of the answers take every internal service + account, the accounts the router creates and manages for its own services, instead of only the + metrics service's; the 403 answers say that the router manages them. +- The README, the ADR and the users module describe a service account as the account another system, + such as an OpenTelemetry Collector reading /metrics, signs in with, and the internal ones as + managed by the router. + +## 0.18.2 - 2026-10-26 18:00:00 +0100 + +fix: service accounts are managed at /service-accounts, not /users, and the internal one of the +metrics service is only listed. + +- /service-accounts, for members of admins and admin tokens, lists the service accounts, adds one + with a password and an optional e-mail address, changes the e-mail address, sets the password, + disables, enables, unlocks and removes them. +- /users no longer lists service accounts or takes "service" on POST, and answers 404 to a request + naming one. +- /service-accounts answers 403 to every request but the list on the account metrics.service_account + names while metrics are enabled, and /groups to putting it in or taking it out of a group; + vpn-router-setup and root's vpn-router-user still change it. + +## 0.18.1 - 2026-10-26 17:00:00 +0100 + +fix: vpn-router-setup owns only the creation of the metrics service's account, which is marked +internal, and administrators add service accounts with vpn-router-user add --service and /users. + +- POST /users takes "service": true and adds a service account, which cannot sign in to /auth; + vpn-router-user add takes --service. +- The users of /users and vpn-router-user have internal, true for the account + metrics.service_account names while metrics are enabled; vpn-router-user list shows its kind as + internal. +- PUT /users//password refuses the internal service account, whose password vpn-router-setup + keeps. + +## 0.18.0-2 - 2026-10-26 14:00:00 +0100 + +update: release.py tags a Debian revision other than 1 as x.y.z-n. + +- release.py tags the newest entry x.y.z for the Debian revision 1 and x.y.z-n for a later revision, + so a packaging change gets a release of its own. + +## 0.18.0 - 2026-10-25 23:00:00 +0100 + +feature: site_to_site holds any number of named site-to-site connections, which /site-to-site lists, +adds, changes and removes. + +- site_to_site maps a connection name to addrs, id, cidrs, local_cidrs, local_id_mode, psk and + psk_file; it replaces remote and wan.local_id_mode, and a configuration with them is refused. +- The install answers fill the connection remote-site; the local subnets fill both its local_cidrs + and local.cidrs. +- Every ready connection is written to /etc/swanctl/conf.d/site-to-site.conf as the swanctl + connection and child of its name with the secret ike-psk-; remote-site.conf is no longer + written. +- Traffic from each connection's local_cidrs to its cidrs is not masqueraded. +- /site-to-site, for members of admins and admin tokens, lists the connections without their keys, + adds, changes and removes them, and restarts vpn-router-setup to apply the change. +- vpn-config-edit sets site_to_site.NAME.option, creating the connection, and removes + site_to_site.NAME; it and the web service write vpn-router.json under one lock. +- The status shows site_to_site.connections, whether each connection is established. +- The metrics service keeps, per site-to-site connection, whether it is up, the bytes and packets + per second received and sent, and the seconds its IKE SA has been up, in metrics_site_to_site and + its summaries; /metrics/history has them in site_to_site of each point. +- /metrics serves vpn_router_site_to_site_up, vpn_router_site_to_site_uptime_seconds, + vpn_router_site_to_site_io_bytes_per_second and vpn_router_site_to_site_packets_per_second by + connection, and the OTLP push the vpn_router.site_to_site gauges; vpn_router_clients and + metrics_vpn no longer have the kind site_to_site. +- /config shows each connection in network.site_to_site, and no psk at any level of the + configuration. +- Removing the package terminates every site-to-site connection; purging removes site-to-site.conf. + +## 0.17.0 - 2026-10-25 21:00:00 +0200 + +feature: /config shows the router's PostgreSQL clusters and their settings, and /postgresql their +databases with their sizes. + +- /config has a postgresql section: each cluster of pg_lsclusters with its version, name, port, + status and data directory, and the main settings of each online cluster. +- /postgresql, protected like /config, lists the databases of each online cluster with owner, + encoding and size, and the total size. + +## 0.16.0 - 2026-10-25 19:00:00 +0200 + +feature: the router keeps its metrics in PostgreSQL, serves them for an OpenTelemetry Collector and +pushes them over OTLP. + +- vpn-router-metrics takes a sample every minute: CPU, memory, free space of /, bytes per second on + the external and the internal interface, the load averages, and the VPN clients of each enabled + system. +- The samples are kept in metrics_system, metrics_network and metrics_vpn, and summarized hourly, + daily, monthly and yearly in their _hourly, _daily, _monthly and _yearly tables; once a day the + rows older than metrics.keep_details, keep_hourly, keep_daily, keep_monthly and keep_yearly are + deleted. +- /metrics serves the last sample in the Prometheus format on the interfaces metrics.listen names + (internal by default) at metrics.port, and over HTTPS by Caddy at metrics.https_port, with HTTP + Basic authentication of the service account metrics.service_account names (metrics by default). +- metrics.otlp_endpoint pushes every sample as OTLP/HTTP JSON, with metrics.otlp_username and + metrics.otlp_password. +- /metrics/history of the web service answers the hour, day, month and year views for the Router + Manager. +- vpn-router-setup adds and keeps that service account, which cannot sign in to /auth, with a random + password in /etc/vpn-router/metrics.secret, set anew when the file is missing. +- Depends on python3-psutil and python3-prometheus-client. + +## 0.15.0 - 2026-10-25 18:00:00 +0200 + +feature: vpn-config-edit shows and changes the router's configuration. + +- vpn-config-edit show prints /etc/vpn-router/vpn-router.json as indented JSON. +- vpn-config-edit set SECTION.OPTION VALUE converts the value to the setting's type, checks the + whole configuration as vpn-router-setup does, writes the file indented with mode 0600, and reminds + that vpn-router-setup applies it. + +## 0.14.1 - 2026-10-25 17:00:00 +0200 + +fix: web.status_content is basic by default. + +- Without web.status_content, or with a value that is not allowed, / and /status show only the + overall status, the time and the Client IP; set it to standard or full to show more. + +## 0.14.0 - 2026-10-25 16:00:00 +0200 + +feature: the status page shows the Client IP, and web.status_content sets how much it shows. + +- / and /status show the Client IP, the address the request came from: the last X-Forwarded-For + entry for a request from a trusted proxy, so behind Caddy or the Router Manager the browser's; + /status has it as client_ip. +- web.status_content sets what / and /status show: basic the overall status, the time and the Client + IP; standard also the package versions and the number of active and failed services; full, the + default, everything as before. /status names it in content. + +## 0.13.0 - 2026-10-25 15:00:00 +0200 + +feature: Caddy serves the status page and the Router Manager over HTTPS with a certificate from +Let's Encrypt. + +- The package depends on caddy. While https.enabled is true, the default, and wan.local_fqdn is set, + vpn-router-setup writes /etc/caddy/vpn-router.Caddyfile and runs Caddy, which serves the status + page on https.web_port (7444) and the Router Manager, when it is installed, on https.manager_port + (7443) for wan.local_fqdn, and obtains the certificate from Let's Encrypt with the HTTP challenge. +- The package's drop-in for caddy.service makes Caddy read that file and keeps it from starting + before the file exists. The file belongs to root and the group caddy, which Caddy runs as, with + mode 0640. +- The firewall opens port 80 on the external interface and the HTTPS ports on both interfaces while + HTTPS is on. +- The web service also listens on 127.0.0.1, where Caddy calls it. +- docker.exposed_ports may not take port 80 or the HTTPS ports while HTTPS is on. +- Removing the package stops and disables caddy; purging it removes /etc/caddy/vpn-router.Caddyfile. + +## 0.12.3 - 2026-10-25 13:00:00 +0200 + +fix: the web service listens on the internal address, the external address or both. + +- web.listen in vpn-router.json sets the interfaces the web service listens on: internal, external + or both, the default. It is read every 30 seconds, so a change takes effect without running setup, + at the latest when vpn-router-web restarts. +- The firewall opens the ports of the web service and of the Router Manager on the internal and the + external interface. + +## 0.12.2 - 2026-10-25 12:00:00 +0200 + +fix: the web service manages users also when it started before setup. + +- vpn-router-web creates /run/vpn-router when it starts, so the user operations take their lock + there; started before vpn-router-setup had made the directory, they failed with "Read-only file + system". + +## 0.12.1 - 2026-10-25 11:00:00 +0200 + +fix: the status page shows whether the Router Manager runs. + +- When vpn-router-manager is installed, the services show the state of vpn-router-manager, and + status is degraded while it is not active. + +## 0.12.0 - 2026-10-25 10:00:00 +0200 + +feature: every user manages their own account through /account. + +- /account serves the signed-in user, admin or not: GET shows the user and whether they are a member + of admins; PUT /account/password sets the password and POST and PUT /account/otp enrol or replace + the TOTP enrolment, given the current password and, when enrolled, a current code. A wrong one is + 403 and counts as a failed login. Tokens of vpn-router-token get 403 there. + +## 0.11.0 - 2026-10-25 09:00:00 +0200 + +feature: the status page shows the Router Manager's version. + +- / and /status show the installed version of vpn-router-manager, as manager_version in JSON, or + that it is not installed. +- The services show the state of each PostgreSQL cluster, as postgresql@-, or + postgresql: no cluster without one. + +## 0.10.0 - 2026-10-25 08:00:00 +0200 + +feature: Manager-only accounts, and the Router Manager's first administrator. + +- vpn-router-user add without the person options, and POST /users without them, add a Manager-only + account: a name and a password, no names, no e-mail address and no certificate, so no VPN access. + Giving only some of the three is refused. The answers show the kind as manager_only, list shows a + KIND column, and update refuses a Manager-only account. +- vpn-router-setup creates the administrator the Router Manager's package leaves in + /etc/vpn-router-manager/admin.json as a Manager-only account in the group admins, which it creates + when missing, and removes the file. +- The directory has the package's own schema, with the auxiliary class vpnRouterAccount and the + attribute vpnRouterScope. A Manager-only account can have an e-mail address: add --email, update + --email ('' removes it), and email in POST and PUT /users. + +## 0.9.2 - 2026-10-25 06:00:00 +0200 + +fix: the web service starts once libpq can be found. + +- The web service unit waits, with wait-for-libpq, until libpq is in the linker cache before it + starts the service, for at most 5 minutes; the service imports psycopg at start again. +- The package starts the web service without waiting for it. + +## 0.9.1 - 2026-10-25 05:00:00 +0200 + +fix: the web service waits for the PostgreSQL driver instead of failing at start. + +- The web service imports psycopg as the first step of its initialization, retrying every 15 seconds + and logging the failure while libpq cannot be found yet during an installation. +- vpn-router-user and vpn-router-token load without psycopg; a command that needs the token database + then reports that the driver cannot be loaded, as it reports every failure of that database. + +## 0.9.0 - 2026-10-25 04:00:00 +0200 + +feature: bootstrap diagnostics on port 17081 during the first setup. + +- vpn-router-bootstrap serves, on port 17081, the setup state, the services, the failed units, the + addresses, cloud-init status and the end of the logs of setup and the web service, as plain text. +- vpn-router-setup starts it, and the Router Manager's bootstrap on port 17080, until a run has + succeeded, and opens both ports on the internal interface; the first successful run writes + /var/lib/vpn-router/setup.done, closes the ports and stops them. A failed run leaves them running. +- The web service no longer has a starting phase: it creates its key and database, then listens. + +## 0.8.0 - 2026-10-25 03:00:00 +0200 + +feature: the web service creates its key and database itself and shows its starting phase. + +- vpn-router-web makes its signing key and creates the refresh tokens' database on its first run, + retrying every 15 seconds until PostgreSQL answers; vpn-router-setup no longer creates them. +- Until then / and /status show the web service's phase and its failure, with the state, the step + and the failure of the last run of vpn-router-setup, and every page answers 503. +- vpn-router-setup records its state, current step and failure in /run/vpn-router/setup.json. + +## 0.7.1 - 2026-10-25 02:00:00 +0200 + +fix: a failing user directory or token database no longer leaves the tunnels down. + +- vpn-router-setup brings up strongSwan and WireGuard before it provisions the user directory and + the token database. A failure of either no longer stops the other steps; setup reports it and + fails at the end. + +## 0.7.0 - 2026-10-25 01:00:00 +0200 + +feature: users sign in to the web service, and only members of admins manage the router. + +- POST /auth signs a user in with the password, and the TOTP code for an enrolled user, and answers + a 5 minute access token and an 8 hour refresh token; /auth/refresh renews them and /auth/logout + revokes the refresh token. +- /config, /users and /groups take tokens of users in the group admins, and tokens of the new + vpn-router-token, which has an admin claim and a chosen lifetime. Only these may change the group + admins. +- The tokens are signed with /etc/vpn-router/web.key, which vpn-router-setup makes on the router; + web.jwt_secret is ignored. +- Five failed logins lock an account for 15 minutes, for OpenVPN and /auth. vpn-router-user unlock + and POST /users//unlock end the lockout, and the users show locked. +- /auth takes at most 10 calls a minute per client address; for calls from web.trusted_proxies the + address is read from X-Forwarded-For. +- Users enrolled for TOTP log in to OpenVPN with the password followed by the code. +- Refresh tokens are kept in PostgreSQL, in the database web.database names or in the vpn-router + database vpn-router-setup creates. The package depends on postgresql and python3-psycopg. + +## 0.6.0 - 2026-10-24 23:30:00 +0200 + +feature: users can be enrolled for TOTP one-time passwords. + +- vpn-router-user otp-new makes a TOTP secret and its otpauth URI, otp-enrol stores the secret, read + from standard input, given a code of it, and otp-remove removes it. list and every answer show + whether a user is enrolled, as otp. +- The web service enrols with POST, PUT and DELETE /users//otp. +- The secret is kept in the user's entry with the OATH-LDAP schema of slapd's otp module; only the + user manager account may set it, and no one can read it. Logins do not ask for the codes. +- The package depends on python3-pyotp. + +## 0.5.9 - 2026-10-24 21:00:00 +0200 + +fix: package upgrades no longer ask the configuration questions. + +- The configuration questions are asked only on a fresh installation and by dpkg-reconfigure. + +## 0.5.8 - 2026-10-24 20:00:00 +0200 + +fix: an upgrade keeps the configuration and asks nothing. + +- postinst passes on only the debconf answers that were given. The defaults of questions never + asked, such as platform none, no longer replace settings of vpn-router.json. +- Without an answer that changes it, the configuration ucf is given is vpn-router.json byte for + byte, so an upgrade has no conflict to ask about; settings the file leaves out keep their defaults + when it is read. + +## 0.5.7 - 2026-10-24 19:00:00 +0200 + +feature: users have a first name, a last name and an e-mail address. + +- vpn-router-user add needs --first-name, --last-name and --email, kept as givenName, sn and mail, + with cn set to the first and the last name. vpn-router-user update changes them, and list and + every answer show them as first_name, last_name and email. +- POST /users needs first_name, last_name and email, and PUT /users/ changes them. +- vpn-router-user answers in text: a table of the users, the client profile or a short message, with + failures on standard error. --json gives the JSON answers. -h and --help show the commands and + their options. +- The web service manages users with vpnrouter_users, the module vpn-router-user uses, instead of + running vpn-router-user for each request. +- Groups of users, kept as groupOfNames entries in ou=groups with a description and at least one + member. vpn-router-group lists, adds, renames, describes and removes them and adds and takes out + members, and the web service serves the same under /groups. Removing a user takes it out of its + groups and is refused while it is the last member of one. + +## 0.5.6 - 2026-10-24 18:00:00 +0200 + +update: the status web service listens on port 7081 by default. + +- web.port defaults to 7081. +- vpn-router-setup opens the Router Manager's port, 7080 by default, on the internal interface. + +## 0.5.5 - 2026-10-24 16:00:00 +0200 + +feature: users and their certificates no longer need a P2S system enabled. + +- vpn-router-setup provisions the user directory, the CA and its CRL once a platform is chosen, + whether or not OpenVPN or road-warrior access is enabled. The server certificate is issued once + wan.local_fqdn is set, also for an existing CA that has none. +- /users and vpn-router-user manage users and issue and revoke their certificates without a P2S + system; only the OpenVPN client profile needs OpenVPN. + +## 0.5.4 - 2026-10-24 13:00:00 +0200 + +feature: the firewall lets the Router Manager in on the internal interface. + +- While vpn-router-manager is installed, vpn-router-setup opens its port, port in + /etc/vpn-router-manager/manager.json or 8090, on the internal interface. Purging the package + removes the rule. + +## 0.5.3 - 2026-10-24 12:00:00 +0200 + +fix: the status always shows the state of slapd. + +- /status and the status page show the state of slapd whether or not OpenVPN or road-warrior access + is configured, since the package always runs it. + +## 0.5.2 - 2026-10-24 11:00:00 +0200 + +fix: /config no longer shows secret options. + +- The configuration shown by /config leaves out the secret options (psk, jwt_secret, and options + named like a password, token or key) instead of showing them masked. + +## 0.5.1 - 2026-10-24 10:00:00 +0200 + +fix: the web service works in every state of the router. + +- vpn-router-web works whether /etc/vpn-router/pki and /etc/swanctl/x509crl exist or not; they exist + only while OpenVPN or road-warrior access is configured. The paths the unit may write are used + when they exist and ignored when they do not. +- vpn-router-web starts on its own and keeps running. Every 30 seconds a discovery thread works out + the internal address from vpn-router.json as general.mode directs, with web.port and web.enabled, + and starts, moves or stops the server thread to match. Each request reads the token secret, the + features and the facts it shows. The service is no longer ordered after vpn-router-setup, which no + longer restarts it, and web.json no longer holds the address, the port or the secret. + +## 0.5.0 - 2026-10-23 23:00:00 +0200 + +- OpenVPN P2S access, set in the openvpn section (enabled, address_pool, port, protocol). Clients + need a certificate of the router CA and the password of the user named in it; the password is + checked against a local LDAP directory by openvpn-auth-ldap. +- The users live in the package's own slapd database, dc=vpn-router, dc=local, which + vpn-router-setup provisions while OpenVPN or road-warrior access is configured. slapd listens on + its local socket only. Passwords are stored as ARGON2 hashes, and a disabled user is locked with + the password policy. +- vpn-router-user lists, adds, disables, enables and removes users, sets passwords and gives OpenVPN + client profiles. Adding a user also issues the user's client certificate; removing one revokes it. +- The web service manages users under /users, with the same token as /config, and /status shows the + OpenVPN clients. +- The CA gets a certificate revocation list when it is created, and an existing CA without one gets + one. +- Purging the package removes the firewall rules of the web service, which it left behind before. +- The status page follows the browser's light or dark colour scheme, uses a proportional font and + reloads itself every minute. + +## 0.4.3 - 2026-10-23 22:00:00 +0200 + +- swanctl output with more closing than opening lines is read as not available instead of failing + the request. + +## 0.4.2 - 2026-10-23 21:30:00 +0200 + +- /config gives the IPsec connections and SAs as objects, read from swanctl --pretty, and the routes + as objects from ip -j, instead of lines of text. The site-to-site and road-warrior state of + /status is counted from the same swanctl objects. + +## 0.4.1 - 2026-10-23 20:10:00 +0200 + +- Fix the start of vpn-router-setup hanging on a host that runs Docker. vpn-router-setup restarted + vpn-router-docker and waited for it, but that unit was ordered after vpn-router-setup, so each + waited for the other, the installation of the package never finished and vpn-router-web was never + enabled or started. vpn-router-docker is no longer ordered after vpn-router-setup, so + vpn-router-setup still waits for it and the Docker rules are in place when it ends. The restart of + vpn-router-web is queued without waiting. +- Start vpn-router-setup after docker.service, so that Docker is up when the setup looks for it and + does not start in parallel with it. The ordering applies only when Docker is installed. + +## 0.4.0 - 2026-10-23 19:00:00 +0200 + +- Add the vpn-router-web service, a small status web service that uses only the Python standard + library. It listens on the internal address and on web.port, 8080 by default. / shows the state of + the router for people, as plain text for curl and wget and as a Tailwind CSS page for a browser, + and /status shows the same as JSON: the state of the services, the package version, whether Docker + is installed, and the state of site-to-site, road-warrior and WireGuard, with no configuration + data. +- Add the web configuration section. web.enabled (true by default) and web.port. vpn-router-setup + opens the port on the internal interface in UFW and restarts the service. +- Add /config to the status web service, for a client such as manage-ui. It shows the configuration + with its secrets masked, the interfaces, addresses, identities and routes the router resolved, the + IPsec connections and SAs, the WireGuard peers (no keys) and the Docker rules. It needs a JWT + signed with HS256 by web.jwt_secret, with an exp claim within ten minutes, and is not served while + web.jwt_secret is not set. + +## 0.3.2 - 2026-10-23 18:00:00 +0200 + +- Accept an IPv4 or IPv6 address as remote.id and as wan.local_fqdn. The identities are written to + the strongSwan configuration as given, without an @ added, and strongSwan reads an address as an + IP identity and a name as an FQDN. A value that starts with @ is refused with an error, since + strongSwan 5.0 and later need no @ to avoid resolving a name. Road-warrior access still needs a + name in wan.local_fqdn. +- Depend on strongswan-swanctl and charon-systemd 5.0 or later. + +## 0.3.1 - 2026-10-23 13:44:00 +0200 + +- Ignore virtual interfaces when mode auto looks for the internal interface. The Docker bridge + docker0, which has an address, was counted as a second internal interface, so vpn-router-setup and + vpn-router-docker failed on a host with Docker installed. + +## 0.3.0 - 2026-10-23 12:44:45 +0200 + +- Secure the ports Docker publishes. Rules in a chain of their own, VPN-ROUTER-DOCKER, entered by a + jump at the top of DOCKER-USER, accept IPsec protected traffic, TCP to docker.exposed_ports and + established connections from the external interface and drop the rest of it. Other rules in + DOCKER-USER are left alone. The rules cover IPv4 only. +- Add the docker configuration section. docker.mode is auto (the default, secures Docker when + docker.service is installed), on (requires Docker) or off (removes the rules); + docker.exposed_ports lists the TCP ports and port ranges reachable from the external interface, + none by default. +- Add the vpn-router-docker service, which applies the Docker rules after docker.service starts and + removes them when it stops. vpn-router-setup restarts it while Docker runs, so a changed + configuration takes effect. +- Installing Docker before this package is recommended. When Docker is installed later, restart + vpn-router-setup to apply the rules. + +## 0.2.0 - 2026-10-23 08:00:06 +0200 + +- Change the configuration file to JSON, /etc/vpn-router/vpn-router.json. Lists are arrays, booleans + and the WireGuard listen port are native JSON types, and unknown sections, unknown settings and + wrong value types are rejected. +- Replace remote.psk_b64 with remote.psk, holding the pre-shared key as a plain string. + remote.psk_file still takes precedence. +- Ship /usr/share/doc/vpn-router/vpn-router.json.example in place of vpn-router.conf.example. +- Add platform "none" as the default, so installing the package changes nothing on the machine until + a platform is chosen. +- Add the mode setting (manual, interfaces, auto) controlling how much of the network configuration + is supplied and how much is read from the system. +- Manage the configuration file with ucf, so dpkg-reconfigure reapplies debconf answers without + overwriting local edits. +- Apply NAT and forward rules to every local subnet, not only the first. + +## 0.1.0 - 2026-05-26 00:00:00 +0200 + +- Initial release. diff --git a/Dockerfile b/Dockerfile index ff9d8a3..b26c2bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,15 +18,17 @@ RUN apt-get -o Acquire::Retries=5 update \ dpkg-dev \ debhelper \ lintian \ + python3 \ && rm -rf /var/lib/apt/lists/* WORKDIR /build COPY debian-package/ src/ COPY docs/ src/docs/ COPY --from=web /web/dist src/web/dist/ -# DEB_VERSION, when set, replaces the version of the newest changelog entry in the image only. +# debian/changelog is written from CHANGELOG.md; DEB_VERSION, when set, is the version of its newest entry. +COPY CHANGELOG.md bin/changelog.py ./ ARG DEB_VERSION -RUN if [ -n "$DEB_VERSION" ]; then sed -i "1s/([^)]*)/($DEB_VERSION)/" src/debian/changelog; fi +RUN python3 changelog.py CHANGELOG.md src/debian/control src/debian/changelog ${DEB_VERSION:+--version "$DEB_VERSION"} RUN cd src && dpkg-buildpackage -us -uc -b RUN lintian --no-tag-display-limit /build/*.changes || true diff --git a/README.md b/README.md index 1128b96..1317806 100644 --- a/README.md +++ b/README.md @@ -2543,9 +2543,9 @@ PostgreSQL is not running yet. | `router_url` | The server's status web service | On the server, `http://127.0.0.1:7091`, the web service behind Caddy | | `database` | A PostgreSQL connection string for the sessions | The `linux-manager-ui` database on the server | | `listen` | On the server, the interfaces the firewall opens `port` on: `internal`, `external` or `both` | `both` | -| `bind` | The one address to listen on, with `port`, off the server, as `dev.sh` sets it | none; on the server `127.0.0.1:7090` | +| `bind` | The one address to listen on, with `port`, off the server, as `dev.py` sets it | none; on the server `127.0.0.1:7090` | | `port` | The port of `bind`; on the server, Caddy's plain HTTP port of the manager, which redirects to the HTTPS address while HTTPS is on unless `https.disable_auto_redirect` is `true` | `7080` | -| `terraform_dir` | A Terraform root directory whose outputs give `router_url` when it is not set; `dev.sh` sets it | none | +| `terraform_dir` | A Terraform root directory whose outputs give `router_url` when it is not set; `dev.py` sets it | none | | `iac_tool` | The tool that reads the outputs of `terraform_dir`: `terraform` or `tofu` | `terraform` | From the outputs of ` -chdir= output -json`, read every 30 seconds at @@ -2577,20 +2577,20 @@ echo 'linux-manager linux-manager/admin_password password s3cr3t-pass' | debconf ### Running the application on a workstation -`dev.sh` runs the manager and the Vite development server, which reloads on changes, on the +`dev.py` runs the manager and the Vite development server, which reloads on changes, on the workstation; the application is at http://localhost:5180. Its first argument is the `config.json` of the platform that deployed the server. Its `module_root`, relative to the directory of that file, is the Terraform root module whose outputs give the server's address. The second argument, optional, is the connection string of a PostgreSQL database for the sessions; without it the sessions are kept in the database `PGDATABASE` names, or the one named after the login, and libpq takes the server, port, user, password and SSL mode from the `PG*` -variables of the environment, such as those of the platform's `pg.env.sh`. `dev.sh` writes them +variables of the environment, such as those of the platform's `pg.env.sh`. `dev.py` writes them as `terraform_dir` and `database`, with the platform's `iac_tool` and `bind` `127.0.0.1`, to `dev.json` in the repository root, which is not in Git, and the manager reads that and listens on `127.0.0.1:7080`: ```sh -./dev.sh /path/to/azure-platform/config.json -./dev.sh /path/to/azure-platform/config.json 'host=localhost dbname=manager user=manager password=secret' +./dev.py /path/to/azure-platform/config.json +./dev.py /path/to/azure-platform/config.json 'host=localhost dbname=manager user=manager password=secret' ``` It creates `.venv` with `psycopg[binary]` and `requests` when they are missing, and installs the npm dependencies @@ -2635,7 +2635,7 @@ key pair, everything under `/etc/swanctl`, the folders of the web sites in `/var ## Building ```sh -./build.sh +./build.py ``` The build runs in a container from the repository root: a Node.js stage builds the @@ -2645,9 +2645,34 @@ container runtime is Apple's `container` on macOS and Docker on Linux, or `CONTA when set, for example Docker on a remote engine: ```sh -CONTAINER_RUNTIME=docker DOCKER_CONTEXT=build-host ./build.sh +CONTAINER_RUNTIME=docker DOCKER_CONTEXT=build-host ./build.py ``` -`./publish.sh` uploads the package to the component `main` of the distribution `resolute` -(Ubuntu 26.04, the only supported release) of the configured repository, skipping a -distribution that has the version already; `DISTRIBUTIONS` names others. +The build writes `debian/changelog` from `CHANGELOG.md` with `bin/changelog.py`; the file is +not kept in the repository. + +`./publish.py` uploads the package of the newest `CHANGELOG.md` entry from `out/` to the +component `main` of the distribution `resolute` (Ubuntu 26.04, the only supported release) of the +Gitea Debian repository of `OWNER` at `SERVER_URL`, with the token `PACKAGES_TOKEN` or else the +content of `~/.gitea-packages-token`, skipping a distribution that has the version already; +`DISTRIBUTIONS` names others. + +## Releasing + +`CHANGELOG.md` is the package's history. Its newest entry, a `## x.y.z` heading, a summary +paragraph and `-` items, is the next release; `x.y.z` is the Debian version `x.y.z-1`, and +`x.y.z-n` is a later release of the same code. + +```sh +./release.py +./release.py --push +./release.py --no-tag --push +./release.py -n --push +``` + +`./release.py` writes the current time into the newest entry's heading, `## x.y.z - YYYY-MM-DD +HH:MM:SS +ZZZZ`, and commits everything with the entry's summary as the message; the release stays +on the machine, and the next change needs a new entry. `--push` also tags the version, `x.y.z` or +`x.y.z-n`, and pushes `main` and the tag, which starts the release workflow; a committed entry is +pushed this way later too. `--no-tag` makes an internal release: `--push` then pushes `main` alone. +`-n` prints the heading and the git commands instead of making them. diff --git a/bin/changelog.py b/bin/changelog.py new file mode 100644 index 0000000..1b957e0 --- /dev/null +++ b/bin/changelog.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Read CHANGELOG.md and write debian/changelog from it: changelog.py CHANGELOG CONTROL OUTPUT [--version V]. + +CHANGELOG.md is the history of the package. Its entries, newest first, are "## VERSION" headings, +"## VERSION - YYYY-MM-DD HH:MM:SS +ZZZZ" once released, each followed by a summary paragraph and +"- " items whose continuation lines are indented by two spaces; an older entry may have items only. +VERSION x.y.z is the Debian version x.y.z-1, and x.y.z-n, n from 2, is x.y.z-n. + +The command writes OUTPUT in Debian's format: the package name (Source) and the maintainer +(Maintainer) of the debian/control CONTROL, the summary and the items wrapped at 80 columns, and the +entry's date, the current time for an entry without one. --version replaces the Debian version of +the newest entry, as the dev builds do. A malformed CHANGELOG.md is a message on standard error and +the exit status 1. +""" + +import argparse +import datetime +import email.utils +import pathlib +import re +import sys +import textwrap + +#: The format of the date in a heading. +DATE_FORMAT = '%Y-%m-%d %H:%M:%S %z' + +#: A heading: its version, and its date once the entry is released. +HEADING = re.compile(r'## (\d+\.\d+\.\d+(?:-\d+)?)(?: - (\d{4}-\d\d-\d\d \d\d:\d\d:\d\d [+-]\d{4}))?$') + + +def entries(text): + """The entries of the CHANGELOG.md text, newest first: dicts of version, date (a datetime or None), summary (a + string or None), items (strings) and line, the index of the heading's line; ValueError when it is malformed.""" + found = [] + # Where the entry is: right after its heading, in its summary, after the summary, or in its items. + state = None + for index, line in enumerate(text.splitlines()): + if line.startswith('## '): + match = HEADING.match(line) + if not match: + raise ValueError(f'line {index + 1}: a heading is "## x.y.z" or "## x.y.z - {DATE_FORMAT}": {line}') + date = datetime.datetime.strptime(match.group(2), DATE_FORMAT) if match.group(2) else None + found.append({'version': match.group(1), 'date': date, 'summary': None, 'items': [], 'line': index}) + state = 'heading' + elif state is None: + continue + elif not line.strip(): + state = 'after' if state == 'summary' else state + elif line.startswith('- '): + found[-1]['items'].append(line[2:].strip()) + state = 'items' + elif line.startswith(' ') and state == 'items': + found[-1]['items'][-1] += ' ' + line.strip() + elif state in ('heading', 'summary'): + found[-1]['summary'] = f'{found[-1]["summary"]} {line.strip()}' if state == 'summary' else line.strip() + state = 'summary' + else: + raise ValueError(f'line {index + 1}: neither a summary line, an item nor its continuation: {line}') + return found + + +def debian_version(version): + """The Debian version of a CHANGELOG.md version: x.y.z-1 for x.y.z, x.y.z-n as it is.""" + return version if '-' in version else f'{version}-1' + + +def wrapped(text, first, rest): + """The text wrapped at 80 columns, its first line indented by first and the others by rest.""" + return textwrap.fill(text, width=80, initial_indent=first, subsequent_indent=rest, break_long_words=False, + break_on_hyphens=False) + + +def debian(found, package, maintainer, version=None): + """The debian/changelog of the entries, with the version as the newest entry's Debian version when given.""" + blocks = [] + for index, entry in enumerate(found): + number = version if index == 0 and version else debian_version(entry['version']) + date = entry['date'] or datetime.datetime.now().astimezone() + lines = [f'{package} ({number}) unstable; urgency=medium', ''] + if entry['summary']: + lines += [wrapped(entry['summary'], ' ', ' '), ''] + lines += [wrapped(item, ' * ', ' ') for item in entry['items']] + if entry['items']: + lines.append('') + lines.append(f' -- {maintainer} {email.utils.format_datetime(date)}') + blocks.append('\n'.join(lines) + '\n') + return '\n'.join(blocks) + + +def control_field(text, name): + """The value of the field name of the source paragraph of the debian/control text.""" + match = re.search(rf'^{name}:\s*(.+)$', text.split('\n\n', 1)[0], re.MULTILINE) + if not match: + raise ValueError(f'debian/control has no {name}') + return match.group(1).strip() + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument('changelog', type=pathlib.Path, help='CHANGELOG.md') + parser.add_argument('control', type=pathlib.Path, help='debian/control') + parser.add_argument('output', type=pathlib.Path, help='the debian/changelog to write') + parser.add_argument('--version', help='the Debian version of the newest entry instead of its own') + args = parser.parse_args() + try: + found = entries(args.changelog.read_text(encoding='utf-8')) + control = args.control.read_text(encoding='utf-8') + if not found: + raise ValueError('no entry') + text = debian(found, control_field(control, 'Source'), control_field(control, 'Maintainer'), args.version) + except (OSError, ValueError) as error: + print(f'changelog.py: {args.changelog}: {error}', file=sys.stderr) + return 1 + args.output.write_text(text, encoding='utf-8') + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/bin/lm-dev-build.py b/bin/lm-dev-build.py index f8baa8c..547c62d 100755 --- a/bin/lm-dev-build.py +++ b/bin/lm-dev-build.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 """Build the next numbered dev build and publish it to a test project's repository: lm-dev-build.py. -The serial N in .dev-build.serial of the repository is that of the last dev build; each build that -succeeds writes its own, one higher, and release.py writes 0 when it releases. The build's version -is the newest changelog entry's with ~devN before its Debian revision, 0.41.0-1 becoming -0.41.0~dev7-1, so the release of that entry is newer than all its dev builds. ./build.sh builds it +The serial N, the setting LXD_DEV_BUILD_SERIAL (lm_dev.setting, 0 by default), is that of the last +dev build; each build that succeeds writes its own, one higher, into .lm-dev-config/settings.json, +and release.py writes 0 there when it releases. The build's version is the Debian version of the +newest entry of CHANGELOG.md (bin/changelog.py) with ~devN before its revision, 0.41.0 (0.41.0-1) +becoming 0.41.0~dev7-1, so the release of that entry is newer than all its dev builds. ./build.py builds it with CONTAINER_RUNTIME and DOCKER_CONTEXT from the environment; the build is moved to out/dev/, copied into the repository container of the project --project (LXD_PROJECT, lm-dev by default) made by lm-dev-lxd-project.py, and published there. The remote is the project's, read from @@ -13,20 +14,19 @@ made by lm-dev-lxd-project.py, and published there. The remote is the project's, import argparse import json -import os -import re import subprocess import sys -from lm_dev import PROJECT, ROOT, config_path, lxc_exec +import changelog +from lm_dev import PROJECT, ROOT, config_path, lxc_exec, save_setting, setting -SERIAL = ROOT / '.dev-build.serial' -CHANGELOG = ROOT / 'debian-package' / 'debian' / 'changelog' +CHANGELOG = ROOT / 'CHANGELOG.md' +CONTROL = ROOT / 'debian-package' / 'debian' / 'control' def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) - parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT), + parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT), help=f'the test project made by lm-dev-lxd-project.py, whose remote is used (LXD_PROJECT, ' f'default {PROJECT})') args = parser.parse_args() @@ -35,19 +35,21 @@ def main(): sys.exit(f'no {state_file}; create the project with lm-dev-lxd-project.py create') state = json.loads(state_file.read_text(encoding='utf-8')) - # The newest entry's first line is "package (version) distribution; urgency=...". - match = re.match(r'(\S+) \(([^)]+)\)', CHANGELOG.read_text(encoding='utf-8')) - if not match: - sys.exit(f'no version in the first line of {CHANGELOG}') - package, version = match.groups() - number = int(SERIAL.read_text(encoding='utf-8').strip()) + 1 if SERIAL.is_file() else 1 - upstream, dash, revision = version.rpartition('-') - dev = f'{upstream}~dev{number}-{revision}' if dash else f'{version}~dev{number}' + try: + found = changelog.entries(CHANGELOG.read_text(encoding='utf-8')) + package = changelog.control_field(CONTROL.read_text(encoding='utf-8'), 'Source') + except ValueError as error: + sys.exit(f'{CHANGELOG}: {error}') + if not found: + sys.exit(f'{CHANGELOG} has no entry') + number = int(setting('LXD_DEV_BUILD_SERIAL', 0)) + 1 + upstream, _, revision = changelog.debian_version(found[0]['version']).rpartition('-') + dev = f'{upstream}~dev{number}-{revision}' print(f'building {package} {dev}') - if subprocess.run(['./build.sh', '--build-arg', f'DEB_VERSION={dev}'], cwd=ROOT).returncode != 0: + if subprocess.run(['./build.py', '--build-arg', f'DEB_VERSION={dev}'], cwd=ROOT).returncode != 0: sys.exit(f'the build of {dev} failed; the serial stays {number - 1}') - SERIAL.write_text(f'{number}\n', encoding='utf-8') + save_setting('LXD_DEV_BUILD_SERIAL', number) # The dev build leaves out/ to out/dev/, so out/ keeps the release builds. target = ROOT / 'out' / 'dev' diff --git a/bin/lm-dev-lxd-project.py b/bin/lm-dev-lxd-project.py index 0d6209a..6444bf4 100755 --- a/bin/lm-dev-lxd-project.py +++ b/bin/lm-dev-lxd-project.py @@ -21,17 +21,20 @@ project and those files. import argparse import json -import os import re import subprocess import sys import time -from lm_dev import PROJECT, TESTS, VAULT_PORT, VaultError, config_path, enrol_instance, lxc_exec, vault_initialise, \ - vault_state, vault_unseal +from lm_dev import PROJECT, TESTS, VAULT_PORT, MissingSetting, VaultError, config_path, enrol_instance, lxc_exec, \ + setting, vault_initialise, vault_state, vault_unseal NETWORKS = ('wan', 'lana', 'lanb') +# The settings of the options of uplink setup, which have no defaults. +UPLINK_SETTINGS = {'parent': 'LXD_UPLINK_PARENT', 'gateway': 'LXD_UPLINK_GATEWAY', 'dns': 'LXD_UPLINK_DNS', + 'ovn_ranges': 'LXD_UPLINK_OVN_RANGES', 'routes': 'LXD_UPLINK_ROUTES'} + def lxc(*args, project, check=True, input=None): """Run lxc with the arguments in the project; raise CalledProcessError when it fails, unless check is false.""" @@ -217,10 +220,11 @@ def uplink(args): if exists: print(f'{args.remote} has the network {args.uplink} already') return - missing = [option for option, value in (('--parent', args.parent), ('--gateway', args.gateway), ('--dns', args.dns), - ('--ovn-ranges', args.ovn_ranges), ('--routes', args.routes)) if not value] - if missing: - sys.exit(f'uplink setup needs {", ".join(missing)}') + for option, name in UPLINK_SETTINGS.items(): + try: + setattr(args, option, getattr(args, option) or setting(name)) + except MissingSetting as missing: + sys.exit(f'uplink setup: --{option.replace("_", "-")} or {missing}') lxc('network', 'create', network, '--type=physical', f'parent={args.parent}', f'ipv4.gateway={args.gateway}', f'dns.nameservers={args.dns}', f'ipv4.ovn.ranges={args.ovn_ranges}', f'ipv4.routes={args.routes}', project='default') @@ -233,31 +237,33 @@ def main(): parser.add_argument('action', choices=('create', 'remove', 'vault', 'uplink')) parser.add_argument('operation', nargs='?', choices=('setup', 'create', 'unseal', 'remove'), help='after vault: create, unseal or remove; after uplink: setup or remove') - parser.add_argument('--remote', default=os.environ.get('LXD_REMOTE'), help='the lxc remote (LXD_REMOTE)') - parser.add_argument('--pool', default=os.environ.get('LXD_POOL'), + parser.add_argument('--remote', help='the lxc remote (LXD_REMOTE)') + parser.add_argument('--pool', help='the storage pool of the project, for create (LXD_POOL)') - parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT), + parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT), help=f'the project (LXD_PROJECT, default {PROJECT})') - parser.add_argument('--image', default=os.environ.get('LXD_IMAGE', 'ubuntu:26.04'), + parser.add_argument('--image', default=setting('LXD_IMAGE', 'ubuntu:26.04'), help='the image of the repository container (LXD_IMAGE, default ubuntu:26.04)') - parser.add_argument('--vault-address', default=os.environ.get('LXD_VAULT_ADDRESS'), + parser.add_argument('--vault-address', default=setting('LXD_VAULT_ADDRESS', None), help="the listen address of the Vault's forward, one of the uplink's routes " '(LXD_VAULT_ADDRESS); without it one is allocated') - parser.add_argument('--uplink', default=os.environ.get('LXD_UPLINK', 'uplink'), + parser.add_argument('--uplink', default=setting('LXD_UPLINK', 'uplink'), help='the physical uplink network of the OVN networks (LXD_UPLINK, default uplink)') - parser.add_argument('--parent', default=os.environ.get('LXD_UPLINK_PARENT'), + parser.add_argument('--parent', help='uplink setup: the host bridge on the LAN (LXD_UPLINK_PARENT)') - parser.add_argument('--gateway', default=os.environ.get('LXD_UPLINK_GATEWAY'), + parser.add_argument('--gateway', help='uplink setup: the LAN gateway as address/prefix (LXD_UPLINK_GATEWAY)') - parser.add_argument('--dns', default=os.environ.get('LXD_UPLINK_DNS'), + parser.add_argument('--dns', help='uplink setup: the LAN name servers, comma-separated (LXD_UPLINK_DNS)') - parser.add_argument('--ovn-ranges', default=os.environ.get('LXD_UPLINK_OVN_RANGES'), + parser.add_argument('--ovn-ranges', help='uplink setup: LAN addresses for OVN routers, FIRST-LAST (LXD_UPLINK_OVN_RANGES)') - parser.add_argument('--routes', default=os.environ.get('LXD_UPLINK_ROUTES'), + parser.add_argument('--routes', help='uplink setup: LAN subnets for network forwards, CIDR (LXD_UPLINK_ROUTES)') args = parser.parse_args() - if not args.remote: - parser.error('--remote or LXD_REMOTE is required') + try: + args.remote = args.remote or setting('LXD_REMOTE') + except MissingSetting as missing: + parser.error(f'--remote or {missing}') operations = {'uplink': ('setup', 'remove'), 'vault': ('create', 'unseal', 'remove')} if args.operation not in operations.get(args.action, (None,)): parser.error('setup or remove follows uplink, create, unseal or remove follows vault, and nothing else') @@ -292,8 +298,10 @@ def main(): if args.action == 'remove': sys.exit(0 if remove(args, state, key) else 1) - if not args.pool: - parser.error('--pool or LXD_POOL is required') + try: + args.pool = args.pool or setting('LXD_POOL') + except MissingSetting as missing: + parser.error(f'--pool or {missing}') if subprocess.run(['lxc', 'project', 'show', f'{args.remote}:{args.project}'], capture_output=True).returncode == 0: sys.exit(f'project {args.project} exists on {args.remote}; remove it first or choose another --project') state.parent.mkdir(parents=True, exist_ok=True) diff --git a/bin/lm-dev-otp-code.py b/bin/lm-dev-otp-code.py index 22b6272..c0e77d4 100755 --- a/bin/lm-dev-otp-code.py +++ b/bin/lm-dev-otp-code.py @@ -7,15 +7,14 @@ lm-dev-otp-register.py or lm-dev-vm.py create enrolled. """ import argparse -import os import sys -from lm_dev import PROJECT, VaultError, otp_code +from lm_dev import PROJECT, VaultError, otp_code, setting def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) - parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT), + parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT), help=f'the project of the VM (LXD_PROJECT, default {PROJECT})') parser.add_argument('--vm', default='lm-dev', help='the name of the VM (default lm-dev)') parser.add_argument('--user', default='admin', help='the user (default admin)') diff --git a/bin/lm-dev-otp-register.py b/bin/lm-dev-otp-register.py index 7c390e8..f0a7615 100755 --- a/bin/lm-dev-otp-register.py +++ b/bin/lm-dev-otp-register.py @@ -9,22 +9,23 @@ VM; lm-dev-otp-code.py prints the user's codes. """ import argparse -import os import sys -from lm_dev import PROJECT, enrol_otp, totp_key +from lm_dev import PROJECT, MissingSetting, enrol_otp, setting, totp_key def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) - parser.add_argument('--remote', default=os.environ.get('LXD_REMOTE'), help='the lxc remote (LXD_REMOTE)') - parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT), + parser.add_argument('--remote', help='the lxc remote (LXD_REMOTE)') + parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT), help=f'the project of the VM (LXD_PROJECT, default {PROJECT})') parser.add_argument('--vm', default='lm-dev', help='the name of the VM (default lm-dev)') parser.add_argument('--user', default='admin', help='the user to enrol (default admin)') args = parser.parse_args() - if not args.remote: - parser.error('--remote or LXD_REMOTE is required') + try: + args.remote = args.remote or setting('LXD_REMOTE') + except MissingSetting as missing: + parser.error(f'--remote or {missing}') problem = enrol_otp(args.remote, args.project, args.vm, args.user) if problem: sys.exit(problem) diff --git a/bin/lm-dev-run.py b/bin/lm-dev-run.py index 29d9f6c..00f8311 100755 --- a/bin/lm-dev-run.py +++ b/bin/lm-dev-run.py @@ -16,7 +16,6 @@ import argparse import importlib import ipaddress import json -import os import pathlib import re import secrets @@ -24,8 +23,8 @@ import subprocess import sys import time -from lm_dev import HANDOVER_DIR, ROOT, TESTS, VAULT_PORT, VaultError, config_path, enrol_instance, hand_over, \ - host_address, lxc_exec, newest_deb, store_secret, vault_initialise +from lm_dev import HANDOVER_DIR, ROOT, TESTS, VAULT_PORT, MissingSetting, VaultError, config_path, enrol_instance, hand_over, \ + host_address, lxc_exec, newest_deb, setting, store_secret, vault_initialise TMP = ROOT / 'tmp' / 'remote-test' @@ -388,20 +387,21 @@ class Lab: def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser.add_argument('scenarios', nargs='+', metavar='scenario', help=f'{", ".join(SCENARIOS)} or all') - parser.add_argument('--remote', default=os.environ.get('LXD_REMOTE'), help='the lxc remote (LXD_REMOTE)') - parser.add_argument('--pool', default=os.environ.get('LXD_POOL'), + parser.add_argument('--remote', help='the lxc remote (LXD_REMOTE)') + parser.add_argument('--pool', help='the storage pool of the project (LXD_POOL)') - parser.add_argument('--project', default=os.environ.get('LXD_TEST_PROJECT', 'lm-test'), + parser.add_argument('--project', default=setting('LXD_TEST_PROJECT', 'lm-test'), help='the project the instances live in (LXD_TEST_PROJECT, default lm-test)') - parser.add_argument('--image', default=os.environ.get('LXD_IMAGE', 'ubuntu:26.04'), + parser.add_argument('--image', default=setting('LXD_IMAGE', 'ubuntu:26.04'), help='the image of every instance (LXD_IMAGE, default ubuntu:26.04)') parser.add_argument('--keep', action='store_true', help='leave the project and the networks in place') parser.add_argument('--deb', help='the package to test (default the one built last, in out/ or out/dev/)') args = parser.parse_args() - if not args.remote: - parser.error('--remote or LXD_REMOTE is required') - if not args.pool: - parser.error('--pool or LXD_POOL is required') + try: + args.remote = args.remote or setting('LXD_REMOTE') + args.pool = args.pool or setting('LXD_POOL') + except MissingSetting as missing: + parser.error(f'--{missing.name.removeprefix("LXD_").lower()} or {missing}') scenarios = SCENARIOS if args.scenarios == ['all'] else args.scenarios unknown = [name for name in scenarios if name not in SCENARIOS] if unknown: @@ -409,7 +409,7 @@ def main(): deb = pathlib.Path(args.deb) if args.deb else newest_deb() if deb is None or not deb.is_file(): - sys.exit(f'no package {args.deb}' if args.deb else 'no out/linux-manager_*_all.deb; run ./build.sh first') + sys.exit(f'no package {args.deb}' if args.deb else 'no out/linux-manager_*_all.deb; run ./build.py first') if subprocess.run(['lxc', 'project', 'show', f'{args.remote}:{args.project}'], capture_output=True).returncode == 0: sys.exit(f'project {args.project} exists on {args.remote}; remove it or choose another with --project') diff --git a/bin/lm-dev-vm.py b/bin/lm-dev-vm.py index 9c057e5..c5f22c3 100755 --- a/bin/lm-dev-vm.py +++ b/bin/lm-dev-vm.py @@ -6,7 +6,7 @@ create launches the VM --vm (lm-dev by default) on the remote --remote (LXD_REMO made by lm-dev-lxd-project.py, which .lm-dev-config/lxd-project-PROJECT.json describes, the VM gets the package from that project's repository, as its apt source, so later dev builds reach it as updates; elsewhere it gets --deb, or else the package built last, in out/ or out/dev/. The administrator is admin with a -generated password, set as ADMIN_USERNAME and ADMIN_PASSWORD in the repository's .env, and a TOTP +generated password, kept as username and password in .lm-dev-config/vm-PROJECT-VM.json, and a TOTP token, the key VM-admin of the project's Vault's TOTP engine, unless --no-otp is given; lm-dev-otp-code.py prints its codes. The VM gets a configuration from tests/remote/configs/ (--config, core.json by default), whose @ETH0@ is the interface of its default route, @CIDR0@ its @@ -21,14 +21,14 @@ the same ports of the VM, and port 2222 to its SSH port. In a test project the l network forward's on the project's WAN, --forward-address (LXD_FORWARD_ADDRESS) or else one allocated from its uplink's routes; elsewhere NAT proxy devices listen on the host address --listen (LXD_LISTEN, by default the IPv4 address of the host of -the remote's URL). remove deletes the VM, its forward and what the Vault keeps for it; .env is left -as it is. +the remote's URL). remove deletes the VM, its forward, its .lm-dev-config/vm-PROJECT-VM.json and what +the Vault keeps for it. The defaults of the options come from the environment, else from +.lm-dev-config/settings.json (lm_dev.setting). """ import argparse import ipaddress import json -import os import pathlib import re import secrets @@ -36,8 +36,9 @@ import subprocess import sys import time -from lm_dev import HANDOVER_DIR, PROJECT, ROOT, TESTS, VAULT_MOUNT, VaultError, config_path, enrol_instance, enrol_otp, \ - forget_instance, hand_over, host_address, lxc_exec, newest_deb, set_dotenv, store_secret, vault_state +from lm_dev import HANDOVER_DIR, PROJECT, ROOT, TESTS, VAULT_MOUNT, MissingSetting, VaultError, config_path, \ + credentials_path, enrol_instance, enrol_otp, forget_instance, hand_over, host_address, lxc_exec, newest_deb, \ + setting, store_secret, vault_state, write_private # The listen port and the VM port of each forward or proxy: the Manager, the status web service and SSH. PORTS = ((7080, 7080), (7081, 7081), (2222, 22)) @@ -46,26 +47,28 @@ PORTS = ((7080, 7080), (7081, 7081), (2222, 22)) def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser.add_argument('action', choices=('create', 'remove')) - parser.add_argument('--remote', default=os.environ.get('LXD_REMOTE'), help='the lxc remote (LXD_REMOTE)') - parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT), + parser.add_argument('--remote', help='the lxc remote (LXD_REMOTE)') + parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT), help=f'the project of the VM (LXD_PROJECT, default {PROJECT})') parser.add_argument('--vm', default='lm-dev', help='the name of the VM (default lm-dev)') - parser.add_argument('--image', default=os.environ.get('LXD_IMAGE', 'ubuntu:26.04'), + parser.add_argument('--image', default=setting('LXD_IMAGE', 'ubuntu:26.04'), help='the image of the VM (LXD_IMAGE, default ubuntu:26.04)') parser.add_argument('--config', default='core.json', help='the configuration from tests/remote/configs/ (default core.json)') - parser.add_argument('--listen', default=os.environ.get('LXD_LISTEN'), + parser.add_argument('--listen', default=setting('LXD_LISTEN', None), help="outside a test project, the LXD host address the proxies listen on (LXD_LISTEN, " "default the IPv4 address of the remote URL's host)") - parser.add_argument('--forward-address', default=os.environ.get('LXD_FORWARD_ADDRESS'), + parser.add_argument('--forward-address', default=setting('LXD_FORWARD_ADDRESS', None), help="with create in a test project, the forward's listen address, one of the uplink's routes " "(LXD_FORWARD_ADDRESS); without it one is allocated") parser.add_argument('--no-otp', action='store_true', help='with create, enrol no TOTP token for admin') parser.add_argument('--deb', help='outside a test project, the package to install (default the one built last, ' 'in out/ or out/dev/)') args = parser.parse_args() - if not args.remote: - parser.error('--remote or LXD_REMOTE is required') + try: + args.remote = args.remote or setting('LXD_REMOTE') + except MissingSetting as missing: + parser.error(f'--remote or {missing}') project_file = config_path(f'lxd-project-{args.project}.json') project = json.loads(project_file.read_text(encoding='utf-8')) if project_file.is_file() else None if project and project['remote'] != args.remote: @@ -74,8 +77,10 @@ def main(): # The default listen address is the IPv4 address of the remote's host in its lxc URL. args.listen = host_address(args.remote) if not args.listen: - parser.error(f'no IPv4 address of the host of remote {args.remote}; give --listen or LXD_LISTEN') + parser.error(f'no IPv4 address of the host of remote {args.remote}; give --listen or LXD_LISTEN, in the ' + 'environment or .lm-dev-config/settings.json') where = f'{args.remote}:{args.vm} (project {args.project})' + credentials = credentials_path(args.project, args.vm) exists = subprocess.run(['lxc', 'info', f'{args.remote}:{args.vm}', '--project', args.project], capture_output=True).returncode == 0 @@ -106,6 +111,7 @@ def main(): forget_instance(vault, args.vm) except VaultError as error: print(f'the Vault keeps what it had for {args.vm}: {error}', file=sys.stderr) + credentials.unlink(missing_ok=True) print(f'removed {where}') return @@ -116,7 +122,7 @@ def main(): parser.error(f'no tests/remote/configs/{args.config}') deb = pathlib.Path(args.deb) if args.deb else newest_deb() if not project and (deb is None or not deb.is_file()): - sys.exit(f'no package {args.deb}' if args.deb else 'no out/linux-manager_*_all.deb; run ./build.sh first') + sys.exit(f'no package {args.deb}' if args.deb else 'no out/linux-manager_*_all.deb; run ./build.py first') source = f'the repository {project["repository"]}' if project else str(deb) vault = vault_state(args.project) if vault is None: @@ -124,7 +130,7 @@ def main(): 'lm-dev-lxd-project.py vault create') password, psk = secrets.token_hex(16), secrets.token_hex(24) - set_dotenv({'ADMIN_USERNAME': 'admin', 'ADMIN_PASSWORD': password}) + write_private(credentials, json.dumps({'username': 'admin', 'password': password}, indent=2) + '\n') reached = f'a forward on {project["networks"][0]}' if project else f'proxies on {args.listen}' print(f'launching {where} from {args.image} with {source}; reached through {reached}') @@ -234,10 +240,10 @@ def main(): sys.exit(f'{args.vm} is up, but {problem}') print(f'{args.vm} is up at {interface.ip} with {args.config}') - print(f'administrator: admin, password in {ROOT / ".env"} (ADMIN_PASSWORD) and the Vault ({VAULT_MOUNT}/' - f'{args.vm}/admin)') + print(f'administrator: admin, password in {credentials} and the Vault ({VAULT_MOUNT}/{args.vm}/admin)') if not args.no_otp: - print(f'administrator TOTP codes: bin/lm-dev-otp-code.py --project {args.project} --vm {args.vm}') + print(f'administrator TOTP: otp_url in {credentials}; codes: bin/lm-dev-otp-code.py --project {args.project} ' + f'--vm {args.vm}') print(f'manager: http://{args.listen}:7080/ status: http://{args.listen}:7081/ ssh: {args.listen} port 2222') print(f'shell: lxc exec {args.remote}:{args.vm} --project {args.project} -- su -l') print(f'remove: {sys.argv[0]} remove --remote {args.remote} --project {args.project} --vm {args.vm}') diff --git a/bin/lm_dev.py b/bin/lm_dev.py index b9fedf7..7dcbf99 100644 --- a/bin/lm_dev.py +++ b/bin/lm_dev.py @@ -1,5 +1,5 @@ -"""What the lm-dev scripts share: the repository's paths, lxc in an instance, the .env of the repository, the -persistent state in .lm-dev-config, the Vault of a test project, the AppRole of each instance in it, the hand-over of +"""What the lm-dev scripts share: the repository's paths, lxc in an instance, the persistent state and settings in +.lm-dev-config, the Vault of a test project, the AppRole of each instance in it, the hand-over of secrets to an instance through it, and the TOTP tokens of the users of a VM, kept in the Vault's TOTP engine. A secret never reaches an instance as a command-line argument or on standard input. Each instance has an AppRole of @@ -25,8 +25,10 @@ ROOT = pathlib.Path(__file__).resolve().parent.parent TESTS = ROOT / 'tests' / 'remote' # The project of the manual tests, which lm-dev-lxd-project.py makes. PROJECT = 'lm-dev' -# The state of the scripts that outlives a clean-up of tmp/: project and Vault states, keys and secrets; 0700. +# The state of the scripts that outlives a clean-up of tmp/: settings, project and Vault states, keys and secrets; 0700. CONFIG = ROOT / '.lm-dev-config' +# The settings of the scripts, the defaults of their options: a JSON object of LXD_* names and their values. +SETTINGS = CONFIG / 'settings.json' # The Vault: its port, the KV v2 and TOTP mounts, the lifetimes of a wrapping token and of an instance's token. VAULT_PORT = 8200 @@ -66,15 +68,42 @@ def lxc_push(remote, project, instance, source, path, mode): '--project', project], capture_output=True, text=True).returncode == 0 -def set_dotenv(values): - """Set the variables in the repository's .env, readable by its owner only, keeping its other lines.""" - dotenv = ROOT / '.env' - lines = dotenv.read_text(encoding='utf-8').splitlines() if dotenv.is_file() else [] - kept = [line for line in lines if line.split('=', 1)[0] not in values] - dotenv.touch(mode=0o600) - dotenv.chmod(0o600) - dotenv.write_text(''.join(f'{line}\n' for line in kept + [f'{key}={value}' for key, value in values.items()]), - encoding='utf-8') +class MissingSetting(Exception): + """A setting without a default that neither the environment nor SETTINGS has; name is the setting.""" + + def __init__(self, name): + super().__init__(f'{name}, in the environment or {SETTINGS.relative_to(ROOT)}, is required') + self.name = name + + +# The default of a setting that has none. +REQUIRED = object() + + +def setting(name, default=REQUIRED): + """The value of the setting name, such as LXD_REMOTE: the environment's, else that of SETTINGS, else default; + MissingSetting without a default.""" + if name in os.environ: + return os.environ[name] + try: + values = json.loads(SETTINGS.read_text(encoding='utf-8')) + except FileNotFoundError: + values = {} + except ValueError as error: + raise SystemExit(f'{SETTINGS} is not JSON: {error}') + if name in values: + return values[name] + if default is REQUIRED: + raise MissingSetting(name) + return default + + +def save_setting(name, value): + """Set the setting name to the value in SETTINGS, keeping its other settings.""" + path = config_path(SETTINGS.name) + values = json.loads(path.read_text(encoding='utf-8')) if path.is_file() else {} + values[name] = value + write_private(path, json.dumps(values, indent=2) + '\n') def newest_deb(): @@ -250,6 +279,11 @@ def hand_over(remote, project, instance, state, name, content, destination, mode return None +def credentials_path(project, instance): + """The file of the administrator of the VM lm-dev-vm.py made, JSON of username, password and otp_url; 0600.""" + return config_path(f'vm-{project}-{instance}.json') + + def totp_key(instance, user): """The name of the TOTP key of the user of the instance in the Vault's TOTP engine.""" return f'{instance}-{user}' @@ -258,8 +292,9 @@ def totp_key(instance, user): def enrol_otp(remote, project, instance, user): """Enrol a new TOTP token for the user of the VM, replacing one the user had; the problem, or None. - The VM has the Vault generate the key with its AppRole and enrols its secret with its current code; the secret is - held by the Vault and the VM only, and the codes are read from the Vault (otp_code). + The VM has the Vault generate the key with its AppRole and enrols its secret with its current code; the codes are + read from the Vault (otp_code). When the user is the administrator of the VM's credentials_path, the key's otpauth + URI, read from the VM's file before it is removed, is kept there as otp_url, to add the token to an authenticator. """ state = vault_state(project) if state is None: @@ -270,11 +305,19 @@ def enrol_otp(remote, project, instance, user): except VaultError as error: return f'the TOTP key {key} cannot be replaced: {error}' target = f'{HANDOVER_DIR}/otp-url' - for command in (('install', '-d', '-m', '0700', HANDOVER_DIR), (HELPER, 'totp', key, instance, user, target, '0600'), - ('python3', '-c', OTP_ENROL, user, target)): + credentials = credentials_path(project, instance) + known = json.loads(credentials.read_text(encoding='utf-8')) if credentials.is_file() else {} + keep = known.get('username') == user + steps = (('install', '-d', '-m', '0700', HANDOVER_DIR), (HELPER, 'totp', key, instance, user, target, '0600'), + *((('cat', target),) if keep else ()), ('python3', '-c', OTP_ENROL, user, target)) + for command in steps: result = lxc_exec(remote, project, instance, *command) if result.returncode != 0: return f'{user} was not enrolled: {(result.stderr.strip().splitlines() or ["lxc exec failed"])[-1]}' + if command[0] == 'cat': + known['otp_url'] = result.stdout.strip() + if keep: + write_private(credentials, json.dumps(known, indent=2) + '\n') return None diff --git a/build.py b/build.py new file mode 100755 index 0000000..c7f2764 --- /dev/null +++ b/build.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Build the package in a container and write it to out/: build.py [CONTAINER BUILD OPTIONS]. + +The Dockerfile builds the Manager's application and the package, whose debian/changelog it writes +from CHANGELOG.md; the build's files are then streamed out of the image as a tar archive into out/, +so no bind mount is needed. The container runtime is CONTAINER_RUNTIME from the environment, for +example docker with DOCKER_CONTEXT naming a remote engine, else Apple's container CLI on macOS and +Docker on Linux. Options are passed to the runtime's build, such as --build-arg DEB_VERSION=V. A +failure is a message on standard error and a non-zero exit status. +""" + +import os +import pathlib +import platform +import subprocess +import sys +import tarfile + +ROOT = pathlib.Path(__file__).resolve().parent +OUT = ROOT / 'out' +IMAGE = 'linux-manager-builder' +#: The container runtime of each platform when CONTAINER_RUNTIME is not set. +RUNTIMES = {'Darwin': 'container', 'Linux': 'docker'} + + +def main(): + runtime = os.environ.get('CONTAINER_RUNTIME') or RUNTIMES.get(platform.system()) + if not runtime: + sys.exit(f'build.py: unsupported platform {platform.system()}; set CONTAINER_RUNTIME') + OUT.mkdir(exist_ok=True) + build = [runtime, 'build', '--build-arg', f'HOST_UID={os.getuid()}', '--build-arg', f'HOST_GID={os.getgid()}', + '-t', IMAGE, *sys.argv[1:], '.'] + if subprocess.run(build, cwd=ROOT).returncode != 0: + sys.exit('build.py: the image build failed') + with subprocess.Popen([runtime, 'run', '--rm', IMAGE, 'tar', '-cf', '-', '-C', '/out', '.'], cwd=ROOT, + stdout=subprocess.PIPE) as stream: + with tarfile.open(fileobj=stream.stdout, mode='r|') as archive: + archive.extractall(OUT, filter='data') + if stream.returncode != 0: + sys.exit('build.py: the build files could not be copied out of the image') + print(f'Build artifacts written to {OUT.relative_to(ROOT)}/') + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/build.sh b/build.sh deleted file mode 100755 index 249153c..0000000 --- a/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -set -e - -# CONTAINER_RUNTIME from the environment, for example docker with DOCKER_CONTEXT naming a remote engine; -# otherwise Apple container CLI on macOS and Docker CE on Linux. -if [ -z "${CONTAINER_RUNTIME:-}" ]; then - case "$(uname -s)" in - Darwin) CONTAINER_RUNTIME=container ;; - Linux) CONTAINER_RUNTIME=docker ;; - *) printf 'ERROR: unsupported platform %s\n' "$(uname -s)" >&2; exit 1 ;; - esac -fi - -mkdir -p out - -$CONTAINER_RUNTIME build --build-arg HOST_UID=$(id -u) --build-arg HOST_GID=$(id -g) -t linux-manager-builder "$@" . -# Artifacts are streamed out as a tar archive, so no bind mount is needed. -$CONTAINER_RUNTIME run --rm linux-manager-builder tar -cf - -C /out . | tar -xf - -C out - -echo "Build artifacts written to out/" diff --git a/debian-package/debian/changelog b/debian-package/debian/changelog deleted file mode 100644 index 6f5f05d..0000000 --- a/debian-package/debian/changelog +++ /dev/null @@ -1,1754 +0,0 @@ -linux-manager (0.42.0-1) unstable; urgency=medium - - feature: the VPN, the router, the name server and WebDAV are components - switched on the System tab and installed on demand, Caddy from the Ubuntu - archive is a dependency and serves every HTTP and HTTPS port, HTTPS is - chosen at install, its certificate is of the Servers Issuing CA or - self-signed by default, of ACME or of another CA, the issuing CAs are in one - tab, a locked account is unlocked again, the name of a CA is fixed once the - CA exists, and a run of setup is no longer cut short by a change. - - * The Manager's System tab has a Components panel: the VPN, the router, - the name server and WebDAV, each switched on and off there, with GET and - PUT /components; the router is offered only with a second network - interface, and its Enable asks for the internal interface and, in manual - mode, its address and gateway. The DNS and sites settings dialogs no - longer switch the name server and WebDAV. - * The Overview's Addresses panel lists each address of the status page - once, and the Manager's plain HTTP addresses while Caddy does not - redirect it; /api/info gives the port and listen of the Manager's site. - * Every page and tab with more than one panel has Edit layout and Panels, - its layout kept in the browser. - * The name server has a DNS page of its own, in the page menu while it is - on, instead of a tab of Web Sites; its secondary name server is optional, - and without it the server is the domains' only name server, with no - warning at each setup run. - * The VPN's and the router's packages are suggested, not depended on, and - linux-manager-install@vpn and @router install them from the Ubuntu - archive while the component is on; setup also has packages of a - component that is on, marked as installed automatically, marked as - installed by hand, so apt autoremove keeps them. - * A change made in the Manager, with the package's commands or by the - installation of a component no longer restarts a run of - linux-manager-setup in progress, which could leave the firewall, the VPN - or the routes half applied; the run runs once more when it ends instead. - linux-manager-config-edit apply runs setup and waits for it, and --restart - of set and remove does the same. - * The package depends on caddy from the Ubuntu archive, which serves - web.port, the Manager's port and metrics.port over plain HTTP as well as - the HTTPS ports; the web service, the Manager and the metrics service - listen on 127.0.0.1 only, on ports 7091, 7090 and 9474, and the firewall - opens each plain HTTP port on the interfaces its listen setting names. - * The Manager's sign-in page and /api/info without a session no longer - show the package's version, and Caddy removes the Server header of - every answer, which named Caddy and the services' Python version. - * https.caddy_source, the upstream Caddy repository and - linux-manager-caddy are removed; a configuration that names - https.caddy_source is refused. - * The installer asks whether to serve over HTTPS, https.enabled, and with - HTTPS whether to keep the Manager on plain HTTP, - https.disable_auto_redirect; while HTTPS is on, Caddy redirects the - Manager's plain HTTP port to its HTTPS address, and the status page never - redirects. - * https.certificate is self-signed when the configuration does not set it, - and acme only when set; a new installation's first setup chooses ca when - the root CA and the Servers Issuing CA are available, else self-signed, - and writes it into the configuration file. A server whose configuration - did not set it moves from acme to self-signed. - * https.certificate, self-signed, ca, acme or external, says - where the certificate of wan.local_fqdn comes from; while the chosen one - is not available, the server serves a self-signed one and warns. - * With external, linux-manager-ca https csr, import and import-pfx, POST - /https/csr, PUT /https/certificate and PUT /https/pfx, and Generate CSR, - Import certificate and Import PFX of the Certificates page's Server tab - make a CSR and take the certificate another CA signed, or a PFX file. - * https.acme_provider, letsencrypt, zerossl or custom with acme_url and - optional EAB, is the ACME CA of the server and of the sites with TLS - acme; https.zerossl_api_key is optional. - * PUT /https/settings changes the source and the ACME settings; the - Certificates page's first tab, Server, shows HTTPS, the certificate, the - ACME CA and Caddy, which the Overview no longer shows; its HTTPS row's - button changes the source and its ACME CA row's button the ACME CA, - which the web sites with TLS ACME also use; port 80 is opened for the - challenge only with acme. - * The built-in Servers Issuing CA servers, named pki.servers_name, issues - mTLS certificates and the server's HTTPS certificate with ca; the - site-to-site template is mtls, and the s2s CA issues it. - * The Certificates page shows the built-in and the custom issuing CAs in - one Issuing CAs tab, with the certificates of all of them; a built-in CA - whose component is off is off, not missing. - * Every test instance gets an AppRole of its own in a Vault of the test - project, with /etc/vault and the helper lm-dev-vault, and reads its - secrets with it, never as an argument or on standard input; - lm-dev-lxd-project.py vault create, unseal and remove manage the Vault, - and the scripts' state is in .lm-dev-config/. - * lm-dev-vm.py takes --forward-address, and enrols a TOTP token for admin - when the VM is created unless --no-otp is given. - * The TOTP tokens of test VMs are keys of the Vault's TOTP engine; - lm-dev-otp-code.py prints their codes, and lm-dev-otp-register.py takes - no --secret-file. bin/otp.py stores its secret without a line end, or - with --url its otpauth URI, so Vault imports the file as it is, and - reads codes from either. - * linux-manager-user unlock, POST /users//unlock and the metrics - account's new password end a lockout again; they failed when the user - had failed binds. - * Setup refuses a CA name that differs from the common name of the CA's - certificate or CSR, and linux-manager-ca ca import a certificate whose - common name differs from the CSR's; the PKI settings dialog edits the - P2S and S2S names only until their CA exists, and the issuing CA dialog - no longer edits the common name of an existing CA. - * lm-dev-run.py keeps the lab's admin password in the scenario's Vault and - no longer replaces ADMIN_PASSWORD in .env. - * lm-dev-run.py and lm-dev-vm.py install the package built last, in out/ - or out/dev/, or the one --deb names; lm-dev-vm.py no longer prints the - admin password. - * The build retries failed downloads of the image's packages. - - -- Slawomir Koszewski Mon, 23 Nov 2026 08:20:31 +0100 - -linux-manager (0.41.1-1) unstable; urgency=medium - - 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/. - - * The Manager's browser settings have Open the shell in a new tab, off by - default; with it the shell button opens the shell in a tab of its own. - * The page menu leaves the Docker page out while Docker is not installed; - /config has docker.installed. - * The test scripts are bin/lm-dev-run.py, lm-dev-vm.py, - lm-dev-lxd-project.py and lm-dev-build.py, their data stays in - tests/remote; bin/otp.py is a command-line authenticator app, and - bin/lm-dev-otp-register.py enrols a token for a user of a test VM. - * The lm-dev scripts default to the project lm-dev, read from LXD_PROJECT, - and name the VM with --vm; lm-dev-run.py reads its project from - LXD_TEST_PROJECT; lm-dev-vm.py takes create and remove. - * lm-dev-build.py keeps the serial of the last dev build in - .dev-build.serial, which release.py writes as 0 when it releases. - * pki.root, local by default, offline or simple-ca, says where the root CA - comes from, and is fixed once the root exists; the debconf question - linux-manager/pki_root sets it. - * With pki.root offline, setup makes the CSRs of the issuing CAs and waits; - linux-manager-ca ca import root, and Import root certificate on the Root - tab, take the root certificate before the issuing CAs. - * With pki.root simple-ca, setup exchanges a setup code, debconf - linux-manager/pki_setup_code or linux-manager-ca root setup-code, for a - sign-ca token of a Simple CA issuing CA at pki.simple_ca_url, has the - issuing CAs signed by it, and fetches the CRLs of the root and that CA, - which joins every chain the server gives; the CA of the service's HTTPS - certificate is installed in the system's trust store before setup. - * The root key is no longer exported, removed or imported: - linux-manager-ca root export-key, remove-key and import-key, - pki.root_key_warning, and a root placed in /etc/linux-manager/pki/root - are gone. - * The Root tab shows the source of the root, and with Simple CA its - issuing CA and the expiry of the token, with Enter setup code. - * examples/cloud-init-with-pki.yaml.tpl and the Azure and GCP examples - give the router a Simple CA root with simple_ca_url and - simple_ca_setup_code, and both cloud-init examples add the CAs of - trusted_ca_files to the trust store. - * The name server settings describe TTL as the default TTL of the records, - used where neither the record nor its domain has one. - - -- Slawomir Koszewski Sun, 22 Nov 2026 20:13:38 +0100 - -linux-manager (0.41.0-1) unstable; urgency=medium - - feature: the package is linux-manager, the Ubuntu Linux Manager, whose - router and VPN are components switched on in the configuration. - - * The package, its paths, units, commands, Python modules, debconf - questions, LDAP base DN dc=linux-manager,dc=local, schema, database and - metric names are linux-manager instead of vpn-router; the Manager's unit - is linux-manager-ui.service, vpn-config-edit is - linux-manager-config-edit and vre is lme. - * The Manager is the Ubuntu Linux Manager, its first page Server. - * router.enabled and vpn.enabled, false by default, switch the router and - the VPN; the debconf questions linux-manager/router_enabled and - vpn_enabled set them, and only the questions of the components on are - asked. - * With the router off the server needs only interfaces.external, which is - also the internal side of the listen choices, and site_to_site must be - empty; with the VPN off p2s, openvpn and wireguard must be off. - * With the router off and the VPN on, the VPN pools are masqueraded out of - the external interface, so the clients reach local.cidrs through NAT. - * linux-manager-setup writes /etc/sysctl.d/99-linux-manager.conf while the - router or the VPN is on and removes it while both are off; the package - ships no sysctl file. - * The firewall is enabled once any service of the core is configured; the - IPsec rules are written only while site-to-site or IKEv2 is ready, and - MSS clamping while the router or the VPN is on; strongSwan is stopped - while neither needs it. - * The P2S CA is created while the VPN is on and the site-to-site CA while - the router is on; switching the VPN on issues the missing certificates - of the VPN users. - * While the VPN is off, a VPN user is created without a certificate, and - WireGuard peers and the VPN profiles are refused. - * The Manager hides the Remote Access page while the VPN is off, and shows - only the Network tab of the Connectivity page while the router is off. - * The Network tab lists every interface but loopback by name, with its - type, external when it holds the IPv4 default route and internal - otherwise, state, addresses and MAC address; the internal gateway and the - local CIDRs are in a Router panel shown while the router is on. /config - has the interfaces in network.interfaces. - * The LDAP schema is under 1.3.6.1.4.1.67380.10.1.2, the arc listed in - OID-REGISTRY.txt. - * Ubuntu 26.04 (resolute) is the only supported release: the build image - and the published distribution are resolute, the Azure and GCP examples - install from resolute, and the Azure example boots the 26.04 image. - * The examples switch the router and the VPN on. - * A NAT rule that the configuration no longer needs is removed from the - running firewall at once, not only at the next boot. - * The last enabled member of admins can no longer be disabled, through - the API, the Manager or linux-manager-user (409, status 4). - * The Users, Groups, Service accounts, Web Sites and Files pages keep a - refused change's message above the list after they read it again. - * tests/remote/run.py tests the components on Ubuntu 26.04 instances of an - LXD remote, and tests/remote/vm.py starts and removes one server - VM there to work with, reached through ports 7080, 7081 and 2222 (SSH) - of the LXD host, by default at the address of the remote's URL. - * tests/remote/lxd-project.py creates and removes a project for manual - tests with its own OVN networks, a WAN and two LANs, and a signed apt - repository; tests/remote/dev-build.py publishes numbered dev builds, version - ~devN-, to it, and vm.py installs from it there. - - -- Slawomir Koszewski Sat, 21 Nov 2026 23:39:03 +0100 - -vpn-router (0.40.0-1) unstable; urgency=medium - - feature: the package installs the Router Manager, which is no longer a - package of its own. - - * The Router Manager, vpn-router-manager.service, is installed and started - with the router; its programs are in /usr/lib/vpn-router, its application - and help in /usr/share/vpn-router/manager. - * Its settings are /etc/vpn-router/manager.json, its database password - /etc/vpn-router/manager-database.secret and the state of its upgrades - /var/lib/vpn-router/upgrade.json and system-upgrade.json. - * The debconf questions vpn-router/admin_username and admin_password give - its first administrator, written to /etc/vpn-router/manager-admin.json. - * The Overview tab and the upgrade helper know the package vpn-router - alone. - * The bootstrap page on port 17081 shows the manager's service and log; - port 17080 and vpn-router-manager-bootstrap are gone. - * The status has no manager_version; the manager's unit is always among - the services. - * The package cannot be installed beside the package vpn-router-manager, - which has to be removed first. - * A purge also removes the manager's settings, its database and role, and - the record of its upgrades. - * build.sh, publish.sh and the Dockerfile are in the repository root, the - build also builds the application in web/, and CONTAINER_RUNTIME chooses - the container runtime. - * The README and the ADR call the product that deploys the router Cloud - Manager, also where they named manage-ui, and the docstring of the GCP - platform names Google Cloud. - - -- Slawomir Koszewski Fri, 13 Nov 2026 20:15:15 +0100 - -vpn-router (0.39.1-1) unstable; urgency=medium - - fix: the web service starts again after its first start with 0.39.0, and the - name server's domains can be changed from any process. - - * The schemas of the web sites and of the name server can be applied any - number of times, so the web service no longer keeps retrying with - 'function "site_put" already exists' and never listening, and - vpn-router-site and setup no longer fail the same way. - - -- Slawomir Koszewski Fri, 06 Nov 2026 20:16:57 +0100 - -vpn-router (0.39.0-2) unstable; urgency=medium - - update: vpn-router is published in the koszewscy package registry. - - * publish.sh uploads to the owner koszewscy unless OWNER names another. - * repo_url of the Azure and GCP examples defaults to - https://gitea.koszewscy.waw.pl/api/packages/koszewscy/debian. - - -- Slawomir Koszewski Fri, 06 Nov 2026 20:08:29 +0100 - -vpn-router (0.39.0-1) unstable; urgency=medium - - feature: the name server's domains have wan.local_fqdn and dns.secondary as - their name servers, and a site with dns router gets records of the router's - public, internal or external address. - - * The SOA and the first NS of every domain are wan.local_fqdn, and the - second NS is dns.secondary, a host name, whose addresses are notified - of every change and may transfer the domains; dns.nameserver is gone. - * wan.local_fqdn gets no record in the domains; its record is kept in - the DNS of its own domain. - * A site has dns, user (the default), served elsewhere, or router, whose - host names get an A or AAAA record in their closest domain, with - dns_address public (wan.public_address, new), internal or external. - dns.addresses, the domains' site records switch and the per-domain - secondaries with their routes are gone; dns.nameserver and - dns.addresses of an earlier configuration are left out when read. - * A site may use wan.local_fqdn as a host name on a port of its own. - * GET /dns answers nameserver, wan.local_fqdn, and public_address, - which PUT /dns changes. - * The summaries of the changelog entries are wrapped at 80 columns, and - release.py joins the lines of a summary into the commit message. - - -- Slawomir Koszewski Fri, 30 Oct 2026 21:30:01 +0100 - -vpn-router (0.38.1-1) unstable; urgency=medium - - fix: /https/settings shows the https section and switches https.acme_staging, - for the Router Manager. - - * GET /https/settings shows the https section, and PUT /https/settings - changes acme_staging; the other settings of the section stay with - vpn-config-edit. - - -- Slawomir Koszewski Fri, 30 Oct 2026 02:43:22 +0100 - -vpn-router (0.38.0-1) unstable; urgency=medium - - feature: https.acme_staging takes Caddy's certificates from Let's Encrypt's - staging environment. - - * While https.acme_staging is true, Caddy's only CA is Let's Encrypt's - staging environment, for the router's services and the web sites - with tls acme; its certificates are not trusted by browsers. - - -- Slawomir Koszewski Fri, 30 Oct 2026 02:34:01 +0100 - -vpn-router (0.37.3-1) unstable; urgency=medium - - fix: an answer whose client went away ends quietly, and a shell whose client - left before it opened is stopped. - - * The web service, the metrics service and the bootstrap server stop - writing an answer when its client closes the connection, and a site - file whose download is left no longer gets a second answer. - * A shell whose client closed the connection before it opened is - stopped and its end is logged, instead of running on. - - -- Slawomir Koszewski Fri, 30 Oct 2026 02:03:26 +0100 - -vpn-router (0.37.2-1) unstable; urgency=medium - - fix: the web service, the metrics service and the bootstrap server log a - failure in one line instead of a traceback, and nothing when a client goes - away. - - * A request whose client closed the connection is no longer logged. - * Any other failure of a request, a thread or the service is logged in - one line with the exception's type and message. - - -- Slawomir Koszewski Fri, 30 Oct 2026 01:59:19 +0100 - -vpn-router (0.37.1-1) unstable; urgency=medium - - fix: /config answers the OpenID Provider's state and issuer. - - * /config has oidc: enabled, and issuer, the issuer URL, null while the - provider is disabled. - - -- Slawomir Koszewski Fri, 30 Oct 2026 01:53:55 +0100 - -vpn-router (0.37.0-1) unstable; urgency=medium - - feature: the OpenID Provider has the client credentials and device - authorization grants, public clients, and service accounts as resources with - roles and scopes in JWT access tokens. - - * A client may have the grants client_credentials, by which a - confidential client gets an access token as its own service account, - and the device code (RFC 8628): POST /oidc/device_authorization gives - a device code and a user code, the user enters the code on - /oidc/device, signs in and allows or denies the device, and the device - polls /oidc/token. A public client has no secret. - * An http loopback redirect URI matches with any port. - * Every service account is a resource: it defines scopes, which clients - ask for as : when their client scopes allow them, and - roles, assigned to groups, users and service accounts. A token request - names its resource with resource (RFC 8707) or by its scopes. - * Access tokens are RS256 JWTs of RFC 9068 for the resource, or the - client, with client_id, scope, roles and the claims of the scopes; ID - tokens and /oidc/userinfo carry the user's roles of the client. - * vpn-router-user takes --grant, --public-client, --client-scope and - --resource-scope; the new vpn-router-role manages the roles; and - /service-accounts takes and answers grants, public_client, - client_scopes, resource_scopes and roles. - * Changing the password of a service account, disabling, unlocking or - removing it through /service-accounts revokes its tokens. - * POST /oidc/device and /oidc/device_authorization are rate limited as - /oidc/login is. - - -- Slawomir Koszewski Fri, 30 Oct 2026 00:57:11 +0100 - -vpn-router (0.36.0-1) unstable; urgency=medium - - feature: a shell opens with one of the user's passkeys in place of the - password and the TOTP code. - - * POST /shell/passkey begins a proof for one of the signed-in user's own - passkeys, with user verification; POST /shell takes the browser's - answer as {"passkey": {"id", "credential"}} in place of the password - and the code, and gives the ticket of the shell. - * A passkey that is not accepted is refused with 403. The shell still - needs the user's TOTP enrolment, which its login session and sudo in - it need. - - -- Slawomir Koszewski Thu, 29 Oct 2026 23:09:43 +0100 - -vpn-router (0.35.2-2) unstable; urgency=medium - - update: the package is published for Ubuntu 26.04 (resolute) as well as 24.04 - (noble). - - * publish.sh uploads the package to the distributions noble and resolute - of the repository, component main, skipping a distribution that has - the version already; DISTRIBUTIONS names others. A router on Ubuntu - 26.04 installs vpn-router from the distribution resolute. - - -- Slawomir Koszewski Thu, 29 Oct 2026 21:41:32 +0100 - -vpn-router (0.35.2-1) unstable; urgency=medium - - fix: the web service answers /, /status and /status/full again while IKEv2 - runs. - - * The status of IKEv2 clients is collected again; the requests that - collect the status were dropped with a NameError since 0.35.1. - - -- Slawomir Koszewski Thu, 29 Oct 2026 19:03:16 +0100 - -vpn-router (0.35.1-1) unstable; urgency=medium - - update: the router web service is split into the package vpnrouter_web, with - one module per family of paths. - - * /usr/lib/vpn-router/web initializes and serves; the package - /usr/lib/vpn-router/vpnrouter_web/ answers the requests, with a module - for the status, the sign-in, the identities, the connections, backups, - the PKI, logs, web sites, DNS, metrics and the shell. The paths, the - answers and the log messages are the same. - - -- Slawomir Koszewski Thu, 29 Oct 2026 18:20:50 +0100 - -vpn-router (0.35.0-1) unstable; urgency=medium - - feature: vre opens files from the Router Manager's shell in the editor of its - Shell page. - - * vpn-router-editor FILE..., or vre, in the shell of the Router Manager - opens the files in the editor of the Shell page and returns at once; - outside that shell it exits with status 2. - * GET, PUT and DELETE /shell/editor// read, save and close - a file opened so, as the shell's console account; a save is refused - with 409 when the file changed since it was read. - * The editor takes regular files of UTF-8 text up to 1 MiB, at most 20 - per shell, while the shell lives. - - -- Slawomir Koszewski Thu, 29 Oct 2026 18:02:27 +0100 - -vpn-router (0.34.0-1) unstable; urgency=medium - - feature: the web service shows and changes the settings of the metrics service - at /metrics/settings, and OpenVPN starts on a new router, as setup installs - CRLs that revoke nothing. - - * GET and PUT /metrics/settings show and change the metrics section; - otlp_password is never shown, an empty one keeps it, and an empty - otlp_username removes it. - * A CRL without revoked certificates is installed for strongSwan and - OpenVPN. - - -- Slawomir Koszewski Wed, 28 Oct 2026 22:00:00 +0100 - -vpn-router (0.33.3-1) unstable; urgency=medium - - fix: vpn-router-setup runs on a new installation once libpq can be found. - - * The vpn-router-setup unit waits, with wait-for-libpq, until libpq is in - the linker cache before it runs setup. - * The package starts vpn-router-setup without waiting for it. - - -- Slawomir Koszewski Wed, 28 Oct 2026 21:00:00 +0100 - -vpn-router (0.33.2-1) unstable; urgency=medium - - fix: the router's IPsec remote access is called IKEv2 instead of road-warrior. - - * The README, the package description, the installer's questions, the - status page, the messages of the web service and the examples say - IKEv2 access and IKEv2 clients; the strongSwan connection keeps its - name, road-warrior. - - -- Slawomir Koszewski Tue, 27 Oct 2026 23:00:00 +0100 - -vpn-router (0.33.1-1) unstable; urgency=medium - - fix: the name server is the primary of any number of domains, each with - secondary name servers and a switch for the records of the sites. - - * The domains, their secondaries and manual records are kept in the - vpn-router-dns database and changed through /dns/domains; dns.zone is - removed. - * Each domain is served as a primary zone: the router and its - secondaries are its NS, and each secondary's address is notified of - changes and may transfer the zone. - * A domain with site records gives the host names of the enabled sites - in it A and AAAA records of dns.addresses; a domain inside another is - delegated from it. - * Manual records belong to a domain; those of the single zone are - dropped. - - -- Slawomir Koszewski Tue, 27 Oct 2026 20:00:00 +0100 - -vpn-router (0.33.0-1) unstable; urgency=medium - - feature: road-warrior clients resolve the domains of the new setting - p2s.dns_domains with the router's resolver. - - * p2s.dns_domains lists up to 16 domains; setup pushes them to IKEv2 - clients as INTERNAL_DNS_DOMAIN (RFC 8598, attribute 25) of the - road-warrior pool. - * The Apple VPN profile names them as match domains of the router's - resolver, which macOS and iOS use for those domains. - - -- Slawomir Koszewski Tue, 27 Oct 2026 18:00:00 +0100 - -vpn-router (0.32.1-1) unstable; urgency=medium - - fix: a VPN user downloads the own OpenVPN client profile through /account, - with the current password and code. - - * POST /account/profile answers the user's OpenVPN client profile; it - needs the current password and, when enrolled, a code. - - -- Slawomir Koszewski Tue, 27 Oct 2026 16:00:00 +0100 - -vpn-router (0.32.0-1) unstable; urgency=medium - - feature: the web service gives Apple VPN profiles that set up IKEv2 - road-warrior access on macOS, iOS and iPadOS. - - * POST /users//apple-profile and POST /account/apple-profile answer - an unsigned .mobileconfig with the P2S CA and the root CA, the user's - certificate and key as a PKCS#12 encrypted with the password of the - request, and an IKEv2 VPN to wan.local_fqdn with EAP-TLS and the - proposals of the road-warrior connection. - * A user's own profile needs the current password and, when enrolled, a - code. - - -- Slawomir Koszewski Tue, 27 Oct 2026 14:00:00 +0100 - -vpn-router (0.31.3-1) unstable; urgency=medium - - fix: WireGuard clients may use the router's DNS resolver, which runs while - WireGuard does, and /remote-access names its addresses for their - configuration. - - * The firewall opens port 53 of the remote access clients' resolver for - the WireGuard network, as it does for the IKEv2 and OpenVPN pools. - * The resolver runs while WireGuard is the only remote access enabled. - * GET /remote-access answers the resolver's addresses as - wireguard_server.dns. - * dns.listen may not share an interface with p2s.dns_listen while - WireGuard is enabled either. - - -- Slawomir Koszewski Tue, 27 Oct 2026 12:00:00 +0100 - -vpn-router (0.31.2-1) unstable; urgency=medium - - fix: dnsmasq answers the remote access clients' DNS queries, so they no longer - get the router's own host name with all its addresses from systemd-resolved. - - * vpn-router-resolver.service runs dnsmasq on the addresses of - p2s.dns_listen, forwarding to systemd-resolved's stub on 127.0.0.53; - names without a dot are not forwarded. The package depends on - dnsmasq-base. - * systemd-resolved keeps its loopback stubs only; setup removes the - drop-in that made it listen for the clients. - * /logs shows the journal of vpn-router-resolver, vpn-router-webdav and - pdns. - - -- Slawomir Koszewski Tue, 27 Oct 2026 11:00:00 +0100 - -vpn-router (0.31.1-1) unstable; urgency=medium - - fix: the remote access clients' resolver answers on the internal address by - default, chosen by p2s.dns_listen, so the name server can take port 53 of the - external addresses. - - * The new setting p2s.dns_listen chooses the addresses of the resolver the - road-warrior and OpenVPN clients are given: internal, the default, - external or both. The firewall opens port 53 for the client pools on - those addresses only. - * dns.listen is refused only when it shares an interface with - p2s.dns_listen while IKEv2 or OpenVPN is enabled. - - -- Slawomir Koszewski Mon, 26 Oct 2026 23:00:00 +0100 - -vpn-router (0.31.0-1) unstable; urgency=medium - - feature: Caddy serves static web sites from folders on the router, defined in - their own database, with files uploaded through the web service or WebDAV, and - an optional PowerDNS name server answers for a zone of the sites. - - * The new database vpn-router-sites holds the web sites: host names, - port, interfaces, TLS (none, Let's Encrypt, an issuing CA or a - certificate and key), index file, single-page fallback and the group - whose members change the files. sites.enabled serves them from - /var/lib/vpn-router/sites/; setup writes their blocks into the - Caddyfile and opens their ports, and Caddy also runs without HTTPS of - the router while a site is served. - * vpn-router-site lists, shows, adds, changes and removes the sites, and - bash completes it. - * /sites manages the sites and the settings of the sites section, and - under /sites//files/ lists, downloads, uploads, extracts zip - archives into, creates, renames and removes the files of a site, up to - sites.upload_max_mb; members of the site's editors group may use its - files. - * sites.webdav runs rclone's WebDAV server of the sites' folders behind - Caddy on sites.webdav_port, signing users in with the directory and - showing each the sites it may change. - * dns.enabled runs PowerDNS with its PostgreSQL backend in the new - database vpn-router-dns for dns.zone on the addresses of dns.listen: - SOA, NS, the A and AAAA records of dns.addresses for the zone, the - name server and the sites' host names in the zone, and manual records - added with /dns. - * rclone and PowerDNS are installed from the Ubuntu archive by - vpn-router-install@.service when their feature is on. - * Backups hold the sites' folders and the dumps of both databases; a - restore puts them back. Purge removes the databases, their roles and - password files, and the settings of PowerDNS. - * Renaming a group renames it in the sites; a group a site has cannot be - removed. - - -- Slawomir Koszewski Mon, 26 Oct 2026 21:00:00 +0100 - -vpn-router (0.30.0-1) unstable; urgency=medium - - feature: the web service serves the last lines of the journal of the router's - units and of the log files web.log_files lists, at /logs. - - * GET /logs lists the units whose journal and the files whose lines it - serves; GET /logs/journal?unit=&lines= and /logs/file?path=&lines= - answer the last lines, 200 by default and at most 1000, a file read - from its last MiB. Units and files outside the lists are refused. - * The new setting web.log_files lists the absolute paths of the log - files, at most 32. - - -- Slawomir Koszewski Mon, 26 Oct 2026 19:00:00 +0100 - -vpn-router (0.29.0-1) unstable; urgency=medium - - feature: vpn-config-edit set and remove take --restart, which applies the - change with vpn-router-setup and waits for it. - - * vpn-config-edit set --restart and remove --restart restart - vpn-router-setup after writing the configuration and wait until it has - applied the change; a failed run exits with status 1 and points to its - journal. Bash completes --restart. - - -- Slawomir Koszewski Mon, 26 Oct 2026 17:00:00 +0100 - -vpn-router (0.28.0-1) unstable; urgency=medium - - feature: bash completes the vpn-* commands, their options and the names they - take. - - * Bash completes the commands, options and arguments of vpn-router-user, - vpn-router-group, vpn-router-token, vpn-config-edit, vpn-router-backup, - vpn-router-ca and vpn-router-caddy, from - /usr/share/bash-completion/completions; for root also the users, - groups, issuing CAs, templates, settings and site-to-site connections. - * The package recommends bash-completion. - - -- Slawomir Koszewski Mon, 26 Oct 2026 16:00:00 +0100 - -vpn-router (0.27.0-1) unstable; urgency=medium - - feature: the web service is an OpenID Provider, which signs the directory's - users in to other systems, the clients being service accounts with redirect - URIs. - - * oidc.enabled turns on the OpenID Provider at the issuer - https://:, with discovery, JWKS, - authorize, token, userinfo and RP-initiated logout under /oidc/, - answered only through Caddy. The authorization code flow with PKCE - S256 and refresh tokens are offered; ID tokens are RS256, signed with - /etc/vpn-router/oidc.key, which the web service makes on its first run. - * Users sign in on the provider's page with the password and the TOTP - code or with a passkey; the session lasts 8 hours. The scopes openid, - profile, email and groups give sub (the entry's entryUUID), the names, - the e-mail address and the user's groups. - * A service account with redirect URIs is a client: its name is the - client ID and its password the secret. Its redirect URIs, - post-logout redirect URIs and allowed groups are set with - vpn-router-user add/update --redirect-uri, --post-logout-redirect-uri - and --allowed-group, and in /service-accounts as redirect_uris, - post_logout_redirect_uris and allowed_groups; GET /service-accounts - also answers the issuer. vpn-router-user list shows them. - * Changing a user's password, disabling, unlocking or removing the user - also revokes the user's codes, tokens and sessions of the provider. - * Renaming a group renames it in the clients that allow it, and a group - a client allows cannot be removed. - * The package depends on python3-oauthlib and python3-jwt. - - -- Slawomir Koszewski Mon, 26 Oct 2026 14:00:00 +0100 - -vpn-router (0.26.2-1) unstable; urgency=medium - - fix: a service account may be named by a GUID in lowercase, as the Router - Manager proposes for a new one. - - * vpn-router-user add --service and POST /service-accounts take a GUID - in lowercase as the name, besides a user name; users and groups keep - the rules of user names. - - -- Slawomir Koszewski Mon, 26 Oct 2026 10:00:00 +0100 - -vpn-router (0.26.1-1) unstable; urgency=medium - - fix: the package installs vpnrouter_passkeys, without which the web service - and vpn-router-user do not start. - - * /usr/lib/vpn-router/vpnrouter_passkeys.py is part of the package. - - -- Slawomir Koszewski Mon, 26 Oct 2026 08:45:00 +0100 - -vpn-router (0.26.0-1) unstable; urgency=medium - - feature: users sign in to the Router Manager with passkeys, and console login - needs a TOTP token, so a user without one is refused the shell, SSH and sudo. - - * Console login is switched on only for a user enrolled for TOTP. A user - whose console login is on without a token is refused POST /shell, the - shell's WebSocket, SSH and sudo; an open shell ends within a minute of - the token's removal or of console login being switched off, and - removing the token ends the sessions of the user's own POSIX account. - * POST /auth/passkey and /auth/passkey/complete sign a user in with a - passkey of wan.local_fqdn, giving the tokens of /auth; POST /auth also - answers the user's name. - * POST, PUT /account/passkeys and DELETE /account/passkeys/ add, with - the current password and code, and remove the user's passkeys, at most - 10, kept in the new attribute vpnRouterPasskey; DELETE - /users//passkeys and vpn-router-user passkeys-remove remove all - passkeys of a user. - * Users have passkeys, [{"id", "label", "created"}], in /users and - /account; vpn-router-user list shows their number and a console login - refused for want of a TOTP token. - * The package depends on python3-fido2. - - -- Slawomir Koszewski Tue, 03 Nov 2026 08:00:00 +0100 - -vpn-router (0.25.4-1) unstable; urgency=medium - - fix: a shell opens without the password and code again while the user's last - use of a shell is within web.shell_auth_timeout minutes. - - * New setting web.shell_auth_timeout, 15 minutes by default, 0 to 1440: - POST /shell without a password gives a ticket while the user's last - sign-in of POST /shell or keystroke in a shell is within it, and a - null ticket otherwise; 0 asks for the password and code every time. - - -- Slawomir Koszewski Tue, 03 Nov 2026 06:00:00 +0100 - -vpn-router (0.25.3-1) unstable; urgency=medium - - fix: /config gives the state of caddy.service with the installed Caddy, for - the Router Manager's Web page. - - * caddy of /config is {"version", "source", "service"}. - - -- Slawomir Koszewski Tue, 03 Nov 2026 05:00:00 +0100 - -vpn-router (0.25.2-1) unstable; urgency=medium - - fix: wireguard.address must be the router's own address in its network, not - the network or broadcast address, from which the peers' addresses are told - apart. - - * A wireguard.address that is the network or the broadcast address of a - network larger than /31, such as 192.168.232.0/24, is refused with the - first address of the network as the example. - - -- Slawomir Koszewski Tue, 03 Nov 2026 02:30:00 +0100 - -vpn-router (0.25.1-1) unstable; urgency=medium - - fix: /remote-access gives the router's WireGuard public key, endpoint and - allowed IPs, which a peer's configuration needs. - - * GET /remote-access answers wireguard_server: {"public_key", - "endpoint", "allowed_ips"}. - - -- Slawomir Koszewski Tue, 03 Nov 2026 01:30:00 +0100 - -vpn-router (0.25.0-1) unstable; urgency=medium - - feature: a VPN user has WireGuard peers, each a device with its public key and - IPs, kept in the directory and written into wg0.conf by setup. - - * PUT /users/ takes wireguard_peers, [{"public_key", "ips"}], - which replaces the user's peers; keys are unique and IPs may not - overlap another peer's or cover the router's WireGuard address. - * GET /users answers each user's wireguard_peers and the WireGuard - endpoint's enabled and address. - * Setup writes a [Peer] section into wg0.conf for each peer of a user - who is not disabled, in a marked block, and keeps the peers added by - hand; changing a user's peers, disabling, enabling or removing a user - with peers applies at once. - - -- Slawomir Koszewski Tue, 03 Nov 2026 00:00:00 +0100 - -vpn-router (0.24.1-1) unstable; urgency=medium - - fix: the status gives the number of connected OpenVPN clients at most 5 - seconds old instead of up to a minute. - - * The OpenVPN server writes its status file every 5 seconds, so a - refresh of the status shows clients that connected or left since. - - -- Slawomir Koszewski Mon, 02 Nov 2026 23:30:00 +0100 - -vpn-router (0.24.0-1) unstable; urgency=medium - - feature: /remote-access of the web service shows and changes the settings of - IKEv2 road-warrior, OpenVPN and WireGuard access and whether each runs, for - the Router Manager's Remote access page. - - * GET /remote-access answers the p2s, openvpn and wireguard sections, - which of them setup runs, and wan.local_fqdn; PUT - /remote-access/ changes one section and restarts setup. - * p2s.enabled and openvpn.enabled need their address_pool, and - wireguard.enabled its address. - - -- Slawomir Koszewski Mon, 02 Nov 2026 23:00:00 +0100 - -vpn-router (0.23.2-1) unstable; urgency=medium - - fix: the shell of a user's own POSIX account opens on the first setup that - sets up console login, and the journal records each refused shell with the - reason. - - * Setup restarts vpn-router-web when it adds ldap to the name service - switch, so the web service finds the POSIX accounts of the directory. - * The journal of vpn-router-web records each refused ticket and shell, - with the user, the address and the reason. - - -- Slawomir Koszewski Mon, 02 Nov 2026 22:00:00 +0100 - -vpn-router (0.23.1-1) unstable; urgency=medium - - fix: the shell runs as the console account of each member of admins, a local - account or the user's own POSIX account in the directory, which also signs in - with SSH and sudo, instead of one web.shell_user. - - * vpn-router-user console --posix | --account LOCAL | --off, and - PUT /users//console with a token of vpn-router-token, switch a - member of admins' console login; leaving admins switches it off. - * The user's own POSIX account is served by nslcd from the directory, - with a uid from 20000, the group vpn-router-console, which may use - sudo, and a home created at the first login; its password is the - directory password, followed by the code once enrolled for TOTP. - * ssh.ldap_login (false) lets sshd accept that password. - * POST /shell and the shell need the user's console login; web.shell_user - is gone. - * Depends on nslcd, libnss-ldapd, libpam-ldapd and sudo. - - -- Slawomir Koszewski Mon, 02 Nov 2026 21:00:00 +0100 - -vpn-router (0.23.0-1) unstable; urgency=medium - - feature: web.shell lets /shell of the web service open a login shell of - web.shell_user over a WebSocket for the Router Manager's Shell page, after the - user signs in again. - - * web.shell (false), web.shell_user and web.shell_idle_minutes (15). - * POST /shell takes the password and the TOTP code and answers a - one-time ticket; GET /shell with it is a WebSocket carrying the - terminal, closed after web.shell_idle_minutes without a keystroke. - * The journal of vpn-router-web records each shell opened and ended. - - -- Slawomir Koszewski Mon, 02 Nov 2026 20:00:00 +0100 - -vpn-router (0.22.1-1) unstable; urgency=medium - - fix: the status gives the number of site-to-site connections set up and - established, not each connection by name. - - * site_to_site of the status document is {"connections", "established"}, - and the status page shows "Site to site: N of M established". - - -- Slawomir Koszewski Mon, 02 Nov 2026 18:00:00 +0100 - -vpn-router (0.22.0-1) unstable; urgency=medium - - feature: pki.extended_key_usages adds custom extended key usages by their - OIDs, which templates give by name, and a template's policies put certificate - policy OIDs into its certificates. - - * pki.extended_key_usages maps a name to the OID of a custom extended - key usage; a template's extended_key_usage takes the built-in and the - custom names. - * The template option policies lists certificate policy OIDs, written - into a Certificate Policies extension. - * GET /ca answers extended_key_usages, each usage with its OID and - whether it is built in. - - -- Slawomir Koszewski Mon, 02 Nov 2026 14:00:00 +0100 - -vpn-router (0.21.5-1) unstable; urgency=medium - - fix: /status/full of the status web service gives an authenticated client the - whole status, whatever web.status_content says. - - * /status/full takes the token of /config and answers the status - document as web.status_content full shows it. - - -- Slawomir Koszewski Mon, 02 Nov 2026 12:00:00 +0100 - -vpn-router (0.21.4-1) unstable; urgency=medium - - fix: vpn-router-setup, vpn-router-ca and /ca read a CA's key and CRL from the - directory each as itself, instead of failing on a CA with a CRL. - - * A CA's CRL was read as its key and its key as its CRL, so every - operation on a CA with a CRL failed with "Could not deserialize key - data". - - -- Slawomir Koszewski Mon, 02 Nov 2026 10:00:00 +0100 - -vpn-router (0.21.3-1) unstable; urgency=medium - - fix: the PKI is kept in ou=pki of the router's directory instead of files - under /etc/vpn-router/pki, and the router's site-to-site certificate names - only the identities its connections present, and /ca/bundle gives the - certificate bundle of a CA. - - * The CAs with their certificates, keys, CSRs and CRLs, and every - certificate issued with its revocation, are entries of the - package's schema in ou=pki; a user's certificate is also the - userCertificate of the user's entry, and only root reads a key. - * slapcat puts the PKI into every backup with the users. - * A root CA supplied as /etc/vpn-router/pki/root/cert.pem and key.pem - before the first setup is imported into the directory, and the files - are removed; vpn-router-ca root import-cert is gone. - * Setup provisions the directory before the configuration; without it, - the PKI and its files are left as they are. - * The router's site-to-site certificate names wan.local_fqdn and the - public or internal address a connection with auth certificate uses - as its identity, not every address of the router, and is issued - again when those names change. - * GET /ca/bundle/ of the status web service answers the PEM - certificates a client trusts a CA with: the root alone, or an issuing - CA followed by the root. - - -- Slawomir Koszewski Sun, 01 Nov 2026 10:00:00 +0100 - -vpn-router (0.21.2-1) unstable; urgency=medium - - fix: pki.root_key_warning silences the warning of vpn-router-ca status and /ca - about the root key on the router. - - * pki.root_key_warning, true by default, set to false silences the - warning that the root key is on the router. - - -- Slawomir Koszewski Sat, 31 Oct 2026 10:00:00 +0100 - -vpn-router (0.21.1-1) unstable; urgency=medium - - fix: vpn-router-ca status and /ca warn about a CRL the router signs only once - vpn-router-pki.timer has not renewed it in time. - - * A CRL whose CA key is on the router is reported once past half of its - validity, when the timer should have signed it again; a root CRL - signed offline is still reported 30 days before it expires. - - -- Slawomir Koszewski Fri, 30 Oct 2026 10:00:00 +0100 - -vpn-router (0.21.0-1) unstable; urgency=medium - - feature: the router has a two-level CA with an optional offline root, issuing - CAs for P2S, site-to-site and general use, templates, published certificates - and CRLs and an ACME server, site-to-site connections authenticate with - certificates, and setup installs Caddy from Ubuntu or Caddy's repository. - - * The root CA signs the issuing CAs p2s, which issues the router's VPN - server certificate and the users' certificates, s2s, which issues - the site-to-site certificates, and the general-purpose CAs of - pki.issuing_cas; road-warrior and OpenVPN accept certificates of p2s - only. - * The pki section of vpn-router.json sets the names, lifetimes and - key type of the CAs, the validity of the CRLs, where certificates - and CRLs are published, the general-purpose CAs and the certificate - templates; p2s.ca_name and the vpn-router/p2s_ca_name question are - replaced by pki.root_name and vpn-router/pki_root_name. - * Without the root key on the router, new issuing CAs wait with a CSR - for an offline signature; vpn-router-ca exports, removes and imports - the root key, imports the signed certificates and a root CRL, issues - certificates from a CSR or into a PFX file, lists and revokes them. - * Certificates name their issuer's certificate and CRL at the - endpoints of pki.publish: the status port over HTTP, or Caddy on port - 80, on the HTTPS status port or on port 443; the CRLs are signed - again at every revocation and by vpn-router-pki.timer. - * A general-purpose CA with acme backs an ACME server of Caddy. - * The router renews its own certificates before they expire. - * A site-to-site connection with auth certificate authenticates with - the router's site-to-site certificate and trusts the s2s CA or the - connection's remote_ca. - * /ca of the status web service shows and changes the PKI; /pki/ - serves the published certificates and CRLs; /config shows the - installed Caddy and its source; request bodies may be 64 KiB. - * vpn-router no longer depends on caddy: vpn-router-setup installs it - from https.caddy_source, the Ubuntu archive or Caddy's repository, - and vpn-router-caddy use-upstream switches an installed router to - Caddy's repository for good. - * The package depends on python3-cryptography instead of openssl, and - simple-ca is gone. - - -- Slawomir Koszewski Thu, 29 Oct 2026 10:00:00 +0100 - -vpn-router (0.20.0-1) unstable; urgency=medium - - feature: the router makes scheduled backups to a local folder, copied to the - cloud with rclone, or to a Proxmox Backup Server, and vpn-router-backup - restores them. - - * The backup section of vpn-router.json switches on backups and sets - the schedule (hourly, daily or weekly), the target (local or pbs), - the folder, the retention of local archives, whether the metrics - database is included, the rclone remote and mode, and the Proxmox - Backup Server repository, token secret, fingerprint, namespace and - key file. - * A backup holds /etc/vpn-router, /etc/wireguard, the ufw rules, the - Router Manager's settings, PSK files outside /etc/vpn-router, the - user directory as slapcat writes it and, optionally, the database as - pg_dump writes it, copied while the configuration and the users are - locked. - * Local backups are tar archives compressed with zstd. Archives the - retention settings no longer keep are deleted by the rules of Proxmox - Backup Server's prune, and rclone can sync or copy the archives to a - remote of /etc/vpn-router/rclone.conf. - * Backups to a Proxmox Backup Server are made with - proxmox-backup-client-static, which the package suggests; the server - keeps them. - * vpn-router-backup runs a backup, lists the backups and restores a - local archive or a snapshot; vpn-router-backup.timer runs it on the - schedule. - * /backup of the status web service shows and changes the backup - settings, shows the last run, the local archives and the next run, - and starts a backup. - * The package depends on zstd and suggests rclone and - proxmox-backup-client-static. - - -- Slawomir Koszewski Wed, 28 Oct 2026 10:00:00 +0100 - -vpn-router (0.19.1-3) unstable; urgency=medium - - update: ADR-24 names Ubuntu's apt-daily timer, not a cron job, as what updates - the package lists. - - * ADR-24 says that Ubuntu's apt-daily timer updates the package lists - twice a day, and that apt-daily or unattended-upgrades may hold the - dpkg lock the upgrade waits for. - - -- Slawomir Koszewski Tue, 27 Oct 2026 10:00:00 +0100 - -vpn-router (0.19.1-2) unstable; urgency=medium - - update: ADR-24 says that the Router Manager checks for updates on demand. - - * ADR-24 describes Check update of the Router Manager, which updates - apt's package lists in the transient unit vpn-router-manager-check. - - -- Slawomir Koszewski Tue, 27 Oct 2026 09:00:00 +0100 - -vpn-router (0.19.1-1) unstable; urgency=medium - - fix: /metrics/history gives the availability of each site-to-site connection - as the percentage of time it was up in slots of the view. - - * site_to_site_up of /metrics/history divides the view into slots of 5 - minutes for an hour, 1 hour for a day, 1 day for a month and 1 month - for a year, and gives for each slot and connection the percentage of - the samples in which the connection was up. - - -- Slawomir Koszewski Mon, 26 Oct 2026 21:00:00 +0100 - -vpn-router (0.19.0-1) unstable; urgency=medium - - feature: service accounts have a display name and a description, which the - router sets for its internal ones. - - * vpnRouterAccount of the package's schema also takes displayName and - description; vpn-router-setup updates the schema of an existing - directory. - * /service-accounts shows display_name and description, takes them when - adding a service account and changes them with PUT; "" removes one. - /users shows them as null. - * vpn-router-user add --service and update take --display-name and - --description. - * vpn-router-setup gives the metrics service's internal account the - display name Metrics and its description, and sets them again when - they differ. - - -- Slawomir Koszewski Mon, 26 Oct 2026 20:00:00 +0100 - -vpn-router (0.18.3-1) unstable; urgency=medium - - fix: internal service accounts are the router's own, of which the metrics - service's is the one at present, and the documentation says what a service - account is. - - * /service-accounts, /groups and the internal field of the answers - take every internal service account, the accounts the router creates - and manages for its own services, instead of only the metrics - service's; the 403 answers say that the router manages them. - * The README, the ADR and the users module describe a service account - as the account another system, such as an OpenTelemetry Collector - reading /metrics, signs in with, and the internal ones as managed by - the router. - - -- Slawomir Koszewski Mon, 26 Oct 2026 19:00:00 +0100 - -vpn-router (0.18.2-1) unstable; urgency=medium - - fix: service accounts are managed at /service-accounts, not /users, and the - internal one of the metrics service is only listed. - - * /service-accounts, for members of admins and admin tokens, lists the - service accounts, adds one with a password and an optional e-mail - address, changes the e-mail address, sets the password, disables, - enables, unlocks and removes them. - * /users no longer lists service accounts or takes "service" on POST, - and answers 404 to a request naming one. - * /service-accounts answers 403 to every request but the list on the - account metrics.service_account names while metrics are enabled, and - /groups to putting it in or taking it out of a group; - vpn-router-setup and root's vpn-router-user still change it. - - -- Slawomir Koszewski Mon, 26 Oct 2026 18:00:00 +0100 - -vpn-router (0.18.1-1) unstable; urgency=medium - - fix: vpn-router-setup owns only the creation of the metrics service's account, - which is marked internal, and administrators add service accounts with - vpn-router-user add --service and /users. - - * POST /users takes "service": true and adds a service account, which - cannot sign in to /auth; vpn-router-user add takes --service. - * The users of /users and vpn-router-user have internal, true for the - account metrics.service_account names while metrics are enabled; - vpn-router-user list shows its kind as internal. - * PUT /users//password refuses the internal service account, - whose password vpn-router-setup keeps. - - -- Slawomir Koszewski Mon, 26 Oct 2026 17:00:00 +0100 - -vpn-router (0.18.0-2) unstable; urgency=medium - - update: release.py tags a Debian revision other than 1 as x.y.z-n. - - * release.py tags the newest entry x.y.z for the Debian revision 1 and - x.y.z-n for a later revision, so a packaging change gets a release - of its own. - - -- Slawomir Koszewski Mon, 26 Oct 2026 14:00:00 +0100 - -vpn-router (0.18.0-1) unstable; urgency=medium - - feature: site_to_site holds any number of named site-to-site connections, - which /site-to-site lists, adds, changes and removes. - - * site_to_site maps a connection name to addrs, id, cidrs, local_cidrs, - local_id_mode, psk and psk_file; it replaces remote and - wan.local_id_mode, and a configuration with them is refused. - * The install answers fill the connection remote-site; the local subnets - fill both its local_cidrs and local.cidrs. - * Every ready connection is written to - /etc/swanctl/conf.d/site-to-site.conf as the swanctl connection and - child of its name with the secret ike-psk-; remote-site.conf is - no longer written. - * Traffic from each connection's local_cidrs to its cidrs is not - masqueraded. - * /site-to-site, for members of admins and admin tokens, lists the - connections without their keys, adds, changes and removes them, and - restarts vpn-router-setup to apply the change. - * vpn-config-edit sets site_to_site.NAME.option, creating the - connection, and removes site_to_site.NAME; it and the web service - write vpn-router.json under one lock. - * The status shows site_to_site.connections, whether each connection is - established. - * The metrics service keeps, per site-to-site connection, whether it is - up, the bytes and packets per second received and sent, and the - seconds its IKE SA has been up, in metrics_site_to_site and its - summaries; /metrics/history has them in site_to_site of each point. - * /metrics serves vpn_router_site_to_site_up, - vpn_router_site_to_site_uptime_seconds, - vpn_router_site_to_site_io_bytes_per_second and - vpn_router_site_to_site_packets_per_second by connection, and the - OTLP push the vpn_router.site_to_site gauges; vpn_router_clients and - metrics_vpn no longer have the kind site_to_site. - * /config shows each connection in network.site_to_site, and no psk at - any level of the configuration. - * Removing the package terminates every site-to-site connection; purging - removes site-to-site.conf. - - -- Slawomir Koszewski Sun, 25 Oct 2026 23:00:00 +0100 - -vpn-router (0.17.0-1) unstable; urgency=medium - - feature: /config shows the router's PostgreSQL clusters and their settings, - and /postgresql their databases with their sizes. - - * /config has a postgresql section: each cluster of pg_lsclusters with - its version, name, port, status and data directory, and the main - settings of each online cluster. - * /postgresql, protected like /config, lists the databases of each - online cluster with owner, encoding and size, and the total size. - - -- Slawomir Koszewski Sun, 25 Oct 2026 21:00:00 +0200 - -vpn-router (0.16.0-1) unstable; urgency=medium - - feature: the router keeps its metrics in PostgreSQL, serves them for an - OpenTelemetry Collector and pushes them over OTLP. - - * vpn-router-metrics takes a sample every minute: CPU, memory, free - space of /, bytes per second on the external and the internal - interface, the load averages, and the VPN clients of each enabled - system. - * The samples are kept in metrics_system, metrics_network and - metrics_vpn, and summarized hourly, daily, monthly and yearly in - their _hourly, _daily, _monthly and _yearly tables; once a day the - rows older than metrics.keep_details, keep_hourly, keep_daily, - keep_monthly and keep_yearly are deleted. - * /metrics serves the last sample in the Prometheus format on the - interfaces metrics.listen names (internal by default) at - metrics.port, and over HTTPS by Caddy at metrics.https_port, with - HTTP Basic authentication of the service account - metrics.service_account names (metrics by default). - * metrics.otlp_endpoint pushes every sample as OTLP/HTTP JSON, with - metrics.otlp_username and metrics.otlp_password. - * /metrics/history of the web service answers the hour, day, month - and year views for the Router Manager. - * vpn-router-setup adds and keeps that service account, which cannot - sign in to /auth, with a random password in - /etc/vpn-router/metrics.secret, set anew when the file is missing. - * Depends on python3-psutil and python3-prometheus-client. - - -- Slawomir Koszewski Sun, 25 Oct 2026 19:00:00 +0200 - -vpn-router (0.15.0-1) unstable; urgency=medium - - feature: vpn-config-edit shows and changes the router's configuration. - - * vpn-config-edit show prints /etc/vpn-router/vpn-router.json as - indented JSON. - * vpn-config-edit set SECTION.OPTION VALUE converts the value to the - setting's type, checks the whole configuration as vpn-router-setup - does, writes the file indented with mode 0600, and reminds that - vpn-router-setup applies it. - - -- Slawomir Koszewski Sun, 25 Oct 2026 18:00:00 +0200 - -vpn-router (0.14.1-1) unstable; urgency=medium - - fix: web.status_content is basic by default. - - * Without web.status_content, or with a value that is not allowed, / - and /status show only the overall status, the time and the Client - IP; set it to standard or full to show more. - - -- Slawomir Koszewski Sun, 25 Oct 2026 17:00:00 +0200 - -vpn-router (0.14.0-1) unstable; urgency=medium - - feature: the status page shows the Client IP, and web.status_content sets how - much it shows. - - * / and /status show the Client IP, the address the request came from: - the last X-Forwarded-For entry for a request from a trusted proxy, so - behind Caddy or the Router Manager the browser's; /status has it as - client_ip. - * web.status_content sets what / and /status show: basic the overall - status, the time and the Client IP; standard also the package - versions and the number of active and failed services; full, the - default, everything as before. /status names it in content. - - -- Slawomir Koszewski Sun, 25 Oct 2026 16:00:00 +0200 - -vpn-router (0.13.0-1) unstable; urgency=medium - - feature: Caddy serves the status page and the Router Manager over HTTPS with a - certificate from Let's Encrypt. - - * The package depends on caddy. While https.enabled is true, the - default, and wan.local_fqdn is set, vpn-router-setup writes - /etc/caddy/vpn-router.Caddyfile and runs Caddy, which serves the - status page on https.web_port (7444) and the Router Manager, when it - is installed, on https.manager_port (7443) for wan.local_fqdn, and - obtains the certificate from Let's Encrypt with the HTTP challenge. - * The package's drop-in for caddy.service makes Caddy read that file - and keeps it from starting before the file exists. The file belongs - to root and the group caddy, which Caddy runs as, with mode 0640. - * The firewall opens port 80 on the external interface and the HTTPS - ports on both interfaces while HTTPS is on. - * The web service also listens on 127.0.0.1, where Caddy calls it. - * docker.exposed_ports may not take port 80 or the HTTPS ports while - HTTPS is on. - * Removing the package stops and disables caddy; purging it removes - /etc/caddy/vpn-router.Caddyfile. - - -- Slawomir Koszewski Sun, 25 Oct 2026 15:00:00 +0200 - -vpn-router (0.12.3-1) unstable; urgency=medium - - fix: the web service listens on the internal address, the external address or - both. - - * web.listen in vpn-router.json sets the interfaces the web service - listens on: internal, external or both, the default. It is read - every 30 seconds, so a change takes effect without running setup, - at the latest when vpn-router-web restarts. - * The firewall opens the ports of the web service and of the Router - Manager on the internal and the external interface. - - -- Slawomir Koszewski Sun, 25 Oct 2026 13:00:00 +0200 - -vpn-router (0.12.2-1) unstable; urgency=medium - - fix: the web service manages users also when it started before setup. - - * vpn-router-web creates /run/vpn-router when it starts, so the user - operations take their lock there; started before vpn-router-setup had - made the directory, they failed with "Read-only file system". - - -- Slawomir Koszewski Sun, 25 Oct 2026 12:00:00 +0200 - -vpn-router (0.12.1-1) unstable; urgency=medium - - fix: the status page shows whether the Router Manager runs. - - * When vpn-router-manager is installed, the services show the state of - vpn-router-manager, and status is degraded while it is not active. - - -- Slawomir Koszewski Sun, 25 Oct 2026 11:00:00 +0200 - -vpn-router (0.12.0-1) unstable; urgency=medium - - feature: every user manages their own account through /account. - - * /account serves the signed-in user, admin or not: GET shows the user - and whether they are a member of admins; PUT /account/password sets - the password and POST and PUT /account/otp enrol or replace the TOTP - enrolment, given the current password and, when enrolled, a current - code. A wrong one is 403 and counts as a failed login. Tokens of - vpn-router-token get 403 there. - - -- Slawomir Koszewski Sun, 25 Oct 2026 10:00:00 +0200 - -vpn-router (0.11.0-1) unstable; urgency=medium - - feature: the status page shows the Router Manager's version. - - * / and /status show the installed version of vpn-router-manager, as - manager_version in JSON, or that it is not installed. - * The services show the state of each PostgreSQL cluster, as - postgresql@-, or postgresql: no cluster without one. - - -- Slawomir Koszewski Sun, 25 Oct 2026 09:00:00 +0200 - -vpn-router (0.10.0-1) unstable; urgency=medium - - feature: Manager-only accounts, and the Router Manager's first administrator. - - * vpn-router-user add without the person options, and POST /users without - them, add a Manager-only account: a name and a password, no names, no - e-mail address and no certificate, so no VPN access. Giving only some of - the three is refused. The answers show the kind as manager_only, list - shows a KIND column, and update refuses a Manager-only account. - * vpn-router-setup creates the administrator the Router Manager's package - leaves in /etc/vpn-router-manager/admin.json as a Manager-only account in - the group admins, which it creates when missing, and removes the file. - * The directory has the package's own schema, with the auxiliary class - vpnRouterAccount and the attribute vpnRouterScope. A Manager-only account - can have an e-mail address: add --email, update --email ('' removes it), - and email in POST and PUT /users. - - -- Slawomir Koszewski Sun, 25 Oct 2026 08:00:00 +0200 - -vpn-router (0.9.2-1) unstable; urgency=medium - - fix: the web service starts once libpq can be found. - - * The web service unit waits, with wait-for-libpq, until libpq is in the - linker cache before it starts the service, for at most 5 minutes; the - service imports psycopg at start again. - * The package starts the web service without waiting for it. - - -- Slawomir Koszewski Sun, 25 Oct 2026 06:00:00 +0200 - -vpn-router (0.9.1-1) unstable; urgency=medium - - fix: the web service waits for the PostgreSQL driver instead of failing at - start. - - * The web service imports psycopg as the first step of its - initialization, retrying every 15 seconds and logging the failure while - libpq cannot be found yet during an installation. - * vpn-router-user and vpn-router-token load without psycopg; a command - that needs the token database then reports that the driver cannot be - loaded, as it reports every failure of that database. - - -- Slawomir Koszewski Sun, 25 Oct 2026 05:00:00 +0200 - -vpn-router (0.9.0-1) unstable; urgency=medium - - feature: bootstrap diagnostics on port 17081 during the first setup. - - * vpn-router-bootstrap serves, on port 17081, the setup state, the - services, the failed units, the addresses, cloud-init status and the end - of the logs of setup and the web service, as plain text. - * vpn-router-setup starts it, and the Router Manager's bootstrap on port - 17080, until a run has succeeded, and opens both ports on the internal - interface; the first successful run writes - /var/lib/vpn-router/setup.done, closes the ports and stops them. A - failed run leaves them running. - * The web service no longer has a starting phase: it creates its key and - database, then listens. - - -- Slawomir Koszewski Sun, 25 Oct 2026 04:00:00 +0200 - -vpn-router (0.8.0-1) unstable; urgency=medium - - feature: the web service creates its key and database itself and shows its - starting phase. - - * vpn-router-web makes its signing key and creates the refresh tokens' - database on its first run, retrying every 15 seconds until PostgreSQL - answers; vpn-router-setup no longer creates them. - * Until then / and /status show the web service's phase and its failure, - with the state, the step and the failure of the last run of - vpn-router-setup, and every page answers 503. - * vpn-router-setup records its state, current step and failure in - /run/vpn-router/setup.json. - - -- Slawomir Koszewski Sun, 25 Oct 2026 03:00:00 +0200 - -vpn-router (0.7.1-1) unstable; urgency=medium - - fix: a failing user directory or token database no longer leaves the tunnels - down. - - * vpn-router-setup brings up strongSwan and WireGuard before it provisions - the user directory and the token database. A failure of either no - longer stops the other steps; setup reports it and fails at the end. - - -- Slawomir Koszewski Sun, 25 Oct 2026 02:00:00 +0200 - -vpn-router (0.7.0-1) unstable; urgency=medium - - feature: users sign in to the web service, and only members of admins manage - the router. - - * POST /auth signs a user in with the password, and the TOTP code for an - enrolled user, and answers a 5 minute access token and an 8 hour refresh - token; /auth/refresh renews them and /auth/logout revokes the refresh - token. - * /config, /users and /groups take tokens of users in the group admins, - and tokens of the new vpn-router-token, which has an admin claim and a - chosen lifetime. Only these may change the group admins. - * The tokens are signed with /etc/vpn-router/web.key, which - vpn-router-setup makes on the router; web.jwt_secret is ignored. - * Five failed logins lock an account for 15 minutes, for OpenVPN and - /auth. vpn-router-user unlock and POST /users//unlock end the - lockout, and the users show locked. - * /auth takes at most 10 calls a minute per client address; for calls from - web.trusted_proxies the address is read from X-Forwarded-For. - * Users enrolled for TOTP log in to OpenVPN with the password followed by - the code. - * Refresh tokens are kept in PostgreSQL, in the database web.database - names or in the vpn-router database vpn-router-setup creates. The - package depends on postgresql and python3-psycopg. - - -- Slawomir Koszewski Sun, 25 Oct 2026 01:00:00 +0200 - -vpn-router (0.6.0-1) unstable; urgency=medium - - feature: users can be enrolled for TOTP one-time passwords. - - * vpn-router-user otp-new makes a TOTP secret and its otpauth URI, - otp-enrol stores the secret, read from standard input, given a code of - it, and otp-remove removes it. list and every answer show whether a user - is enrolled, as otp. - * The web service enrols with POST, PUT and DELETE /users//otp. - * The secret is kept in the user's entry with the OATH-LDAP schema of - slapd's otp module; only the user manager account may set it, and no - one can read it. Logins do not ask for the codes. - * The package depends on python3-pyotp. - - -- Slawomir Koszewski Sat, 24 Oct 2026 23:30:00 +0200 - -vpn-router (0.5.9-1) unstable; urgency=medium - - fix: package upgrades no longer ask the configuration questions. - - * The configuration questions are asked only on a fresh installation and - by dpkg-reconfigure. - - -- Slawomir Koszewski Sat, 24 Oct 2026 21:00:00 +0200 - -vpn-router (0.5.8-1) unstable; urgency=medium - - fix: an upgrade keeps the configuration and asks nothing. - - * postinst passes on only the debconf answers that were given. The - defaults of questions never asked, such as platform none, no longer - replace settings of vpn-router.json. - * Without an answer that changes it, the configuration ucf is given is - vpn-router.json byte for byte, so an upgrade has no conflict to ask - about; settings the file leaves out keep their defaults when it is read. - - -- Slawomir Koszewski Sat, 24 Oct 2026 20:00:00 +0200 - -vpn-router (0.5.7-1) unstable; urgency=medium - - feature: users have a first name, a last name and an e-mail address. - - * vpn-router-user add needs --first-name, --last-name and --email, kept as - givenName, sn and mail, with cn set to the first and the last name. - vpn-router-user update changes them, and list and every answer show - them as first_name, last_name and email. - * POST /users needs first_name, last_name and email, and PUT - /users/ changes them. - * vpn-router-user answers in text: a table of the users, the client - profile or a short message, with failures on standard error. --json - gives the JSON answers. -h and --help show the commands and their - options. - * The web service manages users with vpnrouter_users, the module - vpn-router-user uses, instead of running vpn-router-user for each - request. - * Groups of users, kept as groupOfNames entries in ou=groups with a - description and at least one member. vpn-router-group lists, adds, - renames, describes and removes them and adds and takes out members, and - the web service serves the same under /groups. Removing a user takes it - out of its groups and is refused while it is the last member of one. - - -- Slawomir Koszewski Sat, 24 Oct 2026 19:00:00 +0200 - -vpn-router (0.5.6-1) unstable; urgency=medium - - update: the status web service listens on port 7081 by default. - - * web.port defaults to 7081. - * vpn-router-setup opens the Router Manager's port, 7080 by default, on - the internal interface. - - -- Slawomir Koszewski Sat, 24 Oct 2026 18:00:00 +0200 - -vpn-router (0.5.5-1) unstable; urgency=medium - - feature: users and their certificates no longer need a P2S system enabled. - - * vpn-router-setup provisions the user directory, the CA and its CRL once - a platform is chosen, whether or not OpenVPN or road-warrior access is - enabled. The server certificate is issued once wan.local_fqdn is set, - also for an existing CA that has none. - * /users and vpn-router-user manage users and issue and revoke their - certificates without a P2S system; only the OpenVPN client profile - needs OpenVPN. - - -- Slawomir Koszewski Sat, 24 Oct 2026 16:00:00 +0200 - -vpn-router (0.5.4-1) unstable; urgency=medium - - feature: the firewall lets the Router Manager in on the internal interface. - - * While vpn-router-manager is installed, vpn-router-setup opens its port, - port in /etc/vpn-router-manager/manager.json or 8090, on the internal - interface. Purging the package removes the rule. - - -- Slawomir Koszewski Sat, 24 Oct 2026 13:00:00 +0200 - -vpn-router (0.5.3-1) unstable; urgency=medium - - fix: the status always shows the state of slapd. - - * /status and the status page show the state of slapd whether or not - OpenVPN or road-warrior access is configured, since the package always - runs it. - - -- Slawomir Koszewski Sat, 24 Oct 2026 12:00:00 +0200 - -vpn-router (0.5.2-1) unstable; urgency=medium - - fix: /config no longer shows secret options. - - * The configuration shown by /config leaves out the secret options (psk, - jwt_secret, and options named like a password, token or key) instead of - showing them masked. - - -- Slawomir Koszewski Sat, 24 Oct 2026 11:00:00 +0200 - -vpn-router (0.5.1-1) unstable; urgency=medium - - fix: the web service works in every state of the router. - - * vpn-router-web works whether /etc/vpn-router/pki and - /etc/swanctl/x509crl exist or not; they exist only while OpenVPN or - road-warrior access is configured. The paths the unit may write are - used when they exist and ignored when they do not. - * vpn-router-web starts on its own and keeps running. Every 30 seconds a - discovery thread works out the internal address from vpn-router.json as - general.mode directs, with web.port and web.enabled, and starts, moves - or stops the server thread to match. Each request reads the token - secret, the features and the facts it shows. The service is no longer - ordered after vpn-router-setup, which no longer restarts it, and - web.json no longer holds the address, the port or the secret. - - -- Slawomir Koszewski Sat, 24 Oct 2026 10:00:00 +0200 - -vpn-router (0.5.0-1) unstable; urgency=medium - - * OpenVPN P2S access, set in the openvpn section (enabled, address_pool, - port, protocol). Clients need a certificate of the router CA and the - password of the user named in it; the password is checked against a - local LDAP directory by openvpn-auth-ldap. - * The users live in the package's own slapd database, dc=vpn-router, - dc=local, which vpn-router-setup provisions while OpenVPN or road-warrior - access is configured. slapd listens on its local socket only. Passwords - are stored as ARGON2 hashes, and a disabled user is locked with the - password policy. - * vpn-router-user lists, adds, disables, enables and removes users, sets - passwords and gives OpenVPN client profiles. Adding a user also issues - the user's client certificate; removing one revokes it. - * The web service manages users under /users, with the same token as - /config, and /status shows the OpenVPN clients. - * The CA gets a certificate revocation list when it is created, and an - existing CA without one gets one. - * Purging the package removes the firewall rules of the web service, which - it left behind before. - * The status page follows the browser's light or dark colour scheme, - uses a proportional font and reloads itself every minute. - - -- Slawomir Koszewski Fri, 23 Oct 2026 23:00:00 +0200 - -vpn-router (0.4.3-1) unstable; urgency=medium - - * swanctl output with more closing than opening lines is read as not - available instead of failing the request. - - -- Slawomir Koszewski Fri, 23 Oct 2026 22:00:00 +0200 - -vpn-router (0.4.2-1) unstable; urgency=medium - - * /config gives the IPsec connections and SAs as objects, read from - swanctl --pretty, and the routes as objects from ip -j, instead of - lines of text. The site-to-site and road-warrior state of /status is - counted from the same swanctl objects. - - -- Slawomir Koszewski Fri, 23 Oct 2026 21:30:00 +0200 - -vpn-router (0.4.1-1) unstable; urgency=medium - - * Fix the start of vpn-router-setup hanging on a host that runs Docker. - vpn-router-setup restarted vpn-router-docker and waited for it, but that - unit was ordered after vpn-router-setup, so each waited for the other, - the installation of the package never finished and vpn-router-web was - never enabled or started. vpn-router-docker is no longer ordered after - vpn-router-setup, so vpn-router-setup still waits for it and the Docker - rules are in place when it ends. The restart of vpn-router-web is queued - without waiting. - * Start vpn-router-setup after docker.service, so that Docker is up when - the setup looks for it and does not start in parallel with it. The - ordering applies only when Docker is installed. - - -- Slawomir Koszewski Fri, 23 Oct 2026 20:10:00 +0200 - -vpn-router (0.4.0-1) unstable; urgency=medium - - * Add the vpn-router-web service, a small status web service that uses only - the Python standard library. It listens on the internal address and on - web.port, 8080 by default. / shows the state of the router for people, - as plain text for curl and wget and as a Tailwind CSS page for a - browser, and /status shows the same as JSON: the state of the services, - the package version, whether Docker is installed, and the state of - site-to-site, road-warrior and WireGuard, with no configuration data. - * Add the web configuration section. web.enabled (true by default) and - web.port. vpn-router-setup opens the port on the internal interface in - UFW and restarts the service. - * Add /config to the status web service, for a client such as manage-ui. It - shows the configuration with its secrets masked, the interfaces, - addresses, identities and routes the router resolved, the IPsec - connections and SAs, the WireGuard peers (no keys) and the Docker rules. - It needs a JWT signed with HS256 by web.jwt_secret, with an exp claim - within ten minutes, and is not served while web.jwt_secret is not set. - - -- Slawomir Koszewski Fri, 23 Oct 2026 19:00:00 +0200 - -vpn-router (0.3.2-1) unstable; urgency=medium - - * Accept an IPv4 or IPv6 address as remote.id and as wan.local_fqdn. The - identities are written to the strongSwan configuration as given, without - an @ added, and strongSwan reads an address as an IP identity and a name - as an FQDN. A value that starts with @ is refused with an error, since - strongSwan 5.0 and later need no @ to avoid resolving a name. - Road-warrior access still needs a name in wan.local_fqdn. - * Depend on strongswan-swanctl and charon-systemd 5.0 or later. - - -- Slawomir Koszewski Fri, 23 Oct 2026 18:00:00 +0200 - -vpn-router (0.3.1-1) unstable; urgency=medium - - * Ignore virtual interfaces when mode auto looks for the internal - interface. The Docker bridge docker0, which has an address, was counted - as a second internal interface, so vpn-router-setup and - vpn-router-docker failed on a host with Docker installed. - - -- Sławomir Koszewski Fri, 23 Oct 2026 13:44:00 +0200 - -vpn-router (0.3.0-1) unstable; urgency=medium - - * Secure the ports Docker publishes. Rules in a chain of their own, - VPN-ROUTER-DOCKER, entered by a jump at the top of DOCKER-USER, accept - IPsec protected traffic, TCP to docker.exposed_ports and established - connections from the external interface and drop the rest of it. Other - rules in DOCKER-USER are left alone. The rules cover IPv4 only. - * Add the docker configuration section. docker.mode is auto (the default, - secures Docker when docker.service is installed), on (requires Docker) or - off (removes the rules); docker.exposed_ports lists the TCP ports and port - ranges reachable from the external interface, none by default. - * Add the vpn-router-docker service, which applies the Docker rules after - docker.service starts and removes them when it stops. vpn-router-setup - restarts it while Docker runs, so a changed configuration takes effect. - * Installing Docker before this package is recommended. When Docker is - installed later, restart vpn-router-setup to apply the rules. - - -- Sławomir Koszewski Fri, 23 Oct 2026 12:44:45 +0200 - -vpn-router (0.2.0-1) unstable; urgency=medium - - * Change the configuration file to JSON, /etc/vpn-router/vpn-router.json. - Lists are arrays, booleans and the WireGuard listen port are native JSON - types, and unknown sections, unknown settings and wrong value types are - rejected. - * Replace remote.psk_b64 with remote.psk, holding the pre-shared key as a - plain string. remote.psk_file still takes precedence. - * Ship /usr/share/doc/vpn-router/vpn-router.json.example in place of - vpn-router.conf.example. - * Add platform "none" as the default, so installing the package changes - nothing on the machine until a platform is chosen. - * Add the mode setting (manual, interfaces, auto) controlling how much of - the network configuration is supplied and how much is read from the - system. - * Manage the configuration file with ucf, so dpkg-reconfigure reapplies - debconf answers without overwriting local edits. - * Apply NAT and forward rules to every local subnet, not only the first. - - -- Sławomir Koszewski Fri, 23 Oct 2026 08:00:06 +0200 - -vpn-router (0.1.0-1) unstable; urgency=medium - - * Initial release. - - -- Sławomir Koszewski Tue, 26 May 2026 00:00:00 +0200 diff --git a/debian-package/src/usr/lib/linux-manager/linuxmanager_ui.py b/debian-package/src/usr/lib/linux-manager/linuxmanager_ui.py index 6dcd722..5b0e747 100644 --- a/debian-package/src/usr/lib/linux-manager/linuxmanager_ui.py +++ b/debian-package/src/usr/lib/linux-manager/linuxmanager_ui.py @@ -3,7 +3,7 @@ The settings file (CONFIG_FILE unless another is given) sets, all optional: router_url, database, listen, bind, port, terraform_dir and iac_tool. bind is the one address to listen on. Without router_url, terraform_dir names the Terraform root module whose output router_web_url gives the -URL of the server's web service, read with iac_tool, terraform (the default) or tofu; dev.sh uses +URL of the server's web service, read with iac_tool, terraform (the default) or tofu; dev.py uses it to run the manager on a workstation. On the server, where ROUTER_CONFIG_FILE is, the manager listens without bind on linuxmanager_net.MANAGER_LOOPBACK_PORT of the loopback address, where Caddy calls it: Caddy serves port over plain HTTP and https.manager_port over HTTPS, and the diff --git a/dev.py b/dev.py new file mode 100755 index 0000000..f981bcd --- /dev/null +++ b/dev.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Run the manager and the Vite development server on this workstation: dev.py CONFIG [CONNECTION]. + +CONFIG is the config.json of a platform. The server's address comes from the outputs of the +platform's root module, module_root of CONFIG, relative to its directory, read with its iac_tool +(terraform by default, or tofu). The sessions are kept in the database of the PostgreSQL connection +string CONNECTION, or without one in PGDATABASE (else the login name), with libpq's PG* variables +for the rest. The manager reads the generated dev.json, whose bind is 127.0.0.1, and listens on +127.0.0.1:7080; its Python packages are installed in .venv. The application is served at +http://localhost:5180 and passes /api to the manager. A wrong argument is a message on standard +error and the exit status 2. +""" + +import getpass +import json +import os +import pathlib +import subprocess +import sys + +ROOT = pathlib.Path(__file__).resolve().parent +SETTINGS = ROOT / 'dev.json' +VENV = ROOT / '.venv' +WEB = ROOT / 'web' +MANAGER = ROOT / 'debian-package' / 'src' / 'usr' / 'lib' / 'linux-manager' / 'manager' + + +def main(): + if not 2 <= len(sys.argv) <= 3: + print(f'usage: {sys.argv[0]} [PostgreSQL connection string]', file=sys.stderr) + return 2 + config = pathlib.Path(sys.argv[1]).resolve() + if not config.is_file(): + print(f'dev.py: {sys.argv[1]} does not exist', file=sys.stderr) + return 2 + database = sys.argv[2] if len(sys.argv) == 3 else f'dbname={os.environ.get("PGDATABASE") or getpass.getuser()}' + platform = json.loads(config.read_text(encoding='utf-8')) + root = platform.get('module_root') + if not isinstance(root, str) or not root.strip() or os.path.isabs(root): + print(f'dev.py: module_root in {config} must be a directory relative to {config.parent}', file=sys.stderr) + return 2 + module_root = pathlib.Path(os.path.normpath(config.parent / root)) + if not module_root.is_dir(): + print(f'dev.py: module_root {module_root} is not a directory', file=sys.stderr) + return 2 + SETTINGS.write_text(json.dumps({'terraform_dir': str(module_root), 'database': database, + 'iac_tool': platform.get('iac_tool') or 'terraform', 'bind': '127.0.0.1'}) + '\n', + encoding='utf-8') + + # The manager's packages in .venv, and the application's in node_modules, installed when missing or older. + python = VENV / 'bin' / 'python' + if not os.access(python, os.X_OK): + subprocess.run([sys.executable, '-m', 'venv', str(VENV)], check=True) + if subprocess.run([str(python), '-c', 'import psycopg, requests'], stderr=subprocess.DEVNULL).returncode != 0: + subprocess.run([str(VENV / 'bin' / 'pip'), 'install', '--quiet', 'psycopg[binary]', 'requests'], check=True) + modules, lock = WEB / 'node_modules', WEB / 'package-lock.json' + if not modules.is_dir() or lock.stat().st_mtime > modules.stat().st_mtime: + subprocess.run(['npm', 'install'], cwd=WEB, check=True) + + manager = subprocess.Popen([str(python), str(MANAGER), '--config', str(SETTINGS)]) + try: + print(f'Platform module: {module_root}', flush=True) + return subprocess.run(['npm', 'run', 'dev'], cwd=WEB, + env={**os.environ, 'VITE_MANAGER': 'http://127.0.0.1:7080'}).returncode + except KeyboardInterrupt: + return 130 + finally: + manager.terminate() + manager.wait() + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/dev.sh b/dev.sh deleted file mode 100755 index ec54ab0..0000000 --- a/dev.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# Run the manager and the Vite development server on this workstation. -# Usage: ./dev.sh [PostgreSQL connection string] -# The server's address comes from the outputs of the platform's root module, module_root of that -# config.json, relative to its directory, read with its iac_tool; the sessions are kept in the database of the connection -# string, or without one in PGDATABASE (else the login name) with libpq's PG* variables for the -# rest. The manager reads the generated dev.json, whose bind is 127.0.0.1, and listens on 127.0.0.1:7080; its Python packages -# are installed in .venv. The application is served at http://localhost:5180 and passes /api to the -# manager. -set -e - -if [ $# -lt 1 ] || [ $# -gt 2 ]; then - printf 'Usage: %s [PostgreSQL connection string]\n' "$0" >&2 - exit 2 -fi -DATABASE="${2:-dbname=${PGDATABASE:-$(id -un)}}" -if [ ! -f "$1" ]; then - printf 'ERROR: %s does not exist.\n' "$1" >&2 - exit 2 -fi - -ROOT="$(cd "$(dirname "$0")" && pwd)" -SETTINGS="$ROOT/dev.json" -PLATFORM_CONFIG="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" - -MODULE_ROOT="$(python3 - "$PLATFORM_CONFIG" <<'EOF' -import json, os, sys -path = sys.argv[1] -root = json.load(open(path, encoding='utf-8')).get('module_root') -if not isinstance(root, str) or not root.strip() or os.path.isabs(root): - sys.exit(f'module_root in {path} must be a directory relative to {os.path.dirname(path)}') -print(os.path.normpath(os.path.join(os.path.dirname(path), root))) -EOF -)" -# The tool that reads the outputs is the platform's, iac_tool of its config.json: tofu or terraform. -IAC_TOOL="$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1], encoding="utf-8")).get("iac_tool") or "terraform")' "$PLATFORM_CONFIG")" -if [ ! -d "$MODULE_ROOT" ]; then - printf 'ERROR: module_root %s is not a directory.\n' "$MODULE_ROOT" >&2 - exit 2 -fi -python3 - "$SETTINGS" "$MODULE_ROOT" "$DATABASE" "$IAC_TOOL" <<'EOF' -import json, sys -with open(sys.argv[1], 'w', encoding='utf-8') as handle: - json.dump({'terraform_dir': sys.argv[2], 'database': sys.argv[3], 'iac_tool': sys.argv[4], 'bind': '127.0.0.1'}, handle) - handle.write('\n') -EOF - -if [ ! -x "$ROOT/.venv/bin/python" ]; then - python3 -m venv "$ROOT/.venv" -fi -if ! "$ROOT/.venv/bin/python" -c 'import psycopg, requests' 2>/dev/null; then - "$ROOT/.venv/bin/pip" install --quiet 'psycopg[binary]' requests -fi - -cd "$ROOT/web" -if [ ! -d node_modules ] || [ package-lock.json -nt node_modules ]; then - npm install -fi - -"$ROOT/.venv/bin/python" "$ROOT/debian-package/src/usr/lib/linux-manager/manager" --config "$SETTINGS" & -MANAGER=$! -trap 'kill $MANAGER 2>/dev/null' EXIT INT TERM - -echo "Platform module: $MODULE_ROOT" -VITE_MANAGER=http://127.0.0.1:7080 npm run dev diff --git a/examples/azure/README.md b/examples/azure/README.md index 2a06c77..a7562e2 100644 --- a/examples/azure/README.md +++ b/examples/azure/README.md @@ -11,11 +11,11 @@ for what the package itself does. up). - An SSH key pair for `admin_ssh_public_key`. - A build of the `linux-manager` package published to the repository at `repo_url` (default: the - project's Gitea Debian registry). See [../../debian-package](../../debian-package) for - `build.sh`/`publish.sh`. + project's Gitea Debian registry). See [Building](../../README.md#building) for + `build.py`/`publish.py`. - That repository must allow anonymous reads, since the server pulls the package with no credentials configured. On Gitea this means the `debian` package registry under the - `slawek` account is set to public/anonymous-read; `publish.sh` still authenticates to + `slawek` account is set to public/anonymous-read; `publish.py` still authenticates to upload, only reads are anonymous. This is a one-time change made on the Gitea side, outside this repository. diff --git a/examples/gcp/README.md b/examples/gcp/README.md index fb2e8ca..9c88d45 100644 --- a/examples/gcp/README.md +++ b/examples/gcp/README.md @@ -12,8 +12,8 @@ repository's top-level [README](../../README.md) for what the package itself doe or a service account). - An SSH key pair for `admin_ssh_public_key`. - A build of the `linux-manager` package published to the repository at `repo_url` (default: the - project's Gitea Debian registry). See [../../debian-package](../../debian-package) for - `build.sh`/`publish.sh`. That repository must allow anonymous reads, since the server pulls + project's Gitea Debian registry). See [Building](../../README.md#building) for + `build.py`/`publish.py`. That repository must allow anonymous reads, since the server pulls the package with no credentials configured. ## Usage diff --git a/publish.py b/publish.py new file mode 100755 index 0000000..08db874 --- /dev/null +++ b/publish.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +"""Upload the package built for the newest CHANGELOG.md entry to the Gitea Debian repository: publish.py. + +The package is out/PACKAGE_VERSION_all.deb, its name the Source of debian/control and its version +the Debian version of the newest entry of CHANGELOG.md (bin/changelog.py), which build.py builds. +It is uploaded to the component main of each distribution of DISTRIBUTIONS (resolute by default, +separated by spaces) of the owner OWNER (koszewscy by default) at SERVER_URL +(https://gitea.koszewscy.waw.pl by default), signed in as OWNER with the token PACKAGES_TOKEN, else +the content of ~/.gitea-packages-token. A distribution that has the version already (Gitea's 409) +is skipped. A failure is a message on standard error and the exit status 1. +""" + +import base64 +import os +import pathlib +import sys +import urllib.error +import urllib.request + +ROOT = pathlib.Path(__file__).resolve().parent +sys.path.insert(0, str(ROOT / 'bin')) + +import changelog # noqa: E402 + +CHANGELOG = ROOT / 'CHANGELOG.md' +CONTROL = ROOT / 'debian-package' / 'debian' / 'control' +TOKEN_FILE = pathlib.Path.home() / '.gitea-packages-token' + + +def main(): + owner = os.environ.get('OWNER') or 'koszewscy' + server = (os.environ.get('SERVER_URL') or 'https://gitea.koszewscy.waw.pl').rstrip('/') + distributions = (os.environ.get('DISTRIBUTIONS') or 'resolute').split() + try: + found = changelog.entries(CHANGELOG.read_text(encoding='utf-8')) + package = changelog.control_field(CONTROL.read_text(encoding='utf-8'), 'Source') + if not found: + raise ValueError('no entry') + token = os.environ.get('PACKAGES_TOKEN') or TOKEN_FILE.read_text(encoding='utf-8').strip() + except (OSError, ValueError) as error: + sys.exit(f'publish.py: {error}') + version = changelog.debian_version(found[0]['version']) + deb = ROOT / 'out' / f'{package}_{version}_all.deb' + if not deb.is_file(): + sys.exit(f'publish.py: {deb.relative_to(ROOT)} does not exist; run ./build.py first') + content = deb.read_bytes() + credentials = base64.b64encode(f'{owner}:{token}'.encode()).decode() + + for distribution in distributions: + request = urllib.request.Request(f'{server}/api/packages/{owner}/debian/pool/{distribution}/main/upload', + data=content, method='PUT', + headers={'Authorization': f'Basic {credentials}', + 'Content-Type': 'application/octet-stream'}) + try: + with urllib.request.urlopen(request, timeout=300): + print(f'{package} {version} is published in {distribution}/main.') + except urllib.error.HTTPError as error: + if error.code != 409: + sys.exit(f'publish.py: the upload to {distribution}/main returned HTTP {error.code}: ' + f'{error.read().decode(errors="replace").strip()}') + print(f'{package} {version} is already in {distribution}/main, skipping.') + except urllib.error.URLError as error: + sys.exit(f'publish.py: {server} cannot be reached: {error.reason}') + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/publish.sh b/publish.sh deleted file mode 100755 index 780eb42..0000000 --- a/publish.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -set -e - -# CONTAINER_RUNTIME from the environment, for example docker with DOCKER_CONTEXT naming a remote engine; -# otherwise Apple container CLI on macOS and Docker CE on Linux. -if [ -z "${CONTAINER_RUNTIME:-}" ]; then - case "$(uname -s)" in - Darwin) CONTAINER_RUNTIME=container ;; - Linux) CONTAINER_RUNTIME=docker ;; - *) printf 'ERROR: unsupported platform %s\n' "$(uname -s)" >&2; exit 1 ;; - esac -fi - -OWNER="${OWNER:-koszewscy}" -SERVER_URL="${SERVER_URL:-https://gitea.koszewscy.waw.pl}" -PACKAGES_TOKEN="${PACKAGES_TOKEN:-$(cat ~/.gitea-packages-token)}" -# The Ubuntu releases whose distribution of the repository gets the package, in its component main. -DISTRIBUTIONS="${DISTRIBUTIONS:-resolute}" - -# Reads the changelog copied into the builder image, so no bind mount is needed. -changelog_field() { - $CONTAINER_RUNTIME run --rm linux-manager-builder \ - dpkg-parsechangelog --show-field "$1" -l /build/src/debian/changelog -} - -VERSION="$(changelog_field Version)" -PACKAGE="$(changelog_field Source)" -DEB="out/${PACKAGE}_${VERSION}_all.deb" - -if [ ! -f "$DEB" ]; then - printf 'ERROR: %s does not exist. Run ./build.sh first.\n' "$DEB" >&2 - exit 1 -fi - -BODY="$(mktemp)" -trap 'rm -f "$BODY"' EXIT - -# Gitea answers 409 for a version that is in the distribution already. -for DISTRIBUTION in $DISTRIBUTIONS; do - STATUS="$(curl -s -o "$BODY" -w '%{http_code}' --user "$OWNER:$PACKAGES_TOKEN" \ - --upload-file "$DEB" \ - "$SERVER_URL/api/packages/$OWNER/debian/pool/$DISTRIBUTION/main/upload")" - case "$STATUS" in - 2??) printf '%s %s is published in %s/main.\n' "$PACKAGE" "$VERSION" "$DISTRIBUTION" ;; - 409) printf '%s %s is already in %s/main, skipping.\n' "$PACKAGE" "$VERSION" "$DISTRIBUTION" ;; - *) printf 'ERROR: the upload to %s/main returned HTTP %s: %s\n' "$DISTRIBUTION" "$STATUS" "$(cat "$BODY")" >&2; exit 1 ;; - esac -done diff --git a/release.py b/release.py index 6df57ba..cda6b92 100755 --- a/release.py +++ b/release.py @@ -1,25 +1,39 @@ #!/usr/bin/env python3 -"""Commit everything, tag the version of the newest changelog entry and push main with the tags. +"""Commit everything with the summary of the newest CHANGELOG.md entry; with --push, tag its version and push main and the tag. -The tag is the version of the first entry of debian-package/debian/changelog, without the -Debian revision 1: linux-manager (0.5.1-1) is tagged 0.5.1 and (0.5.1-2) 0.5.1-2. The tag -starts the release workflow. Once the release succeeds, .dev-build.serial, the serial of the last -dev build (bin/lm-dev-build.py), is written as 0, so the dev builds of the next entry start at -~dev1. +The newest entry of CHANGELOG.md (bin/changelog.py reads it) is released: its heading gets the +current time, "## 0.5.1 - 2026-11-24 10:00:00 +0100", and everything is committed with its summary +paragraph, its lines joined, as the message. The commit marks the entry as released: a second run +for the same entry is refused, and the next change needs a new entry. With --push, the version of +the heading is tagged, 0.5.1 or 0.5.1-2, and main and the tag are pushed in one atomic push; the tag +starts the release workflow. With --no-tag, the entry is an internal release: it is committed as +without --push, and --push pushes main without a tag. debian/changelog is not kept in the +repository; the build writes it from CHANGELOG.md. + +Once a release is committed, LXD_DEV_BUILD_SERIAL of .lm-dev-config/settings.json, the serial of +the last dev build (bin/lm-dev-build.py), is written as 0 when the file exists, so the dev builds +of the next entry start at ~dev1. -n prints what would change and the git commands instead. """ import argparse +import datetime +import json import pathlib import shlex import subprocess import sys ROOT = pathlib.Path(__file__).resolve().parent -CHANGELOG = ROOT / 'debian-package' / 'debian' / 'changelog' -DEV_SERIAL = ROOT / '.dev-build.serial' +sys.path.insert(0, str(ROOT / 'bin')) + +import changelog # noqa: E402 + +CHANGELOG = ROOT / 'CHANGELOG.md' +#: The settings of the lm-dev scripts, which hold LXD_DEV_BUILD_SERIAL. +DEV_SETTINGS = ROOT / '.lm-dev-config' / 'settings.json' -#: Print the git commands instead of running them; set by -n/--dry-run. +#: Print the changes and the git commands instead of making them; set by -n/--dry-run. DRY_RUN = False @@ -34,67 +48,63 @@ def git(*args): sys.exit(result.returncode) -def summary(): - """The summary of the first changelog entry joined into one line, or None when it has none. - - The summary is the entry's first paragraph: lines indented by exactly two spaces, the - first not a "*" item, with a blank line between it and the header and a blank line after it. - """ - lines = CHANGELOG.read_text(encoding='utf-8').splitlines() - if len(lines) < 4 or lines[1].strip(): - return None - paragraph = [] - for line in lines[2:]: - if not line.strip(): - break - if not line.startswith(' ') or line.startswith(' ') or line.startswith(' -- '): - return None - paragraph.append(line.strip()) - else: - return None - if not paragraph or paragraph[0].startswith('*'): - return None - return ' '.join(paragraph) - - -def version(): - """The tag of the first changelog entry: its version, without the Debian revision when that is 1.""" - first = CHANGELOG.read_text(encoding='utf-8').splitlines()[0] - start, end = first.find('('), first.find(')') - if start == -1 or end < start: - sys.exit(f'{CHANGELOG}: the first line has no version: {first}') - full = first[start + 1:end] - upstream, _, revision = full.rpartition('-') - return upstream if upstream and revision == '1' else full - - def main(): global DRY_RUN parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) - parser.add_argument('-m', '--message', help='commit message; default: the summary of the newest changelog entry, a paragraph not starting with "*" between blank lines right after its header') - parser.add_argument('-n', '--dry-run', action='store_true', help='print the git commands instead of running them') - parser.add_argument('--no-push', action='store_true', help='commit and tag, but do not push') + parser.add_argument('-n', '--dry-run', action='store_true', + help='print the changes and the git commands instead of making them') + parser.add_argument('--push', action='store_true', help='also tag the release and push main and the tag') + parser.add_argument('--no-tag', action='store_true', + help='make an internal release: with --push, push main alone, without a tag') args = parser.parse_args() DRY_RUN = args.dry_run - message = args.message or summary() - if not message: - sys.exit(f'no commit message: pass -m, or start the newest entry of {CHANGELOG} with a summary paragraph ' - 'not starting with "*", indented by two spaces, with a blank line above and below it') - tag = version() + text = CHANGELOG.read_text(encoding='utf-8') + try: + found = changelog.entries(text) + except ValueError as error: + sys.exit(f'{CHANGELOG}: {error}') + if not found or not found[0]['summary']: + sys.exit(f'start the newest entry of {CHANGELOG} with a summary paragraph between blank lines right after ' + 'its heading') + newest = found[0] + message, tag = newest['summary'], newest['version'] if subprocess.run(['git', 'rev-parse', '-q', '--verify', f'refs/tags/{tag}'], cwd=ROOT, capture_output=True).returncode == 0: sys.exit(f'tag {tag} exists; add a new changelog entry first') - git('add', '-A') - git('commit', '-m', message) - git('tag', tag) - if not args.no_push: - git('push', 'origin', 'main', '--tags') - if DRY_RUN: - print(f'echo 0 > {shlex.quote(str(DEV_SERIAL))}') - else: - DEV_SERIAL.write_text('0\n', encoding='utf-8') + log = subprocess.run(['git', 'log', '--format=%s'], cwd=ROOT, capture_output=True, text=True) + committed = log.returncode == 0 and message in log.stdout.splitlines() + dirty = subprocess.run(['git', 'status', '--porcelain'], cwd=ROOT, capture_output=True, + text=True).stdout.strip() != '' + if committed and dirty: + sys.exit(f'{tag} is released; add a new changelog entry for the changes') + if committed and not args.push: + sys.exit(f'{tag} is released; add a new changelog entry, or publish it with --push') + if not committed and not dirty: + sys.exit(f'nothing to commit for {tag}') + if not committed: + if newest['date'] is None: + heading = f'## {tag} - {datetime.datetime.now().astimezone().strftime(changelog.DATE_FORMAT)}' + if DRY_RUN: + print(f'# {CHANGELOG.name}: {heading}') + else: + lines = text.splitlines(keepends=True) + lines[newest['line']] = heading + '\n' + CHANGELOG.write_text(''.join(lines), encoding='utf-8') + git('add', '-A') + git('commit', '-m', message) + if DRY_RUN: + print(f'# LXD_DEV_BUILD_SERIAL of {DEV_SETTINGS} set to 0') + elif DEV_SETTINGS.is_file(): + settings = json.loads(DEV_SETTINGS.read_text(encoding='utf-8')) + settings['LXD_DEV_BUILD_SERIAL'] = 0 + DEV_SETTINGS.write_text(json.dumps(settings, indent=2) + '\n', encoding='utf-8') + if args.push and args.no_tag: + git('push', 'origin', 'main') + elif args.push: + git('tag', tag) + git('push', '--atomic', 'origin', 'main', tag) return 0 diff --git a/tests/remote/README.md b/tests/remote/README.md index b703784..de93c1f 100644 --- a/tests/remote/README.md +++ b/tests/remote/README.md @@ -30,7 +30,7 @@ export LXD_POOL=... ``` ```sh -./build.sh +./build.py bin/lm-dev-run.py core nat s2s ``` @@ -54,7 +54,7 @@ its end. Its first instance is its Vault, `lm-vault` on the bridge `lmt-vault` ( reached by the Mac and the instances on the LXD host's address, port 8200, through a proxy device; every secret reaches an instance through it (see Secrets). The administrator password and the pre-shared key are generated per run and kept in the scenario's Vault, as `/admin` and -`/config`; with `--keep` they stay there. The run leaves `.env` as it is. +`/config`; with `--keep` they stay there. 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. @@ -91,25 +91,41 @@ and alice's password and OpenVPN profile take this way; the admin password is al `/admin`. A WireGuard client's private key is made in the client and never leaves it. A user's TOTP token is the key `-` of the TOTP engine. The VM has the Vault generate it -with `lm-dev-vault totp` and enrols its secret with its current code; the secret is never on the -Mac and cannot be read back from the Vault, which gives the codes (`totp/code/-`). +with `lm-dev-vault totp` and enrols its secret with its current code; the secret cannot be read +back from the Vault, which gives the codes (`totp/code/-`). For the administrator of a VM +made by `lm-dev-vm.py`, the Mac also reads the key's otpauth URL from the VM before the VM removes +its copy, and keeps it as `otp_url` with the password, to add the token to an authenticator app. `lm-dev-vm.py remove` deletes the VM's role, policy, secrets and TOTP keys. The Vault's web UI is at `/ui` of its address, `http://:8200/ui`; it signs in with the root token of `vault-.json`. The state the scripts keep across clean-ups of `tmp/` is in `.lm-dev-config/` at the repository's -root, mode 0700, its files 0600, ignored by git: the project's state and repository key, the -Vault's address, unseal key and root token (`vault-.json`). `tmp/` holds -only what can go: logs and files removed right after use. +root, mode 0700, its files 0600, ignored by git: the scripts' settings (`settings.json`), the +project's state and repository key, the Vault's address, unseal key and root token +(`vault-.json`) and the administrator of each VM `lm-dev-vm.py` made, its `username`, +`password` and the otpauth URL of its TOTP token, `otp_url` (`vm--.json`). `tmp/` holds only what can go: logs and files removed right after use. + +Each variable of the option tables below, and `LXD_DEV_BUILD_SERIAL`, the serial of the last dev +build (see `lm-dev-build.py` below), is read from the environment, else from `settings.json`, a +JSON object of the variables and their values, else it takes its default. A variable without a +default, such as `LXD_REMOTE`, is required: without its option, the script stops and names it. + +```json +{ + "LXD_REMOTE": "my-remote", + "LXD_POOL": "default", + "LXD_FORWARD_ADDRESS": "192.0.2.10" +} +``` ## A VM to work with `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`, a TOTP token for `admin` in the project's Vault unless `--no-otp` is given, +administrator `admin` and a generated password, kept as `username` and `password` in +`.lm-dev-config/vm--.json`, a TOTP token for `admin` in the project's Vault unless `--no-otp` is given, and a configuration from `configs/`, `core.json` by default; `@ETH0@` is the interface of the VM's default route. @@ -141,8 +157,8 @@ bin/lm-dev-vm.py remove `create` needs the project's Vault (`lm-dev-lxd-project.py vault create`): the VM gets its AppRole there, and reads the preseed and the configuration, kept as `/preseed` and -`/config`, and creates the TOTP key `-admin` with it. `remove` deletes the VM, its forward -and what the Vault keeps for it; `.env` is left as it is. Options: +`/config`, and creates the TOTP key `-admin` with it. `remove` deletes the VM, its forward, +its `vm--.json` and what the Vault keeps for it. Options: | Option | Variable | Default | Meaning | |---|---|---|---| @@ -228,12 +244,12 @@ bin/lm-dev-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 | -`lm-dev-build.py` builds and publishes the next dev build. Its version is the newest changelog -entry's with `~dev` 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 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 +`lm-dev-build.py` builds and publishes the next dev build. Its version is the Debian version of +the newest entry of `CHANGELOG.md` with `~dev` before the Debian revision, `0.41.0~dev7-1` for +`0.41.0`, so the release of that entry is newer than its dev builds. `N` is that of the last dev build, +`LXD_DEV_BUILD_SERIAL`, 0 by default; each build that succeeds writes its own, one higher, into +`.lm-dev-config/settings.json`, and `release.py` writes 0 there when it releases, so the next +entry's builds start at `~dev1`. `./build.py` 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`. @@ -249,7 +265,8 @@ read from its state file, so the script takes no `--remote`. `bin/lm-dev-otp-register.py` enrols a new TOTP token for a user of a VM, `admin` of `lm-dev` by default, replacing a token the user had. The project's Vault generates the key `-` in its TOTP engine and hands it to the VM (see Secrets), where the package's `linuxmanager_users` stores -it. `bin/lm-dev-otp-code.py` prints the user's current code, read from the Vault, for the Manager's +it. A new token of the VM's administrator replaces `otp_url` in `vm--.json`. +`bin/lm-dev-otp-code.py` prints the user's current code, read from the Vault, for the Manager's sign-in, SSH or `sudo`. ```sh