From 1825e1efb1fc00323cb7ec99ccd552750f7acf57 Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Sun, 25 Oct 2026 23:44:05 +0100 Subject: [PATCH] fix: the status gives the number of site-to-site connections set up and established, not each connection by name. --- README.md | 7 ++++--- debian-package/debian/changelog | 9 +++++++++ debian-package/src/usr/lib/vpn-router/web | 16 +++++++++------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a5aeb42..00e4fbd 100644 --- a/README.md +++ b/README.md @@ -804,7 +804,7 @@ configuration: no key, identity, subnet, or address but the client's. They show |---|---| | `basic` (default) | The overall status (`ok` or `degraded`), the time and the Client IP | | `standard` | Also the `vpn-router` version, the `vpn-router-manager` version or that it is not installed, and the number of active services and of services in any other state, without their names | -| `full` | Also each service and its state, Docker, and the state of each site-to-site connection, road-warrior, OpenVPN and WireGuard | +| `full` | Also each service and its state, Docker, how many site-to-site connections are set up and how many of them are established (`site_to_site`: `connections` and `established`, `null` when swanctl cannot be asked), road-warrior, OpenVPN and WireGuard | The Client IP is the address the request came from: the last entry of `X-Forwarded-For` for a request from one of `web.trusted_proxies`, by default the address the request came in on, so @@ -852,8 +852,9 @@ road-warrior access is configured, of `wg-quick@wg0` when WireGuard is, and of OpenVPN clients, from the server's status file, which OpenVPN rewrites every minute; the package version and, as `manager_version`, the installed version of `vpn-router-manager` (`null`, shown as not installed, without it); whether Docker is installed, and when it is, the state of `docker.service` and of `vpn-router-docker` -(the Docker rules), which do not change `status`; as `site_to_site.connections`, whether each -site-to-site connection that is set up is established (`null` when swanctl cannot be asked); the number of connected road-warrior (IPsec P2S) clients; and +(the Docker rules), which do not change `status`; as `site_to_site`, the number of site-to-site +connections that are set up (`connections`) and of those established (`established`, `null` when +swanctl cannot be asked), without their names; the number of connected road-warrior (IPsec P2S) clients; and the WireGuard peers with the age of their last handshake and their traffic. `status` is `ok` when all these services are active, and `degraded` otherwise. diff --git a/debian-package/debian/changelog b/debian-package/debian/changelog index 1132798..ff6a9f5 100644 --- a/debian-package/debian/changelog +++ b/debian-package/debian/changelog @@ -1,3 +1,12 @@ +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. diff --git a/debian-package/src/usr/lib/vpn-router/web b/debian-package/src/usr/lib/vpn-router/web index 40b2e6b..33b04ea 100644 --- a/debian-package/src/usr/lib/vpn-router/web +++ b/debian-package/src/usr/lib/vpn-router/web @@ -56,9 +56,9 @@ default the address the call came in on, is the last entry of its X-Forwarded-Fo default, the overall status, the time and the client's address (its address as for the rate limit below); standard also the package version, the installed version of vpn-router-manager (manager_version, null when it is not installed) and the number of active and other services; full -whether each service runs, whether Docker is installed, and the state of each site-to-site connection, road-warrior -(IPsec P2S), OpenVPN and WireGuard. No configuration data or key is shown, and no address but the -client's. +whether each service runs, whether Docker is installed, how many of the site-to-site connections are established +(site_to_site: connections and established, null when swanctl cannot be asked), and road-warrior (IPsec P2S), OpenVPN +and WireGuard. No configuration data, key or connection name is shown, and no address but the client's. The service first initializes, without listening: it makes the signing key and the refresh tokens' database (vpnrouter_auth), retrying every INIT_RETRY_SECONDS until both are ready and @@ -234,8 +234,9 @@ def collect(state): } names = state.get('site_to_site') if isinstance(names, list) and names: - status['site_to_site'] = {'connections': {name: None if count is None else count > 0 - for name, count in established_each(names).items()}} + counts = established_each(names).values() + status['site_to_site'] = {'connections': len(names), + 'established': None if None in counts else sum(1 for count in counts if count)} if state.get('p2s'): status['p2s'] = {'clients': established('road-warrior')} if state.get('wireguard'): @@ -401,8 +402,9 @@ def text_of(status): docker = status['docker'] lines.append('Docker: not installed' if not docker['installed'] else f'Docker: installed, service {docker["service"]}, rules {docker["rules"]}') - for name, value in status.get('site_to_site', {}).get('connections', {}).items(): - lines.append(f'Site to site {name}: {"unknown" if value is None else "established" if value else "not established"}') + if 'site_to_site' in status: + established, connections = status['site_to_site']['established'], status['site_to_site']['connections'] + lines.append(f'Site to site: {"unknown" if established is None else established} of {connections} established') if 'p2s' in status: clients = status['p2s']['clients'] lines.append(f'Road-warrior (IPsec P2S): {"unknown" if clients is None else f"{clients} connected"}')