From 4d1087e3570409b210d79f996238363f436d8de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sat, 28 Nov 2026 17:36:53 +0100 Subject: [PATCH] v0.43.1 --- CHANGELOG.md | 61 +- Cargo.lock | 2 +- Cargo.toml | 8 +- Dockerfile | 1 - SHA256SUMS | 318 +++--- UPDATE_CHECK.toml | 3 - deploy/rustproxy.service | 3 - dev.sh | 2 - docker-agent/containers.go | 12 +- docker-agent/credentials.go | 12 +- docker-agent/diagnostics.go | 4 - docker-agent/docker.go | 5 +- docker-agent/enroll.go | 2 - docker-agent/install.sh | 1 - docker-agent/main.go | 8 +- docker-agent/main_test.go | 2 +- docker-agent/model.go | 2 +- docker-agent/network.go | 1 - docker-agent/server.go | 2 - docker-agent/system.go | 3 - install-debian13.sh | 16 - install.sh | 1 - .../routeros-oci-build/Dockerfile.routeros | 1 - .../routeros-oci-build/build-routeros-oci.sh | 6 - langs/en_US.json | 83 +- langs/pl_pl.json | 83 +- make_zip.py | 14 +- migrations/0002_admin.sql | 1 - migrations/0003_certificate_renewals.sql | 2 - migrations/0004_admin_preferences.sql | 2 - migrations/0005_certificate_api.sql | 2 - .../0006_certificate_api_credentials.sql | 3 - migrations/0007_secret_store.sql | 2 - migrations/0009_certificate_api_grants.sql | 3 - migrations/0010_dashboard_presets.sql | 2 - migrations/0012_admin_preferences_size.sql | 2 - nagios/check_rustproxy.py | 14 +- scripts/audit_css_usage.py | 20 - scripts/build-release.sh | 4 - scripts/build/panel_css.py | 18 - scripts/build/swagger_assets.py | 23 +- scripts/deploy/deploy.py | 6 +- scripts/deploy/deploy_core.py | 32 - scripts/deploy/deploy_runtime.py | 29 +- scripts/deploy/upgrade.py | 6 - scripts/generate_cf_pages.py | 10 - scripts/migration/migrate_npm.py | 6 +- scripts/migration/migrate_npm_api.py | 7 +- scripts/migration/migrate_npm_core.py | 18 - scripts/preflight.py | 2 - scripts/runtime/acme_provider.py | 29 - scripts/runtime/acme_rfc2136.py | 2 +- scripts/start_stream_backends.sh | 3 - scripts/version.py | 2 - src/acl/dynamic/mod.rs | 1 - src/acme/headless.rs | 25 - src/admin/cache_rules.rs | 23 +- src/admin/certificates.rs | 1 - src/admin/file_logs.rs | 11 - src/admin/file_logs_io.rs | 3 - src/admin/file_logs_query.rs | 7 - src/admin/logging_api.rs | 4 - src/admin/openapi.json | 2 +- src/admin/operations.rs | 9 - src/admin/session.rs | 2 - src/admin/status.rs | 2 - src/admin/tests.rs | 1 - src/admin/web/acl-picker.js | 9 +- src/admin/web/acme.js | 83 +- src/admin/web/app/chart-scales.js | 9 - src/admin/web/app/core.js | 8 +- src/admin/web/app/icons.js | 3 +- src/admin/web/app/overview-extra-metrics.js | 2 - src/admin/web/app/overview-rows.js | 3 - src/admin/web/app/preferences.js | 5 - src/admin/web/app/runtime.js | 313 ++++-- src/admin/web/cache-panel.js | 4 +- src/admin/web/cache-rules.js | 45 - src/admin/web/css/10-base.css | 5 - src/admin/web/css/30-overview.css | 11 +- src/admin/web/css/40-editors.css | 24 +- src/admin/web/css/50-settings.css | 734 ++++++++++++- src/admin/web/css/55-policy.css | 3 - src/admin/web/css/60-monitoring.css | 343 +++++- src/admin/web/css/70-responsive.css | 8 - src/admin/web/docker.js | 11 - src/admin/web/host404.js | 3 +- src/admin/web/index.html | 974 ++++++++++-------- src/admin/web/integrations.js | 1 - src/admin/web/management.js | 8 - src/admin/web/partials/overview-charts.html | 6 +- src/admin/web/partials/overview-metrics.html | 42 +- src/admin/web/redirects.js | 8 +- src/admin/web/settings.js | 11 - src/admin/web/streams.js | 4 - src/admin/web/traffic-panel.js | 102 +- src/admin/web/vhosts/balancing.js | 14 - src/admin/web/vhosts/core.js | 7 - src/admin/web/vhosts/headers-tab.js | 9 - src/admin/web/vhosts/render.js | 14 +- src/admin/web/vhosts/routing.js | 12 +- src/admin/web/vhosts/source.js | 3 - src/admin/web/web-server-profiles.js | 1 - src/admin/web/web-server.js | 7 +- src/balance/hash_tests.rs | 9 - src/balance/health.rs | 5 - src/balance/model.rs | 23 - src/balance/pool_core.rs | 20 - src/balance/pool_selection.rs | 1 - src/basic_auth/mod.rs | 3 - src/cache/cache_regression_tests.rs | 7 - src/cache/fill.rs | 2 - src/cache/model/maintenance.rs | 15 - src/cache/policy/decision.rs | 77 -- src/cache/policy/decision_tests.rs | 10 - src/cache/policy/request.rs | 2 - src/cache/policy/response.rs | 17 +- src/cache/rules.rs | 1 - src/cache/rules_tests.rs | 1 - src/config/routing_conditions_tests.rs | 4 - src/diagnostics.rs | 1 - src/headers/mod.rs | 14 - src/headers/tests.rs | 2 - src/hex.rs | 5 - src/logging/error_runtime.rs | 1 - src/logging/format.rs | 2 - src/logging/runtime.rs | 7 - src/logging/tests.rs | 2 - src/main/admin_runtime.rs | 1 - src/main/bootstrap.rs | 28 - src/main/headless.rs | 12 - src/pages/mod.rs | 1 - src/policy/compile.rs | 5 - src/policy/engine.rs | 3 - src/proxy/body/mod.rs | 5 - src/proxy/cache_helpers.rs | 1 - src/proxy/error_fallback.rs | 3 - src/proxy/forward/cache_fast_path_tests.rs | 2 - .../forward/static_cookie_policy_tests.rs | 37 - src/proxy/forward/web_source.rs | 2 - src/runtime/external_config.rs | 8 - src/runtime/headless_tls.rs | 51 - src/runtime/headless_tls_tests.rs | 17 - src/runtime/health_endpoint.rs | 3 - src/runtime/tests.rs | 2 - src/runtime/updates.rs | 2 - src/vhost/conditions.rs | 13 - src/web_server/config/compile.rs | 3 - src/web_server/config/model.rs | 3 - src/web_server/config/validation.rs | 2 - src/web_server/fastcgi/protocol.rs | 10 - src/web_server/fastcgi/response.rs | 3 - src/web_server/htaccess/model.rs | 6 - src/web_server/htaccess/parse.rs | 6 - src/web_server/htaccess/rewrite.rs | 1 - src/web_server/request.rs | 1 - src/web_server/serve.rs | 15 - src/web_server/tests.rs | 8 - tools/legacy/backup.py | 4 - update.sh | 5 - 160 files changed, 2407 insertions(+), 1933 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 084f43c..50a2718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,44 @@ Release history focused on **features, settings, default behavior, compatibility and fixes**. Changes to internal code structure and preliminary performance experiments are intentionally omitted. Historical descriptions reflect their respective releases; consult the current documentation for the settings available in the latest release. +## 0.43.1 — Panel redesign: Settings, redirects, 404 hosts, streams, default responses, security + +- **Appearance corner style everywhere:** 37 more bordered elements now follow Settings → Appearance → corners (previously always square): ACL policy cards, builder and preview with their condition/step tags, listener cards and active-listener summary, chip editors (hostnames, Prometheus CIDRs, stream sockets) and their chips, Vhost card charts, detail strips and live metrics, the "www" panel and the enable switch row, load-balancing simulator and HAProxy equivalent, route tester, header cards, previews and empty states, HTTP policy empty state, Docker service rows and agent summary, Settings shortcuts and the chart palette swatches. With the default corner style the panel looks exactly as before. +- **Language switch without reload:** TLS policy presets and help, the backend details toggle, the Docker "Live view" tooltip, the traffic chart legend ("Total"), and the Settings / Rules & headers tab labels for screen readers now follow a language change immediately. Polish: corrected missing diacritics in the diagnostic headers help, translated the OVH key fields, the ACME terms-of-service error and "Cold cache". +- **Narrow screens:** the Backends "Columns" menu on the Overview stays inside the screen on phones (it extended beyond the right edge at 390 px). +- **Redirects redesign:** tabs Details / Frontend / Rules · N. Rules are a rule table (order, state, match, path, status → target, chips for scheme, path and query handling and cache); an expanded rule shows **When** and **Where** with the target type as choice cards and a label that follows the type, plus Copy and Remove. **Add rule** offers five starting points. A URL tester evaluates the unsaved rules exactly like the proxy (verified against live responses for exact/prefix, strip/append/replace, query preserve/drop, percent-encoded and repeated slashes). Cards show state, rule count, listeners, certificate, protocols and the rule table, and can be enabled/disabled directly (disabling asks for confirmation). +- **404 hosts redesign:** tabs Details / Frontend / Response. The response type is chosen with cards (placeholder, application status page, Cloudflare style with variant, status only, custom HTML) and shown in a sandboxed preview with **Open in a new tab**. New endpoint `GET /api/pages/preview` renders local pages for the panel session with a `sandbox` CSP (scripts in custom HTML do not run); custom HTML is previewed from the saved host. Cards show state, status, listeners, certificate, protocols, Preview and an enable/disable action. +- **Streams redesign:** tabs Details / Listener & upstream / Backends · N / Health / Limits. Backends are table rows with live health and sessions, Copy and Remove; health checks of all backends are in the Health tab. Cards show the state, protocol, backend count and balancing, health summary, limits, per-backend health with colored state and the existing live metrics and chart; streams can be enabled/disabled from the card. +- **Fixed:** stream cards showed “Pending restart” for running streams because the status JSON (sorted keys) was compared as text with the configuration; structures are now compared. Hidden switch rows (`.check[hidden]`) stayed visible: the RFC2136-only “Sign SOA discovery query” option on other certificate sources, HSTS sub-options while HSTS is off and the passive health counters while passive health is off now hide as intended (their values were already ignored). The certificate source hint could show the raw key `providerHint_http01` until the language pack loaded. +- **Corner style:** location rows and their headers, header rows, policy builders, www domain pairs, Docker label help, agent security notes, HTTP listener rows, sparklines (clipped to the box) and the new editors follow the Appearance corner setting; the audit with all Vhost/Docker/Settings/Certificate tabs and sections expanded finds no bordered or filled element left out. +- Saving unchanged redirects, 404 hosts and streams produces the same configuration in 0.42.4 and 0.43.1; scripted edit sequences produce exactly the expected configuration. +- **Settings redesign:** search and the Security / Vhosts shortcuts share one toolbar; the tab list is grouped (Panel, Network & input, Traffic & responses, Observability, Administration, TLS & certificates) with the active tab marked like the other editors, and the search also hides empty groups. Sub-tabs inside settings pages and the certificate views (Installed / Renewal / Generate) use the underlined tabs of the Vhost editor. Documentation links are styled as links. +- **Docker agents (Settings):** each agent is a row (state, name and ID, endpoint, transport security, connection status, Enabled); expanded, it shows the provisioning code, diagnostics and four sections — Connection, Authentication & TLS, Domains & certificates, Default publishing (listeners, default backend IP, ACL profiles, Docker label publishing) — with Test connection and Remove. Every field and action of 0.42.4 remains; expanded rows stay open across live refreshes, and a validation error opens the row that holds the field. Help texts use the regular help style; the Agent ID field is aligned with the name. +- **Listeners (Settings):** an expanded listener is split into Identity & addresses and Protocols (with the HTTP/2 and HTTP/3 settings links). A validation error in a collapsed listener or any closed section now opens it before focusing the field. +- Saving every Settings form without changes produces the same configuration in 0.42.4 and 0.43.1; Docker agent and listener edit sequences produce exactly the expected configuration. +- **Default responses (Settings and Vhost → Pages):** every slot (direct IP, unknown host, static/maintenance host, unmatched path, each error code) is one compact row with when it is used and its current response; the selected row opens its response-type chips, Cloudflare variant, status and custom HTML. One shared, sandboxed preview shows the selected row (built-in pages are rendered live; custom HTML is shown in its saved version). Custom error pages show how many codes are set. All previous options and the "Switch all to Cloudflare style" switch are unchanged. +- **Admin API:** `GET /api/pages/preview` also accepts `slot` (`direct_ip`, `unknown_host`, `response`, `fallback`, `error-`) and optional `vhost` to preview saved custom HTML of global and Vhost default responses; the response stays sandboxed (`Content-Security-Policy: sandbox`) and same-origin framable only. +- **Cache settings:** a request flow (Client → Rules → HOT → COLD → Backend) built from the current form values — rules and bypass prefixes, memory and entry limits, cold cache, grace and stale-if-error — with HIT/MISS/BYPASS legend; each step opens its tab. The Resilience tab starts with a freshness timeline (stored → proactive refresh → TTL expired/grace → backend failing). No statistics are shown there. +- **Response transformation settings:** a flow (Backend → Decompress → Transform → Cache → Compress → Client) with the enabled operations and size limit, and a before/after example per type (CSS, JSON, HTML, SVG, JS) that shows what the built-in minifiers really produce. Each operation switch describes what it changes. +- **Security settings:** summary tiles (administrator and session, API tokens RO/RW, host access policies) that jump to their sections; the account section comes first. The host policy default decision is chosen with two cards, and a simulator tests client IPs against the policy being edited with the same rules as the proxy (deny wins, then allow, otherwise default; IPv4-mapped IPv6 as IPv4; hostname rules are not simulated). +- **Corner style, nested blocks:** a block inside a dialog, card, Settings page or floating panel (drafts dock, menus, popovers) uses a smaller radius than its container (subtle 3 px, rounded 6 px, extra 8 px) instead of the full surface radius, and a dialog body is no longer drawn as a second framed block inside the dialog. Draft rows in the drafts dock are flat list rows. Square style is unchanged. +- **Settings → Rules & headers:** the tabs and their pages are one card, like HTTP connections (previously the tab bar was a separate card above each page's own card); the section headings sit below the tabs. +- **Settings → Response transformation:** each operation is a small tile with its switch, name and a description below it (the description no longer squeezes in next to the switch). +- **Editor dialogs (Vhost, Redirect, 404 host, Stream):** the tabs follow the title row directly. The line between them moved: the backend health summary (or "save the vhost to start observing backends") is at the top of the Backend health tab, stream live metrics (sessions, RX/TX, errors) at the top of the Backends tab; the redirect/404 "ID · hostnames" line is dropped because the ID is in the title pill and hostnames are in the Frontend tab. +- **Certificates redesign:** + - **Installed:** summary tiles (certificates by type, expiring soon, assignments, ACME environment) and a searchable list with filters (all / expiring / unassigned). Each row shows state, ID and type, domains, days left with a bar, and how many places use it. + - **Expanded row:** "Where it is used" groups vhosts, redirects, 404 hosts and Docker agents with their hostnames, shows whether the certificate covers each hostname, and opens the item's editor. It also shows details, renewal status and files. All previous actions remain: Assign vhosts, Reload, Edit, Delete (blocked while in use). + - **Assign vhosts dialog:** search; filters for vhosts matching the certificate's domains, assigned vhosts or all; coverage per vhost; the certificate each vhost has now; a summary of the changes before applying. A vhost whose hostnames the certificate does not cover can be selected only if it already accepts a certificate mismatch, the same rule the configuration enforces. + - **Renewal:** one row per ACME certificate with last check → next check → expiry and all actions (check now, dry run, force, enable/disable automatic renewal). + - **Generate / import:** the source is chosen in three steps: mode (ACME / import PEM / existing files), validation (HTTP-01 / DNS-01) and a searchable DNS provider list, so more providers fit without a longer form. The ACME runtime status is a one-line strip in Generate, and a summary tile elsewhere; it is shown on every tab when the runtime is unavailable. +- **Traffic redesign:** + - **Header and tabs:** scope selector with recently used scopes, refresh, auto and "Collected dimensions…" in one bar; underlined tabs like the rest of the panel. + - **Overview:** five tiles (requests, errors with share, response/request bytes, mean latency, dropped samples) and a strip with the collected dimensions and a link to the logging settings. Methods, status classes and cache outcomes are 100 % stacked bars with counts and shares instead of donuts. Top paths and top client IPs come with shares and an "other" row. + - **Clients / Requests / Delivery:** the same lists as before (countries, User-Agents, client IPs, paths, routes, methods, statuses, cache, volume) as ranked lists with shares. Clicking a value still copies it. + - **Missing data:** when country collection is off or GeoIP is missing, the panel shows one sentence with a settings link instead of an empty chart. +- **Admin panel internals:** vhosts, redirects and 404 hosts expose `edit(id)` so other views (Certificates → Where it is used) can open their editors. +- **Debian 13 install/update script:** the build user's home (Cargo registry and Rust toolchain) moved from `/var/tmp/rustproxy-build` to `/var/lib/rustproxy-build`. systemd-tmpfiles removes files older than 30 days from `/var/tmp`, which left the Cargo registry incomplete and broke updates from source with errors such as "can't find `example` bin at `src/bin/example.rs`" (alloc-stdlib). Existing installations are moved automatically, and the extracted registry sources are refreshed before each build. + ## 0.43.0 — Unified info tooltips, Docker Headers section, FastCGI I/O buffering - **Information icons and bubbles:** every "i" information icon in the panel (Overview widgets, Cache settings, FastCGI profiles) and the Docker label help "?" button now share one look that follows Settings → Appearance (corner style, theme colors, UI scale). The "?" button still opens the label help dialog. Information bubbles open next to their icon, stay inside the visible area (horizontal shift, open upwards near the bottom), close on Escape or a click elsewhere, and only one is open at a time. Long help text inside a bubble is no longer collapsed to two lines in Settings. @@ -14,29 +52,6 @@ Release history focused on **features, settings, default behavior, compatibility - **FastCGI / PHP-FPM:** TCP connections to the responder use `TCP_NODELAY`; request records are buffered (one write for requests without a body), responses are read through a buffer, and already-received `STDOUT` records are merged into larger body chunks without delaying streamed output. Measured on a local PHP-FPM 8.3 pool: about 5 instead of 15 read/write system calls per small PHP request and 13 instead of 27 for a 200 KB page; throughput on the 2-core test machine stayed within measurement noise. Timeouts, limits, error handling and truncation behavior are unchanged; new regression tests cover many small records with interleaved stderr and a 200 KB upload, prompt delivery of flushed output, and a truncated stream. - **Panel stylesheet cleanup:** removed rules for classes that no element uses (`cache-reason`, `runtime-information-grid`, `overview-layout-hidden-item`), 20 declarations that a later rule with the same selector always overrides, an empty rule, and two references to undefined custom properties (replaced by their effective fallback). Removed `app/dashboard-layout-editor.js`, which has not been part of the panel bundle since 0.33.7 and targeted elements that no longer exist. Rendering is unchanged. - Fixed the label of the selected-backend diagnostic header: it is `X-RustProxy-Backend`. -- **Appearance corner style everywhere:** 37 more bordered elements now follow Settings → Appearance → corners (previously always square): ACL policy cards, builder and preview with their condition/step tags, listener cards and active-listener summary, chip editors (hostnames, Prometheus CIDRs, stream sockets) and their chips, Vhost card charts, detail strips and live metrics, the "www" panel and the enable switch row, load-balancing simulator and HAProxy equivalent, route tester, header cards, previews and empty states, HTTP policy empty state, Docker service rows and agent summary, Settings shortcuts and the chart palette swatches. With the default corner style the panel looks exactly as before. -- **Language switch without reload:** TLS policy presets and help, the backend details toggle, the Docker "Live view" tooltip, the traffic chart legend ("Total"), and the Settings / Rules & headers tab labels for screen readers now follow a language change immediately. Polish: corrected missing diacritics in the diagnostic headers help, translated the OVH key fields, the ACME terms-of-service error and "Cold cache". -- **Narrow screens:** the Backends "Columns" menu on the Overview stays inside the screen on phones (it extended beyond the right edge at 390 px). -- **Redirects redesign:** tabs Details / Frontend / Rules · N. Rules are a rule table (order, state, match, path, status → target, chips for scheme, path and query handling and cache); an expanded rule shows **When** and **Where** with the target type as choice cards and a label that follows the type, plus Copy and Remove. **Add rule** offers five starting points. A URL tester evaluates the unsaved rules exactly like the proxy (verified against live responses for exact/prefix, strip/append/replace, query preserve/drop, percent-encoded and repeated slashes). Cards show state, rule count, listeners, certificate, protocols and the rule table, and can be enabled/disabled directly (disabling asks for confirmation). -- **404 hosts redesign:** tabs Details / Frontend / Response. The response type is chosen with cards (placeholder, application status page, Cloudflare style with variant, status only, custom HTML) and shown in a sandboxed preview with **Open in a new tab**. New endpoint `GET /api/pages/preview` renders local pages for the panel session with a `sandbox` CSP (scripts in custom HTML do not run); custom HTML is previewed from the saved host. Cards show state, status, listeners, certificate, protocols, Preview and an enable/disable action. -- **Streams redesign:** tabs Details / Listener & upstream / Backends · N / Health / Limits. Backends are table rows with live health and sessions, Copy and Remove; health checks of all backends are in the Health tab. Cards show the state, protocol, backend count and balancing, health summary, limits, per-backend health with colored state and the existing live metrics and chart; streams can be enabled/disabled from the card. -- **Fixed:** stream cards showed “Pending restart” for running streams because the status JSON (sorted keys) was compared as text with the configuration; structures are now compared. Hidden switch rows (`.check[hidden]`) stayed visible: the RFC2136-only “Sign SOA discovery query” option on other certificate sources, HSTS sub-options while HSTS is off and the passive health counters while passive health is off now hide as intended (their values were already ignored). The certificate source hint could show the raw key `providerHint_http01` until the language pack loaded. -- **Corner style:** location rows and their headers, header rows, policy builders, www domain pairs, Docker label help, agent security notes, HTTP listener rows, sparklines (clipped to the box) and the new editors follow the Appearance corner setting; the audit with all Vhost/Docker/Settings/Certificate tabs and sections expanded finds no bordered or filled element left out. -- Saving unchanged redirects, 404 hosts and streams produces the same configuration in 0.42.4 and 0.43.0; scripted edit sequences produce exactly the expected configuration. -- **Settings redesign:** search and the Security / Vhosts shortcuts share one toolbar; the tab list is grouped (Panel, Network & input, Traffic & responses, Observability, Administration, TLS & certificates) with the active tab marked like the other editors, and the search also hides empty groups. Sub-tabs inside settings pages and the certificate views (Installed / Renewal / Generate) use the underlined tabs of the Vhost editor. Documentation links are styled as links. -- **Docker agents (Settings):** each agent is a row (state, name and ID, endpoint, transport security, connection status, Enabled); expanded, it shows the provisioning code, diagnostics and four sections — Connection, Authentication & TLS, Domains & certificates, Default publishing (listeners, default backend IP, ACL profiles, Docker label publishing) — with Test connection and Remove. Every field and action of 0.42.4 remains; expanded rows stay open across live refreshes, and a validation error opens the row that holds the field. Help texts use the regular help style; the Agent ID field is aligned with the name. -- **Listeners (Settings):** an expanded listener is split into Identity & addresses and Protocols (with the HTTP/2 and HTTP/3 settings links). A validation error in a collapsed listener or any closed section now opens it before focusing the field. -- Saving every Settings form without changes produces the same configuration in 0.42.4 and 0.43.0; Docker agent and listener edit sequences produce exactly the expected configuration. -- **Default responses (Settings and Vhost → Pages):** every slot (direct IP, unknown host, static/maintenance host, unmatched path, each error code) is one compact row with when it is used and its current response; the selected row opens its response-type chips, Cloudflare variant, status and custom HTML. One shared, sandboxed preview shows the selected row (built-in pages are rendered live; custom HTML is shown in its saved version). Custom error pages show how many codes are set. All previous options and the "Switch all to Cloudflare style" switch are unchanged. -- **Admin API:** `GET /api/pages/preview` also accepts `slot` (`direct_ip`, `unknown_host`, `response`, `fallback`, `error-`) and optional `vhost` to preview saved custom HTML of global and Vhost default responses; the response stays sandboxed (`Content-Security-Policy: sandbox`) and same-origin framable only. -- **Cache settings:** a request flow (Client → Rules → HOT → COLD → Backend) built from the current form values — rules and bypass prefixes, memory and entry limits, cold cache, grace and stale-if-error — with HIT/MISS/BYPASS legend; each step opens its tab. The Resilience tab starts with a freshness timeline (stored → proactive refresh → TTL expired/grace → backend failing). No statistics are shown there. -- **Response transformation settings:** a flow (Backend → Decompress → Transform → Cache → Compress → Client) with the enabled operations and size limit, and a before/after example per type (CSS, JSON, HTML, SVG, JS) that shows what the built-in minifiers really produce. Each operation switch describes what it changes. -- **Security settings:** summary tiles (administrator and session, API tokens RO/RW, host access policies) that jump to their sections; the account section comes first. The host policy default decision is chosen with two cards, and a simulator tests client IPs against the policy being edited with the same rules as the proxy (deny wins, then allow, otherwise default; IPv4-mapped IPv6 as IPv4; hostname rules are not simulated). -- **Corner style, nested blocks:** a block inside a dialog, card, Settings page or floating panel (drafts dock, menus, popovers) uses a smaller radius than its container (subtle 3 px, rounded 6 px, extra 8 px) instead of the full surface radius, and a dialog body is no longer drawn as a second framed block inside the dialog. Draft rows in the drafts dock are flat list rows. Square style is unchanged. -- **Settings → Rules & headers:** the tabs and their pages are one card, like HTTP connections (previously the tab bar was a separate card above each page's own card); the section headings sit below the tabs. -- **Settings → Response transformation:** each operation is a small tile with its switch, name and a description below it (the description no longer squeezes in next to the switch). -- **Editor dialogs (Vhost, Redirect, 404 host, Stream):** the tabs follow the title row directly. The line between them moved: the backend health summary (or "save the vhost to start observing backends") is at the top of the Backend health tab, stream live metrics (sessions, RX/TX, errors) at the top of the Backends tab; the redirect/404 "ID · hostnames" line is dropped because the ID is in the title pill and hostnames are in the Frontend tab. -- **Debian 13 install/update script:** the build user's home (Cargo registry and Rust toolchain) moved from `/var/tmp/rustproxy-build` to `/var/lib/rustproxy-build`. systemd-tmpfiles removes files older than 30 days from `/var/tmp`, which left the Cargo registry incomplete and broke updates from source with errors such as "can't find `example` bin at `src/bin/example.rs`" (alloc-stdlib). Existing installations are moved automatically, and the extracted registry sources are refreshed before each build. ## 0.42.4 — Vhost/global error pages for generated Web Server and Basic Auth failures diff --git a/Cargo.lock b/Cargo.lock index ece2271..e246480 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1914,7 +1914,7 @@ dependencies = [ [[package]] name = "rust-proxy" -version = "0.43.0" +version = "0.43.1" dependencies = [ "anyhow", "arc-swap", diff --git a/Cargo.toml b/Cargo.toml index b4cac97..7bd60e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust-proxy" -version = "0.43.0" +version = "0.43.1" edition = "2021" rust-version = "1.99.1" description = "RustProxy - independent reverse proxy with local administration" @@ -35,7 +35,6 @@ regex = "1.13.2" serde = { version = "1.0.229", features = ["derive"] } serde_json = "1.0.154" sqlx = { version = "0.9.1", default-features = false, features = ["runtime-tokio", "sqlite"] } -# Security floor: SQLx allows >=0.30.1,<0.41; 0.39+ bundles SQLite with CVE-2026-119375 fixed. libsqlite3-sys = { version = "0.40.0", default-features = false } subtle = "2.6.1" tokio = { version = "1.54.1", features = ["macros", "rt-multi-thread", "net", "signal", "time", "sync", "fs", "io-util", "process"] } @@ -48,7 +47,6 @@ url = "2.5.8" base64 = "0.23.1" sha1 = "0.11.0" rustls = { version = "0.23.46", default-features = false, features = ["ring", "aws_lc_rs", "std", "tls12"] } -# Security floor: 0.103.16 rejects distrusted emSign intermediates (RUSTSEC-2026-0382). rustls-webpki = { version = "0.103.16", default-features = false } ring = "0.17.14" tokio-rustls = { version = "0.26.6", default-features = false, features = ["ring", "tls12"] } @@ -65,7 +63,6 @@ zstd = "0.14.4" h3 = { package = "hpx-h3", version = "=2.6.1", features = ["quinn"] } quinn = { version = "0.11.12", default-features = false, features = ["runtime-tokio", "rustls-ring"] } -# Security floor: 0.11.19 fixes the Nov 2026 QUIC DoS advisories RUSTSEC-2026-0523/0524. quinn-proto = { version = "0.11.19", default-features = false } socket2 = "0.6.5" @@ -75,9 +72,6 @@ sysinfo = { version = "0.40.4", default-features = false, features = ["network", [target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "dragonfly", target_os = "macos", target_os = "windows"))'.dependencies] systemstat = "=0.2.8" -# Swagger assets are prepared by build.rs and embedded behind the admin guard. -# No adapter build script, implicit version fallback or Cargo-config dependency. - [features] default = [] mimalloc = ["dep:mimalloc"] diff --git a/Dockerfile b/Dockerfile index 375444b..064f9ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ COPY . . RUN if [ ! -f Cargo.lock ]; then cargo generate-lockfile; fi \ && cargo build --locked --release - FROM debian:trixie-slim AS runtime RUN apt-get update \ diff --git a/SHA256SUMS b/SHA256SUMS index edb3777..d6d88b9 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -2,41 +2,41 @@ 4140a2956264b44f259e6a37fc00ba02097bbe68b09296e04d3d243c1287129b .env.example 0a5e87541831edca0e7164c6469dba01a8a7053ab14dbfb8019c83e4db10edc2 .gitignore 903ca521af6ef7e54f83dc0b4b0436d116c88f064c36f0317b689b7cce79ab27 AGENTS.md -36b5e26d4f740fb562b3422a63708daaa49452dbb336d3826b448ef8a74116fa CHANGELOG.md -1ed75ec0adde5af3a0fe565689b45a973c5dad8a8e382ea279f631d9688f7326 Cargo.lock -8bfe4cf8793a43e61ad29a013092069381c51120f85c1ef358fd048d6a22556e Cargo.toml -788745d4f70a0382c6280020afbd48844bb2af65e835a826852143f8132cdeca Dockerfile +59315eb5b4558c548157d816f0cc4ad65013f8c9a7923c7e4af4ba8838df2c4d CHANGELOG.md +062486dade9ca64ed26710775cc991489c75dc475f624a334c0fa881be526e32 Cargo.lock +216f2434431a6eb3b717b8cd5a783f5dda4f60f281b96ffd512919218953e6a6 Cargo.toml +9141c5c5a0923b08ec1e746a7ed10c20ba0a29e67f4302698fa1c2913c6ee66f Dockerfile 0d96a4ff68ad6d4b6f1f30f713b18d5184912ba8dd389f86aa7710db079abcb0 LICENSE a8d456f1b84dbc5f412f7dda9b98b4e765578111d31e7b26027aeb83c26f3f54 README.md -da8311e3db945290666324a2f24bf4521b365272d7ac3f862ded1be993eea646 UPDATE_CHECK.toml +3bf42bf13da17d8b86af2cba1d8a3c24df977d6a509e906d8fa6be93e390b809 UPDATE_CHECK.toml 120609370b79e192c9a2a72c1706225aa5da06c5806efa26a010b733e120322b build.rs 95ececaba550a4bcfd6754073877ba0633373b1e1451521b9ac905a51e8ca6eb deploy/README.md -13d514de5042a230cacf8c10abe1ef183c94ac799a89b8e2c111152ac7c69b48 deploy/rustproxy.service -f743b9e61528453ecedc637678ab42d2d4415a8b0923de15df5335110e1d1777 dev.sh +8808962a936434827842d849c0a923ad0de5c3e445f0cada7ceaab6f0dead20e deploy/rustproxy.service +762141198385b4c1c149b8087629cfdf9f336833d8517d6fb69b12fc4c0d86ce dev.sh e8996fdf05a0a9e317e0ab5cd4139d037c6ca272173b7b5d30d2da7256feafd4 docker-agent/README.md e9f18b358a740f1fe16e369ed16ee37581b8ce4c94ddeb34a1a37b89a49b5a06 docker-agent/certificate.go 600d5aebc8557d6987158969d494bade1ba46ccf9d1cd573d357d0106db26b2b docker-agent/cli_test.go -105f82d7a805a4b485bd1c4fe87f4c6bc6de607b2a1a9ffb825857795bd983be docker-agent/containers.go -067793eee01fd284da66f79c6f8b6f19f8773e64f84af03168c8f751ff044685 docker-agent/credentials.go -b3fe278c181abaa4e83d0743923740ce4449faffa9a1ab2c2fe9c185e9b955bf docker-agent/diagnostics.go +c1a509142ab8fd192ad4e0e2e59c4ccd480cdbf7d74b9d099fba9aebe6907b5a docker-agent/containers.go +28cd512e31e64aab1d70b237331a26c7da16ccf7c0ae8e1606cd631d1f773174 docker-agent/credentials.go +3dc61ac72052cecf914772e8530795b3d4bb28d0684ce2ddb6117fbb5f687e37 docker-agent/diagnostics.go 5140f45740a95817f711cffbbc096a378a137c506d3ded89c65a15e1e078e221 docker-agent/disk_linux.go 6ad4958e72e96e1623b396ba47e6c5f7dc2effe6244833030fbe769ca3ae4e02 docker-agent/disk_other.go 86f1259a7619f5d19500d833e515d67376464851878a84dd2a677350fd2344d6 docker-agent/docker-agent.env.example -29021c42bc4f22fd6c0b7fcd0263fd170ea1c070584affbdcb80e4e3510e47b1 docker-agent/docker.go -6b7c90bca93c5e61c4c555ca373dc5bdaa5df172f4ab583b291557f3e7364c06 docker-agent/enroll.go +83c983e508c436ad19e7de49dc41fcca9c11f159e61438432b928f576a68297f docker-agent/docker.go +82474bc772668bca128f230490ba575632bf1c8a177e997ffd3ad807a4607e9f docker-agent/enroll.go 10a2b07617f0fb68e63adc1a03db035d24e564a23244310407056bb76715762f docker-agent/enroll_test.go 9e9f3f17f38f9b0730f598f65988ce8ef562d2182ef6778fc7292b990e9cf22f docker-agent/go.mod -b849d39e94878c5a754c3d109d8e4b5e37609cfd2a0e05601a35271f4d95271e docker-agent/install.sh -314a3a8d2c7677e8e25725247b62c4d094e95416aec1ffd6cbf54251904cc1da docker-agent/main.go -d660f46f7ef8c539dd3f5486a31d5a1254b9737be8a278c7f9352c254558f8ac docker-agent/main_test.go -d3ceee01252c1b7280a7f0d38828def899c3e3baeb62c27c7946fac23918c7f7 docker-agent/model.go -1d13a7930bebc3e60033a7fd7e0b609b2c62ee03bb17ea5add07e91ef8d268ae docker-agent/network.go +3484163046f9e6360ad5dca5fb1c2cb8f0dde8e1060b67b34116c676cd0a43fd docker-agent/install.sh +37202f83984bf4e794cda54e942d78fcd8704f6822784ff6c0f1cad4b66eb231 docker-agent/main.go +02409ed5f7ae6a54073f9d26138b77266610f3dd44a017cc7f867ffe55d549e5 docker-agent/main_test.go +1c7c74c7a98a83c2abf422e14a98118a437cc8866ecfd9bde1082a013ebe00d1 docker-agent/model.go +ba72e0e0c391041fe0596e544120a0bd16123107173dd39036fb501acff94b4b docker-agent/network.go 6e2e13136fd8198c2d64dfd0612dfc91c4a9c0a952e71b3b24c9614a72b083aa docker-agent/network_proc_test.go 021e0799a95a7c76bc245ff464d94b4495ce0d22555ca202579bd5f45e4be794 docker-agent/provision.go 4a737e5922c2255492c85d5afc053cd15d9e5b83cada648369cfdeeecdbfaa92 docker-agent/runtime.go 4e64abc321d4149a4982e2acb091c1b2c6fd3584693935b115c837d480ac87a9 docker-agent/rustproxy-docker-agent.service -f30c895df3d7f289f3b7c9a73969009ecf91110f59cb247daa242f68e78aa014 docker-agent/server.go -20313df0c14a1696d099ed881b159fe854e92538a60548a1729f92babaead881 docker-agent/system.go +c07486b1cccb474af4a123d10cd0d0f46446b5936531a57781c9524a09561fac docker-agent/server.go +a76322a8acb08bc0b57d384dbc0063f4376aa84486f5133f686bc10a5cfa15a8 docker-agent/system.go 188b74ec4f58da1b46d86925a67b6a590c92fb4fd7516e8d03d43871bc3b4542 docker-agent/system_test.go c4728da70d60d193c5c348d90c7c26ba1756d3459052a10a121f9be69a4dd18a docs/ACCESS.md 7ef8cd7101cc5466f8c6e3ab327176e4dd68568a1d9b3306e12313fd178157dc docs/API.md @@ -123,8 +123,8 @@ d242de9614fbb52933b4accd32f4715ca94107abe4a3b1d7e088362b07a6ba60 examples/vhost af2bdb1343a8141069e94ccd2c7f92574ad848437e2f9fdb5c7576a9a18ef4a5 examples/vhosts-private.json 716dd2ba150e3813116d2a8c568865b1e315f2fd29c6e636dcd72709dd444837 grafana/README.md 0354f8b8e78e81dd8d240e0170fee14202e94686831f1a008fdc2a58da528de4 grafana/rustproxy-overview.json -36a321ff1c1ec593fefb45f843760e990de629d5db0f27d68693192ee180380b install-debian13.sh -909e9ab94617ace74a425f15084bf85f3086cc52ba5b28f2b441ff800abc6ef9 install.sh +ae27c45a103325011e00146d0a759d51d4206d59fa716280de35cc0c0bab00f4 install-debian13.sh +c91ad733dee2ea4e037c48c29e54cd011ee962189f796165042ee8306dcd4749 install.sh 42f9f1d18c021fc7734b5bd020844bf678725a0e539e2fcbe05ec676f6239eae integrations/README.md 13482032666464b2583016144ddc98b036281b2253c8fd8bcbad28cb0ed53876 integrations/opnsense-acme/README.md 7c4063388d1fc3849a2432131e098aac4f2a2008031781d624d5bd4162eb5220 integrations/opnsense-acme/actions_rustproxy_cert.conf @@ -132,28 +132,28 @@ af2bdb1343a8141069e94ccd2c7f92574ad848437e2f9fdb5c7576a9a18ef4a5 examples/vhost 992e45bf5ba46320118c524d9aaf908e45fd6a19246a05aec57b5860d23c8e7b integrations/opnsense-acme/rustproxy-acme.conf.example 0a86cb2a4ed689a5fa70534cac3402ca8bd3bb87c37e8ce2f3774bc2f48ab6c4 integrations/routeros-oci-build/.env.routeros.example e9cbb0224c4a3d23a6019ba557e0cd568c1ad5e1582ff1e335fb7d99b7a1055d integrations/routeros-oci-build/.gitignore -14025f0cad10e1b89f366977123e4cebb68ae59df892d4eed29b6171e63ae908 integrations/routeros-oci-build/Dockerfile.routeros +1de0044b816031d3a11ce5490816bd16b63e8c7607b7c12db629be879efff65b integrations/routeros-oci-build/Dockerfile.routeros 7c7a3e51f43b43e1c962a4b0bb591f99c1f06977bf77f23719f7f867dfe7eb8e integrations/routeros-oci-build/Dockerfile.routeros.dockerignore 3cc5b108c39ca450bdaf59be979622fda41b9ef134914d172eb76f1eb30a959b integrations/routeros-oci-build/README.md -3f092a9ab80221eddd67be4d1a776acbc6e04c1eb6011b588280c28e83b2582f integrations/routeros-oci-build/build-routeros-oci.sh +3d44e4080206c71d3ffdbcbd2f50c43cb227bc38e096801f07f818388a49a405 integrations/routeros-oci-build/build-routeros-oci.sh 3f267cafa16006e5456ade78ee2d5fae02cc7ce747839523068ffd8d7c98798a integrations/routeros-oci-build/docker-entrypoint.sh ae2ee2887fcba096d0de25edcc18faa1ffec35759274518db1bf6d6982f7176c langs/README.md -13bdb323e2e7403aeda490971ec396fc56e0c2e2d8b070c9a5221d1cf9817530 langs/en_US.json -2d59a512293cc21d478dffcb1c1aa8dc69aa6375f7915df5d6d1915dd78414d9 langs/pl_pl.json -38773ed251a8c24af353f4744e498ae2bc7d4151df7927e942c4ac223f6008e1 make_zip.py -e830d37dd1f81a4b0aa7d535f5bba69e34e433b0fd99cc8ee0b296786c32379a migrations/0002_admin.sql -20112cc82192098b8d602f1c4f7ca08712e9e1366c845fabb92753187c370d35 migrations/0003_certificate_renewals.sql -5c62da30fa9db594a4d656c77ae676d3c388072b6a85f91170ec7d911d7cde43 migrations/0004_admin_preferences.sql -57dc28982f416874d5d00d1d438a18846d1ce35cb940c4bcf67fd9a8bc57339c migrations/0005_certificate_api.sql -faa7e50922bf180c363f7627fbcfe8079831e36282220d17481cf69bc64b57f1 migrations/0006_certificate_api_credentials.sql -f093aef9639a959a2522946995a02d2e67c464e794c3ef665261a9a5b348c968 migrations/0007_secret_store.sql +e730767884f63759c3f9ef2ddf6726788ab5ec08f1266747029dc66989f8a3f0 langs/en_US.json +7e7e99665653386ce73cdecb522503cc80c9c26e91ebae07e5086979ef644521 langs/pl_pl.json +80d1fd9cc05d51235f6a871f48cbad1440b2095609c335583674829f1df08a42 make_zip.py +27790aa2c6b5be577fe3f34876385624dca824162fe96ee313845f0389d4674a migrations/0002_admin.sql +d28a83df192518a8b7c01383b683bd34b84307a6e839a05bf917af69d0c87f09 migrations/0003_certificate_renewals.sql +4ab0ae7c600937553baa5754cd0c134b1a1d43047bde0ece76d079bc4f23b7f0 migrations/0004_admin_preferences.sql +fed50cb4a8715b38b5541bdbbbd342eddea33bf090caa981c613203591a90c25 migrations/0005_certificate_api.sql +a80a8ce7b3d2d5ce37e68e95488c71f5d1d34d152f9a377712ff3033dc6ae8c3 migrations/0006_certificate_api_credentials.sql +cdffbbcdb8130f4cd0c10bc975cd7ad58bf1abefadad0b1427f9be1a87d66a6d migrations/0007_secret_store.sql 90f6dce865496e018c047133d3bc1721fc2a19b2f4ced22e2a3625d9e9ff18ac migrations/0008_config_history.sql -fc7585fdcbe99fe3496f0e62f4c4e2161f4a0173222ba4950331aec6c44e50f8 migrations/0009_certificate_api_grants.sql -d58a464870895cbefcaa2b4adfd6fcd0d5182d19f2528eef6509e190046cc9fe migrations/0010_dashboard_presets.sql +4efde60abcc98a735544ea0adb7d91db43348b4a81859b469012e708fdd63a25 migrations/0009_certificate_api_grants.sql +f4bf73ca30c72ff130f2ef778054e18f870fe205041f872f3558dcadcbe2242b migrations/0010_dashboard_presets.sql e56ac3718ea7d73fd9afb1c3b44ca95c9bea424c32166e37ce913bee0e67a277 migrations/0011_tokens.sql -273ce62a518657853428ca44dfe4dd2a56abbbbba684e905a2d0147d08359888 migrations/0012_admin_preferences_size.sql +8718cdf22154cca43c02f001346ac7d40e2c20bc3b6dccbc214a6e37af3bc4fe migrations/0012_admin_preferences_size.sql 478220552ffeea3de00e2866d427d9f87f4cfc4ae5232e5c3a774e62425b1e0c nagios/README.md -91233910aa4dab07ae917fef93d018a7a0beaab697f9a0bb889ac613e595cca4 nagios/check_rustproxy.py +4c8250b25182ced8a6e8d198bacb40da10c6e196fdbe37a4ad175ec5428d5183 nagios/check_rustproxy.py a42e01b341725c9da0928edf40c8c3b9c814ef90592f208c52b1f2c56a2ad383 nagios/check_rustproxy_api ee50f38c037765fab742e888d4b9fc4d874c31c785c6064d4eca3d2c4d24d944 nagios/check_rustproxy_backends 1465396cf1358067e9fe48b3d61f28fd4ac65c577b67c502950ce6b42ecbe3b3 nagios/check_rustproxy_latency @@ -161,30 +161,30 @@ ee50f38c037765fab742e888d4b9fc4d874c31c785c6064d4eca3d2c4d24d944 nagios/check_r 7458b2d74495e6fb1c1edeea4d5a793705476431dadb60627187111f91441e13 rust-toolchain.toml 5611ed0aecdd6411597a6869af5d1a0382d08c3a167dfd054f606be7db0603fa scripts/README.md 1d63e9cea61a744f1bf2085cbb7c3d8755b3eda1569c8532574dd4fb6a840678 scripts/__init__.py -292c65ad2a7f0ca13da4a00a836df17c3192728dc02034b75a6a70eb6b5eb25c scripts/audit_css_usage.py -5a942edcf2b5549042fe88b6d2704139abab5820607f7afdd7ea72cef1a83bf2 scripts/build-release.sh +12279f89f839fa02a7a7767bcafc4e6b416e41ba3db408498ed0c647c2fc1a91 scripts/audit_css_usage.py +7c412526695228510dd8c271a4539a6faf8be7e61c36ecacb0ef118726619996 scripts/build-release.sh 5fc5c7f274aa5a6c07970f7b2e548acabae3dc2a24d598308fd768a8d9de2510 scripts/build/__init__.py -c3066f40f152a2655f88314fd9cf784eddbfa6c3238a494da13d972ef9ad930c scripts/build/panel_css.py -2bf1851e3cf7ac576e38fe4e02532898df2ec11ff8e802266c1db203f29f6a91 scripts/build/swagger_assets.py -e4d15aa6aa864d04b9b30aca33826b833632af02ca643f8b23e219a5ea1298dd scripts/deploy/deploy.py -f0edbdca3af49cfa8f9c118d3eb0977c99569264dc5d74a85c4610234ea1fe88 scripts/deploy/deploy_core.py -f26297284e0ad9fb4e4317deac24b25de819c10d04fed551134ddb6debc41837 scripts/deploy/deploy_runtime.py -a59587ce8ad41b1bbb431356b58398f9c8ff7cb96a613a91752e907a70e10c2e scripts/deploy/upgrade.py -3c3a50d0a7bf32852cf50c4383d1f30962b4728b094b2e2ec63fef699c3792c8 scripts/generate_cf_pages.py -2cc658faaa610b21b48942c59b955525539ad4503fd60f2a49c7e626a22faaff scripts/migration/migrate_npm.py -a459d95bbb0076f33ade8b273b813308167f9d8d45242b309a2d18320ca0093c scripts/migration/migrate_npm_api.py -4c905a387f210c30fbf12a7738676fd39819bc96bc4a272da1db5f18a2d3013e scripts/migration/migrate_npm_core.py -be88ca2163d84913e0d9ee97f95d3217d4a92fc7df122927336deae5f8fcfb3d scripts/preflight.py -2a95ee85848d347b419dcc2c3a1c65b62d491081a554f5fb50623770a5c15b80 scripts/runtime/acme_provider.py -e69813fb1d3a4cdcfb7243964cc323fc21a603087bf2e84188fa42b9d3cee4b5 scripts/runtime/acme_rfc2136.py -91c883cfdce94c8c22c98749f611317f538a112d29be4f3fb1fa460b8f29ceaa scripts/start_stream_backends.sh -22e880e98c7b9d700c7a4c02b9b1d543e5dbd1f4ecdca42813a1083165b32a19 scripts/version.py +45a528c68435286d1f69b7a3292c7d626329899daf9c9ccbd345974756c5d720 scripts/build/panel_css.py +f79493f106474bfa1902054a8e941f578f9122f33fb26315ce44462ac1a908ff scripts/build/swagger_assets.py +57a032aead983eb13f84efd07364803d5e83933319d1f636441594aebfed35ec scripts/deploy/deploy.py +05ef3fe1715767c9404bfec237322bbdf618cdbb65b59b5a225b419668104ed4 scripts/deploy/deploy_core.py +20b5bbc4985d0f24e54690e4e198762cb954e9d786acc56a8f3406be3824b7d2 scripts/deploy/deploy_runtime.py +15283e16c0b76d99154817d8da8873a172b0d764faaf365488be05f40eb903ac scripts/deploy/upgrade.py +a90d8778cb894296f2a89ce07af04d4283255a814dc79acf53b8cc08437062e2 scripts/generate_cf_pages.py +07e564dff1e64560b804f15617bfe4246e6268c1370415fd8594be37a8c95023 scripts/migration/migrate_npm.py +504114301cb8cb1dd6df83a8e21c424e17fcf3bcf7b74c7fdc404cb212bfb6a7 scripts/migration/migrate_npm_api.py +f774127896e2852415ea0a933461220df8cceb15c1f3d86c6628f56d9ef8e320 scripts/migration/migrate_npm_core.py +daab7b7821a70e885fab3492c03f080b224292be95529d5786ff99586e745be4 scripts/preflight.py +8568ff5ae631cfdadacd27c8f10267133ede7bf38f03613ebf88dfbea398d5d3 scripts/runtime/acme_provider.py +e1a59b7a40d1d66ab53ab4a605f0208e0f2ee5466a8401b0d07dd99ada1074bb scripts/runtime/acme_rfc2136.py +bb6a67ce52044d47d0fb042b00d2c2a7c45309c5c42b0d89c5b60cd76a335d28 scripts/start_stream_backends.sh +6df53ae8e516ee8609431ae949382b3a96c3591b3af5a256333fb6f5fff4da97 scripts/version.py 78efae6c43732c0f5527d467bf07d1f890da361925416c89b58bc449d852fc2b src/acl.rs -bbc2c592a91ae4392b996e80066430568cc042d54bb9eeda3825100af2e5a136 src/acl/dynamic/mod.rs +5a2006578e9f01aebf4cf070c156783e560556aba895527f10951070b414f34a src/acl/dynamic/mod.rs f9479b3a3ba56261e45bc1d066508c73e1ff1f295588168680d0d34f136b4acf src/acl/dynamic/tests.rs 50d9a0009cdcee6dd34a6215755d98f38ea18fa39b9faf070d1a7649eeac6aae src/acl/tests.rs f15b5bb11e2b949d7ed203711275b24b3f76de2ab617ef8b7345585c15ca34bd src/acme.rs -767d2f26fa8dea4ff6717d1e20ac0611b83bd20ab64bda8163cc6a5cc4dcb614 src/acme/headless.rs +cc9c59403150a759ab1ed0d1ca65bd861c089cfa14c8d4c42578d3d7bb7d0351 src/acme/headless.rs 170e3307b68d09b2e9e7d13cac178bf4b5edc8612fdca9edb1d213bf9ea878d4 src/acme/jobs.rs f7f737aa28d2d209f4f20a221885e3bb3596dfc8e3c8c9a22ba53bb975c52df8 src/acme/model.rs b77026ad33be84706112881dde840e0fe4694b150dd3087d8e106737d07dd464 src/acme/providers/mod.rs @@ -197,10 +197,10 @@ b28a08ea996befe10949676f40fab5f1036a274c7d0ab1175cf5c43c59849dc3 src/admin/acce f73678bfa4c4f92779cf4e8ae2feb37419de320fb1b53111c982539d5761dbcf src/admin/alerts.rs 898351284480b0d55c6f1ed56c2185ca137fc44926864ab61238ff7f6e98cb6d src/admin/api_token_access.rs 5f5b150bb8f51f57462e519650093354ae7b40fcb80c4380fd3391a33f4b30f2 src/admin/api_tokens.rs -498f3640101b0505b5d8f6aee05b2c0e8a248a6ed53ef52b287496839919692b src/admin/cache_rules.rs +4ced70b79b93024e4e7db6e203186f8e85db88290b4665a10bc90b02984e4959 src/admin/cache_rules.rs 34e851f725e8605e3c5d9946e56ac035996f3bd9d608169cba3408060d229c9b src/admin/certificate_api.rs 4a8b6406a44508b8ba102fef0d8309e871dbe0cbdbee1e6c8721baaca0c1aee1 src/admin/certificate_inspection_tests.rs -6baad2543021bcbe64688a2f58f78a5f5b83b8b189ad9ee7415adf5566bdd4be src/admin/certificates.rs +c6f91eeb6e103d819d4b309c7207236c27a23b066c12ae0eaf4c7bcd5bff99c0 src/admin/certificates.rs 521ac794501570cfa2e8e50c3a5cec2ca08ee4dbce8ac9c0e0310c09612f1062 src/admin/config_reload.rs 11f1501574e4042fab7a97f18a19c8a69856e157933a56baaf4c7cc9d2da9a8c src/admin/config_sections.rs c51f725075b5c4fc3fb7fb8b8b5f73987bff698a400e8950e968068b97a77631 src/admin/dashboard_presets.rs @@ -208,13 +208,13 @@ aae1ca0e70d987830bd63948d431f54302083148177c1b551565be12df7fe771 src/admin/docu 9b5f1da460768ec06dab890ffcdc41382cf9b4f9460897c99e36c66fff4a79a5 src/admin/documentation/documents.rs f9b2c8fe62cc92d7693e46145b2543b12dd6d4943fe2d52c67ed6958d4af83de src/admin/documentation/tests.rs 1ce779b84aa8f47bdb3c34f83593c1f2f06d2235f0319847096cfcd035434168 src/admin/file_log_search.rs -2805c7d1c08fed6a54711b8b5d51078ba8c2daecae431b6c7c39fe0345b6cecc src/admin/file_logs.rs -737876e72c315987515d259de84d46c22780e89f19ed3102fc5c4f55d0e2951b src/admin/file_logs_io.rs -e2253599b5e39510946729920d240711403a3889cc495eb49824296228f1d080 src/admin/file_logs_query.rs -1594c8666991c1d07487a6a718211ef404cf49114721960f7e119bb7f605e3d2 src/admin/logging_api.rs +ab0449d253fd776ae1658a92f2d7dd509ee18ebdecdec085f120733b2f08e740 src/admin/file_logs.rs +9c526995af104fab158fc1ccb148f1ba8ca6b2351187d5dc05d5da52eb2ed956 src/admin/file_logs_io.rs +a2cdd534cb989d5232df344e4f17369dedd8cf19165c0c5b51dbb21b68475e11 src/admin/file_logs_query.rs +5f68738d1867dfad63324038c1f88addb89801fa925898cbcb15ee2c5b139c67 src/admin/logging_api.rs 781fd5f176dd8f2372f75bd90edcf160708e2d0a8d6a115ba4b283c0cd49eb2d src/admin/mod.rs -123d6aa161c8c04874e396ae5ce63b1bfc0b1b0929ddc3d912eba8eed7fea5cc src/admin/openapi.json -f34628487f99bc37946b2da7d77a9858bf2f40a7b36250e3da5a742d7834f347 src/admin/operations.rs +d0cb75216344706f93f61507c2e375451341377214a3c659b9c9fd8f29209a2e src/admin/openapi.json +6f68d2545a33bbedc588511dff1179a1634c0c9939fea486adab38b25ee20591 src/admin/operations.rs 257d93a29d0bda96462bcf695aba8d0ec0f9412c379e066ec46ae8ee034e3a53 src/admin/panel_assets.rs f5127855c2994d052678865df36d703b74f4a0afc633daf7718b10da18d26e37 src/admin/panel_content.rs a051fb9f67d4d9dac1c05327006639b3dfcd7d25172e48f457bb2724c1ead9ba src/admin/policy.rs @@ -226,45 +226,45 @@ ea202c67d9acb7614046f153beecdff10d5822b3d5627eaf2ebda33954b36474 src/admin/pref 7a00e4ab943f74d2b1bdcbfab7f9cd3f584e9f59536b4aca6c4c31f5f5508d12 src/admin/public/tests.rs 6930b4f4b45257772b321b20a9becdf9bc4610274852948ba38c2d0cdf02dfaf src/admin/refresh_preferences.rs 409fc0bfa0b35b766e50c63b2e147d439fa31f89f4559df9d7045a903a2da7c0 src/admin/router.rs -0c5efa4669b5827e352f946edcc81de8fb18fa34ba3d458d314f018e673008d9 src/admin/session.rs -38f53c52c2e3bc49b5ad4254c657d282cf4ca7c8c11c6a79cc1d7a2086f017de src/admin/status.rs +ec7128da7e6cf67deb99275f5bea38408b95ce6cf97c8d501655c558427f67d1 src/admin/session.rs +4cf5d27789c3bd9240e77ee174b6d8bda4b7a9d933835519b8591e97991bebd7 src/admin/status.rs bac2116e9a7d5f19a112565e1483787ff6102f489bed0cb3b0b3e2102ddd3edb src/admin/status_live.rs c20f214e2ec2a14d8a88d07a63a27d9396a7a6bf9446f6ee31dbd77b12e4b585 src/admin/status_system.rs ea1d0b8ff69157215f9358f0de35b91462ab2bf1fb97f9ce9b37846d0432c56b src/admin/tail.rs -fbe931102341a612c1b295fefb7672230fc9746e37453fe2db3a9244b57088b5 src/admin/tests.rs -d6c7ef48325c8f4f7ae7504827c0255c263b41c838f61960381907ca78eb9b95 src/admin/web/acl-picker.js -dd43c3ec62112f296760b45a549956441d9b8dcb9de43767012067d996d50368 src/admin/web/acme.js +e4e7887063d26b1f33e105ad1f40dcf9923158b71118259dc03258e607cae725 src/admin/tests.rs +c3108166ede36947196d238280bb7ba7396d8fb734dc56a06656d0d2b721791b src/admin/web/acl-picker.js +6a2ee85a3aa07312127d339699e646fda87ec1b3252ac80ebc2744a5a8111c29 src/admin/web/acme.js 30a71c399e9a2cd9a4c1830568e4767f219ce09bca35f6d5fd22424f1a6617ac src/admin/web/admin_origin_rejected.html aa33315bf8e11d281778cdf258444ad8f02c22ac4fb8fba02fd4ee8677595d1f src/admin/web/api-tokens.js c7699bd6a78a1b76739999a363b78cea9cca7401dd993b2e278427ffb8b3f4f7 src/admin/web/app/alerts.js faa9735c2a02746b2954bc4955eb609f94afebb685cd5521d2629640cea2777a src/admin/web/app/backend-dashboard.js aed3aea4eef0011c6b51d39736782e7d1ec52662e422f40e0c7b9ddfc19d0378 src/admin/web/app/certificate-inspection.js -86240b836ba68b1c203701f893c76a606434e094a203b76b91287c9a23853f9b src/admin/web/app/chart-scales.js +80f2f9dc059df5ab23b189930d820ef4a1a2f0f719ed4d18dda3333a8c3c3561 src/admin/web/app/chart-scales.js dedda129e173a347ebca9445c8a313849d1d678c256deabeb18f9977559e021a src/admin/web/app/config-history.js -3f85d490a2d175045bab7d343175ab14fccf24384de772195e23fd58cac5b6d5 src/admin/web/app/core.js +bbb6460e1b2209cb1bab173ad261014602fc6b7acdc670a21da089fab929d217 src/admin/web/app/core.js 1fe90b27e241477e67b24283f3ae8a15a1770e3a3a8f5017a0732396294bff90 src/admin/web/app/dashboard-inline-layout.js e9830fdbaaf0a671f7ce2121564cfd7960c49733b172a4bd927f15d0e722fc4d src/admin/web/app/dashboard-presets.js fce1fe268749b28ab68ac41519ced05252c1193f11bc9a3851de45dae4c419ad src/admin/web/app/docker-dashboard.js -78569bbc055a6fe2e689ea372b6dad922350ba0dcc090c192dca7cd5d1f2c407 src/admin/web/app/icons.js +a426adcfe1d971d6fca0d24239c89d931301c4fafe85ec53aa509bce5b781d34 src/admin/web/app/icons.js 9fc3165febd83a6661b2827aacd612fbc0f834e99ef1585ec54e03e97fe54a72 src/admin/web/app/logo-animation.js 92ed982c3ac4bc4218a24a200d2a33f30fc6705b77b260db2be31b0ce91a7df9 src/admin/web/app/memory-breakdown.js -e165db3dd12be8dbff2dfffe3bb9608ce9125924cb97558c26826e9f3d070699 src/admin/web/app/overview-extra-metrics.js +57feb9d793cab60f8dce95a685dae43437d38e87a0ca1520cd6aac475b31bfe7 src/admin/web/app/overview-extra-metrics.js 3049a308881f98ab19ffd95b4bb88976702c61f2fc82792b4402f0212fcd7403 src/admin/web/app/overview-masonry.js -776306b8db51db952de352aa066ea1775b12e71b7cd956bb25084860cef650e4 src/admin/web/app/overview-rows.js +52ee57e8002a613893f868452c3c861cc06b3a49b306aff0dd46fc6e6eb39fd5 src/admin/web/app/overview-rows.js 6f10f3239aea505aa01796620981eed873930c129ed5a2fd7eb439e0e0d24558 src/admin/web/app/overview-samples.js 3b5c68e6258946b79b7f5042384ad2d39407807a40984ef2f58c4b0edb9d65fa src/admin/web/app/overview-wide-metrics.js e799e0406c7ff54cbf71faf704a20265bdf5180a8ed2f26388d0775231365410 src/admin/web/app/path-permissions.js -e3b9202fa113f39453c699c3595ab006b120dd759c342c078660d85c77e4c2df src/admin/web/app/preferences.js +f6c49948dd32de1e0a03938c4d236c7ad89c7a2b3253b5c6940b214aad799b7b src/admin/web/app/preferences.js 30ec0a7027215eae63946689af2c042de0cf468a6b1054535694da4dd4214cdb src/admin/web/app/rate-sampling.js 3b8e566d81a5b94ef21c73e7805ae128454f085554de9358040de266bcbdb0e0 src/admin/web/app/refresh.js -66de066418464669f9d47c6f61b0333b13b95e188a90bb964c7851acb3bc3cbf src/admin/web/app/runtime.js +b3d8165a126e6cd7ae4bdbac24541d687ec35a0f705b5cfae855ccd8336ea99c src/admin/web/app/runtime.js 31201586925e6f4792071d7d03fb05dcc4a69a03c02a4e85eb0746f45af68074 src/admin/web/app/session-resume.js c638e82ebe2c49c61124ab647e74ff594d293fa85131051cff625f9d1f1451a5 src/admin/web/app/settings.js 2281f06990f86acd3ff12fa368e1b73e4c83601e20245f24abbce389dfccb77f src/admin/web/app/sidebar.js b7ead49224a4ec67181d3f24f9d9634bd6d76756f826a4d5d993300637d1d8f3 src/admin/web/app/stream-dashboard.js 7de070cc8cdde45d7e0932259299e341e25b32c9ffbd87e4fcce934d0f090de4 src/admin/web/app/web-overview.js -ba22ff211f408052aee0aa75a5a52734b1c257247e7112972aff75a9646faf22 src/admin/web/cache-panel.js -433f5ccf0a4df1c4452f746f7b2f351f6712ee73873cb07204638c205e4f2c88 src/admin/web/cache-rules.js +5b940dd07f9ee975e4a64adafcc328a459a2c47e6a10266420c477b7aa830603 src/admin/web/cache-panel.js +fcce610f6d61145506af2db73446eb26178a408fe67fb1f73d4f6512ec015fa4 src/admin/web/cache-rules.js 6288b0a8228d828ac2e2535ace2d1aefd1c04011e789eb97f7279129874ac35c src/admin/web/certificate-api.js acfdf7a31a7f3d1a7636125d724f9348ac397a1081344046e67fce2620e37fd6 src/admin/web/cf_page/README.md 9cafebce6eddc2a4b498a69ddb72a32d6ed781e3ccb072d8a6f13ee5c360f7c8 src/admin/web/cf_page/error_200.html @@ -283,21 +283,21 @@ e9cfe14e8e5093e8f8be504d9590643d71935846241f4e73ea4afcafb7f0f806 src/admin/web/ 9efc37b434336db30333f28c09e14355c45332e1d28c64bb6b88f875ba9fd297 src/admin/web/cf_page/placeholder.html 38bb67d9ec6b6e08298d63267afa3a92cbc0818fb0a21fc39520afdca4a995e4 src/admin/web/cf_page/welcome.html 5ad913eb4a06e9da62338da4e6122d4bfef93954b8ee718215d3e00ad1e5ab17 src/admin/web/css/00-tokens.css -e44d19066b1c9dc470c74c5a40d590e6f00acf6a74e4eb6d7e092ab72bee7c20 src/admin/web/css/10-base.css +8271a56ed6edc1b2abb2302224ed4347c21cd5fd2c2d1229b516b86301555871 src/admin/web/css/10-base.css 9cd9b62ff8cfba47cb180e29ea5f69b8e97c7817dfcfddcb55fc4e08d11a7184 src/admin/web/css/20-shell.css -d26c13fdc10f94aa630e7ae059b68b1931341c026d231e7245d0d32c42451ad0 src/admin/web/css/30-overview.css -59f08fa609b266df6558cebf41b5b1d27d881dc4449f946b3ae35a8559e79593 src/admin/web/css/40-editors.css -587f026c6dbc8c3dd116314c468fee68a5c1a0342ca37950973771d4367796bb src/admin/web/css/50-settings.css -5cff4e76562d3f8dd4789830f7af2e5d81f6f7d019b0e748310a1baa39aa51ba src/admin/web/css/55-policy.css -7691a9608e376bcc1f0802edef8b19e5c5ecb522e560a2fa7168a14985eb561a src/admin/web/css/60-monitoring.css -85ec6c754a260f817ad8130a517e1da965704654f6a930bd62e87a56898d6b37 src/admin/web/css/70-responsive.css +99f37617e65ea064e526c161e63587d4081a03be861b6d305f678cf783c4bd1c src/admin/web/css/30-overview.css +eb35c918e67c3d8fc43836662e35a12f83149dc9bb32fbfdb5e69ed24414c035 src/admin/web/css/40-editors.css +fe4621d42adca7649225afe53a0ce67ebf6c24a3b837d19b1f9dadab0b20618b src/admin/web/css/50-settings.css +9bfee7bc5fed42aa5ee17f14d43f73073646fdbc6e7d0466be20ac57740c3bd1 src/admin/web/css/55-policy.css +638171543182172b32e3ac899ff6e63e2bd726983b809d792e88d5b12fe22e34 src/admin/web/css/60-monitoring.css +2393d5c70d0a3c8f492fc2f0cd9e5fe949e746fcc70367cc962c632d2230ebe0 src/admin/web/css/70-responsive.css 4149881632a6ed48340443c51362c59d2ac7ae16eba8d724fa9a9555d2af8314 src/admin/web/css/README.md ea08fbe1a616042f2dab32d829dba837660a5facb068bb9d5a9b3abdb5c00717 src/admin/web/css/manifest.json 7d3c09f13e3026e3230f35472a9d163b790c7c68b672127ed9fb0e66b26e3d70 src/admin/web/dashboard-builtin-presets.json 78bf6179f769b68d518028464697e50dea5d75e33ecb1b89d88e2c2b01e86bf2 src/admin/web/dashboard-defaults.json 355046ecb80ce6adb73ceabd29825b0cf79ca364771070cedd5eb44760fae890 src/admin/web/dashboard-widgets.json 50d1ebcbaf4d0b2968da23bb943fc3f67131c5d32df3f61d23ff37aad9da5b81 src/admin/web/demo.html -e9c467a632daae1ef71ba2adf67399e80b28a6e61639ea2172b9dcc08e97abe7 src/admin/web/docker.js +9efca558964ec3eaa25d32d9a11ca0ed20ffb3852f47712da1fc35c8402894cc src/admin/web/docker.js 8bf5d1f4f06d6e87536d808a680bf3d3a0c90c1637df0e58da667fd22ad4782d src/admin/web/docs.css aeffd403fa1823df7d9fa4c48280b4033b2d15e4cb9f66608caff89290de0a52 src/admin/web/docs.html 306db8db9e4d651a85e09dbc15464e7f920d7fe5bd9ec9d1d8068321eb0106ab src/admin/web/docs.js @@ -317,38 +317,38 @@ e6c4d91d1542d0a5b47bb8736f9539d43a6713df5a473b635519d5b7eac2eb9c src/admin/web/ 003d382cc8dd69ad7237679632c04a9389366bb71dd7dca8ee64ee06614aa9a5 src/admin/web/error_auth_provider.html 0a5fff35555153f59d4346933030a67b6e1a8768cee7a47cfa2fcf1a2c564f63 src/admin/web/favicon.svg 3fbd758d96701dab907e98331b41e8e8953bc969a00aa9e44df5c401b8ac19c9 src/admin/web/file-logs.js -1a74b58d355c7e653aa73c524cbbdf3946ba755af45c57a1c2fcb7431ef9fc13 src/admin/web/host404.js -d2689d200b7bf7f322929e0fa3241ac74b962ce4701ffafc3f02a2f2af162104 src/admin/web/index.html -d6ad10900bd4804285b07f188cd232288ca97429a9ed1ce4fafc966beae295f3 src/admin/web/integrations.js +06a2f3cace482cae2221510042108d036aac6c0b7de68bcd4e5f036f59ec0ce9 src/admin/web/host404.js +8d0f56bf391817bb18b5f4533b0bab47112f7d110384c2312b8c50b2de73ee43 src/admin/web/index.html +42029866a8a20ac4c66a9a087676c14766914648d507ffeb2dbf817dd0bc4d9b src/admin/web/integrations.js 7a12f020fc587205694978ab41b660e9a80487d413fbf6e34fc525eabc58308f src/admin/web/login-keys.json ac9f667273918e18406df06cb2613c923f50a88897693a03a18f500e22dc6ec2 src/admin/web/login.html c2e5f554810b8e34fb47361fb90a01073a2e332ee26d82e030956fad3ec1f83e src/admin/web/login.js -faf06be0236fe0a1f145ca20d8c4ad99a901d751ce94ab0366378b954ab9bbff src/admin/web/management.js -d4db7b20fa80d4472e260a99aa18c7beb179a4d9d6b63a9df7d3560168e8c7ee src/admin/web/partials/overview-charts.html -bd94e61e051a6bebe0afbda0a21aa36349c2067516b974986765555ed47455cc src/admin/web/partials/overview-metrics.html +8796ce58590e63e0d1e2b7c5e2cad2d9ff52949c4a5c611f2bf4b86e294a1acf src/admin/web/management.js +2c96b6341f2445ca4493bbd5ea9af8ac1ab75d1077d73a3dcefda0186e2225d5 src/admin/web/partials/overview-charts.html +16d1d275e3f7cfc56d4ad58042dbe095fbbad59bfadefeec67bbf49978869da4 src/admin/web/partials/overview-metrics.html 8bb503677f51362dc3cc9522596affa65c5960ab5e44b1c935cb4abf85505429 src/admin/web/policy-presets.js 943121aaaaddcee81ce70fb153820666d06a41abab17d60c20c7e3dba1894f8c src/admin/web/policy.js 80d6eb03f204a90f7b140c5b053d0fd8facb350b1c96b74fa1402e2a35d4fb10 src/admin/web/prometheus-token.js -c2f7b760577df6d1aaa00478c214766df26162eaf22068f8bb851ebc22581b02 src/admin/web/redirects.js -1f1cbda4f9311ab981814b39e3b18eda4809879f36cf13ae4af9549590813458 src/admin/web/settings.js +c2080a00c15b8b1d2ac014828edc3682de1765fd094fc2d1c5b9f597f218e9b9 src/admin/web/redirects.js +ee0d831c5fa9f2e121ce833b3b3df80cda65f41f0549ebce664098c75c2a8e75 src/admin/web/settings.js 8eadbada619b15087783dcfa0e889a81f88e78034d084c5ab616f7912b835940 src/admin/web/status_200.html -2fe6f16036bd066ddce8c5508bf0209e3f77217211b046215ddb2e0b0c82dca1 src/admin/web/streams.js +d7b6a0e87247aca4296f978f501a9ed282389023fc01085b64d6deb5930a8c7f src/admin/web/streams.js 14ef42dec556c5fa62ff4ed4d6865d28f322e8e963dc43e3a714ef9d0af12ac6 src/admin/web/system-info.js 7ea8409fa899398ef3d35402d73de6fdf05cf9f28892a5e30fe3f15fc6bb9d7d src/admin/web/tls-configurator.js -336cc5b2a3e5e2514b6b15eed5f2b1ba714458d0e3e913d6f9ad7c870623c758 src/admin/web/traffic-panel.js +2a83603fbc96df39728327dd9a86f25af7b9b1e69a6e25adb557a94d6b84da3e src/admin/web/traffic-panel.js 675ea169d4cc55fda5e291af536338b882bede1eaa6c9d5cc7dfde0779c7c4d1 src/admin/web/transform-panel.js -c30373b0f2dc5672f88bc6fad0ffd5f6d85496d75da8fae83c6aa306e4e0f676 src/admin/web/vhosts/balancing.js -2146feb7b1dbf5f1923fca85c6624a30fd32cd7322794641255dd29c6ed36e8c src/admin/web/vhosts/core.js +ea5db4aed3679ee0302dd739bd993668d8ad651e72f786de52e9a81cbb8fc902 src/admin/web/vhosts/balancing.js +d683c5546582f91d443d654179e616039e7f56639355cd58ae6170732341594a src/admin/web/vhosts/core.js 7f3d6a2c93c9d546cf9f712c9038ceb159368bc99ad19be2405232200de7205c src/admin/web/vhosts/editor.js -f082588c35d981fc689542d4c12a7614638279335220d587fdee5d3fff822e80 src/admin/web/vhosts/headers-tab.js +f3d0d9c2e53d847f75f79dedcd642e9864d2d04f9dcba80e37e082fc406842e8 src/admin/web/vhosts/headers-tab.js 3776f72d7051af86ac5fbdd4581040dd88a424c0c6cde789301b032b159094d8 src/admin/web/vhosts/health.js b3239e67901f1796d7a974ade0796f2e3590ff8064628a5629b78c7f6ce2f32e src/admin/web/vhosts/protocol.js 8c3da49973c62333559b0e3588c02beb0b425c025eac5cfa82a1bb968f70d9dd src/admin/web/vhosts/rates.js -d1dc4c4771c2f7d049dc06953e3103aebe47533407ae0b8a1f831176fc3e5fe6 src/admin/web/vhosts/render.js -90684f1bfb0e079438654e1f8c5b9ee1b4f74e49126a82c88768f3ae209a1875 src/admin/web/vhosts/routing.js -7be5a5fed5480b431d2eece59271c2567dd48592b9d7e65fdb30b4a28f58ce3a src/admin/web/vhosts/source.js -2dad90ef4c717508790d16ecc429edf5fd37fc7b2a952f7b47874795cc656dcf src/admin/web/web-server-profiles.js -8cc2751710546ee0e2551d3f3bde33d47891c73f9c1328b8367dd62827387e8f src/admin/web/web-server.js +26f898527beab499d293584f79e093e6d4fdab97fb4b318a745c6e82c60a0aa3 src/admin/web/vhosts/render.js +70e9126cecdeb9a91b52f72ab6043b7f6e9247017723f1976272cbde0bda62cd src/admin/web/vhosts/routing.js +8239f66ee5a37168f055503d3e2ea8af6a8e8fe6607d4f128af9f4b17d6240cc src/admin/web/vhosts/source.js +83069691777558b9f4556792ed48b1f7e7d49c328d366698f8f37855708d8ef0 src/admin/web/web-server-profiles.js +7285038fca397ea5ae1d005971bcf1f529bd179ec26661be2f9c926e3bf7a79c src/admin/web/web-server.js 36f11beed56711640bb56bb6f452bf76dec2ce4be6a57e8abc19560af477c870 src/alerts.rs 2d40c2cb32d7365df0c9cd6c8cb6f0483c7a799786c648f4836a0d9740c6c5ef src/auth/files/mod.rs b2f948bcc3dbd24952c7b1b02d41d06757f49f0c38a78caf51f8f8a687d8480d src/auth/files/tests.rs @@ -370,17 +370,17 @@ d4a388f0897e50ad26e1d8ea527eccdf656557abb4b88fe714cc2b1969d8715e src/authentik/ 859cec0bcd604f205d7d8e14d1c810e33d97fd7cf00ddcc30877bcea7c5fc2b5 src/backup/tests.rs a7dda92c0323343f28dd59d0907af52000ce18cc66c1386fdb83b6665ade7fa2 src/backup/validation.rs 65afcdd08b861ecc2fb215f9249759e66083d2e8e93fe114f9f13255e64cb0d5 src/balance.rs -9bb518e2285351a2e6bacef8abb303a36f7101bb40c41ac72ca4f15391dfd899 src/balance/hash_tests.rs -e730a68e51b88cf2473ffbc6b29549ef1d8d13a11982d72f75046df325d48f6a src/balance/health.rs +9cc82b2cb1400fd5800549fa0925a67a3c3532a1fcefeb2a60ad069c9ccd0f90 src/balance/hash_tests.rs +9887452ac27558fa337b7f1bfd8a83a3bb57b458dc31aff3bdb071ec1f7cedc9 src/balance/health.rs 458733ad4ec56d58112de6ffa3539ca7e9fa8311048a4e120da96b5f899d5dae src/balance/lease_runtime.rs -ded4f445eec1caacd92fb1546f9eaeba1bc35fd164deb4d3142a64d0e9e261d9 src/balance/model.rs -800f847b1259d398797f51725ee34ab53cd96eaa2d244d23782747cf826ed04c src/balance/pool_core.rs -5f9419176d5b927f8376d39b7dc4a6adf37b975835fedb35d82e7d6a2bb052fd src/balance/pool_selection.rs +54998f1881bd17a2c80a1d2e0451058ee2a3679b2662c5361f41cfe0a177b88b src/balance/model.rs +ca66824456c8b7febdd616000a553113b2dc37a21ad09cb7a0db74c8f60652de src/balance/pool_core.rs +12272f3a2be36a78662de51d073d07ca4bc0821cc5ee8eda7d00ee816e69aa55 src/balance/pool_selection.rs d789bf40cf9433e2fd16409d112210fe93154588b1ac9bddc9c7f78e1db14426 src/balance/pool_view.rs a361c341932ffd186c0b21356c91ab1fe8043f5020d40798266d15ae896a114e src/balance/tests.rs -8a7a6ad2f8e0cbebf9c4c3dcd22bbecb6c2071c2d007b8b8a4de32854d5a4a41 src/basic_auth/mod.rs +3ab50602c54d68721095300d94b3f2b213fe58580cb9b21d6cd565e4c377c989 src/basic_auth/mod.rs 8f8a53d32623f95533ba6392a369976093761d41d8176c55f70bb10eee6ac1f6 src/basic_auth/tests.rs -d9c44f9be9e3855c2339d4867c164b35938474b0a970de887d3990f33779b03b src/cache/cache_regression_tests.rs +a145f824eb2bcbbb9ecca9e8ffdcf29dac63b1af59be879341472a10f7d2e9d0 src/cache/cache_regression_tests.rs 7def03ace07dc38a4806277d75b6ce673d33ddaaf1c4855fa0a3372be1cf9489 src/cache/cold.rs b75ff512a1c6344483e00d2c67578ceea6b5472c279da0246f3622daa68d7e16 src/cache/cold/cleanup.rs 640a0f11bf3c77e44f276ba300bdb645465621b2015a32e215e416faaaf65b18 src/cache/cold/cold_tier_tests.rs @@ -390,7 +390,7 @@ b75ff512a1c6344483e00d2c67578ceea6b5472c279da0246f3622daa68d7e16 src/cache/cold 7f81a07400ab680a34affa32b63199bb5ca7d4511dd9d58465f68279b32d3232 src/cache/collapse.rs 68e2e4b6fd294f795c13b8984149c628c0abc4e41c8e8e8a5c3656fd58dfbcc9 src/cache/dashboard.rs 302a1db06d8be4cc4f213f25209d2c357ec60e9e73f0dc89703d9eaf957dae57 src/cache/dashboard_tests.rs -da41073d36453135624f6eba80db89e19e5fa2dccff188320acdb5f956113477 src/cache/fill.rs +ce15c0c84b3360a3ed49526f61d5062354d20923d17a20d9e262d1137bb531c2 src/cache/fill.rs 675d18afb53f25c56cba49bbb431fa39ecd9d7bdd192c7b39b0698225de7a2a2 src/cache/invalidation.rs c1357a13658e1ed5158084d3a41ba9ea906512774a5863ce9c56cb508d3fa6c8 src/cache/invalidation/ban.rs bbd9f372648d89b5e14d5b58029582d37f66a89752caf2c14eb1cbf8f24bb7a0 src/cache/invalidation/http_invalidation_tests.rs @@ -407,18 +407,18 @@ b96e30ef2b12ad7647915457f087a4d11b6141847bc5e971a75c2739c88c3d8c src/cache/mode 0ec4f6d0adea1ed80a3ca17c68c9c85502491da2904d9d690b4169ab9b025b21 src/cache/model/cold_metadata.rs d5dc6f28d81c8124694dc259611060d64eda405e452954d2c0ddf019d60374ab src/cache/model/entry.rs ff1c3a1a3bc0d26218dcc943ef951c2a212c180bbf6e4bf1c542ffbf12a9f150 src/cache/model/http_invalidation.rs -7f2b43560eaa30bb8faf56659aaf3d59fdf5f84407122dfedc2a55bd1e699f2e src/cache/model/maintenance.rs +428ba699251d5ff22d26a4bb12ccfb62ce51f95d2ff9f1cee3c4e17082400d8e src/cache/model/maintenance.rs 37649cf245c90813ba1f25f80bdd261cb7ab31e2c19dd537234513edb4974251 src/cache/model/settings.rs 14f3f8ae5252a2dc13fcf9556523ffb945b77ee92a5fb4939cd27e113fc61660 src/cache/model/views.rs b9e4b05ff1dfac993d40f926937243e6281621c9cf82ee6c03f47695f4712e8d src/cache/policy.rs -b0c4486a25383ecf82bcdad3527649ea510a16ef07276810b8574644c045f7b3 src/cache/policy/decision.rs -5f525f97b3519117eb504f70fc57055ef33c41d1bf75636cbfbd8c6d8a0c7fec src/cache/policy/decision_tests.rs -1f74f1830beab307e6865d5691126c65eff153ce04d17e95cf478ee75df39205 src/cache/policy/request.rs -20d4af129be642f727f3de694abe9404210dd0210dc56124028d62c2f8dd4649 src/cache/policy/response.rs +c997735c0a909958a4dca0999840e1597b17b098e35a9f2d2a8b828c82c8226f src/cache/policy/decision.rs +51ab958b97baacc682ff467d8a768b4d23da2061c2f2170d17e262e1e8793e26 src/cache/policy/decision_tests.rs +b6cc37fc2e571b0002a75f48d2cea60f246e6b9c1d5676f62ecb914a663806e0 src/cache/policy/request.rs +bbc29c4a8310d2de57eba716eb9a7c375ffd3a945a28bbc28d197187a24178ce src/cache/policy/response.rs 12a6d5d9d6711e956391b4b952e8149658b8bf64cfcc0a4c59c281f2630a6aac src/cache/policy/scope_tests.rs c3a4300f7cdb6b2b7c16fbc489d49ba2451331bb4a55a2d9f618c684fd61eecb src/cache/range.rs -2ff1a7c42eba61aa3a9d168169c295409b57e9b4dd4cf3b5c9fb88ca073daa61 src/cache/rules.rs -06ce13ef3ed6745883353f6b6406c64cf60ef81d38a1edebbb980a155cd18417 src/cache/rules_tests.rs +c4ef12ab085bc324dc1a01ed44a5205d5ea9c680d0536212057270ad08cb1737 src/cache/rules.rs +25aee4a1805f5054444f2a231a6b799ca59af68d8c06af4f0b59e97a0086f08d src/cache/rules_tests.rs 48344d7dcbbb220d8c16f5aa9bb88d86a6388b226bbf93d0ca92d8dfbf2c8001 src/cache/stats.rs 65b9776786a904d5ac72fa7d85dd56e3185e29201e34b0ed9b95aaf21d058f89 src/cache/tests.rs b969394b04859b269dcecd8958b1aab40b532709512714e9900f0ecad6b6d0c5 src/cache/tickets.rs @@ -436,7 +436,7 @@ fbea01fea1213d98aea812c1b78d5db289e09200b98ae514d742235cd3fa70e1 src/config/int a3bd297d160b3bad25bb362de848f182b7ec9807943c5c4537dafbc2a1e299d8 src/config/model.rs 75839458ddbc7480ec4492a95eeb67b617ba7d62f7b67e7a767a3453b74dbcbc src/config/route_policy_tests.rs caf688a85edc57e92d9ab0cd480282d4a3ecffe210473cf7e3abaccf8c8cd7ce src/config/routing.rs -4ba1998de8b8b7d43548d0a6708db59e05654c0ed5a999152885668246bd69d7 src/config/routing_conditions_tests.rs +4a7fc07017afd5567c047528c747efae3052262d97c20096c2d91fd43cf58ffc src/config/routing_conditions_tests.rs fa835ba4bf063c373defd95e7b37e95d8a281cfa8b8595f4c1fc0cf3988af3a5 src/config/snapshot.rs c56f696db4e37f5bbf7179e9a952aca8a89c81b4e479f9c79bb18a6f89cf5364 src/config/tests.rs f35de0ee1516ece6bbfd2b2a7db7d1e0f5048b0ec47cf2a3765dffb799abfd93 src/config/transport_tests.rs @@ -447,7 +447,7 @@ c290d0cb02dfa5d2c60ecabac1cfb20c8884e3d14cca1944906c6d8e677f1784 src/db/api_tok 2ff744223934685439374572b83fd639bb3eabdbac168bea4a6501a6e9ce0ee0 src/db/history.rs fefe4896f91f41b7a9ad1f77560c10eb2b3ed989848d3d402cf00bf4948b9217 src/db/tests.rs dada314e1709e960eb2e225b4d10c3cd12606c62c4bc2c0220aec1ba133e4ade src/demo.rs -d2ef07d1565569f520a6a8eb01f4ea9bb673499d038018d52e65fe95e800bb27 src/diagnostics.rs +9273dfebe366c594d46112ccadefec6a6709390b5de346903351d348623a0133 src/diagnostics.rs 045593a42a6e4f632e5052c655788f0843faa313fc929265b89509f6dfff91ed src/docker.rs ea041859335219773748acbb479f83245ecdd3301108972fc0e0c1ea4c95717f src/docker/client.rs c312cfa95759722c56e441feb6c261fe69944e8aaccb4cf90aa7ad5f4d321c89 src/docker/model.rs @@ -465,9 +465,9 @@ cfc75486e69c310fa6e7bf0448ed39a20cdad9dd8afe75e01592fc7c76a380db src/geoip/test cbc6e7446f188a8bacb8c97dbbca5254639d899b926d8723523dcbfa5fedfc46 src/geoip/update.rs fa1ba1275ff35afa1fea55cd50e3e7321a6a9140827008b0d76880fe298be79d src/geoip/update_http.rs 8c72a10f07f82e2c0864551a3c95e261129c23cf6072f902d063564b6ea6770f src/geoip/update_tests.rs -0d30680419a2a013fdfcb38ce3f96c8daa167adc1fcd400ee5d3221fd77c6409 src/headers/mod.rs -bd72aeef1c79cc13cb64a5d3774d601cfe99a32ee2e6014a4cf8de68f77aac89 src/headers/tests.rs -f54f29bb923c7101a0da4d9a0a322447a8ebd4c59c5954d9b2b30b0dad13b5e0 src/hex.rs +05e16d748905cce059fa209d83eeaac9cd3ab9c13541761366b8b5321b11daf2 src/headers/mod.rs +9f0ffe462dc78216098df28ccea41e29f67c8c682442d7ea600b3b538809eef6 src/headers/tests.rs +bfcd5622910f5acee0fb9db6b004931472f13274c052c6ef7eece392bd301805 src/hex.rs 4cbf9e60b1b641b63f80bccfe38bbc0025ca2b75991d630bed8e484f1239bd37 src/http3.rs 2554fc93a555e1f39d12d8c172097a4a4571d79db2b6b871a5a1bad0e8dd2778 src/http3/body.rs 741972222414c280104acbcd8f8071bed9cbfcfa2f503c487c11c56f553f53cd src/http3/diagnostics.rs @@ -476,15 +476,15 @@ f54f29bb923c7101a0da4d9a0a322447a8ebd4c59c5954d9b2b30b0dad13b5e0 src/hex.rs 58cb53c10e6993340433bab1decc3491297ea2bdaf60ad4dbf5145ba076637ca src/http3/tests.rs c61bfe0292111990586dbc765361788b80b599e25101f5cb3d1afc090688f884 src/lib.rs e8399753a6ff49b7de19edb0a268bf871c9979a518354160cf07b4669051fcbb src/logging.rs -3635b2b915f2c055d118596a26569fe93c44e2c0fac34d135e47c538f0f4457a src/logging/error_runtime.rs -4fd439ad1f0357fd859bd02ce10cbb476f8c4e03ee432ff1687abd4c453dfed9 src/logging/format.rs +8954dcc22b217f185a49108d4710c615929a6f7adfe9fa1586cbb8a08858f390 src/logging/error_runtime.rs +ee30960ca48ed34c8ca4b3a2661b5aeecaad57f4519032edcdb1d6c1448d8550 src/logging/format.rs 535b81c4565f2385adb0a5bcfaca64f70d2c67e8c99a3b5039b6ea46ae16c0ce src/logging/model.rs -2da02bccfffa206305d95b34a4d73924db2873d5706e17a6d409083b41ab436e src/logging/runtime.rs -1e161754359808f921bf19fe2b124fcd99c70983fa4800bb93b0ac9e3068f47e src/logging/tests.rs +54abd53d26b7ec4f00bafdbdae6601fbd8b3b65fbfbf8dfcfc6282048cca0d0b src/logging/runtime.rs +7304ea46a4754cd49e5e01c4dc6dae62a95ade3be82b692ef7d864375570c8d2 src/logging/tests.rs 560c3a022a163a751d7b568d9493076500effdac34dc29cf5aa2954487504619 src/main.rs -adbe7240ed3230dbdf37e5f5678718a14fa234e15c1907a16dc81ae8961470b7 src/main/admin_runtime.rs -9a58cb68f64f8d0c55de754832d8c638ee65e93ae48f492a43538951a71679a0 src/main/bootstrap.rs -48d5261771a382b6581ac02eb1fabbb4a5b8af44468a5a8a81b8a6db0792fb1b src/main/headless.rs +2e4065cc9c08bfac87e1c9e9937e81d12c196e91471a0f9b3671507a99584f33 src/main/admin_runtime.rs +9b8586b0728f41f1b705942c7c1040875773a7ec8ec8310f7762d8a64bda269f src/main/bootstrap.rs +eec8ebdeb33f3f06c8d96540b36ae4ae5801cb8ce4e3ba0d37587678505f22e3 src/main/headless.rs 5a98d0e249338e73aa57ae2e352dc16db2f79c2d042c1544ce1c2022da76a31c src/main/proxy_runtime.rs 4b500a53fe5c0c2f6002b8488523a51e65ad1655ff9b17a0a1f721147d545005 src/main/shutdown/mod.rs 0a6578a0f4023b9f8d73043bf942dc5e096ef9afb8c0d2f131c14f65d08ac01d src/main/shutdown/tests.rs @@ -499,10 +499,10 @@ c456b31ddd7a5c209073812b288f2cc150b5cdb0ed9372d4d1a9a84a74d706cd src/not_found/ c19998732c2d65b464f43d17a58644db5bcf7b4a6dd4c31a65a091c57692a5bb src/oidc/mod.rs c4dbe0f8ded237d45b6a3977bdc7544296e4408996815cae9e28af028419d0b7 src/oidc/tests.rs 992f49379e44361d98088d8f8ca1013d62846a54a5a35c089a5e0e1a9488e08d src/oidc/token.rs -88aec79784c4307707d3c1489d6a4e878f83a7eec2ba7d0f2db98b88589fbc1f src/pages/mod.rs +eda1cf863335df9c30fbc7d21a086c22ef472a64dbaa80b5d5bd8ec061fada5f src/pages/mod.rs 3ebf39c7e7de2ad794625e67937991b65adcf4e8c9978061f21ad891b2238aaa src/pages/tests.rs -9840ec5b3786661084fefdced6694f3c099fef1e872e28fab9ef9a5cef29d141 src/policy/compile.rs -420d3e1133621a6bab8c15523cbd81712ea4b5d36c1390d52d5ef703164850c9 src/policy/engine.rs +8337027975a087b8196813a65c92629b0bee6292fe76af364b7bd5900a5bf1ec src/policy/compile.rs +847a49161e3beabbb9945f1fc71e5af8ba595aa83b30ae3d3e29a6fa9a9b4e1d src/policy/engine.rs 12440a52f0a90f0f853f4a1273aef20b4b95137709dcf48345707aeef291df90 src/policy/expression.rs 8cd479954224d1b873070a36a63ca6bc852bd1b4a4deebf845857178ea34d2a3 src/policy/haproxy.rs 12232e72df429ae867e7b8d41ce61be2b94941237a3b18b223dbd07df2b42dab src/policy/mod.rs @@ -517,27 +517,27 @@ f8a9541b568ade946dfc0b3353548a773a0126f705b537815ce0523439b07ef4 src/prometheus 028e1dd9f2ec2afaf699a6b21c2d4b0d96e76f11f5e4ed009c233dadf0f3be51 src/prometheus/traffic.rs 12cf2b67072b10bcb163eeef76efc298dae1d9598ea6bb8a441f735339c1c467 src/prometheus/vhosts_backends.rs f1b0254f53b1a4336bd8170ad441ba072b49a114e497b985cb20699b4e375044 src/prometheus/web_php.rs -0907577a636a330b3c82c3f68b820c019088199b06ac824df23eaf47dff2633f src/proxy/body/mod.rs +389ed3db9c165668d4aeeb3d92482745d7c7711a56513bcb58feaf9dc28406d1 src/proxy/body/mod.rs f882bd071bf83a71e6786dd426a62b3a11ab022715d14f2f95b956b0ccee757b src/proxy/body/tests.rs -1af4712b76c5fd1f1248db8f3aa32a53019e20aeb1d62a34792ee539ed8e5d80 src/proxy/cache_helpers.rs +af6119cf9dfa18d2a0836a088eb4311ff2c4d667d4f51a23db4514e4e71ed061 src/proxy/cache_helpers.rs 2d39552aa01ce3d048560944975243d0a58ae762d838e547f5fa65007d871dc4 src/proxy/cache_http_invalidation.rs a86b10ce0707b51e925e11ea14f7f40fa108a196166f62cf40007a97f9e17203 src/proxy/cache_http_invalidation_tests.rs 235388904f138367e30ea4c1d2123133d1d00591fd351f32f963fec3453aaf7d src/proxy/cache_plan/credential_tests.rs 19e3e0157c139cb05cd199ee8ea0d5f212a9b6c14aeb641bad81a7c456792f6a src/proxy/cache_plan/mod.rs 811a00b55b24638b4bf8a6bea9ed7c0ffe2a758f76bfe63a95e1d31bce1c2c9c src/proxy/cache_plan/tests.rs -86985cc07f7a16a6c18265dbcd37528dcafa8f39944d49cb94cfc2ab6b85aa00 src/proxy/error_fallback.rs +87c3447044416a7b7cf211a7aa700292c6933fb69f9d3cf0d2ca428b8a12b96d src/proxy/error_fallback.rs 8d6edb93bd7e82577639509a675c6a387e04ea2d8a01a8ededf834995a42d54a src/proxy/error_fallback_policy_tests.rs -ff525886feef76d5fafcdfc68799a47b1c6a72651e6848ace7c3e5609793cbef src/proxy/forward/cache_fast_path_tests.rs +be4d91a17d5a91fb0cc3f860e09166e02cf797f29c79e5df25ed2ea70ca69523 src/proxy/forward/cache_fast_path_tests.rs fdb3d0c1604a3cd829b1313dbeea20cc875ac5cd3fbff3686b37a2066ac6fb01 src/proxy/forward/cache_lookup.rs 287012c81144d8f15af4a148ce3ca911d431bc59adff44e697567561aa372bb3 src/proxy/forward/h3_navigation_tests.rs a2a097852d126851fc7191c2fda65764dc842745ad657b970399c1f906caf114 src/proxy/forward/response.rs e56339212d8fe4eca45e76dd0e6372ea009ac4becdf7220c41eb9061f19d8e9b src/proxy/forward/route_cache.rs -ccecf3077cebe96320f1cef9b8df17253a9dde314d57b2f9a62a6af754406105 src/proxy/forward/static_cookie_policy_tests.rs +286912a6f6fab192ecbeb1677dfad7863df758b7d947a5b45310f1fd24e76593 src/proxy/forward/static_cookie_policy_tests.rs ab27174e36fabe0b4e610a96be4a81de4b9d173ec60736ce5d6b51c1a8fa9826 src/proxy/forward/success_finish.rs 8beccb28fbee2a7d7df5991ce93a8610f7d92bd1d4abed8679b968861ebd8a1f src/proxy/forward/success_prepare.rs a91d0bdc5740beec921df50ad14a4e85de0a73d46c9626c9cfd37a7f8baca317 src/proxy/forward/upstream.rs 03961ad0d386759ca2016d2dde37e124453514650d19a7feeaaa931f1ba81fc8 src/proxy/forward/vcl_policy_matrix_tests.rs -a1cea78b32c0c05e583f42c98d6387284fe096325a255e3df7f9b7051dad73dd src/proxy/forward/web_source.rs +6af3b8144e4f81b6f7210c87914c0da13ba07ce4304cdb554dcff04d7df5b2f9 src/proxy/forward/web_source.rs 3df1cd933c77e5390066e0bf3a4671a053b97ec1948c4a4204004312a3572c9d src/proxy/forward_entry.rs 9b25f5e3ea4443a63ee6f45d12e1957dd316fe8e85325fc00ea416faaab1025a src/proxy/h2_graceful.rs 9f4ac3cd82d8929be015c2a42a1934076e554d714cd0dd34636a9458ec552130 src/proxy/headers/authority_tests.rs @@ -568,15 +568,15 @@ db254128c8013adaad7280f40a0edd8b196083afef299cd9e193e6db1d698b82 src/redirect/m e2a5367eb4e9b35e58acacb2390cc859e7ee5b59379b79e302018737028a90a7 src/runtime/certificates.rs d9017b6ca3a624b6883f696337471d513fbf2e96a90c92b184a895c72a16ccf0 src/runtime/constructors.rs a868442930930eeb71aeb2e14274bb69497ecbc4d844879e3666b636c7c993d9 src/runtime/docker.rs -2a086cb2fac54709c953810d628bd81d321b6f8318f7ef7281abfea8252d9b9d src/runtime/external_config.rs +ed90a0f04f6544f44eb2de95511658fee6c597f7d91608152f4b60e9d2aa0a61 src/runtime/external_config.rs 66a6f30dee7df4514a75643889be0f8da17f977475cd680fd9e17b8a5d9233da src/runtime/headless.rs -e7c21dbabb9d89058cd9e767f83a3e9217865fa87ab6c07bbf96826fe154ff52 src/runtime/headless_tls.rs -e524ebd53e83c1f660cb1525e1d458b24423063d69984ffad0fa0d9d2dd9e2e0 src/runtime/headless_tls_tests.rs -728d7736eeb916c231a1016454529dfec452666a2f42faf21a69de252ade7b02 src/runtime/health_endpoint.rs +99b54a4f38da0d90dbea072513d509a3e6a53181ee2b082b4562943f26eb284b src/runtime/headless_tls.rs +d0cb7b145a0666fc5c710f4668deabc79d82d837a3c2a2f3c1cc8e7418b16753 src/runtime/headless_tls_tests.rs +74afbc82119a65a373b820784ae8649b6f8e26900e57e6ecb637baff0598dee9 src/runtime/health_endpoint.rs da6eaa5cfe3b6111367743229be5c1891011fa397059b63e520f12b6930ca819 src/runtime/policy_revision_tests.rs -4275bb507e5e7f52fe1b5b011db2770890217ce99530b6d8f620ccd894cafe3d src/runtime/tests.rs +eb63a4735b18a39e03dc4c3efbe85516568c5c758eff7287ca4dc96a60dd03ba src/runtime/tests.rs f626bdeb9f2f9a1bad87c8894d68c478a4767496d66225dbca1a10f83290dddb src/runtime/types.rs -2cc3e9fcd0464828b99aec1d334646eca7729267734a74d53bd38c67f27f5ba9 src/runtime/updates.rs +40b63507c92430ce8e6b51b09bd3597a2d2c4fdb33bf112e2e9a4b23e468ea62 src/runtime/updates.rs e3dbd60953db5a976985dd796e4268b41a0f3df59764c4664015bd41e2578058 src/secret_store/mod.rs b0c4a46b40b09794fd8a037afca380ee3b95941bf75a0e1102a4e520a4bd8be3 src/secret_store/tests.rs 53bc7b1fcc1eab8860ebafccd0c9ed2aadf75363323891a4a4a22114c323b22a src/security/mod.rs @@ -638,28 +638,28 @@ ae880b40197454ea3fbf4d2113984dc372098b2e54b97e87c83cc319de253377 src/upstream/t 5c42f1befec267293b6f03eada118a11c90adfb4b32e0134d7f0033c7453c7cc src/user_agent/mod.rs 696a2783a24f7f3d69fb820dc3a772ec49ea46ee017087952a8253363a9b7374 src/user_agent/tests.rs 3fca10e85c6b936c142f4f0c32e642fa92fd4ad792af8cb05514fc8f19002714 src/vhost.rs -f8b3f8e45306b13ee925f5cb54f8e2de1934314e2c590f14be7ca3814438f4af src/vhost/conditions.rs +6896cc24cdb933422ec4afb9a22c05a691a77b91ba73a3d3ee3d9be6ff699b8c src/vhost/conditions.rs 846707452ccf10962f1763be66b8f56c050b0398b48968015fb799dac289c0d6 src/vhost/error_fallback.rs a7b789d92cda754ba74f6b2c8de0693626b311112cf50b6a73fbe3f52dbeade5 src/vhost/model.rs fc8af7342a3b147921e9040116af5dfe680b3df910db2416ada18198bbeea7df src/vhost/redirect.rs c8722700c4e42b5daa212e70a4c56938f41c1ada8c541cb6b614a2d496369741 src/vhost/tests.rs 34ffb202075c9fa720d2a23c6d901471655befe583a6335d778391d467cc8186 src/vhost/validation.rs 8d1eff4b24f01d137414ef5419f75dd281879228adb70409645b11b3c78c20e9 src/web_server/config.rs -77e030e44dfb3019765927a42626f6154df423b74f816e6432dec1df14572e65 src/web_server/config/compile.rs -a4d394582f34ab16bb046780d4f755c6bbcc6afb497b03e277980750ab2e5f25 src/web_server/config/model.rs -9a3056d371219b7327d612b40b89587a0c30c7f8487386ba95e69050d0bdf11f src/web_server/config/validation.rs +cadab683ee4e4daf3ee05efa6e8928c7e997b50a96f2bbed34a64087fbd1ceb2 src/web_server/config/compile.rs +d247215ebbd3e2ed609273f3885bfa6ade4a01c4eaaec44f74a2c8091b92bf22 src/web_server/config/model.rs +b0c0cc4b3cd5575474525c7e41e7c36af2d0ca450e605cb4695e91677655dfcd src/web_server/config/validation.rs 86c744216d7132d8294a6e90ba9be5fd871646006313d1c62506d40c81db9b12 src/web_server/fastcgi.rs -c0a00d9e72a41250ed75e1a3551098936d16e0abf4cc0b42c184dad7e9991bdb src/web_server/fastcgi/protocol.rs -508da845651652641110ec850034385a49b53e5698065635228627a6a56e3731 src/web_server/fastcgi/response.rs +9f6ee386083565a65316ec53a8287baeafa528bcc497d4cabcb9da9738dd4a17 src/web_server/fastcgi/protocol.rs +d095b475e2241fa0e6a815a1ecf143977363c3407efb8fc0a696a0d2d8add43c src/web_server/fastcgi/response.rs 92d2ab4d7ecb766bbc705f8eba94c1ca33347ffb84b36e0ad0eccfed5915473f src/web_server/filesystem.rs d4fec3682532b0f2d11a0aefcd024f69fb623a39922ddb6c528a2d2de265347d src/web_server/htaccess.rs -a4d955e9225022a4402885cbbe9b03929a651acb8eac57d304dac297f075eb14 src/web_server/htaccess/model.rs -66e5fafcb04dea31a799bdf330b668e88e35198dfaafeff1134c451a4c6e3fdc src/web_server/htaccess/parse.rs -5f25f62190e5743c3661895e00ffda59e1f7fa5074924a0c5db02789fa20ef69 src/web_server/htaccess/rewrite.rs +b456370293cfa95d64ee7eb2fed666463195f7bbce6590260b5572c93dd27dd5 src/web_server/htaccess/model.rs +63dbc49c64853df3ff01fe563479a21c269a7f868c341bf5825efd7423c06ea4 src/web_server/htaccess/parse.rs +36e5fc8c4d57aceb4d8f3550977dbd975ae25611d0a637e1993b4778c6de6816 src/web_server/htaccess/rewrite.rs 8ca74d9cc4470045301f70eb4a9fbabd0dbfe74434429148d2230df9f996c06c src/web_server/htaccess/tests.rs 7fe32af33b4d8e079ad724665aa1cfb62f6e98b9406b77168feaac55dac36137 src/web_server/metrics.rs 2356ec4180ad2880766e77c1117ebc2aef0a90c6a47f8fac4a7ec757314318c0 src/web_server/mod.rs -709a672a0d210aae94f791de50ddbe0f902a1955c150ff35a3a575e352d9c198 src/web_server/request.rs +90d7e50ffb19f42f8c5d22bd5d5595d4d8bc814194ef5d4f17fc33508e7f4344 src/web_server/request.rs d98c80663847d6d83073df074ebff65952755415574708abcc153bd8d3adfaa9 src/web_server/response.rs b38a1c9e648e3606a534ebdf74f6315863a326c6de1ca8edc433abe9c1fed7b4 src/web_server/response/file.rs df87b67c75bbe58d7e077ed4c4cfa105ec680e89dd0c25af7dbd793d418a01ad src/web_server/response/file_body/mod.rs @@ -667,8 +667,8 @@ e5f5fbe702f66bfcbcbc1d1f3cd3d89bdbb929bb86aed94868a2a06a4b9e59e3 src/web_server 7da903c1a69be0ae6b85772b3208c518679efa8ed9d3e98adb694483518156b6 src/web_server/response/headers.rs 2665d4eac9a6430d68224874784cb65d9b9d424353af77735caf044401d08cb4 src/web_server/routing.rs 9e584eb4455a18641c2c89f9e9725745c93f32877abf0f0f2fbea9e3d5ef38c3 src/web_server/security.rs -ca7fbabd87fa117f6cfd9cccb2375396432a999f15d4e9af0f6f3420eb2ae57f src/web_server/serve.rs -3b2005d4e0dfa7597b4577363eebd6e5afb96f5f356a2c96905f5af1f9cc2058 src/web_server/tests.rs +56729c13c5f175dd6b84f367ed6b69eb9969f8c9052d052626371955dd155030 src/web_server/serve.rs +f98e660cfba49cbc9bf2521822e47a04a3a2b178d884d0da5fc662586933ce4a src/web_server/tests.rs f00743af2cf4a5952caef7a1dcf68e7817b5599a252a9973e1c22045517c0b0e tests/fixtures/argon2id.json 9540e9a904455a2190c2d0a32b47b1345976e4c4618767ed2b55898d13da9987 tests/fixtures/balance_rendezvous_vectors.txt affb5c728d2d2bd58807c080f22ac17575e06486c7cca38dc13cf58ad01873ae tests/fixtures/routing_conditions_cases.json @@ -735,6 +735,6 @@ dc57d461e14ac7451f6c78fd2f6c3769dbbb4f613e0fc05348711548ee408175 tools/dev/fixt 06da8cc54d0b530f444f5569abd31df5cbfdff80e4fc3cd49419d32483d94465 tools/dev/fixtures/vcl_regression/vary_unset.candidate.json 3bed9706943de42e0bab8ee810035a279e54271b1adcd69184a4d01779da81c9 tools/dev/fixtures/vcl_regression/vary_unset.json b440bf533bad7e6f6478c5964c30aa490d9ce0661477d8e2fda3ad6cd1d5a492 tools/dev/fixtures/vcl_regression/vary_unset.vcl -c711154a9df425a56607bd88f03815ffb408213a31a2b66ed1c1c9a6301a2fc6 tools/legacy/backup.py -5421082e24f3794356331157e30b428f3221a0d74c0b5d060bd4d3989e0bcf3a update.sh +d08d4489fd8482debb43b84decd60fcdf413486d54a8ebb1cc45f896240b44c5 tools/legacy/backup.py +5258cc08e5c62b3643a7e441a692fc3492fb2168f02e3847f3079fe3c71ca122 update.sh 56c702111022e1ca2c8f6b72c635c749b05936ffe6387bdb0a202691614cbc96 upgrade.sh diff --git a/UPDATE_CHECK.toml b/UPDATE_CHECK.toml index 737bc83..a05318c 100644 --- a/UPDATE_CHECK.toml +++ b/UPDATE_CHECK.toml @@ -1,6 +1,3 @@ -# Embedded defaults for the built-in RustProxy release checker. -# The file is compiled into the rust-proxy binary. Runtime overrides are available -# through CLI flags / environment variables documented in README.md. repository_url = "https://git.linuxiarz.pl/gru/RustProxy" version_url = "https://git.linuxiarz.pl/gru/RustProxy/raw/branch/master/Cargo.toml" interval_seconds = 3600 diff --git a/deploy/rustproxy.service b/deploy/rustproxy.service index f39c9c1..3ae7a8b 100644 --- a/deploy/rustproxy.service +++ b/deploy/rustproxy.service @@ -1,4 +1,3 @@ -# Reference for install.sh defaults; the installer generates paths from its arguments. [Unit] Description=RustProxy reverse proxy Wants=network-online.target @@ -30,8 +29,6 @@ ProtectSystem=strict LogsDirectory=rustproxy LogsDirectoryMode=0770 ReadWritePaths=/var/lib/rustproxy /var/log/rustproxy -/etc/rustproxy -# Read-only document roots/certificates may live in /home, /var/www or /srv; -# service-account Unix group/ACL permissions still apply. ProtectHome=read-only ProtectKernelTunables=true ProtectKernelModules=true diff --git a/dev.sh b/dev.sh index 307afce..9a0a7f5 100755 --- a/dev.sh +++ b/dev.sh @@ -4,9 +4,7 @@ ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" cd "$ROOT" umask 077 if [[ -f .env ]]; then - # This is a local shell configuration file. Do not use untrusted .env files. set -a - # shellcheck disable=SC1091 source .env set +a fi diff --git a/docker-agent/containers.go b/docker-agent/containers.go index 34bdb41..786b697 100644 --- a/docker-agent/containers.go +++ b/docker-agent/containers.go @@ -124,9 +124,6 @@ func (c *containerCollector) cpuPercent(id string, stats containerStats) *float6 return &value } -// enrich applies a bounded, short-lived snapshot to every service, including -// multiple published ports belonging to the same container. It coalesces -// concurrent polls without holding a mutex during Docker API requests. func (c *containerCollector) enrich(ctx context.Context, sock string, services []service) { selected := make(map[string]struct{}) order := make([]string, 0, maxStatContainers) @@ -166,7 +163,7 @@ func (c *containerCollector) enrich(ctx context.Context, sock string, services [ } } if hit { - snapshot := c.cache // immutable until replaced; copies are applied below + snapshot := c.cache c.mu.Unlock() applyContainerSnapshot(services, snapshot) return @@ -187,9 +184,6 @@ func (c *containerCollector) enrich(ctx context.Context, sock string, services [ snapshot := c.fetchSnapshot(ctx, sock, order) c.mu.Lock() - // A disconnected client must not replace a complete cache with an - // incomplete snapshot. Docker API timeouts still produce a bounded, - // temporarily cached partial snapshot to avoid repeated heavy polling. if ctx.Err() == nil { c.cache, c.cacheSock = snapshot, sock c.cacheUntil = time.Now().Add(containerStatsTTL) @@ -207,8 +201,6 @@ func (c *containerCollector) enrich(ctx context.Context, sock string, services [ } } -// fetchSnapshot uses a fixed worker pool rather than a goroutine per container. -// Results are indexed so workers never write concurrently into a Go map. func (c *containerCollector) fetchSnapshot(parent context.Context, sock string, order []string) map[string]containerState { ctx, cancel := context.WithTimeout(parent, 4*time.Second) defer cancel() @@ -276,8 +268,6 @@ func (c *containerCollector) inspectContainer(ctx context.Context, sock, id stri return state } -// Each request owns its service structs. Never hand out pointers to cached -// values: a caller modifying an inventory must not mutate a later response. func applyContainerSnapshot(services []service, snapshot map[string]containerState) { for i := range services { dest := services[i].Container diff --git a/docker-agent/credentials.go b/docker-agent/credentials.go index 3ea5120..a63f952 100644 --- a/docker-agent/credentials.go +++ b/docker-agent/credentials.go @@ -18,8 +18,6 @@ import ( const defaultEnvFile = "/etc/rustproxy/docker-agent.env" -// requestedEnvFile is handled before other flags so CLI calls can load the same -// configuration as systemd. Both --env-file=X and --env-file X are supported. func requestedEnvFile(args []string) (string, error) { path := defaultEnvFile for i := 0; i < len(args); i++ { @@ -39,7 +37,6 @@ func requestedEnvFile(args []string) (string, error) { return path, nil } -// Read a restricted, plain KEY=VALUE EnvironmentFile. Never execute it as shell. func readEnvironmentFile(path string) (map[string]string, error) { result := make(map[string]string) f, err := os.Open(path) @@ -91,7 +88,6 @@ func makeToken() (string, error) { } func provisionToken(path string, rotate bool) (string, bool, error) { - // Reject symlinks, devices and directories before opening anything. stat, err := os.Lstat(path) var raw []byte if err == nil { @@ -130,7 +126,6 @@ func provisionToken(path string, rotate bool) (string, bool, error) { "RUSTPROXY_DOCKER_AGENT_LISTEN=0.0.0.0:9876\n" + "RUSTPROXY_DOCKER_AGENT_TLS=true\n") } - // Preserve non-secret settings/comments, remove duplicate token assignments. lines := strings.Split(strings.TrimRight(string(raw), "\n"), "\n") filtered := make([]string, 0, len(lines)+1) for _, line := range lines { @@ -148,8 +143,6 @@ func provisionToken(path string, rotate bool) (string, bool, error) { return token, true, nil } -// Generated keys must be readable by the unprivileged systemd service even -// when 'init' is invoked via sudo during DEB/RPM or manual installation. func setServiceCertificateOwnership(certFile, keyFile string) error { if os.Geteuid() != 0 { return nil @@ -157,7 +150,7 @@ func setServiceCertificateOwnership(certFile, keyFile string) error { serviceUser, err := user.Lookup("rustproxy-docker-agent") if err != nil { return nil - } // Standalone CLI; warn operators to run init as service user. + } uid, err := strconv.Atoi(serviceUser.Uid) if err != nil { return err @@ -172,7 +165,6 @@ func setServiceCertificateOwnership(certFile, keyFile string) error { if err := os.Chown(certFile, uid, gid); err != nil { return err } - // Parent generated via atomicWrite must also be traversable by the service. dir := filepath.Dir(keyFile) if dir == filepath.Dir(certFile) { if err := os.Chown(dir, uid, gid); err != nil { @@ -274,5 +266,3 @@ func printAgentInfo(w io.Writer, cfg config, envFile string, showToken, asJSON b } return nil } - -// Compile-time reference: readCertificate returns an x509 parsed certificate. diff --git a/docker-agent/diagnostics.go b/docker-agent/diagnostics.go index b99b62b..0e61ee5 100644 --- a/docker-agent/diagnostics.go +++ b/docker-agent/diagnostics.go @@ -14,14 +14,10 @@ type agentHealthMetrics struct { OpenFDs *int `json:"open_fds,omitempty"` } -// agentDiagnostics is an authenticated, on-demand snapshot. No background -// goroutine, accumulating history, or extra public health endpoint is needed. func agentDiagnostics() agentHealthMetrics { var memory runtime.MemStats runtime.ReadMemStats(&memory) result := agentHealthMetrics{HeapAllocBytes: memory.HeapAlloc, Goroutines: runtime.NumGoroutine()} - // Linux agents expose RSS and descriptor counts in /proc. On unsupported - // platforms omit these fields instead of incorrectly calling heap RSS. if fields := strings.Fields(readTrimmed("/proc/self/statm")); len(fields) >= 2 { if resident, err := strconv.ParseUint(fields[1], 10, 64); err == nil { rss := resident * uint64(os.Getpagesize()) diff --git a/docker-agent/docker.go b/docker-agent/docker.go index eef8d98..eabea19 100644 --- a/docker-agent/docker.go +++ b/docker-agent/docker.go @@ -16,10 +16,7 @@ import ( type unixRoundTripper struct{ sock string } -// Each Docker socket gets one shared transport. Creating one per RoundTrip -// leaks idle connections and their goroutines when keep-alive is enabled. -// The configured socket is stable during the lifetime of the agent. -var unixTransports sync.Map // map[string]*http.Transport +var unixTransports sync.Map func unixTransport(sock string) *http.Transport { if existing, ok := unixTransports.Load(sock); ok { diff --git a/docker-agent/enroll.go b/docker-agent/enroll.go index 9a75ab2..05b5817 100644 --- a/docker-agent/enroll.go +++ b/docker-agent/enroll.go @@ -135,8 +135,6 @@ func (e *enroller) redeem(cfg config, presented string, now time.Time) bool { return true } -// The limiter is deliberately global: it has constant memory usage even if -// callers rotate source IPs. Enrollment is a rare administrative operation. type enrollLimiter struct { mu sync.Mutex tokens float64 diff --git a/docker-agent/install.sh b/docker-agent/install.sh index 78db089..11ac814 100755 --- a/docker-agent/install.sh +++ b/docker-agent/install.sh @@ -36,7 +36,6 @@ install -d -o rustproxy-docker-agent -g docker -m 0750 /var/lib/rustproxy-docker if [[ ! -f /etc/rustproxy/docker-agent.env ]]; then install -m 0600 docker-agent.env.example /etc/rustproxy/docker-agent.env fi -# Provisioning is delegated to the Go CLI, which keeps existing credentials. /usr/local/bin/rustproxy-docker-agent init install -m 0644 rustproxy-docker-agent.service /etc/systemd/system/rustproxy-docker-agent.service systemctl daemon-reload diff --git a/docker-agent/main.go b/docker-agent/main.go index a56e292..e98fb4e 100644 --- a/docker-agent/main.go +++ b/docker-agent/main.go @@ -39,7 +39,7 @@ func main() { } func run(args []string, stdout, stderr io.Writer) error { - command := "serve" // Preserve the legacy invocation used by existing systemd units. + command := "serve" if len(args) > 0 && !strings.HasPrefix(args[0], "-") { command, args = args[0], args[1:] } @@ -58,8 +58,6 @@ func run(args []string, stdout, stderr io.Writer) error { } fileValues, err := readEnvironmentFile(envFile) if err != nil { - // PID 1 already loaded EnvironmentFile for the unprivileged daemon; - // access to the on-disk secret is deliberately restricted to root. if !errors.Is(err, os.ErrPermission) || os.Getenv("RUSTPROXY_DOCKER_AGENT_TOKEN") == "" { return err } @@ -80,7 +78,6 @@ func run(args []string, stdout, stderr io.Writer) error { fs.SetOutput(stderr) fs.StringVar(&envFile, "env-file", envFile, "systemd EnvironmentFile path") fs.StringVar(&cfg.Listen, "listen", env("RUSTPROXY_DOCKER_AGENT_LISTEN", "127.0.0.1:9876"), "listen address") - // NEVER supply a token as a flag default: `--help` would leak it into output. tokenOverride := fs.String("token", "", "Bearer token override (prefer the protected environment file)") fs.StringVar(&cfg.DockerSock, "docker-socket", env("RUSTPROXY_DOCKER_SOCKET", env("RUSTPROXY_CONTAINER_SOCKET", "auto")), "Docker Engine or Podman API unix socket ('auto' detects Docker, then Podman)") fs.BoolVar(&cfg.DisableSystemInfo, "no-system-info", !envBoolValue(env("RUSTPROXY_DOCKER_SYSTEM_INFO", "true"), true), "do not report host diagnostics (load, memory, network, uptime)") @@ -133,7 +130,6 @@ func run(args []string, stdout, stderr io.Writer) error { if created { fmt.Fprintf(stdout, "Created a random Bearer token in %s\n", envFile) } - // Reload because a new token was written after the initial environment read. fresh, err := readEnvironmentFile(envFile) if err != nil { return err @@ -179,7 +175,7 @@ func run(args []string, stdout, stderr io.Writer) error { if !validToken(cfg.Token) { return errors.New("no valid token configured; run 'sudo rustproxy-docker-agent init'") } - fmt.Fprintln(stdout, cfg.Token) // Deliberate: an explicit administrative command. + fmt.Fprintln(stdout, cfg.Token) return nil case "info": if err := printAgentInfo(stdout, cfg, envFile, *showToken, *asJSON); err != nil { diff --git a/docker-agent/main_test.go b/docker-agent/main_test.go index f2f1bb7..78b69f4 100644 --- a/docker-agent/main_test.go +++ b/docker-agent/main_test.go @@ -226,7 +226,7 @@ func TestTLSInventoryReportsServingCertificateFingerprint(t *testing.T) { go func() { _ = server.ServeTLS(listener, certFile, keyFile) }() t.Cleanup(func() { _ = server.Close() }) - transport := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}} // test-only: verify the endpoint is actually TLS; RustProxy pins it in production. + transport := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}} client := &http.Client{Transport: transport, Timeout: time.Second} req, _ := http.NewRequest(http.MethodGet, "https://"+listener.Addr().String()+"/v1/inventory", nil) req.Header.Set("Authorization", "Bearer "+cfg.Token) diff --git a/docker-agent/model.go b/docker-agent/model.go index 6792b4a..a37bec5 100644 --- a/docker-agent/model.go +++ b/docker-agent/model.go @@ -1,6 +1,6 @@ package main -var version = "0.38.7" // overridden by the package builder using -ldflags -X main.version +var version = "0.38.7" type config struct { Listen string diff --git a/docker-agent/network.go b/docker-agent/network.go index 89a5b8b..a9cc7c3 100644 --- a/docker-agent/network.go +++ b/docker-agent/network.go @@ -296,7 +296,6 @@ func (d *ipDetector) public(ctx context.Context, rawURL string) string { d.fetching = done d.mu.Unlock() - // Do not hold the cache mutex across the external HTTP lookup. ip := publicIPFromURL(ctx, rawURL) d.mu.Lock() if ctx.Err() == nil { diff --git a/docker-agent/server.go b/docker-agent/server.go index 828935d..43363ae 100644 --- a/docker-agent/server.go +++ b/docker-agent/server.go @@ -66,8 +66,6 @@ func handler(cfg config) http.Handler { if !requireToken(w, r, cfg.Token) { return } - // No waiter queue: excess authenticated polls fail fast, so a - // stalled Docker socket cannot accumulate unbounded request work. select { case inventorySlots <- struct{}{}: defer func() { <-inventorySlots }() diff --git a/docker-agent/system.go b/docker-agent/system.go index 1726a26..6087562 100644 --- a/docker-agent/system.go +++ b/docker-agent/system.go @@ -209,7 +209,6 @@ func (c *systemCollector) cpuPercent() *float64 { previous := c.cpu c.mu.Unlock() if previous == nil { - // Initial sample takes time, but no collector mutex is held. time.Sleep(200 * time.Millisecond) next, ok := parseCPUStat(readTrimmed(c.procDir + "/stat")) if !ok { @@ -223,7 +222,6 @@ func (c *systemCollector) cpuPercent() *float64 { if c.cpu != nil { previous = c.cpu } - // Concurrent collection must never roll the baseline backwards. if c.cpu != nil && sample.total < c.cpu.total { c.mu.Unlock() return nil @@ -269,7 +267,6 @@ func (c *systemCollector) collect(ctx context.Context, sock string) *systemInfo info.NetworkRxBytes, info.NetworkTxBytes = ptr(rx), ptr(tx) c.mu.Lock() previous := c.net - // Do not let an older concurrent poll overwrite a newer sample. if previous == nil || !now.Before(previous.at) { c.net = &netSample{rx: rx, tx: tx, at: now} } diff --git a/install-debian13.sh b/install-debian13.sh index 28a1f20..0e49684 100755 --- a/install-debian13.sh +++ b/install-debian13.sh @@ -1,6 +1,4 @@ #!/usr/bin/env bash -# Debian 13+ one-line bootstrap for first install or safe source update. -# Builds as an unprivileged user, then delegates host changes to install.sh/update.sh. set -euo pipefail REPO_URL="${RUSTPROXY_REPO_URL:-https://git.linuxiarz.pl/gru/RustProxy.git}" @@ -83,10 +81,6 @@ if [[ -n ${SUDO_USER:-} && ${SUDO_USER} != root ]] && id "${SUDO_USER}" >/dev/nu builder_home=$(getent passwd "$builder" | cut -d: -f6) else builder=rustproxy-build - # Not under /var/tmp: Debian 13 ages files there after 30 days - # (systemd-tmpfiles), which removes rarely read files from the builder's - # rustup toolchain and Cargo source cache and breaks later builds with - # errors such as "can't find `example` bin at src/bin/example.rs". builder_home=/var/lib/rustproxy-build legacy_builder_home=/var/tmp/rustproxy-build if ! id "$builder" >/dev/null 2>&1; then @@ -121,14 +115,12 @@ run_builder() { run_builder git clone --depth 1 "$REPO_URL" "$work/RustProxy" -# The unprivileged builder owns its rustup toolchain; system compilers are left untouched. if ! run_builder bash -c 'command -v rustup >/dev/null 2>&1'; then echo "Installing rustup for build user: $builder" run_builder env RUSTUP_INIT_SKIP_PATH_CHECK=yes bash -c \ 'set -o pipefail; wget -qO- --https-only --secure-protocol=TLSv1_2 https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path --default-toolchain none' fi -# Read the required Rust version and channel from the checked-out sources. rust_settings=$(python3 - "$work/RustProxy" <<'PY_RUST' import pathlib import re @@ -162,7 +154,6 @@ PY_RUST required_rust=${rust_settings%%|*} build_toolchain=${rust_settings#*|} -# Compare numerically (1.100 > 1.99); do not use lexicographic ordering. rust_version_at_least() { python3 - "$1" "$2" <<'PY_VERSION' import sys @@ -177,7 +168,6 @@ sys.exit(0 if version(sys.argv[1]) >= version(sys.argv[2]) else 1) PY_VERSION } -# rustup run is a non-updating check: it fails when the channel is missing. installed_rust=$(run_builder rustup run "$build_toolchain" rustc --version 2>/dev/null | awk '$1 == "rustc" { print $2; exit }' || true) if [[ -z "$installed_rust" ]] || ! rust_version_at_least "$installed_rust" "$required_rust"; then echo "Rust toolchain '$build_toolchain' needs installation/update (installed: ${installed_rust:-none}; required: >= $required_rust)." @@ -186,7 +176,6 @@ if [[ -z "$installed_rust" ]] || ! rust_version_at_least "$installed_rust" "$req run_builder rustup update "$build_toolchain" ;; *) - # Never silently override a pinned toolchain older than rust-version. if [[ -n "$installed_rust" ]]; then echo "Pinned toolchain '$build_toolchain' is older than rust-version $required_rust; fix rust-toolchain.toml in the repository." >&2 exit 1 @@ -203,7 +192,6 @@ fi run_builder rustup run "$build_toolchain" cargo --version echo "Building with Rust $installed_rust ($build_toolchain); required >= $required_rust." -# Lighter release settings keep builds within RAM limits on small VPSes. BUILD_JOBS="${RUSTPROXY_BUILD_JOBS:-1}" if ! [[ "$BUILD_JOBS" =~ ^[1-9][0-9]*$ ]]; then echo "RUSTPROXY_BUILD_JOBS must be a positive integer." >&2 @@ -214,9 +202,6 @@ if [[ "$ALLOW_REMOTE_ADMIN" != "0" && "$ALLOW_REMOTE_ADMIN" != "1" ]]; then exit 1 fi -# Extracted crate sources are a cache: Cargo re-extracts them from the -# checksum-verified .crate archives, so a damaged or partly removed copy -# (interrupted build, temp-file cleanup) cannot break the build. if [[ "$builder" == rustproxy-build ]]; then run_builder rm -rf -- "$builder_home/.cargo/registry/src" "$builder_home/.cargo/git/checkouts" fi @@ -246,7 +231,6 @@ if [[ "$MODE" == install ]]; then printf 'Administration is loopback-only by default. Use an SSH tunnel or enable Administration HTTPS before remote exposure.\n' fi else - # update.sh preserves the saved data directory, binds and service account. bash update.sh \ --binary target/release/rust-proxy \ --prefix "$PREFIX" diff --git a/install.sh b/install.sh index 7a2f701..4fe8922 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -# Install an already built binary; never download or compile code as root. set -euo pipefail ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" exec python3 "$ROOT/scripts/deploy/deploy.py" install "$@" diff --git a/integrations/routeros-oci-build/Dockerfile.routeros b/integrations/routeros-oci-build/Dockerfile.routeros index 7b7e22b..9acc570 100644 --- a/integrations/routeros-oci-build/Dockerfile.routeros +++ b/integrations/routeros-oci-build/Dockerfile.routeros @@ -7,7 +7,6 @@ COPY . . RUN if [ ! -f Cargo.lock ]; then cargo generate-lockfile; fi \ && cargo build --locked --release - FROM debian:trixie-slim AS runtime-trixie RUN apt-get update \ diff --git a/integrations/routeros-oci-build/build-routeros-oci.sh b/integrations/routeros-oci-build/build-routeros-oci.sh index 53a5416..bbaaf0d 100755 --- a/integrations/routeros-oci-build/build-routeros-oci.sh +++ b/integrations/routeros-oci-build/build-routeros-oci.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -Eeuo pipefail -# RustProxy multi-arch OCI builder for RouterOS (cross-compiled, no QEMU rustc). - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" resolve_project_root() { @@ -39,8 +37,6 @@ PROJECT_ROOT="$(resolve_project_root)" || { exit 1 } -# Supports the invocation: -# ENV_FILE=integrations/routeros-oci-build/.env bash integrations/routeros-oci-build/build-routeros-oci.sh push ENV_FILE="${ROUTEROS_OCI_ENV_FILE:-${ENV_FILE:-$SCRIPT_DIR/.env}}" if [[ "$ENV_FILE" != /* ]]; then ENV_FILE="$PROJECT_ROOT/$ENV_FILE" @@ -53,7 +49,6 @@ fi } set -a -# shellcheck disable=SC1090 source "$ENV_FILE" set +a @@ -72,7 +67,6 @@ VERSION="$(awk ' ' "$PROJECT_ROOT/Cargo.toml")" [[ -n "$VERSION" ]] || { echo "Cannot determine package version from Cargo.toml" >&2; exit 1; } -# Image: REGISTRY + IMAGE_NAME (or OCI_IMAGE shorthand). if [[ -n "${OCI_IMAGE:-}" ]]; then IMAGE_REPO="${OCI_IMAGE%/}" REGISTRY="${OCI_REGISTRY:-${IMAGE_REPO%%/*}}" diff --git a/langs/en_US.json b/langs/en_US.json index b0f1923..d3cc925 100644 --- a/langs/en_US.json +++ b/langs/en_US.json @@ -4690,6 +4690,87 @@ "policySimulatorNoMatch": "no matching rule → default", "policySimulatorDns": "Hostname rules (e.g. office.example.com) are resolved at runtime and are not part of this simulation.", "policySimulatorAllowed": "ALLOWED", - "transformFlowEncodeLine": "global compression with vhost overrides (zstd / br / gzip / deflate)" + "transformFlowEncodeLine": "global compression with vhost overrides (zstd / br / gzip / deflate)", + "certificateAlsoUsedBy": "Also used by", + "certificateAssignAdd": "assign", + "certificateAssignAdded": "assigned", + "certificateAssignAllMatching": "all matching", + "certificateAssignAssigned": "Assigned", + "certificateAssignChanges": "Changes", + "certificateAssignColCoverage": "Coverage", + "certificateAssignColHosts": "Hostnames", + "certificateAssignColNow": "Now", + "certificateAssignColVhost": "Vhost", + "certificateAssignDefault": "default SNI certificate", + "certificateAssignFooterHelp": "Applies to new TLS connections without a restart. A vhost whose hostnames this certificate does not cover can be selected only after accepting the mismatch in its editor.", + "certificateAssignMatching": "Matching the domains", + "certificateAssignNoChanges": "No changes yet.", + "certificateAssignNone": "none", + "certificateAssignRemove": "unassign", + "certificateAssignRemoved": "unassigned", + "certificateAssignSearch": "Search vhost or hostname…", + "certificateAssignSelect": "Select:", + "certificateAssignThis": "this certificate", + "certificateColumnCertificate": "Certificate", + "certificateColumnDomains": "Domains", + "certificateColumnUsage": "Usage", + "certificateColumnValidity": "Validity", + "certificateCoverageNone": "not covered", + "certificateCoveragePartial": "{covered} of {total} covered", + "certificateCoverageUnknownShort": "coverage unknown", + "certificateCovered": "covered", + "certificateCoveredAll": "all hostnames covered", + "certificateDaysLeft": "{days} days", + "certificateDaysShort": "d", + "certificateDefaultSni": "default SNI certificate", + "certificateDnsProvider": "DNS provider", + "certificateDnsProviderNone": "No matching provider", + "certificateFilterAll": "All", + "certificateFilterEmpty": "Nothing matches the search or filter.", + "certificateFilterExpiring": "Expiring", + "certificateFilterLabel": "Certificate filter", + "certificateFilterUnassigned": "Unassigned", + "certificateGroupDocker": "Docker agents", + "certificateGroupNotFound": "404 hosts", + "certificateGroupRedirects": "Redirects", + "certificateGroupVhosts": "Vhosts", + "certificateLabel": "Certificate", + "certificateManagedFiles": "Managed files", + "certificateMismatchAccepted": "mismatch accepted in the vhost", + "certificateMismatchRequired": "requires accepting the mismatch in the vhost editor", + "certificateNotCovered": "not covered", + "certificateOpen": "Open", + "certificateRenewalActionsLink": "Renewal actions in the Renewal tab →", + "certificateSearchPlaceholder": "Search: ID, domain, vhost…", + "certificateSourceAcme": "Issue via ACME", + "certificateSourceExisting": "Existing files", + "certificateSourceImport": "Import PEM", + "certificateSourceValidation": "Domain validation", + "certificateSummaryAssignments": "Assignments", + "certificateSummaryCount": "Certificates", + "certificateSummaryExpiring": "Expiring soon", + "certificateSummaryExternal": "external files", + "certificateSummaryManaged": "managed files", + "certificateSummaryNothingExpiring": "nothing expires soon", + "certificateSummaryRedirects": "redirects", + "certificateSummaryRuntime": "ACME environment", + "certificateUntil": "until", + "certificateUsageHelp": "Redirects and 404 hosts are changed in their own editors (Open). Docker agents choose certificates in Settings → Docker agents.", + "certificateValidationDns": "DNS-01 (TXT record, wildcards too)", + "certificateValidationHttp": "HTTP-01 (port 80 of this server)", + "certificateValidityUnknown": "validity unknown", + "certificateWhereUsed": "Where it is used", + "trafficScope": "Scope", + "trafficCollectedDimensions": "Collected dimensions…", + "trafficMeanLatencyHelp": "mean request duration", + "trafficDroppedTitle": "Dropped samples", + "trafficDroppedNone": "the analytics queue keeps up", + "trafficDroppedSome": "analytics queue was full; lists are slightly incomplete", + "trafficCapturedLabel": "Collected dimensions:", + "trafficDistributionTitle": "Request distribution", + "trafficMoreRequests": "More in Requests", + "trafficMoreClients": "More in Clients", + "trafficOpenCaptureSettings": "Change in Settings → Logging", + "trafficOfRequests": "of all requests" } } \ No newline at end of file diff --git a/langs/pl_pl.json b/langs/pl_pl.json index ff5af39..bf2e98a 100644 --- a/langs/pl_pl.json +++ b/langs/pl_pl.json @@ -4690,6 +4690,87 @@ "policySimulatorNoMatch": "brak pasującej reguły → domyślnie", "policySimulatorDns": "Reguły z nazwą hosta (np. office.example.com) są rozwiązywane w działaniu i nie są częścią tej symulacji.", "policySimulatorAllowed": "ZEZWOLONY", - "transformFlowEncodeLine": "kompresja globalna z nadpisaniem w vhoście (zstd / br / gzip / deflate)" + "transformFlowEncodeLine": "kompresja globalna z nadpisaniem w vhoście (zstd / br / gzip / deflate)", + "certificateAlsoUsedBy": "Używany także przez", + "certificateAssignAdd": "przypięcie", + "certificateAssignAdded": "przypięte", + "certificateAssignAllMatching": "wszystkie pasujące", + "certificateAssignAssigned": "Przypisane", + "certificateAssignChanges": "Zmiany", + "certificateAssignColCoverage": "Pokrycie", + "certificateAssignColHosts": "Hostname'y", + "certificateAssignColNow": "Teraz", + "certificateAssignColVhost": "Vhost", + "certificateAssignDefault": "domyślny certyfikat SNI", + "certificateAssignFooterHelp": "Dotyczy nowych połączeń TLS, bez restartu. Vhosta, którego hostname'ów certyfikat nie obejmuje, można zaznaczyć dopiero po akceptacji niezgodności w jego edytorze.", + "certificateAssignMatching": "Pasujące do domen", + "certificateAssignNoChanges": "Brak zmian.", + "certificateAssignNone": "nic", + "certificateAssignRemove": "odpięcie", + "certificateAssignRemoved": "odpięte", + "certificateAssignSearch": "Szukaj vhosta lub hostname'u…", + "certificateAssignSelect": "Zaznacz:", + "certificateAssignThis": "ten certyfikat", + "certificateColumnCertificate": "Certyfikat", + "certificateColumnDomains": "Domeny", + "certificateColumnUsage": "Użycie", + "certificateColumnValidity": "Ważność", + "certificateCoverageNone": "nie pokrywa", + "certificateCoveragePartial": "{covered} z {total} pokrytych", + "certificateCoverageUnknownShort": "pokrycie nieznane", + "certificateCovered": "pokryty", + "certificateCoveredAll": "wszystkie hostname'y pokryte", + "certificateDaysLeft": "{days} dni", + "certificateDaysShort": "dni", + "certificateDefaultSni": "domyślny certyfikat SNI", + "certificateDnsProvider": "Dostawca DNS", + "certificateDnsProviderNone": "Brak pasującego dostawcy", + "certificateFilterAll": "Wszystkie", + "certificateFilterEmpty": "Nic nie pasuje do wyszukiwania lub filtra.", + "certificateFilterExpiring": "Wygasające", + "certificateFilterLabel": "Filtr certyfikatów", + "certificateFilterUnassigned": "Nieprzypisane", + "certificateGroupDocker": "Agenci Dockera", + "certificateGroupNotFound": "Hosty 404", + "certificateGroupRedirects": "Przekierowania", + "certificateGroupVhosts": "Vhosty", + "certificateLabel": "Certyfikat", + "certificateManagedFiles": "Pliki zarządzane", + "certificateMismatchAccepted": "niezgodność zaakceptowana w vhoście", + "certificateMismatchRequired": "wymaga akceptacji niezgodności w edytorze vhosta", + "certificateNotCovered": "poza certyfikatem", + "certificateOpen": "Otwórz", + "certificateRenewalActionsLink": "Akcje odnowienia w zakładce Odnawianie →", + "certificateSearchPlaceholder": "Szukaj: ID, domena, vhost…", + "certificateSourceAcme": "Wystaw przez ACME", + "certificateSourceExisting": "Istniejące pliki", + "certificateSourceImport": "Importuj PEM", + "certificateSourceValidation": "Walidacja domen", + "certificateSummaryAssignments": "Przypisania", + "certificateSummaryCount": "Certyfikaty", + "certificateSummaryExpiring": "Wygasające wkrótce", + "certificateSummaryExternal": "pliki zewnętrzne", + "certificateSummaryManaged": "pliki zarządzane", + "certificateSummaryNothingExpiring": "nic nie wygasa wkrótce", + "certificateSummaryRedirects": "przekier.", + "certificateSummaryRuntime": "Środowisko ACME", + "certificateUntil": "do", + "certificateUsageHelp": "Przekierowania i hosty 404 zmieniasz w ich edytorach (Otwórz). Agenci Dockera wybierają certyfikaty w Ustawienia → Agenci Dockera.", + "certificateValidationDns": "DNS-01 (rekord TXT, także wildcard)", + "certificateValidationHttp": "HTTP-01 (port 80 tego serwera)", + "certificateValidityUnknown": "ważność nieznana", + "certificateWhereUsed": "Gdzie jest używany", + "trafficScope": "Zakres", + "trafficCollectedDimensions": "Zbierane wymiary…", + "trafficMeanLatencyHelp": "średni czas obsługi żądania", + "trafficDroppedTitle": "Pominięte próbki", + "trafficDroppedNone": "kolejka analityki nadąża", + "trafficDroppedSome": "kolejka analityki była pełna; listy są nieco niepełne", + "trafficCapturedLabel": "Zbierane wymiary:", + "trafficDistributionTitle": "Rozkład żądań", + "trafficMoreRequests": "Więcej w „Żądania”", + "trafficMoreClients": "Więcej w „Klienci”", + "trafficOpenCaptureSettings": "Zmień w Ustawienia → Logowanie", + "trafficOfRequests": "wszystkich żądań" } } \ No newline at end of file diff --git a/make_zip.py b/make_zip.py index d819ae7..81057cc 100755 --- a/make_zip.py +++ b/make_zip.py @@ -21,10 +21,9 @@ MANAGED = [ ] EXCLUDED = {'__pycache__', '.DS_Store', 'node_modules', 'target', 'data', '.git', '.upgrade-backup'} EXECUTABLE_ROOT = {'dev.sh', 'upgrade.sh', 'install.sh', 'install-debian13.sh', 'update.sh', 'make_zip.py'} -ZIP_MIN_EPOCH = 315532800 # 1980-01-01T00:00:00Z -ZIP_MAX_EPOCH = 4354819198 # 2107-12-31T23:59:58Z -DEFAULT_SOURCE_DATE_EPOCH = 946684800 # 2000-01-01T00:00:00Z - +ZIP_MIN_EPOCH = 315532800 +ZIP_MAX_EPOCH = 4354819198 +DEFAULT_SOURCE_DATE_EPOCH = 946684800 def files() -> list[Path]: result: list[Path] = [] @@ -39,7 +38,6 @@ def files() -> list[Path]: rel = file.relative_to(ROOT) if any(part in EXCLUDED for part in rel.parts) or file.suffix in ('.pyc', '.pyo', '.zip'): continue - # Never ship local .env files; templates such as .env.example are listed explicitly. if rel.name == '.env': continue if rel.as_posix() == 'docker-agent/docker-agent': @@ -50,7 +48,6 @@ def files() -> list[Path]: result.append(file) return sorted(set(result), key=lambda path: path.relative_to(ROOT).as_posix()) - def release_datetime() -> tuple[int, int, int, int, int, int]: raw = os.environ.get('SOURCE_DATE_EPOCH') try: @@ -59,11 +56,9 @@ def release_datetime() -> tuple[int, int, int, int, int, int]: raise ValueError('SOURCE_DATE_EPOCH must be an integer Unix timestamp') from error epoch = min(max(epoch, ZIP_MIN_EPOCH), ZIP_MAX_EPOCH) stamp = dt.datetime.fromtimestamp(epoch, tz=dt.timezone.utc).replace(microsecond=0) - # The classic ZIP timestamp stores seconds in two-second increments. stamp = stamp.replace(second=stamp.second - stamp.second % 2) return stamp.year, stamp.month, stamp.day, stamp.hour, stamp.minute, stamp.second - def deterministic_mode(rel: Path) -> int: executable = rel.as_posix() in EXECUTABLE_ROOT or ( rel.parts and rel.parts[0] in {'scripts', 'tools', 'integrations'} and rel.suffix in {'.py', '.sh'} @@ -74,7 +69,6 @@ def deterministic_mode(rel: Path) -> int: ) return 0o755 if executable else 0o644 - def add_file(archive: zipfile.ZipFile, rel: Path, data: bytes, timestamp: tuple[int, int, int, int, int, int]) -> None: info = zipfile.ZipInfo(f'RustProxy/{rel.as_posix()}', date_time=timestamp) info.create_system = 3 @@ -82,7 +76,6 @@ def add_file(archive: zipfile.ZipFile, rel: Path, data: bytes, timestamp: tuple[ info.compress_type = zipfile.ZIP_DEFLATED archive.writestr(info, data, compress_type=zipfile.ZIP_DEFLATED, compresslevel=9) - def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('output', nargs='?', type=Path, default=ROOT.parent / f'RustProxy-{project_version(ROOT)}.zip') @@ -105,6 +98,5 @@ def main() -> None: add_file(archive, Path('SHA256SUMS'), checksum.read_bytes(), timestamp) print(f'Created {output}; {len(paths) + 1} source files; deterministic SHA256SUMS refreshed.') - if __name__ == '__main__': main() diff --git a/migrations/0002_admin.sql b/migrations/0002_admin.sql index 56d70c0..78fd6a0 100644 --- a/migrations/0002_admin.sql +++ b/migrations/0002_admin.sql @@ -1,4 +1,3 @@ --- Additive migration from 0.0.1. The configuration table is never cleared. CREATE TABLE IF NOT EXISTS configuration ( id INTEGER PRIMARY KEY CHECK (id = 1), revision INTEGER NOT NULL CHECK (revision >= 0), diff --git a/migrations/0003_certificate_renewals.sql b/migrations/0003_certificate_renewals.sql index ae2e041..e4fade7 100644 --- a/migrations/0003_certificate_renewals.sql +++ b/migrations/0003_certificate_renewals.sql @@ -1,5 +1,3 @@ --- Persist non-secret ACME renewal observations so the dashboard is populated --- immediately after a restart. Provider credentials remain outside SQLite. CREATE TABLE IF NOT EXISTS certificate_renewals ( certificate_id TEXT PRIMARY KEY, last_checked INTEGER NOT NULL DEFAULT 0, diff --git a/migrations/0004_admin_preferences.sql b/migrations/0004_admin_preferences.sql index 9931afd..129420e 100644 --- a/migrations/0004_admin_preferences.sql +++ b/migrations/0004_admin_preferences.sql @@ -1,5 +1,3 @@ --- Account-scoped administration UI preferences. These are control-plane view state, --- separate from the revisioned proxy configuration document. CREATE TABLE IF NOT EXISTS admin_preferences ( administrator_id INTEGER PRIMARY KEY CHECK (administrator_id = 1), document TEXT NOT NULL CHECK (length(document) BETWEEN 2 AND 4096), diff --git a/migrations/0005_certificate_api.sql b/migrations/0005_certificate_api.sql index be7650d..952ee9f 100644 --- a/migrations/0005_certificate_api.sql +++ b/migrations/0005_certificate_api.sql @@ -1,5 +1,3 @@ --- Scoped credential for externally managed certificate deployment. The cleartext --- token is never persisted; only a SHA-256 digest and non-secret key id are stored. CREATE TABLE IF NOT EXISTS certificate_api_credential ( id INTEGER PRIMARY KEY CHECK (id = 1), key_id TEXT NOT NULL UNIQUE CHECK (length(key_id) BETWEEN 3 AND 64), diff --git a/migrations/0006_certificate_api_credentials.sql b/migrations/0006_certificate_api_credentials.sql index 1f03b12..8300f58 100644 --- a/migrations/0006_certificate_api_credentials.sql +++ b/migrations/0006_certificate_api_credentials.sql @@ -1,6 +1,3 @@ --- Multiple scoped credentials for external certificate automation. Existing --- 0.23/0.24 singleton credentials are copied once and the legacy row is cleared --- so this idempotent migration can run safely on every startup. CREATE TABLE IF NOT EXISTS certificate_api_credentials ( key_id TEXT PRIMARY KEY CHECK (length(key_id) BETWEEN 3 AND 64), token_hash TEXT NOT NULL CHECK (length(token_hash) = 64), diff --git a/migrations/0007_secret_store.sql b/migrations/0007_secret_store.sql index 2212936..6c226fc 100644 --- a/migrations/0007_secret_store.sql +++ b/migrations/0007_secret_store.sql @@ -1,5 +1,3 @@ --- Encrypted application secrets. Ciphertext is protected by the local master --- key stored outside SQLite. Plaintext credentials must never be persisted here. CREATE TABLE IF NOT EXISTS secret_store ( secret_id TEXT PRIMARY KEY CHECK (length(secret_id) BETWEEN 1 AND 256), provider TEXT NOT NULL CHECK (length(provider) BETWEEN 1 AND 64), diff --git a/migrations/0009_certificate_api_grants.sql b/migrations/0009_certificate_api_grants.sql index 66478ae..1c41a7b 100644 --- a/migrations/0009_certificate_api_grants.sql +++ b/migrations/0009_certificate_api_grants.sql @@ -1,6 +1,3 @@ --- Least-privilege grants for certificate automation credentials. Existing --- credentials are migrated to reload-only access for all manual certificate ids; --- rotating them in 0.28.2 lets operators narrow them to explicit ids. CREATE TABLE IF NOT EXISTS certificate_api_grants ( key_id TEXT PRIMARY KEY REFERENCES certificate_api_credentials(key_id) ON DELETE CASCADE, allow_deploy INTEGER NOT NULL DEFAULT 0 CHECK (allow_deploy IN (0, 1)), diff --git a/migrations/0010_dashboard_presets.sql b/migrations/0010_dashboard_presets.sql index f258b84..c2f67db 100644 --- a/migrations/0010_dashboard_presets.sql +++ b/migrations/0010_dashboard_presets.sql @@ -1,5 +1,3 @@ --- Named, administrator-scoped Overview presets. Keep this separate from the --- appearance preferences document and proxy configuration. CREATE TABLE IF NOT EXISTS dashboard_presets ( administrator_id INTEGER NOT NULL CHECK (administrator_id = 1), name TEXT NOT NULL CHECK (length(name) BETWEEN 1 AND 64), diff --git a/migrations/0012_admin_preferences_size.sql b/migrations/0012_admin_preferences_size.sql index fea4a5a..ef088fa 100644 --- a/migrations/0012_admin_preferences_size.sql +++ b/migrations/0012_admin_preferences_size.sql @@ -1,5 +1,3 @@ --- Expand administrator UI preference storage. Current dashboard layouts can exceed --- the original 4096-byte limit once per-widget widths are persisted. CREATE TABLE admin_preferences_v2 ( administrator_id INTEGER PRIMARY KEY CHECK (administrator_id = 1), document TEXT NOT NULL CHECK (length(document) BETWEEN 2 AND 65536), diff --git a/nagios/check_rustproxy.py b/nagios/check_rustproxy.py index 6a28845..bf34d50 100755 --- a/nagios/check_rustproxy.py +++ b/nagios/check_rustproxy.py @@ -15,18 +15,15 @@ import urllib.request OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 - class CheckError(RuntimeError): pass - def plugin_exit(state: int, message: str, perf: list[str] | None = None) -> None: names = {OK: "OK", WARNING: "WARNING", CRITICAL: "CRITICAL", UNKNOWN: "UNKNOWN"} suffix = f" | {' '.join(perf)}" if perf else "" print(f"RUSTPROXY {names[state]} - {message}{suffix}") raise SystemExit(state) - def threshold(value: float, warning: float, critical: float) -> int: if value >= critical: return CRITICAL @@ -34,7 +31,6 @@ def threshold(value: float, warning: float, critical: float) -> int: return WARNING return OK - class Client: def __init__(self, args: argparse.Namespace) -> None: self.base = args.url.rstrip("/") @@ -111,7 +107,6 @@ class Client: except urllib.error.HTTPError as error: raise CheckError(f"status endpoint returned HTTP {error.code} after login") from error - def pools(status: dict, selected: list[str]) -> list[dict]: values = status.get("backend_pools") or [] if not isinstance(values, list): @@ -125,7 +120,6 @@ def pools(status: dict, selected: list[str]) -> list[dict]: raise CheckError("unknown vhost/backend pool: " + ", ".join(sorted(missing))) return found - def check_api(client: Client, args: argparse.Namespace) -> None: status, latency = client.status() state = threshold(latency, args.warning_ms, args.critical_ms) @@ -133,7 +127,6 @@ def check_api(client: Client, args: argparse.Namespace) -> None: uptime = status.get("uptime_seconds", "?") plugin_exit(state, f"API {latency:.1f} ms, revision {revision}, uptime {uptime}s", [f"api_ms={latency:.1f}ms;{args.warning_ms};{args.critical_ms};0"]) - def check_backends(client: Client, args: argparse.Namespace) -> None: status, api_ms = client.status() down: list[str] = [] @@ -162,7 +155,6 @@ def check_backends(client: Client, args: argparse.Namespace) -> None: detail += "; checking: " + ", ".join(checking[:10]) plugin_exit(state, detail, [f"up={up}", f"down={len(down)}", f"checking={len(checking)}", f"api_ms={api_ms:.1f}ms"]) - def check_latency(client: Client, args: argparse.Namespace) -> None: status, api_ms = client.status() samples: list[tuple[float, str]] = [] @@ -184,7 +176,6 @@ def check_latency(client: Client, args: argparse.Namespace) -> None: state = threshold(value, args.warning_ms, args.critical_ms) plugin_exit(state, f"slowest backend {name}: {value:.1f} ms ({len(samples)} sampled)", [f"backend_ms={value:.1f}ms;{args.warning_ms};{args.critical_ms};0", f"api_ms={api_ms:.1f}ms"]) - def check_queues(client: Client, args: argparse.Namespace) -> None: status, api_ms = client.status() logs = int(status.get("logs_dropped") or 0) @@ -193,7 +184,6 @@ def check_queues(client: Client, args: argparse.Namespace) -> None: state = CRITICAL if total >= args.critical else WARNING if total >= args.warning else OK plugin_exit(state, f"dropped work: logs={logs}, cold-cache={cold}", [f"logs_dropped={logs};{args.warning};{args.critical};0", f"cold_queue_dropped={cold};{args.warning};{args.critical};0", f"api_ms={api_ms:.1f}ms"]) - def parser() -> argparse.ArgumentParser: p = argparse.ArgumentParser(description=__doc__) p.add_argument("mode", choices=["api", "backends", "latency", "queues"]) @@ -211,7 +201,6 @@ def parser() -> argparse.ArgumentParser: p.add_argument("--critical", type=int, default=10, help="queues: critical total") return p - def main() -> None: args = parser().parse_args() if args.warning_ms < 0 or args.critical_ms <= args.warning_ms: @@ -223,9 +212,8 @@ def main() -> None: {"api": check_api, "backends": check_backends, "latency": check_latency, "queues": check_queues}[args.mode](client, args) except CheckError as error: plugin_exit(UNKNOWN, str(error)) - except Exception as error: # Nagios plugins must fail closed with a single line. + except Exception as error: plugin_exit(UNKNOWN, f"unexpected check failure: {error}") - if __name__ == "__main__": main() diff --git a/scripts/audit_css_usage.py b/scripts/audit_css_usage.py index 1838676..57771bb 100755 --- a/scripts/audit_css_usage.py +++ b/scripts/audit_css_usage.py @@ -28,7 +28,6 @@ UNSUPPORTED_PSEUDO_ELEMENTS = re.compile(r'::(?:-webkit-[\w-]+|-moz-[\w-]+|backd WORD_PATTERN = re.compile(r'(? list[Path]: if __package__: from .build.panel_css import source_files @@ -36,7 +35,6 @@ def panel_sources() -> list[Path]: from build.panel_css import source_files return source_files(ROOT) - def embedded_javascript_sources() -> list[Path]: paths = set() for parent in (ROOT / 'src').rglob('*.rs'): @@ -46,7 +44,6 @@ def embedded_javascript_sources() -> list[Path]: paths.add(path) return sorted(paths) - def structural_inventory(paths: list[Path]) -> dict: """Report repetitions in their actual conditional scope; never reorder CSS.""" selectors = defaultdict(list) @@ -99,7 +96,6 @@ def structural_inventory(paths: list[Path]) -> dict: families = [tuple(sorted({family for selector in entry['selectors'] for family in VENDOR_SELECTOR.findall(selector)})) for entry in entries] - # Vendor pseudo-element families legitimately repeat one rule body. vendor_only = (any(families) and all(len(family) <= 1 for family in families) and len(families) == len(set(families))) repeated_bodies.append({'scope': list(scope), 'rules': entries, @@ -116,10 +112,7 @@ def structural_inventory(paths: list[Path]) -> dict: 'parse_errors': parse_errors, } - def source_words(scope: str) -> set[str]: - # Rust's include_str! lists are the asset entry points; an abandoned JS file - # beside a bundle must not make its obsolete selectors appear live. paths = embedded_javascript_sources() + list(WEB.rglob('*.html')) if scope == 'panel': paths += list(WEB.rglob('*.json')) + list((ROOT / 'src').rglob('*.rs')) @@ -130,7 +123,6 @@ def source_words(scope: str) -> set[str]: words.update(WORD_PATTERN.findall(path.read_text(encoding='utf-8', errors='replace'))) return words - def selector_parts(tokens: list) -> list[str]: parts: list[list] = [[]] for tok in tokens: @@ -140,7 +132,6 @@ def selector_parts(tokens: list) -> list[str]: parts[-1].append(tok) return [tinycss2.serialize(part).strip() for part in parts if tinycss2.serialize(part).strip()] - def rules(stylesheet: str): def walk(items): for item in items: @@ -150,7 +141,6 @@ def rules(stylesheet: str): yield from walk(tinycss2.parse_rule_list(item.content, skip_whitespace=True, skip_comments=True)) return list(walk(tinycss2.parse_stylesheet(stylesheet, skip_whitespace=True, skip_comments=True))) - def token_refs(node) -> list[tuple[str, str]]: if isinstance(node, css_parser.ClassSelector): return [('class', node.class_name)] @@ -168,10 +158,7 @@ def token_refs(node) -> list[tuple[str, str]]: out.extend(token_refs(child)) return out - def possibly_matches(node, words: set[str]) -> bool: - # Only positive class/id requirements identify review candidates. Runtime - # interpolation still requires manual inspection before removing a rule. if isinstance(node, css_parser.ClassSelector): return node.class_name in words if isinstance(node, css_parser.IDSelector): @@ -192,10 +179,8 @@ def possibly_matches(node, words: set[str]) -> bool: return possibly_matches(node.parsed_tree, words) if isinstance(node, css_parser.RelativeSelector): return possibly_matches(node.selector, words) - # Pseudo-classes, type selectors, vendor syntax and other unknowns: KEEP. return True - def audit_file(path: Path, words: set[str], scope: str) -> dict: raw = path.read_text(encoding='utf-8') entries = [] @@ -210,13 +195,10 @@ def audit_file(path: Path, words: set[str], scope: str) -> dict: references = set().union(*(set(token_refs(item)) for item in parsed)) all_classes.update(word for typ, word in references if typ == 'class') dead = bool(parsed) and not any(possibly_matches(item, words) for item in parsed) - # docs.css targets classes emitted by the third-party Swagger UI bundle. external = scope == 'docs' and '.swagger-ui' in selector if external: dead = False missing = sorted({f'{typ}:{word}' for typ, word in references if word not in words}) - # Retain the historical JSON key for older audit consumers; - # "dead" is a candidate flag, never proof of runtime absence. parts.append({'selector': selector, 'dead': dead, 'review_required': dead, 'missing_tokens': missing, 'external': external}) except css_parser.SelectorError as exc: @@ -234,7 +216,6 @@ def audit_file(path: Path, words: set[str], scope: str) -> dict: 'unparsed': unknown, 'entries': entries, } - def main(): cli = argparse.ArgumentParser(description=__doc__) cli.add_argument('--json', type=Path, help='Write complete selector audit JSON to this file') @@ -270,6 +251,5 @@ def main(): if args.strict and failures: raise SystemExit('Panel CSS structure check failed: ' + ', '.join(failures)) - if __name__ == '__main__': main() diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 9f7c729..8cba120 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -35,7 +35,6 @@ PY VERSION="$(python3 scripts/version.py)" printf 'Validating RustProxy %s\n' "$VERSION" -# Project-owned source/layout validation. python3 scripts/preflight.py python3 scripts/build/panel_css.py --check @@ -44,15 +43,12 @@ if [[ ! -f Cargo.lock ]]; then cargo generate-lockfile fi -# Rust quality gates. cargo fmt --all -- --check cargo check --locked --all-targets cargo test --locked --all-targets cargo clippy --locked --all-targets -- -D warnings cargo build --release --locked -# The Docker discovery agent is shipped with the source tree, but is a separate Go module. -# Set CHECK_DOCKER_AGENT=0 when intentionally validating only the Rust binary. if [[ -f "$ROOT/docker-agent/go.mod" && "${CHECK_DOCKER_AGENT:-1}" != "0" ]]; then command -v go >/dev/null 2>&1 || fail "Go is required to validate docker-agent (or set CHECK_DOCKER_AGENT=0)" ( diff --git a/scripts/build/panel_css.py b/scripts/build/panel_css.py index 3b6f701..611680d 100755 --- a/scripts/build/panel_css.py +++ b/scripts/build/panel_css.py @@ -20,7 +20,6 @@ WHITESPACE = " \t\n\r\f" HEX = "0123456789abcdefABCDEF" DELIMITERS = frozenset("{};") - def _escape_end(text: str, start: int) -> int: end = start + 1 if end == len(text): @@ -36,7 +35,6 @@ def _escape_end(text: str, start: int) -> int: return end return end + (2 if text[end:end + 2] == "\r\n" else 1) - def _string_end(text: str, start: int) -> int: end = start + 1 while end < len(text): @@ -50,17 +48,13 @@ def _string_end(text: str, start: int) -> int: end += 1 raise ValueError("Unterminated CSS string") - def _comment_end(text: str, start: int) -> int: end = text.find("*/", start + 2) if end < 0: raise ValueError("Unterminated CSS comment") return end + 2 - def _group_end(text: str, start: int) -> int: - # Do not rewrite anything in functions or attribute selectors. This also - # protects unquoted data URLs and whitespace required by calc()/CSS escapes. closing = ")" if text[start] == "(" else "]" is_url = (text[start] == "(" and text[max(0, start - 3):start].lower() == "url" and (start < 4 or not (text[start - 4].isalnum() or text[start - 4] in "_-"))) @@ -79,11 +73,9 @@ def _group_end(text: str, start: int) -> int: elif text[end] in ")]" and not is_url: raise ValueError("Mismatched CSS delimiter") else: - # In an unquoted url(), /* and square brackets are literal data. end += 1 raise ValueError(f"Unterminated CSS {text[start]} group") - def minify(text: str) -> str: """Conservatively compact a stylesheet without reordering its CSS tokens.""" tokens: list[tuple[str, str]] = [] @@ -119,8 +111,6 @@ def minify(text: str) -> str: if depth: raise ValueError("Unterminated CSS rule") - # Source modules must stay independent of runtime imports and encoding - # declarations; all are UTF-8 and are delivered as one embedded response. for index, token in enumerate(tokens): if token != ("plain", "@"): continue @@ -152,8 +142,6 @@ def minify(text: str) -> str: if (before and after and before[0] != "space" and after[0] != "space" and not (before[0] == "plain" and before[1] in DELIMITERS) and not (after[0] == "plain" and after[1] in DELIMITERS)): - # Retain a token boundary: e.g. --value:foo/**/bar must never - # become the single identifier foobar. No guessed whitespace. compact.append(("protected", "/**/")) continue if kind == "space" and compact and compact[-1][0] == "space": @@ -173,7 +161,6 @@ def minify(text: str) -> str: output.append(value) return "".join(output) - def source_files(root: Path = ROOT) -> list[Path]: directory = root / CSS_DIRECTORY manifest = directory / "manifest.json" @@ -199,7 +186,6 @@ def source_files(root: Path = ROOT) -> list[Path]: raise ValueError(f"CSS source must be a regular, non-symlink file: {path.name}") return paths - def bundle(root: Path = ROOT) -> tuple[str, list[Path], int]: paths = source_files(root) parts: list[str] = [] @@ -213,7 +199,6 @@ def bundle(root: Path = ROOT) -> tuple[str, list[Path], int]: raise ValueError(f"{path.name}: {error}") from error return "\n".join(parts) + "\n", paths, source_bytes - def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--root", type=Path, default=ROOT) @@ -234,8 +219,6 @@ def main() -> int: if args.cargo: watched = [root / CSS_DIRECTORY, root / CSS_DIRECTORY / "manifest.json", *paths] if args.out_dir is not None: - # Cargo must rerun the generator when its cached output is - # removed even if every source module is unchanged. watched.append(args.out_dir.resolve() / "panel-style.css") for path in watched: if any(char in str(path) for char in "\r\n\0"): @@ -249,6 +232,5 @@ def main() -> int: return 1 return 0 - if __name__ == "__main__": raise SystemExit(main()) diff --git a/scripts/build/swagger_assets.py b/scripts/build/swagger_assets.py index 221716e..28e495f 100755 --- a/scripts/build/swagger_assets.py +++ b/scripts/build/swagger_assets.py @@ -37,11 +37,9 @@ HELP = ("Install Python 3.10+ and allow HTTPS access to github.com/codeload.gith "or set SWAGGER_UI_DOWNLOAD_URL=file:///absolute/path/swagger-ui-5.33.1.zip " "to a reviewed copy of the same tag archive. See docs/INSTALL.md.") - class AssetError(ValueError): """A controlled, actionable source/archive error (never an implicit fallback).""" - def source_value(value: str | None) -> str | Path: """Unset/empty means the pin, never the adapter's historical default.""" if value is None or not value.strip(): @@ -56,7 +54,6 @@ def source_value(value: str | None) -> str | Path: if (parts.scheme != "file" or parts.netloc not in ("", "localhost") or parts.query or parts.fragment): raise ValueError() - # url2pathname decodes percent escapes (including spaces) on this platform. path = Path(url2pathname(parts.path)) if not path.is_absolute() or any(c in str(path) for c in "\r\n\0"): raise ValueError() @@ -64,7 +61,6 @@ def source_value(value: str | None) -> str | Path: except (ValueError, OSError): raise AssetError("Swagger source must be the pinned HTTPS URL or an absolute file:// URL.") from None - def expected_digest(value: str | None) -> str | None: if value is None or not value.strip(): return None @@ -73,7 +69,6 @@ def expected_digest(value: str | None) -> str | None: raise AssetError("SWAGGER_UI_ARCHIVE_SHA256 must contain exactly 64 hexadecimal digits.") return value - class HttpsRedirects(HTTPRedirectHandler): def redirect_request(self, req, fp, code, msg, headers, newurl): target = urlsplit(newurl) @@ -82,7 +77,6 @@ class HttpsRedirects(HTTPRedirectHandler): raise AssetError("Swagger download refused an unexpected redirect.") return super().redirect_request(req, fp, code, msg, headers, newurl) - def download(destination: Path) -> None: """Download with a few retries; github.com occasionally times out or returns a gateway error.""" last: Exception | None = None @@ -92,7 +86,7 @@ def download(destination: Path) -> None: return except AssetError: raise - except (OSError, ValueError) as error: # URLError/HTTPError/timeouts are OSError subclasses + except (OSError, ValueError) as error: last = error if attempt < 3: delay = (3, 6, 12)[attempt] @@ -100,7 +94,6 @@ def download(destination: Path) -> None: time.sleep(delay) raise AssetError(f"Swagger download failed after 4 attempts: {last}") - def _download_once(destination: Path) -> None: """TLS verification uses Python's default trust store; never executes a shell.""" started = time.monotonic() @@ -120,7 +113,6 @@ def _download_once(destination: Path) -> None: raise AssetError("Swagger download exceeded the size or time limit.") output.write(block) - def read_assets(path: Path, checksum: str | None) -> tuple[dict[str, bytes], str]: if not path.is_file() or not 0 < path.stat().st_size <= MAX_ARCHIVE: raise AssetError("Swagger archive must be a nonempty regular file of at most 64 MiB.") @@ -148,7 +140,6 @@ def read_assets(path: Path, checksum: str | None) -> tuple[dict[str, bytes], str mode = (info.external_attr >> 16) & 0o170000 if info.is_dir() or mode not in (0, 0o100000) or not 0 < info.file_size <= limit: raise AssetError(f"Swagger archive member is not a bounded regular file: {name}.") - # Bounded read as well as metadata validation; CRC checked by ZipFile. with archive.open(info) as stream: data = stream.read(limit + 1) if not 0 < len(data) <= limit or len(data) != info.file_size: @@ -168,10 +159,9 @@ def read_assets(path: Path, checksum: str | None) -> tuple[dict[str, bytes], str assets["licenses.txt"] = b"Swagger UI " + VERSION.encode() + b"\n\n" + b"\n\n".join(licenses) return assets, digest - def atomic_write(path: Path, data: bytes) -> None: if path.is_file() and path.read_bytes() == data: - return # Preserve mtime for Cargo's rerun-if-changed tracking. + return fd, name = tempfile.mkstemp(prefix=".swagger-", dir=path.parent) temporary = Path(name) try: @@ -181,7 +171,6 @@ def atomic_write(path: Path, data: bytes) -> None: finally: temporary.unlink(missing_ok=True) - def cached_archives(out_dir: Path, cache: Path) -> list[Path]: """Previously downloaded copies of the pinned archive. @@ -203,7 +192,6 @@ def cached_archives(out_dir: Path, cache: Path) -> list[Path]: candidates.extend(siblings) return [item for item in dict.fromkeys(candidates) if item != cache and item.is_file()] - def remember_archive(out_dir: Path, cache: Path) -> None: """Best-effort copy of a validated archive into the shared cache directory.""" parents = out_dir.parents @@ -216,7 +204,6 @@ def remember_archive(out_dir: Path, cache: Path) -> None: except OSError: pass - def read_vendored() -> tuple[dict[str, bytes], str, Path] | None: """Assets vendored in third_party/ (official swagger-ui-dist files); verified against SHA256SUMS. @@ -250,7 +237,6 @@ def read_vendored() -> tuple[dict[str, bytes], str, Path] | None: "licenses.txt": b"Swagger UI " + VERSION.encode() + b"\n\n" + b"\n\n".join(licenses)} return assets, hashlib.sha256(manifest.read_bytes()).hexdigest(), manifest - def prepare(out_dir: Path, source: str | Path, checksum: str | None = None, *, offline: bool = False) -> list[Path]: out_dir.mkdir(parents=True, exist_ok=True) @@ -288,7 +274,7 @@ def prepare(out_dir: Path, source: str | Path, checksum: str | None = None, try: download(temporary) assets, digest = read_assets(temporary, checksum) - os.replace(temporary, cache) # Cache only an already-validated archive. + os.replace(temporary, cache) finally: temporary.unlink(missing_ok=True) remember_archive(out_dir, cache) @@ -307,11 +293,9 @@ def prepare(out_dir: Path, source: str | Path, checksum: str | None = None, } receipt_path = destination / "source.json" atomic_write(receipt_path, (json.dumps(receipt, indent=2, sort_keys=True) + "\n").encode()) - # Watch both a supplied symlink and its resolved target, plus cached/generated files. inputs = [archive.absolute(), archive.resolve(), *outputs, receipt_path] return list(dict.fromkeys(inputs)) - def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--out-dir", required=True, type=Path) @@ -335,6 +319,5 @@ def main() -> int: return 1 return 0 - if __name__ == "__main__": raise SystemExit(main()) diff --git a/scripts/deploy/deploy.py b/scripts/deploy/deploy.py index 44ac046..822f033 100755 --- a/scripts/deploy/deploy.py +++ b/scripts/deploy/deploy.py @@ -2,8 +2,8 @@ """Install/update a local release binary on Linux/systemd. No builds.""" from __future__ import annotations -from deploy_core import * # stable public helper surface used by release checks -from deploy_runtime import * # stable install/update helper surface +from deploy_core import * +from deploy_runtime import * def main() -> None: parser = argparse.ArgumentParser(description=__doc__) @@ -75,7 +75,5 @@ def main() -> None: except (OSError, ValueError, RuntimeError, subprocess.SubprocessError, KeyError) as error: parser.exit(1, f'Deployment failed: {error}\n') - - if __name__ == '__main__': main() diff --git a/scripts/deploy/deploy_core.py b/scripts/deploy/deploy_core.py index a03440b..519f870 100755 --- a/scripts/deploy/deploy_core.py +++ b/scripts/deploy/deploy_core.py @@ -45,15 +45,12 @@ GEOIP_MAX_BYTES = 256 * 1024 * 1024 GEOIP_FETCH_ATTEMPTS = 4 GEOIP_RETRY_DELAYS = (3, 6, 12) - class GeoipUnavailable(RuntimeError): """The GeoIP CSV download failed after retries; the deployment itself can continue.""" - def run(args: list[str], **kwargs) -> subprocess.CompletedProcess: return subprocess.run(args, check=True, stdin=subprocess.DEVNULL, **kwargs) - def safe_path(raw: str) -> Path: if not re.fullmatch(r'/[A-Za-z0-9_./-]+', raw) or '..' in raw.split('/') or raw in ('/', '/etc', '/var', '/opt', '/usr', '/var/lib'): raise ValueError('Use a dedicated absolute path with no spaces, traversal or shell characters.') @@ -63,7 +60,6 @@ def safe_path(raw: str) -> Path: raise ValueError(f'Symlinked installation/data path is not allowed: {part}') return p - def address(raw: str, loopback: bool = False, allow_remote: bool = False) -> str: if raw.startswith('['): host, port = raw[1:].split(']:', 1) @@ -76,14 +72,10 @@ def address(raw: str, loopback: bool = False, allow_remote: bool = False) -> str raise ValueError('Administration must use loopback unless remote administration is explicitly accepted.') return f'[{ip}]:{int(port)}' if ip.version == 6 else f'{ip}:{int(port)}' - def listener_ip(raw: str) -> ipaddress.IPv4Address | ipaddress.IPv6Address: host = raw[1:].split(']:', 1)[0] if raw.startswith('[') else raw.rsplit(':', 1)[0] return ipaddress.ip_address(host) - - - def admin_address(raw: str, allow_remote: bool = False) -> tuple[str, bool]: value = address(raw) ip = listener_ip(value) @@ -99,7 +91,6 @@ def digest(path: Path) -> str: result.update(block) return result.hexdigest() - def _fetch_https_once(url: str, max_bytes: int) -> bytes: if urllib.parse.urlparse(url).scheme != 'https': raise ValueError('GeoIP downloads require HTTPS.') @@ -120,7 +111,6 @@ def _fetch_https_once(url: str, max_bytes: int) -> bytes: raise ValueError('GeoIP download exceeded the configured safety limit.') return bytes(result) - def fetch_https(url: str, max_bytes: int) -> bytes: """Download with retries; transient gateway/network failures (502/503/504, timeouts) are retried.""" last: BaseException | None = None @@ -139,7 +129,6 @@ def fetch_https(url: str, max_bytes: int) -> bytes: time.sleep(delay) raise GeoipUnavailable(f'GeoIP download from {url} failed: {last}') - def acquire_geoip_update_lock(data: Path, uid: int | None = None, gid: int | None = None) -> int: """Serialize installer/manual GeoIP refresh with the in-process worker.""" path = data / '.geoip-update.lock' @@ -157,7 +146,6 @@ def acquire_geoip_update_lock(data: Path, uid: int | None = None, gid: int | Non os.close(fd) raise - def release_geoip_update_lock(fd: int | None) -> None: if fd is None: return @@ -166,7 +154,6 @@ def release_geoip_update_lock(fd: int | None) -> None: finally: os.close(fd) - def validate_geoip_csv(name: str, payload: bytes) -> None: """Reject truncated/error payloads before a GeoIP CSV is published.""" family = 4 if name == 'user-country-ipv4.csv' else 6 @@ -200,7 +187,6 @@ def validate_geoip_csv(name: str, payload: bytes) -> None: if rows == 0: raise ValueError(f'GeoIP {name} does not contain any address ranges.') - def geoip_file_digest(path: Path) -> str | None: try: st = path.lstat() @@ -210,7 +196,6 @@ def geoip_file_digest(path: Path) -> str | None: return None return digest(path) - def prepare_geoip_update(data: Path, prefix: Path) -> tuple[Path | None, list[str]]: """Download and validate current GeoIP CSVs before service downtime. @@ -243,7 +228,6 @@ def prepare_geoip_update(data: Path, prefix: Path) -> tuple[Path | None, list[st shutil.rmtree(staging, ignore_errors=True) raise - def copy_private(source: Path, target: Path, mode: int = 0o600) -> None: temporary = target.with_name(target.name + '.' + uuid.uuid4().hex + '.tmp') fd = os.open(temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, mode) @@ -260,7 +244,6 @@ def copy_private(source: Path, target: Path, mode: int = 0o600) -> None: finally: temporary.unlink(missing_ok=True) - def apply_geoip_update(data: Path, staging: Path | None, names: list[str], uid: int, gid: int) -> None: if not names: return @@ -279,10 +262,7 @@ def apply_geoip_update(data: Path, staging: Path | None, names: list[str], uid: os.chown(target, uid, gid) print('GeoIP database updated: ' + ', '.join(names)) - def download_geoip(data: Path, uid: int, gid: int) -> None: - # First install has no code-prefix staging transaction. Validate each direct - # payload before publishing it atomically into the private data directory. directory = data / 'geoip' if directory.exists() and directory.is_symlink(): raise ValueError('GeoIP directory cannot be a symlink.') @@ -296,7 +276,6 @@ def download_geoip(data: Path, uid: int, gid: int) -> None: write_private(target, payload, 0o600) os.chown(target, uid, gid) - def write_private(path: Path, value: bytes, mode: int = 0o600) -> None: temporary = path.with_name(path.name + '.' + uuid.uuid4().hex + '.tmp') fd = os.open(temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, mode) @@ -312,7 +291,6 @@ def write_private(path: Path, value: bytes, mode: int = 0o600) -> None: finally: temporary.unlink(missing_ok=True) - def shell_path_profile(prefix: Path) -> bytes: binary_dir = prefix / 'current' return ( @@ -323,13 +301,10 @@ def shell_path_profile(prefix: Path) -> bytes: 'esac\n' ).encode() - def install_shell_path(prefix: Path) -> None: write_private(SHELL_PATH_PROFILE, shell_path_profile(prefix), 0o644) - def logrotate_config(user: str, group: str) -> bytes: - # User/group are validated system account names, never interpolated from a request. for value in (user, group): if not re.fullmatch(r'[a-z_][a-z0-9_-]*\$?', value): raise ValueError('Unsafe service account for logrotate configuration.') @@ -340,12 +315,10 @@ def logrotate_config(user: str, group: str) -> bytes: f' su {user} {group}\n' '}\n').encode() - def install_logrotate(record: dict) -> None: """Keep logrotate in sync with the actual managed service account.""" write_private(LOGROTATE_PATH, logrotate_config(record['user'], record['group']), 0o644) - def check_shell_path(prefix: Path) -> bool: expected = shell_path_profile(prefix) try: @@ -361,7 +334,6 @@ def check_shell_path(prefix: Path) -> bool: ) return valid - def read_record(prefix: Path) -> dict: path = prefix / 'install.json' fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) @@ -381,12 +353,10 @@ def read_record(prefix: Path) -> dict: value['remote_admin'] = remote_admin return value - def validate_user(name: str) -> None: if not re.fullmatch(r'[a-z_][a-z0-9_-]{0,30}', name) or name in ('root', 'nobody'): raise ValueError('Use a dedicated non-root service account.') - def service_unit(record: dict) -> str: prefix, data, user = record['prefix'], record['data_dir'], record['user'] args = f'{prefix}/current/rust-proxy --data-dir {data} --admin-listen {record["admin"]} serve' @@ -441,5 +411,3 @@ LockPersonality=true [Install] WantedBy=multi-user.target ''' - - diff --git a/scripts/deploy/deploy_runtime.py b/scripts/deploy/deploy_runtime.py index 25db7dc..2730785 100755 --- a/scripts/deploy/deploy_runtime.py +++ b/scripts/deploy/deploy_runtime.py @@ -1,7 +1,7 @@ """Runtime install/update operations for deploy.py.""" from __future__ import annotations -from deploy_core import * # re-exported internal deployment primitives +from deploy_core import * ACME_RUNTIME_NAMES = frozenset({'acme-python', 'acme-python.installing', 'acme-python.virtualenv-bootstrap'}) RUNTIME_STATE_NAMES = frozenset({'.geoip-update.lock'}) @@ -117,13 +117,11 @@ def restore_managed_acme_runtime(failed: Path, restored: Path) -> None: except OSError: shutil.copytree(source, target, symlinks=True) - def chown_tree(path: Path, uid: int, gid: int) -> None: os.chown(path, uid, gid) for child in path.rglob('*'): os.chown(child, uid, gid, follow_symlinks=False) - def ensure_service_data_access(data: Path, account) -> None: """Repair the managed data-root metadata and verify service-user traversal. @@ -153,7 +151,6 @@ def ensure_service_data_access(data: Path, account) -> None: 'check execute/search permissions on its parent directories (for example with namei -l).' ) - def switch(prefix: Path, release: str) -> None: if not re.fullmatch(r'[A-Za-z0-9_.-]+', release) or '..' in release: raise ValueError('Invalid release name.') @@ -161,7 +158,6 @@ def switch(prefix: Path, release: str) -> None: os.symlink('releases/' + release, temporary) os.replace(temporary, prefix / 'current') - def running_release_matches(record: dict) -> bool: """Check the actual systemd process executable without publishing a version API. @@ -181,7 +177,6 @@ def running_release_matches(record: dict) -> bool: except (OSError, ValueError, KeyError, subprocess.SubprocessError): return False - def admin_health_endpoint(record: dict) -> tuple[str, bool, str]: """Resolve the active persisted administration listener and scheme. @@ -211,7 +206,6 @@ def admin_health_endpoint(record: dict) -> tuple[str, bool, str]: if isinstance(values, list): allowed_hosts = [str(value).strip() for value in values if str(value).strip()] except (OSError, sqlite3.Error, ValueError, TypeError, json.JSONDecodeError): - # Fall back to the startup listener for old or uninitialized databases. pass host, port = (raw[1:].split(']:') if raw.startswith('[') else raw.rsplit(':', 1)) @@ -226,13 +220,11 @@ def admin_health_endpoint(record: dict) -> tuple[str, bool, str]: connect_raw = f'[{connect_host}]:{port}' if ':' in connect_host else f'{connect_host}:{port}' return connect_raw, tls, authority - def healthy(record: dict, version: str, attempts: int = 30) -> bool: raw, tls, health_host = admin_health_endpoint(record) host, port = (raw[1:].split(']:') if raw.startswith('[') else raw.rsplit(':', 1)) for _ in range(attempts): if tls: - # Local liveness probe only; the admin certificate may be self-signed. conn = http.client.HTTPSConnection(host, int(port), timeout=2, context=ssl._create_unverified_context()) else: conn = http.client.HTTPConnection(host, int(port), timeout=2) @@ -251,7 +243,6 @@ def healthy(record: dict, version: str, attempts: int = 30) -> bool: time.sleep(1) return False - def stage(binary: Path, prefix: Path, user: str, sha: str) -> tuple[str, str]: release = 'build-' + sha[:24] releases = prefix / 'releases'; releases.mkdir(mode=0o755, exist_ok=True); os.chmod(releases, 0o755) @@ -265,16 +256,13 @@ def stage(binary: Path, prefix: Path, user: str, sha: str) -> tuple[str, str]: shutil.rmtree(directory); raise if directory.is_symlink() or (directory / 'rust-proxy').is_symlink() or digest(directory / 'rust-proxy') != sha: raise ValueError('Staged binary checksum mismatch.') - # Never execute the supplied binary as root, even for its version banner. result = run(['runuser', '-u', user, '--', str(directory / 'rust-proxy'), '--version'], capture_output=True, text=True, timeout=15) matched = re.fullmatch(r'(?:rust-proxy|RustProxy) (\d+\.\d+\.\d+(?:[-+][\w.-]+)?)\s*', result.stdout) if not matched: raise ValueError('Binary did not return a RustProxy version.') return release, matched[1] - def backup_stopped(record: dict, prefix: Path) -> Path: - # Service stop must happen before this call: ACME files and SQLite form one backup. data = Path(record['data_dir']) lock_fd = os.open(data / 'process.lock', os.O_WRONLY | os.O_CREAT | os.O_NOFOLLOW, 0o600) try: @@ -290,7 +278,6 @@ def backup_stopped(record: dict, prefix: Path) -> Path: finally: os.close(lock_fd) - def restore_service_unit(backup: Path) -> None: saved = backup / 'rustproxy.service' if saved.exists(): @@ -299,7 +286,6 @@ def restore_service_unit(backup: Path) -> None: UNIT_PATH.unlink(missing_ok=True) run(['systemctl', 'daemon-reload']) - def reset_saved_config(data: Path) -> None: """Development-only reset of desired config while preserving auth/certs/audit data.""" database = data / 'config.sqlite3' @@ -316,7 +302,6 @@ def reset_saved_config(data: Path) -> None: connection.close() print('Stored vhost/settings configuration cleared; account, certificates and other private data were preserved.') - def service_failure_details() -> str: chunks: list[str] = [] commands = ( @@ -333,7 +318,6 @@ def service_failure_details() -> str: pass return '\n'.join(chunks)[-8000:] - def stop_for_managed_update(data: Path) -> None: """Ask RustProxy 0.14.0+ to force hot cache into the enabled cold tier before exit. @@ -349,26 +333,21 @@ def stop_for_managed_update(data: Path) -> None: finally: marker.unlink(missing_ok=True) - def update(record: dict, binary: Path, sha: str, start: bool, refresh_geoip: bool = False, reset_config: bool = False) -> dict: prefix = Path(record['prefix']); data = Path(record['data_dir']); account = pwd.getpwnam(record['user']) geoip_lock_fd: int | None = None geoip_stage: Path | None = None try: - # Repair missing or stale installer-owned shell setup on upgrades. install_shell_path(prefix) check_shell_path(prefix) - # Repair stale ownership before stopping the running service. ensure_service_data_access(data, account) release, version = stage(binary, prefix, record['user'], sha) geoip_names: list[str] = [] if refresh_geoip: - # Shared lock with the runtime worker prevents concurrent upgrades. geoip_lock_fd = acquire_geoip_update_lock(data, account.pw_uid, account.pw_gid) try: geoip_stage, geoip_names = prepare_geoip_update(data, prefix) except GeoipUnavailable as error: - # GeoIP is refreshed best-effort: the update must not be blocked by a flaky download. print(f'WARNING: GeoIP refresh skipped, keeping the installed country data: {error}', file=sys.stderr) geoip_stage, geoip_names = None, [] active = subprocess.run(['systemctl', 'is-active', '--quiet', SERVICE], check=False, stdout=subprocess.DEVNULL).returncode == 0 @@ -399,7 +378,7 @@ def update(record: dict, binary: Path, sha: str, start: bool, refresh_geoip: boo print('New release diagnostics:\n' + details, file=sys.stderr) stop_for_managed_update(data) failed = data.with_name(data.name + '.failed-' + uuid.uuid4().hex[:12]) - data.rename(failed) # keep the failed generation for diagnosis; do not delete it + data.rename(failed) copy_data(backup / 'data', data) restore_managed_acme_runtime(failed, data) chown_tree(data, account.pw_uid, account.pw_gid) @@ -420,7 +399,6 @@ def update(record: dict, binary: Path, sha: str, start: bool, refresh_geoip: boo shutil.rmtree(geoip_stage, ignore_errors=True) release_geoip_update_lock(geoip_lock_fd) - def install(record: dict, binary: Path, sha: str, start: bool, install_geoip: bool = False) -> dict: import grp prefix = Path(record['prefix']); data = Path(record['data_dir']) @@ -448,7 +426,6 @@ def install(record: dict, binary: Path, sha: str, start: bool, install_geoip: bo switch(prefix, release) install_shell_path(prefix) install_logrotate(record) - # Record is written even if initial startup fails, so an update can repair it. write_private(prefix / 'install.json', json.dumps(record, indent=2).encode()) write_private(UNIT_PATH, service_unit(record).encode(), 0o644) run(['systemctl', 'daemon-reload']); run(['systemctl', 'enable', SERVICE]) @@ -458,5 +435,3 @@ def install(record: dict, binary: Path, sha: str, start: bool, install_geoip: bo run(['systemctl', 'stop', SERVICE]) raise RuntimeError('Installed but startup failed. Data was retained; inspect journalctl -u rustproxy.') return record - - diff --git a/scripts/deploy/upgrade.py b/scripts/deploy/upgrade.py index bd7e4c9..0713efe 100755 --- a/scripts/deploy/upgrade.py +++ b/scripts/deploy/upgrade.py @@ -16,7 +16,6 @@ MANAGED = ["build.rs", "langs", "deploy", "debian", "grafana", "make_zip.py", "s "README.md", "LICENSE", "CHANGELOG.md", "AGENTS.md", "SHA256SUMS", ".env.example", ".gitignore"] - def upgrade(source: Path, target: Path, *, stopped: bool, data_dir: Path | None = None) -> Path: source = source.resolve() if target.is_symlink(): @@ -62,8 +61,6 @@ def upgrade(source: Path, target: Path, *, stopped: bool, data_dir: Path | None installed.append(name) shutil.copytree(new, old) if name == "langs" and (backup / name).is_dir(): - # Preserve additional site language packs; bundled packs are - # updated, with their previous bytes retained in the backup. for pack in (backup / name).glob("*.json"): if pack.is_symlink(): raise ValueError("Language packs must not be symlinks.") @@ -72,7 +69,6 @@ def upgrade(source: Path, target: Path, *, stopped: bool, data_dir: Path | None elif new.is_file(): installed.append(name) shutil.copy2(new, old) - # Obsolete renewal sidecar: validate, record the manifest, then remove it last. runtime_data = (data_dir or (target / "data")).resolve() certs_dir = runtime_data / "certs" if certs_dir.is_symlink(): @@ -99,7 +95,6 @@ def upgrade(source: Path, target: Path, *, stopped: bool, data_dir: Path | None for stream in locks: stream.close() - def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("target", type=Path) @@ -116,6 +111,5 @@ def main() -> None: print("Preserved data, .env, .git, target and other unmanaged files. No database migration was run.") print(f"Next: cd {args.target}; ./dev.sh test; ./dev.sh") - if __name__ == "__main__": main() diff --git a/scripts/generate_cf_pages.py b/scripts/generate_cf_pages.py index 17704ff..b3b34b5 100755 --- a/scripts/generate_cf_pages.py +++ b/scripts/generate_cf_pages.py @@ -11,13 +11,8 @@ from pathlib import Path WEB = Path(__file__).resolve().parents[1] / "src/admin/web" ROOT = WEB / "cf_page" -# Use the exact dashboard brand mark: r / p with the same span structure, -# typography, dimensions and border styles as css/20-shell.css. LOGO = 'r/p' -# Code, title, explanation, advice, RustProxy status label, origin status label, -# RustProxy indicator, origin indicator. Indicators describe this request only; -# they must never claim to have checked the upstream's health. STATUSES = [ (200, "Service ready", "RustProxy received and handled the request.", "No further action is required for this response.", "Working", "Not checked", "ok", "unknown"), (400, "Bad request", "The request was malformed or could not be understood.", "Check the request and try again.", "Request rejected", "Not contacted", "error", "unknown"), @@ -85,7 +80,6 @@ ICONS = { "origin": '''''', } - def node(icon: str, location: str, title: str, state: str, indicator: str) -> str: indicator_glyph = {"ok": "✓", "error": "×", "unknown": "–"}[indicator] return ( @@ -95,7 +89,6 @@ def node(icon: str, location: str, title: str, state: str, indicator: str) -> st f'

{escape(state)}

' ) - def make_page(code: int | None, title: str, happened: str, advice: str, gateway: str, origin: str, gateway_indicator: str, origin_indicator: str, *, variant: str = "status") -> str: arrow = '' @@ -133,7 +126,6 @@ def make_page(code: int | None, title: str, happened: str, advice: str, gateway: ''' - VARIANTS = [ ("welcome", "Congratulations! RustProxy is running.", "RustProxy is installed and serving this page. This does not verify an upstream application.", @@ -145,7 +137,6 @@ VARIANTS = [ "Page served", "Not checked", "ok", "unknown"), ] - def main() -> None: ROOT.mkdir(parents=True, exist_ok=True) for entry in STATUSES: @@ -155,6 +146,5 @@ def main() -> None: (ROOT / f"{variant}.html").write_text(make_page(None, *entry, variant=variant), encoding="utf-8") print(f"Generated {len(STATUSES) + len(VARIANTS)} offline RustProxy-branded pages") - if __name__ == "__main__": main() diff --git a/scripts/migration/migrate_npm.py b/scripts/migration/migrate_npm.py index 2ed5263..03776c3 100755 --- a/scripts/migration/migrate_npm.py +++ b/scripts/migration/migrate_npm.py @@ -2,8 +2,8 @@ """Migrate Nginx Proxy Manager proxy hosts from SQLite into RustProxy.""" from __future__ import annotations -from migrate_npm_core import * # stable migration/model API -from migrate_npm_api import * # stable administration API helpers +from migrate_npm_core import * +from migrate_npm_api import * def main() -> None: parser = argparse.ArgumentParser(description=__doc__) @@ -69,7 +69,5 @@ def main() -> None: except (MigrationError, OSError, sqlite3.Error) as error: parser.exit(1, f"Migration failed: {error}\n") - - if __name__ == "__main__": main() diff --git a/scripts/migration/migrate_npm_api.py b/scripts/migration/migrate_npm_api.py index 6490ffc..40237e4 100755 --- a/scripts/migration/migrate_npm_api.py +++ b/scripts/migration/migrate_npm_api.py @@ -15,7 +15,7 @@ class RustProxyClient: handlers: list[Any] = [urllib.request.HTTPCookieProcessor(jar)] if parsed.scheme == "https": if insecure_tls: - context = ssl._create_unverified_context() # Explicit operator opt-in for local/self-signed admin TLS. + context = ssl._create_unverified_context() else: context = ssl.create_default_context(cafile=str(ca_file) if ca_file else None) handlers.append(urllib.request.HTTPSHandler(context=context)) @@ -71,8 +71,6 @@ class RustProxyClient: raise MigrationError("unexpected RustProxy PUT /api/config response") return value - - def write_private_json(path: Path, value: dict[str, Any]) -> None: path = path.expanduser() path.parent.mkdir(parents=True, exist_ok=True) @@ -103,7 +101,6 @@ def split_ids(values: list[str] | None) -> list[str] | None: out.append(item) return out - def print_report(decisions: list[Decision]) -> None: imported = sum(1 for d in decisions if d.action == "import") skipped = sum(1 for d in decisions if d.action == "skip") @@ -120,5 +117,3 @@ def print_report(decisions: list[Decision]) -> None: print(" reason: " + decision.reason) for warning in decision.warnings or []: print(" warning: " + warning) - - diff --git a/scripts/migration/migrate_npm_core.py b/scripts/migration/migrate_npm_core.py index 9c34075..94b056c 100755 --- a/scripts/migration/migrate_npm_core.py +++ b/scripts/migration/migrate_npm_core.py @@ -31,11 +31,9 @@ import urllib.request MAX_CONFIG_BYTES = 2_097_152 - class MigrationError(RuntimeError): pass - @dataclass(frozen=True) class NpmProxyHost: id: int @@ -55,7 +53,6 @@ class NpmProxyHost: block_exploits: bool meta: dict[str, Any] - @dataclass class Decision: npm_id: int @@ -66,7 +63,6 @@ class Decision: warnings: list[str] | None = None reason: str | None = None - def json_value(raw: Any, fallback: Any) -> Any: if raw is None or raw == "": return fallback @@ -77,13 +73,11 @@ def json_value(raw: Any, fallback: Any) -> Any: except (TypeError, json.JSONDecodeError): return fallback - def bool_value(raw: Any) -> bool: if isinstance(raw, str): return raw.strip().lower() in {"1", "true", "yes", "on"} return bool(raw) - def normalize_host_pattern(value: str) -> str: value = value.strip().lower().rstrip(".") wildcard = value.startswith("*.") @@ -100,11 +94,9 @@ def normalize_host_pattern(value: str) -> str: raise MigrationError(f"hostname must be ASCII/punycode: {value!r}") return ("*." if wildcard else "") + base - def sql_columns(connection: sqlite3.Connection, table: str) -> set[str]: return {str(row[1]) for row in connection.execute(f"PRAGMA table_info({table})")} - def load_npm_hosts(database: Path) -> list[NpmProxyHost]: if database.is_symlink() or not database.is_file(): raise MigrationError(f"NPM SQLite database not found or unsafe: {database}") @@ -172,7 +164,6 @@ def load_npm_hosts(database: Path) -> list[NpmProxyHost]: )) return result - def backend_url(item: NpmProxyHost) -> str: if item.forward_scheme not in {"http", "https"}: raise MigrationError(f"unsupported upstream scheme {item.forward_scheme!r}") @@ -193,13 +184,11 @@ def backend_url(item: NpmProxyHost) -> str: rendered = host return f"{item.forward_scheme}://{rendered}:{item.forward_port}" - def slug(value: str) -> str: value = value.lower().replace("*.", "wildcard-") value = re.sub(r"[^a-z0-9_-]+", "-", value).strip("-_") return value[:40] or "host" - def unique_id(base: str, used: set[str]) -> str: base = re.sub(r"[^A-Za-z0-9_-]+", "-", base)[:64].strip("-_") or "npm" candidate = base @@ -211,7 +200,6 @@ def unique_id(base: str, used: set[str]) -> str: used.add(candidate) return candidate - def listener_inventory(config: dict[str, Any]) -> tuple[list[str], list[str]]: http_ids: list[str] = [] https_ids: list[str] = [] @@ -225,7 +213,6 @@ def listener_inventory(config: dict[str, Any]) -> tuple[list[str], list[str]]: (https_ids if binding.get("tls") else http_ids).append(listener_id) return http_ids, https_ids - def selected_tls_ports(config: dict[str, Any], listener_ids: list[str]) -> set[int]: selected = set(listener_ids) ports: set[int] = set() @@ -247,7 +234,6 @@ def selected_tls_ports(config: dict[str, Any], listener_ids: list[str]) -> set[i ports.add(port) return ports - def existing_host_owners(config: dict[str, Any]) -> dict[str, str]: result: dict[str, str] = {} for vhost in config.get("vhosts") or []: @@ -263,7 +249,6 @@ def existing_host_owners(config: dict[str, Any]) -> dict[str, str]: pass return result - def warnings_for(item: NpmProxyHost, tls_verify: bool) -> list[str]: warnings: list[str] = [] if item.access_list_id: @@ -284,7 +269,6 @@ def warnings_for(item: NpmProxyHost, tls_verify: bool) -> list[str]: warnings.append("NPM meta.nginx_err is set; review the source host before cutover") return warnings - def build_migration( npm_hosts: list[NpmProxyHost], config: dict[str, Any], @@ -399,5 +383,3 @@ def build_migration( owners[host] = vid decisions.append(Decision(item.id, "import", normalized, backend=origin, rustproxy_ids=created_ids, warnings=warnings)) return new_config, decisions - - diff --git a/scripts/preflight.py b/scripts/preflight.py index 16a43d2..f1a8f09 100755 --- a/scripts/preflight.py +++ b/scripts/preflight.py @@ -4,7 +4,6 @@ import argparse from pathlib import Path - def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parents[1]) @@ -17,6 +16,5 @@ def main() -> None: if missing: parser.exit(2, f"Source preflight failed: missing {', '.join(missing)}\n") - if __name__ == "__main__": main() diff --git a/scripts/runtime/acme_provider.py b/scripts/runtime/acme_provider.py index f3edf3e..4afe096 100755 --- a/scripts/runtime/acme_provider.py +++ b/scripts/runtime/acme_provider.py @@ -37,18 +37,14 @@ PROVIDER_FIELDS = { "rfc2136": {"dns_server", "dns_port", "key_name", "key_secret", "key_algorithm", "sign_query"}, } - def credential(value: object) -> str: - # API keys are ASCII tokens; reject anything that could inject INI content. if not isinstance(value, str) or not re.fullmatch(r"[A-Za-z0-9_./+\-=]{8,4096}", value): raise AcmeError("acme.invalid_api_credential") return value - class AcmeError(Exception): """Messages contain fixed diagnostics, never provider output or input secrets.""" - def domain(value: object, wildcard: bool = True, single_label: bool = False) -> str: if not isinstance(value, str) or not value.isascii() or len(value) > 253: raise AcmeError("acme.invalid_domain") @@ -62,7 +58,6 @@ def domain(value: object, wildcard: bool = True, single_label: bool = False) -> return value raise AcmeError("acme.dns_names_only") - def validate(raw: object) -> dict: if not isinstance(raw, dict): raise AcmeError("acme.invalid_request") @@ -132,14 +127,12 @@ def validate(raw: object) -> dict: raise AcmeError("acme.invalid_sign_query") return value - def private_directory(path: Path) -> None: path.mkdir(mode=0o700, parents=True, exist_ok=True) info = path.lstat() if not stat.S_ISDIR(info.st_mode) or info.st_uid != os.geteuid() or info.st_mode & 0o077: raise AcmeError("acme.unsafe_directory") - def write_new(path: Path, data: bytes) -> None: fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_NOFOLLOW", 0), 0o600) with os.fdopen(fd, "wb") as stream: @@ -147,7 +140,6 @@ def write_new(path: Path, data: bytes) -> None: stream.flush() os.fsync(stream.fileno()) - def credentials(value: dict) -> bytes: if value["provider"] == "http01": return b"" @@ -163,7 +155,6 @@ def credentials(value: dict) -> bytes: } return "".join(f"dns_rfc2136_{k} = {v}\n" for k, v in lines.items()).encode("ascii") - def certbot_prefix(executable: str | None = None) -> list[str]: if executable: return [executable] @@ -175,7 +166,6 @@ def certbot_prefix(executable: str | None = None) -> list[str]: return [discovered] raise AcmeError("acme.certbot_not_installed") - def certbot_command(value: dict, work: Path, credential_file: Path, command_prefix: list[str]) -> list[str]: args = [*command_prefix, "certonly", "--non-interactive", "--agree-tos", "--no-eff-email", "--email", value["email"], "--server", DIRECTORIES[value["environment"]], @@ -193,9 +183,7 @@ def certbot_command(value: dict, work: Path, credential_file: Path, command_pref args += ["-d", name] return args - def read_generated(work: Path, name: str) -> bytes: - # Resolve live symlinks only inside Certbot's archive. archive = (work / "config" / "archive").resolve(strict=True) path = (work / "config" / "live" / "rustproxy" / name).resolve(strict=True) if not path.is_relative_to(archive): @@ -210,7 +198,6 @@ def read_generated(work: Path, name: str) -> bytes: raise AcmeError("acme.invalid_pem") return data - def issue(raw: dict, certificate_directory: Path, executable: str | None = None) -> dict: value = validate(raw) command_prefix = certbot_prefix(executable) @@ -218,7 +205,6 @@ def issue(raw: dict, certificate_directory: Path, executable: str | None = None) private_directory(certificate_directory) root = certificate_directory / "acme" private_directory(root) - # Each profile has isolated CA accounts, credentials and lineages. suffix = "" if value["provider"] == "rfc2136" else "-" + value["provider"] work = root / (value["environment"] + "-" + value["certificate_id"] + suffix) private_directory(work) @@ -233,7 +219,6 @@ def issue(raw: dict, certificate_directory: Path, executable: str | None = None) raise AcmeError("acme.profile_busy") from None for folder in ["config", "work", "logs"]: private_directory(work / folder) - # Secret Store credentials exist as a plaintext file only while Certbot runs. credential_file = work / (value["provider"] + ".ini") if value["provider"] == "http01": webroot = certificate_directory / "acme-http01" @@ -260,7 +245,6 @@ def issue(raw: dict, certificate_directory: Path, executable: str | None = None) credential_file.unlink(missing_ok=True) cert = read_generated(work, "fullchain.pem") key = read_generated(work, "privkey.pem") - # Work on immutable copies so the active certificate never changes mid-run. stem = "acme-" + uuid.uuid4().hex cert_path = certificate_directory / (stem + ".pem") key_path = certificate_directory / (stem + ".key") @@ -277,13 +261,10 @@ def issue(raw: dict, certificate_directory: Path, executable: str | None = None) "domains": value["domains"], "cert_file": cert_path.name, "key_file": key_path.name, "staged": True} - - def profile_directory(certificate_directory: Path, provider: str, environment: str, certificate_id: str) -> Path: suffix = "" if provider == "rfc2136" else "-" + provider return certificate_directory / "acme" / (environment + "-" + certificate_id + suffix) - def read_private(path: Path, limit: int = MAX_INPUT) -> bytes: fd = os.open(path, os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0)) with os.fdopen(fd, "rb") as stream: @@ -295,7 +276,6 @@ def read_private(path: Path, limit: int = MAX_INPUT) -> bytes: raise AcmeError("acme.unsafe_profile") return data - def certificate_dates(pem: bytes, executable: str | None = None) -> dict: """Read validity without exposing subject/PEM data or requiring a new Python package.""" executable = executable or shutil.which("openssl") @@ -310,7 +290,6 @@ def certificate_dates(pem: bytes, executable: str | None = None) -> dict: dates = {} for line in result.stdout.decode("ascii").splitlines(): name, text = line.split("=", 1) - # OpenSSL's English ASN.1 date print format; LC_ALL is fixed above. value = datetime.datetime.strptime(text.strip(), "%b %d %H:%M:%S %Y GMT").replace(tzinfo=datetime.timezone.utc) dates[name] = int(value.timestamp()) if dates["notAfter"] <= dates["notBefore"]: @@ -319,7 +298,6 @@ def certificate_dates(pem: bytes, executable: str | None = None) -> dict: except (ValueError, KeyError, UnicodeError, subprocess.TimeoutExpired): raise AcmeError("acme.certificate_dates_invalid") from None - def renewal_request(raw: object) -> dict: if not isinstance(raw, dict) or set(raw) - {"action", "certificate_id", "provider", "environment", "cert_file", "key_file", "dry_run", "force", "credential_ini_b64"}: raise AcmeError("acme.invalid_renewal_request") @@ -350,7 +328,6 @@ def renewal_request(raw: object) -> dict: value.pop("credential_ini_b64", None) return value - def renew(raw: dict, certificate_directory: Path, executable: str | None = None) -> dict: """Renew ONE existing, consented lineage; never create a profile. @@ -365,7 +342,6 @@ def renew(raw: dict, certificate_directory: Path, executable: str | None = None) certificate_directory = certificate_directory.absolute() private_directory(certificate_directory) work = profile_directory(certificate_directory, value["provider"], value["environment"], value["certificate_id"]) - # Do not create missing profile paths during renewal. for path in [certificate_directory / "acme", work, work / "config", work / "work", work / "logs"]: if not path.exists(): raise AcmeError("acme.renewal_profile_missing") @@ -389,7 +365,6 @@ def renew(raw: dict, certificate_directory: Path, executable: str | None = None) if not isinstance(names, list) or not 1 <= len(names) <= 16: raise AcmeError("acme.invalid_domains") names = [domain(n, wildcard=value["provider"] != "http01") for n in names] - # Credentials are recreated only for the duration of this invocation. read_private(work / "config" / "renewal" / "rustproxy.conf", 65536) credential_file = work / (value["provider"] + ".ini") if value["provider"] != "http01": @@ -402,7 +377,6 @@ def renew(raw: dict, certificate_directory: Path, executable: str | None = None) try: installed_cert = read_private(certificate_directory / value["cert_file"], MAX_PEM) installed_key = read_private(certificate_directory / value["key_file"], MAX_PEM) - # Check dependencies/installed PEM before invoking a CA operation. old_dates = certificate_dates(installed_cert) args = [*command_prefix, "renew", "--cert-name", "rustproxy", "--non-interactive", "--no-random-sleep-on-renew", "--no-directory-hooks", @@ -434,7 +408,6 @@ def renew(raw: dict, certificate_directory: Path, executable: str | None = None) return output if dates["not_after_unix"] < old_dates["not_after_unix"]: raise AcmeError("acme.renewal_older_certificate") - # Content-addressed staging keeps retries idempotent. stem = "acme-" + hashlib.sha256(cert + b"\0" + key).hexdigest()[:48] paths = [(certificate_directory / (stem + ".pem"), cert), (certificate_directory / (stem + ".key"), key)] if len(list(certificate_directory.glob("acme-*.key"))) >= 1024 and not paths[1][0].exists(): @@ -468,11 +441,9 @@ def main() -> None: result = renew(value, args.cert_dir) if isinstance(value, dict) and value.get("action") == "renew" else issue(value, args.cert_dir) print(json.dumps(result)) except (AcmeError, OSError, ValueError) as error: - # OSError/JSON errors can contain paths/input. Do not serialize them. message = str(error) if isinstance(error, AcmeError) else "acme.local_io_or_json_error" print(json.dumps({"error": message})) raise SystemExit(1) from None - if __name__ == "__main__": main() diff --git a/scripts/runtime/acme_rfc2136.py b/scripts/runtime/acme_rfc2136.py index 9753f05..eaa00f0 100755 --- a/scripts/runtime/acme_rfc2136.py +++ b/scripts/runtime/acme_rfc2136.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 """Compatibility entry point; all issuance uses acme_provider.""" -from acme_provider import * # noqa: F403 +from acme_provider import * if __name__ == "__main__": main() diff --git a/scripts/start_stream_backends.sh b/scripts/start_stream_backends.sh index 9ce31c6..7577845 100755 --- a/scripts/start_stream_backends.sh +++ b/scripts/start_stream_backends.sh @@ -1,6 +1,4 @@ #!/usr/bin/env bash -# Start two TCP and two UDP mock backends for RustProxy Stream tests. -# Usage: ./start_stream_backends.sh [bind-host] set -euo pipefail DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" @@ -37,7 +35,6 @@ printf 'UDP: %s:9201 (udp-a), %s:9202 (udp-b)\n' "$HOST" "$HOST" printf 'UDP health probe: PING => PONG\n' printf 'Stop: Ctrl+C\n\n' -# Stop the group if any backend exits unexpectedly (e.g., port conflict). wait -n "${pids[@]}" echo 'A backend stopped; stopping all mock backends.' >&2 exit 1 diff --git a/scripts/version.py b/scripts/version.py index 3f9b834..37a173d 100755 --- a/scripts/version.py +++ b/scripts/version.py @@ -4,12 +4,10 @@ from pathlib import Path import sys import tomllib - def project_version(root: Path | None = None) -> str: manifest = (root or Path(__file__).resolve().parents[1]) / "Cargo.toml" data = tomllib.loads(manifest.read_text(encoding="utf-8")) return data["package"]["version"] - if __name__ == "__main__": print(project_version(Path(sys.argv[1]) if len(sys.argv) > 1 else None)) diff --git a/src/acl/dynamic/mod.rs b/src/acl/dynamic/mod.rs index fbc364d..5016527 100644 --- a/src/acl/dynamic/mod.rs +++ b/src/acl/dynamic/mod.rs @@ -37,7 +37,6 @@ struct DnsDiagnostic { error: Option, } -/// A read-only view of the live resolver, not a second source of ACL permissions. #[derive(Debug, Serialize)] pub(crate) struct DnsAclStatus { pub hostname: String, diff --git a/src/acme/headless.rs b/src/acme/headless.rs index 3d7b7d2..f2bde5c 100644 --- a/src/acme/headless.rs +++ b/src/acme/headless.rs @@ -1,24 +1,14 @@ -// Headless ACME: issues and renews the certificates requested with -// `--acme-domains` through the same Certbot worker as the panel. Results are -// kept in `/certs/headless-acme.json` and merged into the -// configuration on reload, so the configuration file stays read-only. const HEADLESS_ACME_ACTOR: &str = "system:headless-acme"; const HEADLESS_ACME_CHECK_SECONDS: i64 = 12 * 3600; const HEADLESS_ACME_RETRY_SECONDS: [i64; 6] = [600, 1800, 3600, 3 * 3600, 6 * 3600, 12 * 3600]; -/// Renewal request left in the data directory by `rust-proxy --headless tls renew`. pub const HEADLESS_ACME_RENEW_FILE: &str = "headless-acme-renew.json"; -/// Requests older than this (for example written while the service was down) -/// are discarded instead of forcing a renewal after a later restart. const HEADLESS_ACME_RENEW_MAX_AGE: i64 = 600; const HEADLESS_ACME_RENEW_MAX_TARGETS: usize = 64; static HEADLESS_ACME_RENEW: std::sync::LazyLock = std::sync::LazyLock::new(tokio::sync::Notify::new); -/// Operator request to check (or, with `force`, re-issue) headless ACME -/// certificates now. An empty target list means every headless ACME certificate; -/// a target is a certificate id (`hl-acme-…`) or one of its domain names. #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(deny_unknown_fields)] pub struct HeadlessRenewRequest { @@ -47,7 +37,6 @@ impl HeadlessRenewRequest { Ok(()) } - /// Whether this request selects the certificate `id` covering `names`. pub fn selects(&self, id: &str, names: &[String]) -> bool { self.targets.is_empty() || self.targets.iter().any(|target| { @@ -56,8 +45,6 @@ impl HeadlessRenewRequest { } } -/// Writes a renewal request for the running headless service (atomically, -/// mode 0600, owned by the owner of the data directory). pub fn write_headless_renew_request( data_dir: &std::path::Path, request: &HeadlessRenewRequest, @@ -79,7 +66,6 @@ pub fn write_headless_renew_request( file.sync_all()?; #[cfg(unix)] { - // The CLI usually runs as root while the service runs as its own user. use std::os::unix::fs::MetadataExt; let owner = std::fs::metadata(data_dir)?; if owner.uid() != unsafe { libc::geteuid() } { @@ -95,8 +81,6 @@ pub fn write_headless_renew_request( result.map(|()| path) } -/// Reads and removes a pending renewal request. Invalid or stale requests are -/// removed and reported as errors. pub fn take_headless_renew_request( data_dir: &std::path::Path, now: i64, @@ -133,7 +117,6 @@ pub fn take_headless_renew_request( Ok(Some(request)) } -/// Wakes the headless ACME task to process a renewal request (SIGUSR1). pub fn request_headless_acme_renewal() { HEADLESS_ACME_RENEW.notify_one(); } @@ -325,7 +308,6 @@ pub struct HeadlessAcmeStatus { static HEADLESS_ACME_STATUS: std::sync::Mutex> = std::sync::Mutex::new(std::collections::BTreeMap::new()); -/// Status of the headless ACME certificates for the health listener. pub fn headless_acme_status() -> std::collections::BTreeMap { HEADLESS_ACME_STATUS .lock() @@ -339,8 +321,6 @@ fn set_headless_status(id: &str, update: impl FnOnce(&mut HeadlessAcmeStatus)) { } } -/// Removes automatic certificates that are no longer wanted: their served -/// names are gone, or every served name already has an issued replacement. async fn headless_acme_prune( state: &Arc, directory: &std::path::Path, @@ -408,14 +388,10 @@ async fn headless_acme_prune( tracing::info!(certificates = ?stale, "automatic ACME certificates no longer needed (hosts removed or replaced) were deleted"); } -/// Background task of headless mode: issues and renews the certificates of -/// `--acme-domains` / `headless.acme.domains` and, with `auto`, of every -/// vhost host without a certificate. Settings are re-read after each reload. pub async fn headless_loop( weak: std::sync::Weak, shutdown: tokio_util::sync::CancellationToken, ) { - // Give the listeners a moment so the HTTP-01 challenge can be answered. tokio::select! { _ = shutdown.cancelled() => return, _ = tokio::time::sleep(Duration::from_secs(3)) => {} } let mut next: std::collections::HashMap = Default::default(); let mut failures: std::collections::HashMap = Default::default(); @@ -450,7 +426,6 @@ pub async fn headless_loop( tracing::warn!("headless ACME renewal requested, but no ACME certificates are configured"); } if let Some(acme) = acme.clone() { - // A changed provider/environment makes every certificate due again. let current = (acme.provider.clone(), acme.environment.clone()); if fingerprint.as_ref() != Some(¤t) { next.clear(); diff --git a/src/admin/cache_rules.rs b/src/admin/cache_rules.rs index a2550c6..a37bd4a 100644 --- a/src/admin/cache_rules.rs +++ b/src/admin/cache_rules.rs @@ -147,9 +147,12 @@ async fn cache_rules_test( let mut request_outcome = rules.evaluate_request(&request, false); let mut rule_gate = crate::cache::RuleGate::from_outcome(&request_outcome); if rule_gate == crate::cache::RuleGate::CookieGuard && settings.enabled { - if let Some(relaxed) = - crate::cache::static_cookie_guard_relaxation(&rules, &request, &request_outcome, &settings) - { + if let Some(relaxed) = crate::cache::static_cookie_guard_relaxation( + &rules, + &request, + &request_outcome, + &settings, + ) { request_outcome = relaxed.outcome; rule_gate = crate::cache::RuleGate::CookieGuardRelaxed; } @@ -166,15 +169,21 @@ async fn cache_rules_test( Some(query) => format!("{path}?{query}"), None => path.clone(), }; - // Same precedence as live traffic (cache::request_gate). Vhost security - // gates (Basic auth, providers, sticky pools) are not simulated here. let request_policy = crate::cache::request_gate( - crate::cache::GateInput { cache_enabled: settings.enabled, ..Default::default() }, + crate::cache::GateInput { + cache_enabled: settings.enabled, + ..Default::default() + }, rule_gate, ) .or_else(|| { crate::cache::request_policy_with_vcl_cookie( - &method, &headers, true, &path, query.is_some(), &settings, + &method, + &headers, + true, + &path, + query.is_some(), + &settings, request_outcome.lookup.is_some(), ) .bypass_reason() diff --git a/src/admin/certificates.rs b/src/admin/certificates.rs index 9c9c42b..9c069b1 100644 --- a/src/admin/certificates.rs +++ b/src/admin/certificates.rs @@ -498,7 +498,6 @@ struct RenewRequest { certificate_id: String, #[serde(default)] dry_run: bool, - /// Renew even when Certbot does not consider the certificate due. #[serde(default)] force: bool, } diff --git a/src/admin/file_logs.rs b/src/admin/file_logs.rs index 097568f..6d28c1d 100644 --- a/src/admin/file_logs.rs +++ b/src/admin/file_logs.rs @@ -21,17 +21,11 @@ struct FileLogSource { size: u64, modified_ms: u64, compressed: bool, - /// 0 = file being written; N = rotation `.N` / `.N.gz` (higher is older). rotation: u32, - /// vhost, redirect, host404, unmatched, access or error. scope: &'static str, - /// Site id for per-site logs (vhost, redirect or 404 host id). site: String, - /// Current configured hostnames, not inferred from historical log records. domains: Vec, } -/// Splits `.jsonl[.][.gz]` (or `[.][.gz]` for the global logs) -/// into the rotation index; `None` for files that are not part of the set. fn rotation_suffix(rest: &str) -> Option<(u32, bool)> { if rest.is_empty() { return Some((0, false)); @@ -44,10 +38,8 @@ fn rotation_suffix(rest: &str) -> Option<(u32, bool)> { if !number.is_empty() && number.len() <= 6 && number.bytes().all(|b| b.is_ascii_digit()) { return number.parse().ok().map(|n: u32| (n.max(1), compressed)); } - // Other compressed rotations (e.g. `.old.gz`) sort after numbered ones. compressed.then_some((u32::MAX, true)) } -/// Scope and site of a per-site log base name (`app`, `old.redirect`, `park.host404`). fn site_scope(base: &str) -> (&'static str, String) { if base == "_unmatched" { return ("unmatched", String::new()); @@ -70,7 +62,6 @@ struct FileLogQuery { client_ip: Option, vhost: Option, consolidate_vhosts: Option, - /// Only records at or after this time (ms since the epoch). since_ms: Option, aggregate_field: Option, aggregate_limit: Option, @@ -131,8 +122,6 @@ fn source_from_path( } include!("file_logs_io.rs"); -/// Build a scope-aware hostname catalog, including Docker assignments even when -/// their writer is disabled/offline and currently discovered label publications. fn file_log_vhost_domains( config: &crate::config::Config, observed: &std::collections::BTreeMap, diff --git a/src/admin/file_logs_io.rs b/src/admin/file_logs_io.rs index 8db82b2..5a0f436 100644 --- a/src/admin/file_logs_io.rs +++ b/src/admin/file_logs_io.rs @@ -24,8 +24,6 @@ fn newest_log_files( result } -/// Rotated copies of a global log: `.N`, `.N.gz` (logrotate with or -/// without `delaycompress`) and other `.*.gz`, newest rotation first. fn rotated_gzip_sources( active: &std::path::Path, id_prefix: &str, @@ -90,7 +88,6 @@ fn rotated_gzip_sources( sort_by_rotation(&mut sources); sources } -/// Newest data first: the file being written, then `.1`, `.2`, … (ties by mtime). fn sort_by_rotation(sources: &mut [FileLogSource]) { sources.sort_by(|a, b| { a.rotation diff --git a/src/admin/file_logs_query.rs b/src/admin/file_logs_query.rs index f84f3f8..a027f80 100644 --- a/src/admin/file_logs_query.rs +++ b/src/admin/file_logs_query.rs @@ -208,7 +208,6 @@ fn validate_file_log_query(query: &FileLogQuery) -> Result<(), ApiError> { Ok(()) } -/// Runs a stored-log query (blocking file I/O). fn file_log_query_blocking( config: &crate::config::Config, observed: &std::collections::BTreeMap, @@ -220,10 +219,6 @@ fn file_log_query_blocking( let requested = query.source.as_deref().unwrap_or("all"); let mut truncated = false; let mut files_skipped = 0usize; - // One site/log (all its rotations) or one file is read newest-first: each file - // may use the whole remaining budget, so the newest records are always - // complete and older rotations are read only while budget remains. "All" - // spreads the budget over the newest file of every log first. let sequential = requested != "all"; if requested != "all" { let consolidate = query.consolidate_vhosts.unwrap_or(false); @@ -334,8 +329,6 @@ fn file_log_query_blocking( records.push(value); } } - // Older rotations only hold older records: stop once a whole file - // is before the requested period. if sequential && since_ms.is_some_and(|since| file_newest.is_some_and(|n| n < since)) { diff --git a/src/admin/logging_api.rs b/src/admin/logging_api.rs index 363f236..cdd7b71 100644 --- a/src/admin/logging_api.rs +++ b/src/admin/logging_api.rs @@ -240,10 +240,6 @@ async fn events( .into_response()) } -/// List the effective (compiled) reverse-proxy vhosts, including Docker -/// assignments. The persisted config deliberately excludes generated routes. -/// Catalog fingerprints also change when Docker inventory changes without -/// increasing the persisted configuration revision. fn monitored_vhost_catalog(state: &Arc) -> (Vec, Vec, String) { let snapshot = state.config.load_full(); let desired = &snapshot.envelope.config; diff --git a/src/admin/openapi.json b/src/admin/openapi.json index cfff8d3..b365590 100644 --- a/src/admin/openapi.json +++ b/src/admin/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.3", "info": { "title": "RustProxy Administration API", - "version": "0.43.0", + "version": "0.43.1", "description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only." }, "servers": [ diff --git a/src/admin/operations.rs b/src/admin/operations.rs index 817d65e..d353c71 100644 --- a/src/admin/operations.rs +++ b/src/admin/operations.rs @@ -338,24 +338,16 @@ struct CertificateDeploy { key_pem: String, } -/// Query for the local page preview used by the 404 host editor. #[derive(Default, Deserialize)] #[serde(default, deny_unknown_fields)] struct PagePreviewQuery { kind: String, status: Option, - /// 404 host ID whose saved custom HTML is previewed. host: Option, - /// Saved custom HTML of a default response: `direct_ip`, `unknown_host`, - /// `response`, `fallback` or `error-`; with `vhost` for per-vhost pages. slot: Option, vhost: Option, } -/// Renders a built-in local page (or the saved custom HTML of a 404 host) -/// exactly as `Page::render` serves it. The session guard sends this response -/// with a sandbox CSP, so the document runs in an opaque origin without -/// scripts and may only be framed by the panel itself. async fn page_preview( State(state): State>, Query(query): Query, @@ -413,6 +405,5 @@ async fn page_preview( Ok(response) } -/// Marks a sandboxed page preview for the session guard. #[derive(Clone, Copy)] struct PagePreview; diff --git a/src/admin/session.rs b/src/admin/session.rs index 87dbd2e..799eceb 100644 --- a/src/admin/session.rs +++ b/src/admin/session.rs @@ -407,8 +407,6 @@ async fn guard(State(state): State>, mut request: Request, next: Next) } } if response.extensions().get::().is_some() && response.status().is_success() { - // Rendered page previews may contain operator HTML: no scripts, an - // opaque origin, and framing only by the panel itself. response.headers_mut().insert("content-security-policy", HeaderValue::from_static( "sandbox; default-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:; base-uri 'none'; form-action 'none'; frame-ancestors 'self'")); response diff --git a/src/admin/status.rs b/src/admin/status.rs index a748f71..23ef5d2 100644 --- a/src/admin/status.rs +++ b/src/admin/status.rs @@ -1,7 +1,5 @@ include!("status_system.rs"); -/// Live, read-only diagnostics for every configured DNS/DDNS ACL hostname. -/// In particular, a successful lookup need not match the address of a caller. async fn dns_acl_status(State(state): State>) -> Result, ApiError> { let snapshot = state.config.load(); let hostnames = crate::acl::dynamic::statuses(&snapshot.envelope.config).map_err(|error| { diff --git a/src/admin/tests.rs b/src/admin/tests.rs index dfdc540..38672bb 100644 --- a/src/admin/tests.rs +++ b/src/admin/tests.rs @@ -3411,7 +3411,6 @@ mod tests { .unwrap(); write_gz(&dir.path().join("mail.jsonl.2.gz"), &records(200, 210)); write_gz(&dir.path().join("mail.jsonl.10.gz"), &records(100, 110)); - // The oldest rotation has the newest mtime (copied or touched files). std::fs::File::options() .append(true) .open(dir.path().join("mail.jsonl.10.gz")) diff --git a/src/admin/web/acl-picker.js b/src/admin/web/acl-picker.js index 35f7775..65f947e 100644 --- a/src/admin/web/acl-picker.js +++ b/src/admin/web/acl-picker.js @@ -99,9 +99,6 @@ window.rustProxyChoicePicker = (() => { const maxHint = el("small", t("aclPickerLimit"), "fine acl-picker-limit"); dropdown.append(search, optionsBox, empty, maxHint); details.append(dropdown); const selectedTags = el("div", undefined, "acl-picker-selected"); root.append(details, selectedTags); - // Option rows are built on the first open: long lists (countries) would - // otherwise add thousands of DOM nodes per picker. `state` is the source of - // truth for every option; `checks` holds only rendered checkboxes. const items = [...(options.items || [])], state = new Map(), checks = new Map(), order = []; let rendered = false; const isChosen = id => state.get(id) === true; @@ -223,14 +220,12 @@ window.rustProxyChipInput = (() => { window.rustProxyCountryPicker = (() => { const CODES = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW".split(" "); - // Country names are resolved once per language: constructing Intl.DisplayNames - // for every lookup was a large part of rendering many country pickers. const countryNames = new Map(); const nameOf = code => { const lang = document.documentElement.lang || "en"; let names = countryNames.get(lang); - if (!names) { let display = null; try { display = new Intl.DisplayNames([lang], { type: "region" }); } catch { /* unsupported locale */ } names = { display, cache: new Map() }; countryNames.set(lang, names); } - if (!names.cache.has(code)) { let name = code; try { name = names.display?.of(code) || code; } catch { /* unknown region */ } names.cache.set(code, name); } + if (!names) { let display = null; try { display = new Intl.DisplayNames([lang], { type: "region" }); } catch { } names = { display, cache: new Map() }; countryNames.set(lang, names); } + if (!names.cache.has(code)) { let name = code; try { name = names.display?.of(code) || code; } catch { } names.cache.set(code, name); } return names.cache.get(code); }; const parse = text => [...new Set(String(text || "").split(/[\s,;]+/).map(value => value.trim().toUpperCase()).filter(Boolean))]; diff --git a/src/admin/web/acme.js b/src/admin/web/acme.js index b874eec..8f3c9ee 100644 --- a/src/admin/web/acme.js +++ b/src/admin/web/acme.js @@ -1,6 +1,6 @@ "use strict"; (() => { - let job = null, pending = false, loading = false, renewalLogs = {}, resetIssueFormJob = null, runtimeAvailable = true; + let sourceUiRef = null, job = null, pending = false, loading = false, renewalLogs = {}, resetIssueFormJob = null, runtimeAvailable = true; const picker = $("certificate-provider"); const secrets = ["acme-secret", "acme-cf-token", "acme-ovh-application-key", "acme-ovh-application-secret", "acme-ovh-consumer-key"]; const tabs = [...document.querySelectorAll("[data-certificate-tab]")]; @@ -21,6 +21,7 @@ if (selected && focus) button.focus(); } document.querySelectorAll("[data-certificate-page]").forEach(page => { page.hidden = page.dataset.certificatePage !== name; }); + syncRuntimeVisibility(); if (persist) syncLocation(); } for (const button of tabs) { @@ -36,6 +37,7 @@ }); } + function syncRuntimeVisibility() { const card = $("acme-runtime-card"); if (card) card.hidden = activeTab !== "generate" && card.dataset.state !== "unavailable"; } const clearSecrets = () => { for (const id of secrets) $(id).value = ""; }; function resetIssueForm() { $("acme-form").reset(); @@ -60,6 +62,7 @@ } $("acme-domains").placeholder = provider === "http01" ? "example.org, www.example.org" : "example.org, *.example.org"; syncSubmitState(); + sourceUiRef?.sync(); } function open(provider = "http01") { selectTab("generate"); picker.value = provider; @@ -68,13 +71,79 @@ } function close() { clearSecrets(); selectTab("installed"); } picker.addEventListener("change", () => { clearSecrets(); syncProvider(); }); + sourceUiRef = (() => { + const label = picker.closest("label"); if (!label) return { sync() { } }; + label.classList.add("provider-picker-legacy"); label.hidden = true; + const box = el("div", undefined, "certificate-source"); + const modes = el("div", undefined, "certificate-source-modes"); modes.setAttribute("role", "radiogroup"); + const modeDefs = [["acme", "certificateSourceAcme"], ["import", "certificateSourceImport"], ["existing", "certificateSourceExisting"]]; + const modeButtons = modeDefs.map(([mode, key]) => { + const button = el("button", t(key)); button.type = "button"; button.dataset.i18n = key; button.dataset.sourceMode = mode; button.dataset.uiIconName = "none"; button.setAttribute("role", "radio"); + button.addEventListener("click", () => { + if (mode === "acme") setProvider(["import", "existing"].includes(picker.value) ? (lastAcme || "http01") : picker.value); + else setProvider(mode); + }); + modes.append(button); return button; + }); + const acmeRow = el("div", undefined, "certificate-source-acme"); + const validationField = el("label"), validationLabel = el("span", t("certificateSourceValidation")); validationLabel.dataset.i18n = "certificateSourceValidation"; + const validation = el("select"); validation.id = "certificate-validation"; + for (const [value, key] of [["dns01", "certificateValidationDns"], ["http01", "certificateValidationHttp"]]) { const option = el("option", t(key)); option.value = value; option.dataset.i18n = key; validation.append(option); } + validationField.append(validationLabel, validation); + const providerField = el("div", undefined, "certificate-dns-provider"), providerLabel = el("span", t("certificateDnsProvider")); providerLabel.dataset.i18n = "certificateDnsProvider"; + const combo = el("div", undefined, "provider-combo"); + const input = el("input"); input.id = "certificate-dns-provider"; input.type = "text"; input.autocomplete = "off"; input.setAttribute("role", "combobox"); input.setAttribute("aria-expanded", "false"); input.setAttribute("aria-controls", "certificate-dns-provider-list"); + const list = el("ul", undefined, "provider-combo-list"); list.id = "certificate-dns-provider-list"; list.setAttribute("role", "listbox"); list.hidden = true; + combo.append(input, list); providerField.append(providerLabel, combo); + acmeRow.append(validationField, providerField); + box.append(modes, acmeRow); label.after(box); + const dnsProviders = () => [...picker.options].map(option => option.value).filter(value => !["http01", "import", "existing"].includes(value)); + const providerName = value => { const option = [...picker.options].find(item => item.value === value); return String(option?.textContent || value).replace(/^Let's Encrypt\s*[-–]\s*/i, "").replace(/\s*\(DNS-01\)\s*$/i, ""); }; + let lastAcme = "http01", lastDns = dnsProviders()[0] || "cloudflare", active = -1; + function setProvider(value) { if (picker.value === value) { sync(); return; } picker.value = value; picker.dispatchEvent(new Event("change", { bubbles: true })); } + function renderList(filter = "") { + const query = filter.trim().toLowerCase(); + const items = dnsProviders().filter(value => !query || `${value} ${providerName(value)}`.toLowerCase().includes(query)); + list.replaceChildren(...items.map((value, index) => { + const item = el("li", providerName(value)); item.setAttribute("role", "option"); item.dataset.value = value; item.id = `certificate-dns-provider-${value}`; + item.setAttribute("aria-selected", String(value === picker.value)); item.classList.toggle("is-active", index === active); + item.addEventListener("mousedown", event => { event.preventDefault(); choose(value); }); + return item; + })); + if (!items.length) list.append(el("li", t("certificateDnsProviderNone"), "provider-combo-empty")); + } + function openList() { active = -1; renderList(""); list.hidden = false; input.setAttribute("aria-expanded", "true"); input.select?.(); } + function closeList() { list.hidden = true; input.setAttribute("aria-expanded", "false"); input.value = providerName(lastDns); } + function choose(value) { lastDns = value; closeList(); setProvider(value); } + input.addEventListener("focus", openList); input.addEventListener("click", () => { if (list.hidden) openList(); }); + input.addEventListener("input", () => { active = -1; renderList(input.value); list.hidden = false; input.setAttribute("aria-expanded", "true"); }); + input.addEventListener("blur", () => setTimeout(closeList, 0)); + input.addEventListener("keydown", event => { + const options = [...list.querySelectorAll("[data-value]")]; + if (event.key === "ArrowDown" || event.key === "ArrowUp") { event.preventDefault(); if (list.hidden) openList(); active = options.length ? (active + (event.key === "ArrowDown" ? 1 : options.length - 1) + (active < 0 && event.key === "ArrowUp" ? 1 : 0)) % options.length : -1; options.forEach((node, index) => node.classList.toggle("is-active", index === active)); if (options[active]) input.setAttribute("aria-activedescendant", options[active].id); } + else if (event.key === "Enter") { event.preventDefault(); const pick = options[active >= 0 ? active : 0]; if (pick) choose(pick.dataset.value); } + else if (event.key === "Escape") { event.preventDefault(); closeList(); } + }); + validation.addEventListener("change", () => setProvider(validation.value === "http01" ? "http01" : lastDns)); + function sync() { + const value = picker.value, mode = value === "import" || value === "existing" ? value : "acme"; + if (mode === "acme") lastAcme = value; + if (dnsProviders().includes(value)) lastDns = value; + for (const button of modeButtons) { const on = button.dataset.sourceMode === mode; button.setAttribute("aria-checked", String(on)); button.classList.toggle("is-selected", on); } + acmeRow.hidden = mode !== "acme"; + validation.value = value === "http01" ? "http01" : "dns01"; + providerField.hidden = mode !== "acme" || value === "http01"; + if (list.hidden) input.value = providerName(lastDns); + } + return { sync, translate() { for (const node of box.querySelectorAll("[data-i18n]")) node.textContent = t(node.dataset.i18n); sync(); } }; + })(); $("certificate-new").addEventListener("click", () => open()); const stateKey = value => ({ running: "certificateStateRunning", ready: "certificateStateReady", complete: "certificateStateComplete", failed: "certificateStateFailed" }[value?.status] || "certificateStateIdle"); function renderRuntime(value) { const status = value?.status || "checking", mode = value?.mode || "none"; runtimeAvailable = status !== "unavailable"; - $("acme-runtime-card").dataset.state = status; + $("acme-runtime-card").dataset.state = status; syncRuntimeVisibility(); $("acme-runtime-message").textContent = t(value?.message || "acme.runtime_checking"); $("acme-runtime-state").textContent = t(status === "unavailable" ? "certificateRuntimeUnavailable" : status === "ready" && mode === "managed" ? "certificateRuntimeManaged" : status === "ready" && mode === "system" ? "certificateRuntimeSystem" : "certificateRuntimePreparing"); const path = value?.managed_directory; @@ -83,6 +152,7 @@ const availability = flag => t(flag === true ? "runtimeAvailable" : flag === false ? "runtimeUnavailable" : "certificateRuntimePreparing"); $("acme-runtime-components").textContent = `${t("runtimePython")}: ${availability(value?.python)} · ${t("runtimePip")}: ${availability(value?.pip)} · ${t("runtimeCertbot")}: ${availability(value?.certbot)}`; syncSubmitState(); + if (typeof renderCertificateSummary === "function" && envelope) renderCertificateSummary(envelope.config.tls?.certificates || []); } function renderOperation(cardId, messageId, stateId, logId, value, idleKey) { const card = $(cardId), message = $(messageId), state = $(stateId), log = $(logId); @@ -121,11 +191,14 @@ const state = values[cert.id], enabled = cert.issuer.auto_renew !== false; const entry = el("div", undefined, "renewal-entry"); entry.dataset.state = state?.status || "idle"; const head = el("div", undefined, "renewal-entry-head"), identity = el("div", undefined, "renewal-entry-identity"); - identity.append(el("strong", cert.id), el("span", `${cert.issuer.provider} / ${cert.issuer.environment}`, "fine")); - const mode = el("span", t(enabled ? "renewalEnabled" : "renewalDisabled"), "pill"); head.append(identity, mode); entry.append(head); + const dot = el("span", undefined, "certificate-state-dot"); dot.dataset.tone = state?.status === "failed" ? "bad" : enabled ? "ok" : "unknown"; + identity.append(dot, el("strong", cert.id), el("span", `${cert.issuer.provider} / ${cert.issuer.environment}`, "pill")); + const mode = el("span", t(enabled ? "renewalEnabled" : "renewalDisabled"), `pill${enabled ? " live" : ""}`); head.append(identity, mode); entry.append(head); const meta = el("div", undefined, "renewal-meta"); renewalMeta(meta, "renewalLast", stamp(state?.last_checked)); + meta.append(el("span", "→", "renewal-meta-arrow")); renewalMeta(meta, "renewalNext", enabled ? stamp(state?.next_check) : "-"); + meta.append(el("span", "→", "renewal-meta-arrow")); renewalMeta(meta, "renewalExpires", stamp(state?.not_after)); entry.append(meta); if (state?.message) { @@ -217,6 +290,6 @@ renderRuntime(null); render(null); selectTab("installed", false, false); } }; - window.rustProxyCertificates = { open, close, select: selectTab, reset() { clearSecrets(); picker.value = "http01"; syncProvider(); selectTab("installed", false, false); } }; + window.rustProxyCertificates = { open, close, select: selectTab, syncSource: () => sourceUiRef?.sync(), reset() { clearSecrets(); picker.value = "http01"; syncProvider(); selectTab("installed", false, false); } }; syncProvider(); selectTab(activeTab, false, false); })(); diff --git a/src/admin/web/app/chart-scales.js b/src/admin/web/app/chart-scales.js index b9e6447..afcce77 100644 --- a/src/admin/web/app/chart-scales.js +++ b/src/admin/web/app/chart-scales.js @@ -50,11 +50,6 @@ window.rustProxyChartScale = (() => { } return `${format(n)}${unit === "percent" ? "%" : unit === "ms" ? " ms" : unit === "rate" ? "/s" : ""}`; } - // Crosshair (Grafana-style): with value tooltips enabled, a dashed vertical line - // snaps to the nearest sample, each series gets a dot, and a tooltip lists - // every series' value at that sample; a dashed horizontal line marks the - // Y value under the pointer. Values are read back from the drawn lines - // with the chart's own axis scale, so they match what is plotted. function lineSeries(svg) { const box = svg.viewBox?.baseVal, height = box?.height || svg.clientHeight || 1; return [...svg.querySelectorAll("polyline, path")].filter(node => !node.classList.contains("chart-grid") && !node.closest(".rp-chart-crosshair")).map(node => { @@ -127,8 +122,6 @@ window.rustProxyChartScale = (() => { const draw = () => { frame = 0; if (!last || !host.isConnected) return; const values = crosshairValues(svg, last); if (!values) { cross.hidden = true; return; } - // Client rectangles include the interface-scale transform; the - // overlay is positioned in the host's own (unscaled) pixels. const hostBox = host.getBoundingClientRect(), scale = host.offsetWidth ? hostBox.width / host.offsetWidth : 1; const left = (values.box.left - hostBox.left) / scale, top = (values.box.top - hostBox.top) / scale, width = values.box.width / scale, height = values.box.height / scale; const x = left + values.snap * width, y = top + values.fy * height, pointerX = left + values.fx * width; @@ -156,8 +149,6 @@ window.rustProxyChartScale = (() => { function setAxisText(node, value) { if (node.textContent !== value) node.textContent = value; } - // The overlay host is needed for X/Y scales and for value tooltips; each - // is a separate appearance preference, both off by default. const axesOn = () => document.documentElement.dataset.chartAxes === "true"; const tooltipsOn = () => document.documentElement.dataset.chartTooltips === "true"; const axesWanted = () => axesOn() || tooltipsOn(); diff --git a/src/admin/web/app/core.js b/src/admin/web/app/core.js index fd78c1f..3586295 100644 --- a/src/admin/web/app/core.js +++ b/src/admin/web/app/core.js @@ -32,12 +32,9 @@ function activePack() { return languagePacks.get(language) || languagePacks.get( let canonicalLocale = { source: null, value: "und" }; function locale() { const source = activePack()?.meta.locale || "und"; - if (canonicalLocale.source !== source) { let value = "und"; try { value = Intl.getCanonicalLocales(source)[0]; } catch { /* invalid tag */ } canonicalLocale = { source, value }; } + if (canonicalLocale.source !== source) { let value = "und"; try { value = Intl.getCanonicalLocales(source)[0]; } catch { } canonicalLocale = { source, value }; } return canonicalLocale.value; } -// Live views format hundreds of numbers and times per update; constructing a -// new Intl formatter for each value (toLocaleString with options) dominated -// that work. Formatters are cached per language and options. const intlFormatters = new Map(); function intlFormatter(kind, key, create) { const cacheKey = `${locale()}|${kind}|${key}`; @@ -49,9 +46,6 @@ function formatNumber(value, maximumFractionDigits = 0) { return intlFormatter(" function formatDateParts(date, withDate, hour12) { return intlFormatter(withDate ? "datetime" : "time", hour12, lang => new Intl.DateTimeFormat(lang, withDate ? { year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric", hour12 } : { hour: "numeric", minute: "numeric", second: "numeric", hour12 })).format(date); } -// Sorting calls a comparator O(n log n) times; String#localeCompare with a -// locale/options argument builds a new collator on every call, which made -// periodic table re-renders slow. Collators are cached per language. const textCollators = new Map(); function textCollator(numeric = true) { const key = `${activePack()?.meta.locale || "und"}|${numeric}`; diff --git a/src/admin/web/app/icons.js b/src/admin/web/app/icons.js index 1333b3b..cb1c105 100644 --- a/src/admin/web/app/icons.js +++ b/src/admin/web/app/icons.js @@ -164,6 +164,7 @@ function uiIconForTarget(target) { if (target.matches(".chart-style-choice")) return null; if (target.matches(".overview-inline-grip, .overview-inline-narrow, .overview-inline-widen, .overview-inline-up, .overview-inline-down, .overview-inline-hide, .overview-layout-narrow, .overview-layout-widen, .overview-layout-up, .overview-layout-down, .overview-layout-hide")) return null; if (target.matches("#tunnels-open, .vhost-backend-protocol-badge, .config-history-day, .draft-dock-toggle, .mobile-menu-toggle, .sidebar-collapse")) return null; + if (target.matches(".page-editor-summary, .settings-flow-step, .security-summary-tile, .settings-flow-example-tabs button")) return null; if (UI_GLYPH_LABEL.test(String(target.textContent || "").trim())) return null; if (UI_ID_ICONS[target.id]) return UI_ID_ICONS[target.id]; if (target.matches("#web-service-preset-apply, [data-cache-memory-preset], [data-cache-cold-preset], [data-transform-preset]")) return "wand"; @@ -303,8 +304,6 @@ const uiIconObserver = new MutationObserver(records => { }); window.rustProxyIcons = { refresh: refreshUiIcons, setEnabled: setUiIconsEnabled, iconFor: uiIconForTarget }; -// Shared information popovers (
): one is open at a time, Escape or -// a click elsewhere closes it, and its bubble is kept inside the visible (clipping) area. (() => { const MARGIN = 8; const visibleArea = node => { diff --git a/src/admin/web/app/overview-extra-metrics.js b/src/admin/web/app/overview-extra-metrics.js index 01a15c4..61bc437 100644 --- a/src/admin/web/app/overview-extra-metrics.js +++ b/src/admin/web/app/overview-extra-metrics.js @@ -158,8 +158,6 @@ window.rustProxyExtraOverview = (() => { value: (deltas[0] + deltas[1]) / seconds, unit, detail: `${t("overviewExtraRejectedDetail")}: ${fmt(fields[0])} / ${fmt(fields[1])}` }; if (unit === "rate") return { value: deltas[0] / seconds, unit, detail: "" }; - // Percentages use the sum of mutually exclusive categories, sampled - // at the same lifecycle stage. No false 0% or clamped 100% on skew. const sum = deltas.reduce((total, value) => total + value, 0); return { value: sum > 0 ? deltas[0] / sum * 100 : null, unit, diff --git a/src/admin/web/app/overview-rows.js b/src/admin/web/app/overview-rows.js index af2b639..a6461ab 100644 --- a/src/admin/web/app/overview-rows.js +++ b/src/admin/web/app/overview-rows.js @@ -51,9 +51,6 @@ window.rustProxyOverviewRows = (() => { if (needed > spanOf(card)) setSpan(node, needed, columns); } } - // Measuring forces a layout of the whole document. While Overview is - // hidden there is nothing to measure; remember it and re-run once the - // grid is shown again (the ResizeObserver below fires on that change). let hiddenPending = false; function apply() { frame = 0; diff --git a/src/admin/web/app/preferences.js b/src/admin/web/app/preferences.js index 57abfdb..9e7dac2 100644 --- a/src/admin/web/app/preferences.js +++ b/src/admin/web/app/preferences.js @@ -316,7 +316,6 @@ for (const [id, direction] of [["dashboard-widget-scroll-prev", -1], ["dashboard } function refreshChartStylePalette(active = adminPreferences?.chart_style || "default") { const target = $("chart-style-palette"); if (!target || !languagePacks.size) return; - // Keep the selected swatch button mounted; replacing it on click loses focus. for (const style of ADMIN_CHART_STYLES) { let button = [...target.children].find(node => node.dataset.chartPreset === style); if (!button) { @@ -351,9 +350,6 @@ function applyAdminPreferences(value, cache = true) { const savedHeights = normalizeDashboardWidgetHeights(value.dashboard_widget_heights); const savedAutoFit = value.dashboard_auto_fit !== false; const savedPositions = normalizeDashboardWidgetPositions(value.dashboard_widget_positions); - // A saved table column (or any unrelated preference) must not re-apply the - // dashboard layout. Moving its cards detaches focused controls and shifts - // the page, even if the selected dashboard layout has not changed. const layoutChanged = !adminPreferences || JSON.stringify([ adminPreferences.dashboard_widgets, adminPreferences.dashboard_hidden_widgets, adminPreferences.dashboard_widget_sizes, adminPreferences.dashboard_widget_heights, @@ -393,7 +389,6 @@ function applyAdminPreferences(value, cache = true) { if (redirectChanged) window.rustProxyRedirects?.applyPreferences(normalized); if (notfoundChanged) window.rustProxyNotFound?.applyPreferences(normalized); if (streamChanged) window.rustProxyStreams?.applyPreferences(normalized); - // Only a real language change requires translating/re-rendering the whole panel. if (languagePacks.size && languageChanged) translate(); else refreshAppearanceUi({ palette: paletteChanged, widgets: widgetSettingsChanged, refresh: refreshChanged, presets: layoutChanged, search: false }); diff --git a/src/admin/web/app/runtime.js b/src/admin/web/app/runtime.js index 3607033..279b3f9 100644 --- a/src/admin/web/app/runtime.js +++ b/src/admin/web/app/runtime.js @@ -63,90 +63,187 @@ for (const id of ["certificate-file", "certificate-key"]) { $(id).addEventListener("input", syncCertificatePermissions); $(id).addEventListener("change", syncCertificatePermissions); } +function certificateUsage(cert) { + const config = envelope?.config || {}, settings = config.tls || {}; + const hostsOf = item => item?.frontend?.hosts || []; + const groups = { + vhosts: (config.vhosts || []).filter(item => item.certificate_id === cert.id).map(item => ({ id: item.id, hosts: hostsOf(item), mismatch: item.allow_certificate_mismatch === true, open: () => { setPanel("vhosts"); window.rustProxyVhosts?.edit(item.id); } })), + redirects: (config.redirects || []).filter(item => item.certificate_id === cert.id).map(item => ({ id: item.id, hosts: hostsOf(item), open: () => { setPanel("redirects"); window.rustProxyRedirects?.edit(item.id); } })), + notfound: (config.not_found_hosts || []).filter(item => item.certificate_id === cert.id).map(item => ({ id: item.id, hosts: hostsOf(item), open: () => { setPanel("notfound"); window.rustProxyNotFound?.edit(item.id); } })), + docker: (config.docker_agents?.agents || []).filter(agent => [agent.certificate_id, ...(agent.certificate_ids || [])].includes(cert.id)).map(agent => ({ id: agent.id, hosts: agent.domains || [], open: () => setPanel("settings") })) + }; + const legacy = []; + for (const item of config.vhosts || []) if (item.certificate_id === cert.id) legacy.push(`vhost:${item.id}`); + for (const item of config.redirects || []) if (item.certificate_id === cert.id) legacy.push(`redirect:${item.id}`); + for (const item of config.not_found_hosts || []) if (item.certificate_id === cert.id) legacy.push(`404:${item.id}`); + const admin = config.administration?.certificate_id === cert.id, isDefault = settings.default_certificate === cert.id; + if (admin) legacy.push(t("administration")); + if (isDefault) legacy.push(t("defaultLabel")); + const count = groups.vhosts.length + groups.redirects.length + groups.notfound.length + (admin ? 1 : 0) + (isDefault ? 1 : 0); + return { groups, admin, isDefault, legacy, count, inUse: legacy.length > 0 }; +} +function certificateCoverage(cert) { + const inventory = certificateInventory.get(cert.id); + return inventory?.covered_hosts?.length ? inventory.covered_hosts : (cert.covered_hosts || []); +} +function certificateCovers(coverage, host) { return coverage.some(pattern => window.rustProxyAutoCertificate.covers(pattern, host)); } +function certificateCoverageState(coverage, hosts) { + if (!hosts.length || !coverage.length) return { state: "unknown", missing: [] }; + const missing = hosts.filter(host => !certificateCovers(coverage, host)); + return { state: missing.length === 0 ? "full" : missing.length === hosts.length ? "none" : "partial", missing }; +} +let certificateFilter = "all"; +const certificateOpenRows = new Set(); +function certificateTimeline(inventory) { + const days = inventory?.days_remaining, to = Number(inventory?.not_after_unix); + const box = el("div", undefined, "certificate-validity"); + const tone = inventory?.expiry_status === "expired" ? "bad" : inventory?.expiry_status === "warning" ? "warn" : "ok"; + box.dataset.tone = days == null ? "unknown" : tone; + const text = days == null ? t("certificateValidityUnknown") : `${t("certificateDaysLeft").replace("{days}", days)} · ${t("certificateUntil")} ${formatDate(to * 1000)}`; + const bar = el("span", undefined, "certificate-validity-bar"), fill = el("i"); + const ratio = days == null ? 0 : Math.max(0, Math.min(1, Number(days) / 90)); + fill.style.width = `${Math.round(ratio * 100)}%`; bar.append(fill); + box.append(el("span", text, "certificate-validity-text"), bar); + return box; +} +function formatDate(ms) { try { return new Date(ms).toLocaleDateString(typeof language !== "undefined" ? language.replace("_", "-") : undefined); } catch { return new Date(ms).toISOString().slice(0, 10); } } +function renderCertificateSummary(certificates) { + const box = $("certificate-summary"); if (!box) return; + const settings = envelope?.config.tls || {}; + let acme = 0, external = 0, managedFiles = 0, expiring = [], assignments = 0, vhostCount = 0, redirectCount = 0, notfoundCount = 0; + for (const cert of certificates) { + if (cert.issuer) acme++; else if (certificateUsesExternalFiles(cert)) external++; else managedFiles++; + const inventory = certificateInventory.get(cert.id); + if (["warning", "expired"].includes(inventory?.expiry_status)) expiring.push(`${cert.id} · ${inventory?.days_remaining ?? "-"} ${t("certificateDaysShort")}`); + const usage = certificateUsage(cert); assignments += usage.count; vhostCount += usage.groups.vhosts.length; redirectCount += usage.groups.redirects.length; notfoundCount += usage.groups.notfound.length; + } + const tile = (value, titleKey, line, tone, filter) => { + const node = el(filter ? "button" : "div", undefined, `cert-summary-tile${tone ? ` is-${tone}` : ""}`); + if (filter) { node.type = "button"; node.dataset.uiIconName = "none"; node.addEventListener("click", () => { window.rustProxyAcme?.select("installed"); setCertificateFilter(filter); }); } + const title = el("span", t(titleKey)); title.dataset.i18n = titleKey; + node.append(el("b", value), title, el("small", line)); return node; + }; + const runtime = $("acme-runtime-state")?.textContent || ""; + box.replaceChildren( + tile(String(certificates.length), "certificateSummaryCount", `${acme} ACME · ${external} ${t("certificateSummaryExternal")} · ${managedFiles} ${t("certificateSummaryManaged")}`, certificates.length ? "ok" : "", "all"), + tile(String(expiring.length), "certificateSummaryExpiring", expiring.length ? expiring.slice(0, 2).join(", ") : t("certificateSummaryNothingExpiring"), expiring.length ? "warn" : "ok", "expiring"), + tile(String(assignments), "certificateSummaryAssignments", `${vhostCount} vhost · ${redirectCount} ${t("certificateSummaryRedirects")} · ${notfoundCount} 404${settings.default_certificate ? ` · ${t("defaultLabel")}: ${settings.default_certificate}` : ""}`, "", "unassigned"), + tile(runtime || "-", "certificateSummaryRuntime", $("acme-runtime-components")?.textContent || "", $("acme-runtime-card")?.dataset.state === "ready" ? "ok" : $("acme-runtime-card")?.dataset.state === "unavailable" ? "bad" : "") + ); +} +function setCertificateFilter(value) { + certificateFilter = value; + for (const button of document.querySelectorAll("[data-certificate-filter]")) button.setAttribute("aria-pressed", String(button.dataset.certificateFilter === value)); + applyCertificateFilter(); +} +function applyCertificateFilter() { + const query = ($("certificate-search")?.value || "").trim().toLowerCase(); + let shown = 0; + for (const row of document.querySelectorAll("#certificate-list > .certificate-row")) { + const matchesQuery = !query || row.dataset.search.includes(query); + const matchesFilter = certificateFilter === "all" || (certificateFilter === "expiring" && row.dataset.expiring === "true") || (certificateFilter === "unassigned" && row.dataset.assigned === "false"); + row.hidden = !(matchesQuery && matchesFilter); if (!row.hidden) shown++; + } + const empty = $("certificate-list-filtered-empty"); + if (empty) empty.hidden = shown > 0 || !document.querySelector("#certificate-list > .certificate-row"); +} function renderCertificates() { if (!envelope) return; const settings = envelope.config.tls || {}; - const entries = (settings.certificates || []).map(cert => { + const certificates = settings.certificates || []; + const entries = certificates.map(cert => { const inventory = certificateInventory.get(cert.id); - const coverage = (inventory?.covered_hosts?.length ? inventory.covered_hosts : (cert.covered_hosts || [])); + const coverage = certificateCoverage(cert); const bindings = cert.hosts || []; - const used = []; - for (const vhost of envelope.config.vhosts || []) if (vhost.certificate_id === cert.id) used.push(`vhost:${vhost.id}`); - for (const redirect of envelope.config.redirects || []) if (redirect.certificate_id === cert.id) used.push(`redirect:${redirect.id}`); - for (const host of envelope.config.not_found_hosts || []) if (host.certificate_id === cert.id) used.push(`404:${host.id}`); - if (envelope.config.administration?.certificate_id === cert.id) used.push(t("administration")); - if (settings.default_certificate === cert.id) used.push(t("defaultLabel")); - const managed = !!cert.issuer, inUse = used.length > 0; - const box = el("div", undefined, "entity certificate-card"); - const head = el("div", undefined, "certificate-card-head"); + const usage = certificateUsage(cert), used = usage.legacy; + const managed = !!cert.issuer, inUse = usage.inUse; + const box = el("details", undefined, "entity certificate-card certificate-row"); + box.dataset.certificateId = cert.id; + box.dataset.expiring = String(["warning", "expired"].includes(inventory?.expiry_status)); + box.dataset.assigned = String(usage.count > 0); + box.dataset.search = [cert.id, ...coverage, ...bindings, ...usage.groups.vhosts.map(item => item.id), ...usage.groups.redirects.map(item => item.id), ...usage.groups.notfound.map(item => item.id)].join(" ").toLowerCase(); + box.open = certificateOpenRows.has(cert.id); + box.addEventListener("toggle", () => { if (box.open) certificateOpenRows.add(cert.id); else certificateOpenRows.delete(cert.id); }); + const summary = el("summary", undefined, "certificate-row-summary"); + const dot = el("span", undefined, "certificate-state-dot"); dot.dataset.tone = inventory?.expiry_status === "expired" ? "bad" : inventory?.expiry_status === "warning" ? "warn" : inventory ? "ok" : "unknown"; const identity = el("div", undefined, "certificate-card-identity"); identity.append(el("span", cert.id, "entity-title")); const statePills = el("div", undefined, "vhost-policy-pills certificate-state-pills"); - if (managed) statePills.append(el("small", `${t("certificateManaged")} · ${cert.issuer.provider} / ${cert.issuer.environment}`, "pill")); + if (managed) statePills.append(el("small", `${t("certificateManaged")} · ${cert.issuer.provider} / ${cert.issuer.environment}`, "pill live")); else if (certificateUsesExternalFiles(cert)) statePills.append(el("small", t("certificateExternalFiles"), "pill")); - if (settings.default_certificate === cert.id) statePills.append(el("small", t("defaultLabel"), "pill")); + else statePills.append(el("small", t("certificateManagedFiles"), "pill")); + if (settings.default_certificate === cert.id) statePills.append(el("small", t("defaultLabel"), "pill live")); if (inventory?.expiry_status === "expired") statePills.append(el("small", t("certificateExpired"), "pill status-error")); else if (inventory?.expiry_status === "warning") statePills.append(el("small", t("certificateExpiresSoon"), "pill status-error")); - if (statePills.children.length) identity.append(statePills); - head.append(identity); - box.append(head); - + identity.append(statePills); const coverageBlock = el("div", undefined, "certificate-coverage"); - coverageBlock.append(el("span", t("certificateCovers"), "small-label")); const domainPills = el("div", undefined, "vhost-policy-pills certificate-domain-pills"); if (coverage.length) { - for (const host of coverage) domainPills.append(el("small", host, "pill")); - } else { - domainPills.append(el("small", t("certificateCoverageUnknown"), "certificate-coverage-unknown")); - } + for (const host of coverage.slice(0, 3)) domainPills.append(el("small", host, "pill")); + if (coverage.length > 3) domainPills.append(el("small", `+${coverage.length - 3}`, "pill")); + } else domainPills.append(el("small", t("certificateCoverageUnknown"), "certificate-coverage-unknown")); coverageBlock.append(domainPills); - box.append(coverageBlock); + const usageCell = el("div", undefined, "certificate-usage-cell"); + const usageParts = []; + if (usage.groups.vhosts.length) usageParts.push(`${usage.groups.vhosts.length} vhost`); + if (usage.groups.redirects.length) usageParts.push(`${usage.groups.redirects.length} ${t("certificateSummaryRedirects")}`); + if (usage.groups.notfound.length) usageParts.push(`${usage.groups.notfound.length} 404`); + if (usage.admin) usageParts.push(t("administration")); + if (usage.isDefault) usageParts.push(t("defaultLabel")); + usageCell.append(el("b", String(usage.count)), el("span", usageParts.join(" · ") || t("certUnassigned"), "fine")); + summary.append(dot, identity, coverageBlock, certificateTimeline(inventory), usageCell, el("span", "", "certificate-row-chevron")); + box.append(summary); - const details = el("details", undefined, "certificate-details"); - details.append(el("summary", t("certificateDetails"))); - const detailBody = el("div", undefined, "certificate-details-body"); - const stamp = value => Number(value) ? formatDateTime(Number(value) * 1000) : "-"; - detailBody.append( - el("p", `${t("certificateBindings")}: ${bindings.join(", ") || "-"}`, "entity-details"), - el("p", `${t("certificateFiles")}: ${cert.cert_file} / ${cert.key_file}`, "entity-details"), - el("p", `${t("certAssigned")}: ${used.join(", ") || t("certUnassigned")}`, "entity-details"), - el("p", `${t("certificateIssuerName")}: ${inventory?.certificate_issuer || "-"}`, "entity-details"), - el("p", `${t("certificateValidFrom")}: ${stamp(inventory?.not_before_unix)}`, "entity-details"), - el("p", `${t("renewalExpires")}: ${stamp(inventory?.not_after_unix)}`, "entity-details"), - el("p", `${t("certificateDaysRemaining")}: ${inventory?.days_remaining ?? "-"}`, "entity-details"), - el("p", `${t("certificateRenewalStatus")}: ${inventory?.renewal_status || "-"}`, "entity-details"), - el("p", `${t("renewalLast")}: ${stamp(inventory?.last_renewal_attempt)}`, "entity-details"), - el("p", `${t("certificateRenewalError")}: ${inventory?.last_renewal_error ? t(inventory.last_renewal_error) : "-"}`, "entity-details"), - ); - details.append(detailBody); - box.append(details); - - const buttons = el("div", undefined, "entity-actions"); - const assignPane = el("div", undefined, "certificate-bulk-assign"); - assignPane.hidden = true; - const assignmentList = el("div", undefined, "certificate-bulk-list"); - for (const host of envelope.config.vhosts || []) { - const label = el("label", undefined, "check"); - const check = document.createElement("input"); - check.type = "checkbox"; check.value = host.id; - check.checked = host.certificate_id === cert.id; - label.append(check, el("span", `${host.id} · ${(host.frontend?.hosts || []).join(", ")}`)); - assignmentList.append(label); - } - const applyBindings = action(t("certAssignApply"), async () => { - if (busy) return; - const selected = new Set([...assignmentList.querySelectorAll('input:checked')].map(input => input.value)); - const next = structuredClone(envelope.config); - for (const host of next.vhosts) { - if (selected.has(host.id)) host.certificate_id = cert.id; - else if (host.certificate_id === cert.id) host.certificate_id = null; + const body = el("div", undefined, "certificate-row-body"); + const usageSection = el("section", undefined, "certificate-section certificate-usage"); + const usageHead = el("h4"); usageHead.append(el("span", t("certificateWhereUsed")), el("span", String(usage.count), "pill")); + usageSection.append(usageHead); + const groupDefs = [["vhosts", "certificateGroupVhosts"], ["redirects", "certificateGroupRedirects"], ["notfound", "certificateGroupNotFound"], ["docker", "certificateGroupDocker"]]; + let anyUsage = false; + for (const [key, labelKey] of groupDefs) { + const items = usage.groups[key]; if (!items.length) continue; anyUsage = true; + const group = el("div", undefined, "certificate-usage-group"); + group.append(el("span", `${t(labelKey)} · ${items.length}`, "small-label")); + for (const item of items) { + const row = el("div", undefined, "certificate-usage-row"); + const cover = certificateCoverageState(coverage, item.hosts); + const pillText = cover.state === "full" ? t("certificateCovered") : cover.state === "unknown" ? t("certificateCoverageUnknownShort") : `${t("certificateNotCovered")}: ${cover.missing.join(", ")}${item.mismatch ? ` · ${t("certificateMismatchAccepted")}` : ""}`; + const open = el("button", t("certificateOpen"), "quiet certificate-usage-open"); open.type = "button"; open.dataset.uiIconName = "none"; open.addEventListener("click", item.open); + row.append(el("span", item.id, "mono"), el("span", item.hosts.join(", ") || "-", "fine"), el("span", pillText, `pill${cover.state === "full" ? " live" : cover.state === "unknown" ? "" : " warn"}`), open); + group.append(row); } - await saveSection("vhosts", next.vhosts); - }); - assignPane.append(el("p", t("certAssignHelp"), "fine"), assignmentList, applyBindings); - const assignButton = action(t("certAssignVhosts"), () => { - assignPane.hidden = !assignPane.hidden; - }); + usageSection.append(group); + } + const extra = []; + if (usage.admin) extra.push(t("administration")); + if (usage.isDefault) extra.push(t("certificateDefaultSni")); + if (extra.length) { anyUsage = true; usageSection.append(el("p", `${t("certificateAlsoUsedBy")}: ${extra.join(", ")}`, "fine")); } + if (!anyUsage) usageSection.append(el("p", t("certUnassigned"), "fine")); + usageSection.append(el("p", t("certificateUsageHelp"), "fine certificate-usage-help")); + + const side = el("div", undefined, "certificate-row-side"); + const stamp = value => Number(value) ? formatDateTime(Number(value) * 1000) : "-"; + const kv = (rows) => { const list = el("dl", undefined, "certificate-kv"); for (const [key, value] of rows) list.append(el("dt", t(key)), el("dd", value)); return list; }; + const details = el("section", undefined, "certificate-section certificate-details"); + details.append(el("h4", t("certificateDetails")), kv([ + ["certificateIssuerName", inventory?.certificate_issuer || "-"], + ["certificateValidFrom", stamp(inventory?.not_before_unix)], + ["renewalExpires", stamp(inventory?.not_after_unix)], + ["certificateDaysRemaining", String(inventory?.days_remaining ?? "-")], + ["certificateBindings", bindings.join(", ") || "-"], + ["certAssigned", used.join(", ") || t("certUnassigned")] + ])); + const renewal = el("section", undefined, "certificate-section certificate-renewal-summary"); + renewal.append(el("h4", t("certificateRenewalStatus")), kv([ + ["certificateRenewalStatus", inventory?.renewal_status || "-"], + ["renewalLast", stamp(inventory?.last_renewal_attempt)], + ["certificateRenewalError", inventory?.last_renewal_error ? t(inventory.last_renewal_error) : "-"] + ])); + if (managed) { const link = el("button", t("certificateRenewalActionsLink"), "quiet"); link.type = "button"; link.dataset.uiIconName = "none"; link.addEventListener("click", () => window.rustProxyAcme?.select("renewal")); renewal.append(link); } + const files = el("section", undefined, "certificate-section certificate-files"); + files.append(el("h4", t("certificateFiles")), el("p", `${cert.cert_file}\n${cert.key_file}`, "mono certificate-file-paths")); + const buttons = el("div", undefined, "entity-actions"); + const assignButton = action(t("certAssignVhosts"), () => openCertificateAssign(cert)); assignButton.disabled = !(envelope.config.vhosts || []).length; buttons.append(assignButton); if (!managed) { @@ -173,13 +270,91 @@ function renderCertificates() { } const remove = action(t("remove"), async () => { if (inUse) { toast(t("certInUse"), true); return; } if (!(await appConfirm(t("confirmDelete"), { danger: true }))) return; const next = structuredClone(envelope.config); next.tls.certificates = next.tls.certificates.filter(v => v.id !== cert.id); await saveSection("tls", next.tls); }); remove.disabled = inUse; remove.title = inUse ? t("certInUse") : ""; buttons.append(remove); - box.append(buttons, assignPane); + side.append(details, renewal, files, buttons); + body.append(usageSection, side); + box.append(body); return box; }); - $("certificate-list").replaceChildren(...entries); + const filteredEmpty = el("p", t("certificateFilterEmpty"), "empty"); filteredEmpty.id = "certificate-list-filtered-empty"; filteredEmpty.hidden = true; + $("certificate-list").replaceChildren(...entries, filteredEmpty); if (!entries.length) $("certificate-list").append(el("p", t("emptyCertificates"), "empty")); + renderCertificateSummary(certificates); + applyCertificateFilter(); + window.rustProxyCertificates?.syncSource?.(); syncCertificatePermissions(); } +let certificateAssignState = null; +function openCertificateAssign(cert) { + const dialog = $("certificate-assign-dialog"); if (!dialog || !envelope) return; + const coverage = certificateCoverage(cert); + const rows = (envelope.config.vhosts || []).map(host => { + const hosts = host.frontend?.hosts || [], cover = certificateCoverageState(coverage, hosts); + const selectable = cover.state === "full" || cover.state === "unknown" || host.allow_certificate_mismatch === true || host.certificate_id === cert.id; + return { host, hosts, cover, selectable, initial: host.certificate_id === cert.id, checked: host.certificate_id === cert.id }; + }); + certificateAssignState = { cert, rows, filter: "matching", query: "" }; + $("certificate-assign-title").textContent = `${t("certAssignVhosts")} · ${cert.id}`; + $("certificate-assign-domains").replaceChildren(...coverage.slice(0, 4).map(host => el("span", host, "pill")), ...(coverage.length > 4 ? [el("span", `+${coverage.length - 4}`, "pill")] : [])); + $("certificate-assign-search").value = ""; + renderCertificateAssign(); + if (!dialog.open) dialog.showModal(); +} +function renderCertificateAssign() { + const state = certificateAssignState; if (!state) return; + const counts = { matching: state.rows.filter(row => row.cover.state === "full").length, assigned: state.rows.filter(row => row.checked).length, all: state.rows.length }; + const filters = $("certificate-assign-filters"); + filters.replaceChildren(...[["matching", "certificateAssignMatching"], ["assigned", "certificateAssignAssigned"], ["all", "certificateFilterAll"]].map(([key, labelKey]) => { + const button = el("button", `${t(labelKey)} · ${counts[key]}`); button.type = "button"; button.dataset.uiIconName = "none"; + button.setAttribute("aria-pressed", String(state.filter === key)); + button.addEventListener("click", () => { state.filter = key; renderCertificateAssign(); }); + return button; + })); + const query = state.query.toLowerCase(), list = $("certificate-assign-list"); + const head = el("div", undefined, "certificate-assign-row certificate-assign-head"); + for (const key of ["", "certificateAssignColVhost", "certificateAssignColHosts", "certificateAssignColCoverage", "certificateAssignColNow"]) head.append(el("span", key ? t(key) : "")); + const visible = state.rows.filter(row => (state.filter === "all" || (state.filter === "matching" && row.cover.state === "full") || (state.filter === "assigned" && row.checked)) + && (!query || `${row.host.id} ${row.hosts.join(" ")}`.toLowerCase().includes(query))); + const items = visible.map(row => { + const line = el("label", undefined, "certificate-assign-row"); + const check = document.createElement("input"); check.type = "checkbox"; check.checked = row.checked; check.disabled = !row.selectable && !row.checked; + check.addEventListener("change", () => { row.checked = check.checked; renderCertificateAssign(); }); + const coverText = row.cover.state === "full" ? t("certificateCoveredAll") : row.cover.state === "unknown" ? t("certificateCoverageUnknownShort") : row.cover.state === "none" ? t("certificateCoverageNone") : `${t("certificateCoveragePartial").replace("{covered}", row.hosts.length - row.cover.missing.length).replace("{total}", row.hosts.length)}`; + const coverExtra = row.cover.state !== "full" && row.cover.state !== "unknown" ? (row.host.allow_certificate_mismatch ? ` · ${t("certificateMismatchAccepted")}` : ` · ${t("certificateMismatchRequired")}`) : ""; + const now = el("span", undefined, "certificate-assign-now"); + if (row.checked !== row.initial) now.append(el("span", t(row.checked ? "certificateAssignAdd" : "certificateAssignRemove"), `pill ${row.checked ? "warn" : "status-error"}`), " "); + now.append(el("span", row.host.certificate_id ? (row.host.certificate_id === state.cert.id ? t("certificateAssignThis") : row.host.certificate_id) : t("certificateAssignDefault"), "fine")); + line.classList.toggle("is-changed", row.checked !== row.initial); + line.classList.toggle("is-disabled", check.disabled); + line.append(check, el("b", row.host.id, "mono"), el("span", row.hosts.join(", ") || "-", "fine"), el("span", coverText + coverExtra, `pill${row.cover.state === "full" ? " live" : row.cover.state === "unknown" ? "" : " warn"}`), now); + return line; + }); + list.replaceChildren(head, ...(items.length ? items : [el("p", t("certificateFilterEmpty"), "empty")])); + const added = state.rows.filter(row => row.checked && !row.initial).length, removed = state.rows.filter(row => !row.checked && row.initial).length; + const changes = $("certificate-assign-changes"); changes.replaceChildren(); + if (added || removed) { + changes.append(el("b", `${t("certificateAssignChanges")}: `)); + if (added) changes.append(el("span", `+${added} ${t("certificateAssignAdded")}`, "pill live"), " "); + if (removed) changes.append(el("span", `−${removed} ${t("certificateAssignRemoved")}`, "pill status-error")); + } else changes.append(el("span", t("certificateAssignNoChanges"), "fine")); + $("certificate-assign-apply").disabled = !(added || removed); +} +$("certificate-assign-search")?.addEventListener("input", event => { if (certificateAssignState) { certificateAssignState.query = event.target.value; renderCertificateAssign(); } }); +$("certificate-assign-all")?.addEventListener("click", () => { if (!certificateAssignState) return; for (const row of certificateAssignState.rows) if (row.cover.state === "full") row.checked = true; renderCertificateAssign(); }); +$("certificate-assign-none")?.addEventListener("click", () => { if (!certificateAssignState) return; for (const row of certificateAssignState.rows) row.checked = false; renderCertificateAssign(); }); +for (const id of ["certificate-assign-close", "certificate-assign-cancel"]) $(id)?.addEventListener("click", () => { $("certificate-assign-dialog").close(); }); +$("certificate-assign-dialog")?.addEventListener("close", () => { certificateAssignState = null; }); +$("certificate-assign-apply")?.addEventListener("click", async () => { + const state = certificateAssignState; if (!state || busy || !envelope) return; + const selected = new Set(state.rows.filter(row => row.checked).map(row => row.host.id)); + const next = structuredClone(envelope.config); + for (const host of next.vhosts) { + if (selected.has(host.id)) host.certificate_id = state.cert.id; + else if (host.certificate_id === state.cert.id) host.certificate_id = null; + } + if (await saveSection("vhosts", next.vhosts)) $("certificate-assign-dialog").close(); +}); +$("certificate-search")?.addEventListener("input", applyCertificateFilter); +for (const button of document.querySelectorAll("[data-certificate-filter]")) button.addEventListener("click", () => setCertificateFilter(button.dataset.certificateFilter)); $("certificate-form").addEventListener("submit", async event => { event.preventDefault(); const form = event.currentTarget; if (!envelope || busy) return; diff --git a/src/admin/web/cache-panel.js b/src/admin/web/cache-panel.js index f1642af..35c3fbc 100644 --- a/src/admin/web/cache-panel.js +++ b/src/admin/web/cache-panel.js @@ -263,8 +263,6 @@ try { data = await api(`/api/cache?${query}`, { signal }); } catch (error) { - // A label-only Docker publication can disappear from the - // effective catalog. Recover from its now-invalid scope. if (error?.status !== 404 || scope() === "*") throw error; $("cache-scope").value = "*"; offset = 0; resetLiveChart("*"); @@ -276,7 +274,7 @@ if (data.settings && Array.isArray(data.vhosts)) { staticData = { settings: data.settings, vhosts: data.vhosts, catalog_version: data.catalog_version }; staticRevision = data.revision; - configure(); // Effective Docker vhosts can change without a saved config revision. + configure(); } else if (staticData) { data = { ...staticData, ...data }; } diff --git a/src/admin/web/cache-rules.js b/src/admin/web/cache-rules.js index dd2f2ff..8b44e46 100644 --- a/src/admin/web/cache-rules.js +++ b/src/admin/web/cache-rules.js @@ -52,9 +52,6 @@ window.rustProxyCacheRules = (() => { } const flowMarker = rule => Array.isArray(rule.vcl_flow?.branches) && rule.vcl_flow.branches.length > 0; function flowFailure(rule) { return new Error(t("cacheRulesFlowInvalid").replace("{rule}", rule?.name || rule?.id || "VCL")); } - // Structural checks only. Conditions/actions are evaluated and validated by - // Rust; this prevents UI operations from splitting or silently flattening a - // saved imported program before it reaches that compiler. function validateFlow(rules) { const groups = new Map(); rules.forEach((rule, position) => { @@ -165,8 +162,6 @@ window.rustProxyCacheRules = (() => { } function ruleVcl(rule) { const lines = vclActions(rule).flatMap(line => line.split("\n")); - // An imported return(deliver) may be represented by stop=true and no actions. - // Preserve terminal control flow even when preceded by header/TTL actions. if (rule.stop && !lines.some(line => /^return\s*\(/.test(line))) lines.push(`return (${rule.stage === "request" ? (rule.hash_stage ? "lookup" : "hash") : "deliver"});`); const conditions = rule.conditions.map(c => vclCondition(c, rule.stage)); @@ -224,16 +219,10 @@ window.rustProxyCacheRules = (() => { for (const [unit, size] of [...durationUnits].reverse()) if (seconds >= size && seconds % size === 0) return `${seconds / size}${unit}`; return `${seconds}s`; } - // These are ordinary graphical rules, not a separate VCL engine. Keep - // privacy boundaries fail-closed: rules which can increase cache reuse or - // alter downstream caching start disabled until the operator reviews them. const templatePass = (label, conditions, match = "all") => ({ name: t(label), stage: "request", match, conditions, actions: [{ type: "pass" }], stop: true, }); - // Cookie/session guards use cookie_pass: the same BYPASS for pages, but - // RustProxy may still cache a *public static asset* when the global static - // cookie policy is on and no explicit pass rule matches the request. const templateCookieGuard = (label, conditions, match = "all") => ({ ...templatePass(label, conditions, match), actions: [{ type: "cookie_pass" }], }); @@ -246,8 +235,6 @@ window.rustProxyCacheRules = (() => { }); const protectedPaths = "^/(?:admin|auth|login|logout|user|users|account|profile|settings|dashboard|cart|checkout|orders|billing|payment)(?:/|[?]|$)"; const TEMPLATES = { - // Path guard and Cookie guard are separate rules: the explicit path pass - // is never relaxed, the Cookie guard may yield to the static policy. wordpress: () => [ { name: t("cacheRuleTplWordpress"), stage: "request", match: "all", conditions: [{ field: "path", operator: "regex", values: ["^/(wp-admin|wp-login\\.php|xmlrpc\\.php|wp-json)"] }], actions: [{ type: "pass" }] }, { name: t("cacheRuleTplWordpressCookies"), stage: "request", match: "all", conditions: [{ field: "header", name: "cookie", operator: "regex", values: ["wordpress_logged_in_|comment_author_|woocommerce_items_in_cart|wp-postpass_"] }], actions: [{ type: "cookie_pass" }] }, @@ -256,8 +243,6 @@ window.rustProxyCacheRules = (() => { { name: t("cacheRuleTplStaticCookies"), stage: "request", match: "all", conditions: [{ field: "extension", operator: "equals", values: ["css", "js", "mjs", "png", "jpg", "jpeg", "gif", "webp", "avif", "svg", "ico", "woff", "woff2"] }], actions: [{ type: "strip_cookies", keep: [] }] }, { name: t("cacheRuleTplStaticTtl"), stage: "response", match: "all", conditions: [{ field: "extension", operator: "equals", values: ["css", "js", "mjs", "png", "jpg", "jpeg", "gif", "webp", "avif", "svg", "ico", "woff", "woff2"] }, { field: "status", operator: "equals", values: ["200"] }], actions: [{ type: "ttl", seconds: 2592000 }, { type: "strip_set_cookie" }] }, ], - // Opt-in CDN cookie policy. Never strip a mixed Cookie header: it may - // contain session/authentication state required by the origin. cdn: () => { const technical = "(?:__cf_bm|cf_clearance|_cfuvid|__cfruid|__cfseq|_abck|ak_bmsc|bm_sz|bm_sv)"; return [ @@ -268,9 +253,6 @@ window.rustProxyCacheRules = (() => { { name: t("cacheRuleTplCdnRemaining"), stage: "request", match: "all", conditions: [{ field: "header", name: "Cookie", operator: "exists" }], actions: [{ type: "cookie_pass" }], stop: true }, ]; }, - // Separate from the CDN template: remove only explicitly named cookies - // confirmed to be irrelevant to this Vhost. HTTP Cookie has no Domain - // attribute, so no origin inference or wildcard session-cookie removal. publiccookies: () => [{ name: t("cacheRuleTplPubliccookies"), enabled: false, stage: "request", match: "all", conditions: [ @@ -284,13 +266,10 @@ window.rustProxyCacheRules = (() => { tracking: () => [{ name: t("cacheRuleTplTracking"), stage: "request", match: "all", conditions: [], actions: [{ type: "strip_query", params: ["utm_*", "fbclid", "gclid", "msclkid", "mc_cid", "mc_eid", "_ga"] }] }], api: () => [{ name: t("cacheRuleTplApi"), stage: "request", match: "all", conditions: [{ field: "path", operator: "prefix", values: ["/api/"] }], actions: [{ type: "pass" }] }], language: () => [{ name: t("cacheRuleTplLanguage"), stage: "request", match: "all", conditions: [], actions: [{ type: "hash_cookie", name: "lang" }] }], - // No negative-cache template: the storage layer currently stores 200 only. - // A TTL rule matching 404 would appear enabled but could never yield HIT. headers: () => [{ name: t("cacheRuleTplHeaders"), stage: "deliver", match: "all", conditions: [], actions: [{ type: "remove_header", name: "X-Powered-By" }] }], browser: () => [{ name: t("cacheRuleTplBrowser"), stage: "deliver", match: "all", conditions: [{ field: "extension", operator: "equals", values: ["css", "js", "mjs", "png", "jpg", "jpeg", "gif", "webp", "avif", "svg", "ico", "woff", "woff2"] }, { field: "status", operator: "equals", values: ["200"] }], actions: [{ type: "set_header", name: "Cache-Control", value: "public, max-age=2592000" }] }], nobrowser: () => [{ name: t("cacheRuleTplNoBrowser"), stage: "deliver", match: "any", conditions: [{ field: "content_type", operator: "prefix", values: ["text/html"] }, { field: "path", operator: "prefix", values: ["/admin", "/account"] }], actions: [{ type: "set_header", name: "Cache-Control", value: "no-store" }] }], security: () => [{ name: t("cacheRuleTplSecurity"), stage: "deliver", match: "all", conditions: [], actions: [{ type: "default_header", name: "X-Content-Type-Options", value: "nosniff" }, { type: "default_header", name: "Referrer-Policy", value: "strict-origin-when-cross-origin" }] }], - // Safety and authenticated traffic. No rule below removes unknown cookies. safemethods: () => [templatePass("cacheRuleTplSafemethods", [{ field: "method", operator: "equals", values: ["GET", "HEAD"], negate: true }])], authbypass: () => [templatePass("cacheRuleTplAuthbypass", [{ field: "header", name: "Authorization", operator: "exists" }])], cookiepass: () => [templateCookieGuard("cacheRuleTplCookiepass", [{ field: "header", name: "Cookie", operator: "exists" }])], @@ -316,7 +295,6 @@ window.rustProxyCacheRules = (() => { signedurls: () => [templatePass("cacheRuleTplSignedurls", [ ...["token", "access_token", "signature", "sig", "auth_token"].map(name => ({ field: "query", name, operator: "exists" })), ], "any")], - // Framework-specific guards are independent from the CDN allowlist. woocommerce: () => [ templatePass("cacheRuleTplWoocommerce", [templatePath("^/(?:cart|checkout|my-account)(?:/|[?]|$)")]), templateCookieGuard("cacheRuleTplWoocommerceCookies", [ @@ -328,8 +306,6 @@ window.rustProxyCacheRules = (() => { authjs: () => [templateCookieGuard("cacheRuleTplAuthjs", [{ field: "header", name: "Cookie", operator: "regex", values: ["(?:^|;[ \\t]*)(?:__Secure-)?(?:next-auth[.]session-token|authjs[.]session-token)="] }])], aspnet: () => [templateCookieGuard("cacheRuleTplAspnet", [{ field: "header", name: "Cookie", operator: "regex", values: ["(?:^|;[ \\t]*)(?:[.]AspNetCore[.]Cookies|ASP[.]NET_SessionId)="] }])], drupal: () => [templateCookieGuard("cacheRuleTplDrupal", [{ field: "header", name: "Cookie", operator: "regex", values: ["(?:^|;[ \\t]*)(?:S?SESS[a-fA-F0-9]+)="] }])], - // Cache acceleration must be opt-in: names, routes, representation privacy, - // Vary, and origin Cache-Control must be checked before activation. publicjson: () => [templateResponse("cacheRuleTplPublicjson", [ { field: "path", operator: "prefix", values: ["/api/public/"] }, { field: "status", operator: "equals", values: ["200"] }, @@ -364,8 +340,6 @@ window.rustProxyCacheRules = (() => { { field: "path", operator: "prefix", values: ["/search"] }, { field: "status", operator: "equals", values: ["200"] }, ], [{ type: "ttl", seconds: 15 }])], - // Cache blocking AND browser no-store are separate stages: a deliver rule - // alone cannot prevent a shared-cache HIT. Purge old objects on activation. nocachehtml: () => [ templateResponse("cacheRuleTplNocachehtmlResponse", [{ field: "content_type", operator: "prefix", values: ["text/html"] }], [{ type: "no_store" }], true), templateDeliver("cacheRuleTplNocachehtmlDeliver", [{ field: "content_type", operator: "prefix", values: ["text/html"] }], [{ type: "set_header", name: "Cache-Control", value: "no-store" }]), @@ -382,8 +356,6 @@ window.rustProxyCacheRules = (() => { stagingnoindex: () => [templateDeliver("cacheRuleTplStagingnoindex", [], [{ type: "default_header", name: "X-Robots-Tag", value: "noindex, nofollow" }], false)], frameguard: () => [templateDeliver("cacheRuleTplFrameguard", [], [{ type: "default_header", name: "X-Frame-Options", value: "SAMEORIGIN" }], false)], }; - // Display order is deliberate. Parent-domain cookie cleanup stays a - // distinct template and can be inserted before CDN strip/pass guards. const TEMPLATE_GROUPS = [ { id: "privacy", keys: ["safemethods", "authbypass", "cookiepass", "sessioncookies", "privateroutes", "preview", "checkout", "webhooks", "healthchecks", "graphql", "streaming", "signedurls", "nocachehtml", "privateapi", "privatedownloads"] }, { id: "frameworks", keys: ["wordpress", "woocommerce", "django", "laravel", "authjs", "aspnet", "drupal"] }, @@ -399,9 +371,6 @@ window.rustProxyCacheRules = (() => { function applicableGlobals(vhostId) { return (envelope?.config?.cache?.rules || []).filter(rule => rule.enabled !== false && (!rule.vhosts?.length || rule.vhosts.includes(vhostId))); } - // A request `pass` rule whose only conditions describe cookies (all match) - // or that has a Cookie condition alongside others (any match) is a likely - // Cookie/session guard created before cookie_pass existed. function cookieOnlyPass(rule) { if (rule.stage !== "request" || !rule.actions.some(a => a.type === "pass")) return false; const isCookie = c => !c.negate && (c.field === "cookie" || (c.field === "header" && String(c.name || "").trim().toLowerCase() === "cookie")); @@ -481,9 +450,6 @@ window.rustProxyCacheRules = (() => { const changed = () => { root.dispatchEvent(new Event("input", { bubbles: true })); options.onChange?.(); }; const toolbar = el("div", undefined, "cache-rules-toolbar"); if (scope === "vhost") { - // Both ordinary vhost and Docker assignment editors use this component. - // The shared guide opener is delegated in settings.js, so dynamic editors - // receive the same modal without binding additional event handlers. const helpLinks = el("div", undefined, "cache-rules-vhost-links"); const docs = el("a", t("cacheRulesDocs"), "docs-link"); docs.href = "/docs#doc=docs%2FCACHE.md§ion=cache-rules-vcl-style"; @@ -540,8 +506,6 @@ window.rustProxyCacheRules = (() => { const importResult = el("div", undefined, "cache-rules-import-result"); const importActions = el("div", undefined, "form-actions"); importActions.append(importRun, importApply, importCancel); let pendingImport = null, importGeneration = 0; - // Any edit/close/submit supersedes older in-flight API responses. An old - // parse result must never mutate the editor after the user cancelled it. const resetImportPreview = () => { importGeneration++; pendingImport = null; @@ -653,8 +617,6 @@ window.rustProxyCacheRules = (() => { if (grouped) card.append(el("p", t("cacheRuleFlowPart").replace("{index}", rule.vcl_flow.index + 1).replace("{count}", rule.vcl_flow.count), "fine cache-rules-notice cache-rule-note")); if (scope === "global") for (const note of globalOverrideNotes(rule)) card.append(el("p", note, "fine cache-rules-notice cache-rule-note")); if (cookieOnlyPass(rule)) { - // Controlled migration: an explicit pass is never relaxed automatically. - // The operator may convert a Cookie-session guard after review. const note = el("p", t("cacheRuleCookieGuardHint"), "fine cache-rules-notice cache-rule-note"); const convert = el("button", t("cacheRuleCookieGuardConvert"), "outline"); convert.type = "button"; convert.addEventListener("click", () => { rule.actions = rule.actions.map(a => a.type === "pass" ? { type: "cookie_pass" } : a); render(); changed(); toast(t("cacheRuleCookieGuardConverted")); }); @@ -814,9 +776,6 @@ window.rustProxyCacheRules = (() => { run.disabled = true; result.replaceChildren(el("p", t("cacheRulesTesterRunning"), "fine")); try { const requestHeaders = pairs(headers.value); - // A draft/new vhost has no stored frontend.hosts entry yet. With a - // path-only test use its current editor hostname, not an empty Host, - // so global host conditions are evaluated consistently. if (scope === "vhost" && url.value.trim().startsWith("/") && !requestHeaders.some(([name]) => name.toLowerCase() === "host")) { const host = String(typeof options.testHost === "function" ? options.testHost() || "" : "").trim(); if (host && !host.startsWith("*.")) requestHeaders.push(["Host", host]); @@ -868,8 +827,6 @@ window.rustProxyCacheRules = (() => { } return rule; }); - // The parent-name rule must execute before the independent CDN cookie - // strip / remaining-cookie pass checks; never move or merge CDN rules. const cdnIndex = templateKey === "publiccookies" ? rules.findIndex(rule => /^CDN:/.test(rule.name || "") && rule.conditions.some(c => c.field === "header" && String(c.name || "").toLowerCase() === "cookie") && rule.actions.some(a => a.type === "strip_cookies" || a.type === "pass" || a.type === "cookie_pass")) : -1; @@ -937,8 +894,6 @@ window.rustProxyCacheRules = (() => { const source = importText.value; try { const data = await api("/api/cache/rules/import-vcl", { method: "POST", body: JSON.stringify({ vcl: source }) }); - // The user must opt into a partial/approximated import after seeing - // warnings. Previously incomplete VCL was added before any warning was shown. if (generation !== importGeneration || importText.value !== source || importBox.hidden) return; if (data.warnings?.length) { const list = el("ul", undefined, "cache-rules-warnings"); diff --git a/src/admin/web/css/10-base.css b/src/admin/web/css/10-base.css index feb1e3a..f50caee 100644 --- a/src/admin/web/css/10-base.css +++ b/src/admin/web/css/10-base.css @@ -1139,7 +1139,6 @@ progress::-moz-progress-bar { overflow-wrap: anywhere; } - .pages-errors { margin: 14px 0 6px; } @@ -1635,9 +1634,6 @@ html[data-interface-icons="true"] .network-interface-hidden .quiet>svg.ui-icon { position: relative; } -/* One information affordance for the whole panel:
- with a summary popover, or a .rp-info-icon button that opens a help dialog. - Shape follows the Appearance corner style; colors follow the theme. */ .metric-info>summary, .rp-info-icon { box-sizing: border-box; @@ -2090,7 +2086,6 @@ html[data-interface-icons="true"] :is(button, a, summary)>svg.ui-icon { line-height: 1.45; } - .fastcgi-php-only-local[hidden], #php-fpm-profiles-list .fastcgi-php-only[hidden], #php-fpm-profiles-list .fastcgi-profile-section[hidden] { diff --git a/src/admin/web/css/30-overview.css b/src/admin/web/css/30-overview.css index de3eb72..cdad105 100644 --- a/src/admin/web/css/30-overview.css +++ b/src/admin/web/css/30-overview.css @@ -169,7 +169,6 @@ html[data-theme=cream] :is(.card, .stat, dialog) { gap: 2px; } -/* Value tooltips without X/Y scales: keep the host for the crosshair only. */ .rp-chart-axis-off :is(.rp-chart-axis-y, .rp-chart-axis-x, .rp-chart-axis-series, .rp-chart-crosshair-h, .rp-chart-crosshair-y) { display: none; } @@ -1221,7 +1220,7 @@ html[data-dashboard-density=ultra] #panel-overview .stat-cache-outcomes .cache-m } :is(.stat-chart, .activity-card, .system-card, .function-live-chart) svg:not(.ui-icon), -:is(.traffic-donut, .traffic-bar-chart span) { +.traffic-bar-chart span { filter: var(--chart-svg-filter); } @@ -2051,8 +2050,7 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty border-radius: var(--rp-radius-control) !important; } -/* Corner style coverage for editor/settings surfaces that have no radius of their own. */ -html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(.acl-policy-mode-card, .acl-policy-builder, .acl-policy-preview, .settings-shortcuts, .top-log-menu-items, .listener-active-summary, .listener-active-item, .listener-card, .named-listener-row, .host-chip-editor, .vhost-chart, .vhost-detail-strip, .vhost-live-metric, .vh-www-panel, .vh-enable-control, .lb-simulator, .rt-tester, .hdr-card, .hdr-preview, .hdr-preview-col, .location-header-direction, .vh-header-empty, .docker-service-row, .docker-agent-summary, .lb-equivalent pre, .policy-visual>p.fine, .location-doc-intro, .docker-agent-security, .policy-action, .policy-condition-builder, .hdr-row, .vh-www-domain-pair, .vh-location, .location-conditions, .location-group, .location-preview, .redirect-tester, .redirect-rule-table, .notfound-preview, .notfound-preview iframe, .page-preview-pane, .page-preview-pane iframe, .page-editor, .settings-flow-step, .settings-flow-example pre, .settings-timeline-step, .security-summary-tile, .acl-simulator, .page-kind-chip) { +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(.acl-policy-mode-card, .acl-policy-builder, .acl-policy-preview, .settings-shortcuts, .top-log-menu-items, .listener-active-summary, .listener-active-item, .listener-card, .named-listener-row, .host-chip-editor, .vhost-chart, .vhost-detail-strip, .vhost-live-metric, .vh-www-panel, .vh-enable-control, .lb-simulator, .rt-tester, .hdr-card, .hdr-preview, .hdr-preview-col, .location-header-direction, .vh-header-empty, .docker-service-row, .docker-agent-summary, .lb-equivalent pre, .policy-visual>p.fine, .location-doc-intro, .docker-agent-security, .policy-action, .policy-condition-builder, .hdr-row, .vh-www-domain-pair, .vh-location, .location-conditions, .location-group, .location-preview, .redirect-tester, .redirect-rule-table, .notfound-preview, .notfound-preview iframe, .page-preview-pane, .page-preview-pane iframe, .page-editor, .cert-summary-tile, .certificate-section, .certificate-assign-table, .traffic-capture, .settings-flow-step, .settings-flow-example pre, .settings-timeline-step, .security-summary-tile, .acl-simulator, .page-kind-chip) { border-radius: var(--rp-radius-surface) !important; } @@ -2069,13 +2067,11 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty border-bottom-left-radius: 0; } -/* The sparkline runs edge to edge at the bottom of the chart box. */ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .vhost-chart svg { border-bottom-right-radius: max(0px, calc(var(--rp-radius-surface) - 1px)); border-bottom-left-radius: max(0px, calc(var(--rp-radius-surface) - 1px)); } -/* Filled cells meet the strip corners; clip them to the strip shape. */ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) .vhost-detail-strip { overflow: hidden; } @@ -4104,9 +4100,6 @@ html[data-dashboard-density=ultra] #panel-overview .docker-load-list { background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; } -/* Nested surfaces: a block inside a dialog, card or floating panel uses a - smaller radius than its container, and the dialog body itself is not a - second framed block inside the dialog. */ html[data-corner-style] :is(dialog, .card, .stat, .settings-page, .settings-tabs, .draft-dock, .top-log-menu-items, .metric-info-popover, .backend-column-options) * { --rp-radius-surface: var(--rp-radius-nested, 0px); } diff --git a/src/admin/web/css/40-editors.css b/src/admin/web/css/40-editors.css index 25e00bf..1603697 100644 --- a/src/admin/web/css/40-editors.css +++ b/src/admin/web/css/40-editors.css @@ -94,7 +94,6 @@ margin-top: 6px !important; } - :is(.vh-grid, .field-grid)>:is(.vh-field, label:not([class]), .auto-id-field) { grid-row: span 2; } @@ -368,7 +367,6 @@ border-bottom: 1px solid var(--row-line); } -/* Collapsed Custom Location = one routing-table row. */ .location-summary { display: grid; grid-template-columns: 26px 12px minmax(0, 120px) 120px minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.3fr); @@ -620,8 +618,7 @@ #panel-tls .certificate-operation-heading strong, #panel-tls .renewal-entry-identity strong, .certificate-api-credential-info code, -.certificate-api-credential-info small, -.certificate-bulk-list .check { +.certificate-api-credential-info small { overflow-wrap: anywhere; } @@ -696,11 +693,6 @@ z-index: 2; } -/* Vhost editor: heading and tabs stay on top, only the fields scroll and the - save bar is a plain footer. No sticky positioning inside the scrolled area, - so long Custom Location editors cannot push the bar into the content. */ -/* Tabbed editors: heading, summary and tabs stay on top, only the fields - scroll, and the save bar is the dialog footer. */ :is(#vhost-dialog, #redirect-dialog, #notfound-dialog, #stream-dialog)[open] { display: flex; flex-direction: column; @@ -1239,8 +1231,7 @@ p, font-size: 11px; } -.vh-www-details, -.certificate-bulk-assign { +.vh-www-details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; @@ -1408,7 +1399,6 @@ p, grid-template-columns: repeat(4, minmax(0, 1fr)); } -/* Redirect rule rows reuse the Custom location routing table. */ .redirect-rule-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); } @@ -1704,8 +1694,7 @@ html[data-dashboard-density=ultra] #panel-overview .dashboard-overview-grid>.car align-items: center; } -.acl-policy-step-head, -.certificate-card-head { +.acl-policy-step-head { display: flex; align-items: flex-start; justify-content: space-between; @@ -2478,7 +2467,6 @@ h2+.fine { } } -/* Stream backends: routing-table rows in the editor and the card. */ .stream-backend-toolbar { align-items: end; justify-content: flex-start; @@ -2521,7 +2509,6 @@ h2+.fine { font-size: 11px; } -/* 404 host response choice cards and sandboxed preview. */ .notfound-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 10px; @@ -3018,7 +3005,6 @@ h2+.fine { .hdr-row.is-invalid .hdr-row-hint { color: var(--red); } -/* Error fallback status picker (vhost and Custom Location). */ .vh-error-fallback-statuses { display: grid; gap: 5px; @@ -3070,7 +3056,6 @@ h2+.fine { cursor: default; } -/* Web Service type and FastCGI source choices reuse the Vhost www cards. */ .web-service-kinds { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } @@ -3098,9 +3083,6 @@ h2+.fine { gap: 8px; } -/* Editor dialogs: the title row is followed directly by the tabs. Live - summaries are shown inside the relevant tab (Backend health, Backends); - the identifier is in the title pill and hostnames in the Frontend tab. */ :is(#vhost-form, #redirect-form, #notfound-form, #stream-form)>.vh-live-summary { display: none; } diff --git a/src/admin/web/css/50-settings.css b/src/admin/web/css/50-settings.css index c35516b..510890c 100644 --- a/src/admin/web/css/50-settings.css +++ b/src/admin/web/css/50-settings.css @@ -169,10 +169,6 @@ letter-spacing: .7px; } -.certificate-details-body { - padding: 0 0 8px; -} - .certificate-details .entity-details { margin: 4px 0; } @@ -952,7 +948,6 @@ html:not([data-switch-controls="false"]) .docker-publish-field input.docker-publ gap: 4px; } - .certificate-api-credential-row { display: flex; align-items: center; @@ -1021,14 +1016,6 @@ html:not([data-switch-controls="false"]) .docker-publish-field input.docker-publ border-top: 1px solid var(--line); } -.certificate-bulk-list { - display: grid; - gap: 8px; - max-height: 250px; - overflow-y: auto; - margin: 10px 0; -} - .docker-agent-security-hint, .docker-agent-summary>span, .docker-fingerprint { @@ -3844,7 +3831,6 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, padding: 11px; } } -/* Settings navigation: grouped list, active item marked like other editors. */ .settings-nav-group { padding: 10px 10px 4px; color: var(--muted); @@ -3869,10 +3855,9 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, font-weight: 650; } -/* Sub-tabs inside a settings page and the certificate views use the same - underlined tabs as the Vhost editor. */ #panel-settings .settings-tabs.sub-tabs, -#panel-tls .settings-tabs.certificate-tabs { +#panel-tls .settings-tabs.certificate-tabs, +#panel-traffic .settings-tabs.traffic-tabs { display: flex; flex-direction: row; flex-wrap: wrap; @@ -3886,7 +3871,8 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, } #panel-settings .settings-tabs.sub-tabs button, -#panel-tls .settings-tabs.certificate-tabs button { +#panel-tls .settings-tabs.certificate-tabs button, +#panel-traffic .settings-tabs.traffic-tabs button { width: auto; min-width: 0; margin-bottom: -1px; @@ -3901,13 +3887,15 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, } #panel-settings .settings-tabs.sub-tabs button:hover, -#panel-tls .settings-tabs.certificate-tabs button:hover { +#panel-tls .settings-tabs.certificate-tabs button:hover, +#panel-traffic .settings-tabs.traffic-tabs button:hover { background: var(--panel2); color: var(--text); } #panel-settings .settings-tabs.sub-tabs button[aria-selected=true], -#panel-tls .settings-tabs.certificate-tabs button[aria-selected=true] { +#panel-tls .settings-tabs.certificate-tabs button[aria-selected=true], +#panel-traffic .settings-tabs.traffic-tabs button[aria-selected=true] { border-bottom-color: var(--green); background: transparent; color: var(--text); @@ -3915,7 +3903,7 @@ html[data-dashboard-density=normal] #panel-overview .stat>span, box-shadow: none; } -html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(#panel-settings .settings-tabs.sub-tabs, #panel-tls .settings-tabs.certificate-tabs) { +html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-style=rounded], [data-corner-style=extra]) :is(#panel-settings .settings-tabs.sub-tabs, #panel-tls .settings-tabs.certificate-tabs, #panel-traffic .settings-tabs.traffic-tabs) { border-radius: 0 !important; } @@ -3929,7 +3917,6 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty } } -/* Docker agents in Settings: routing-table rows with sections. */ #docker-agent-settings-list { gap: 9px; } @@ -4055,8 +4042,6 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty } } -/* Help text in agent rows uses the regular help style, not the compact - monospace .entity caption. */ .docker-agent-row small { font: 11px/1.45 inherit; font-family: inherit; @@ -4080,7 +4065,6 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty align-self: start; } -/* Visual request flows (cache, transformation) and the cache freshness timeline. */ .settings-page-intro { margin: 0 0 8px; } @@ -4318,7 +4302,6 @@ button.settings-flow-step:focus-visible { } } -/* Security page: summary tiles, default-decision cards, policy simulator. */ .security-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); @@ -4439,7 +4422,704 @@ button.settings-flow-step:focus-visible { } } -/* Rules & headers: one card with tabs, like HTTP connections. */ .policy-settings-card [data-policy-settings-page]>form { margin-top: 14px; } + +.cert-summary { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 10px; + margin: 0 0 12px; +} + +.cert-summary-tile { + display: grid; + align-content: start; + justify-items: start; + gap: 2px; + min-width: 0; + height: auto; + min-height: 0; + padding: 11px 13px; + border: 1px solid var(--line); + border-left: 3px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel); + color: var(--text); + font: inherit; + text-align: left; + white-space: normal; +} + +button.cert-summary-tile { + cursor: pointer; +} + +button.cert-summary-tile:hover { + border-color: var(--accent); +} + +.cert-summary-tile.is-ok { + border-left-color: var(--green); +} + +.cert-summary-tile.is-warn { + border-left-color: var(--accent); +} + +.cert-summary-tile.is-bad { + border-left-color: var(--red); +} + +.cert-summary-tile b { + font-size: 19px; + font-weight: 600; + overflow-wrap: anywhere; +} + +.cert-summary-tile span { + font-size: 12.5px; + font-weight: 600; +} + +.cert-summary-tile small { + color: var(--muted); + font-size: 11.5px; + overflow-wrap: anywhere; +} + +#panel-tls #acme-runtime-card { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + gap: 2px 12px; + padding: 8px 12px; +} + +#panel-tls #acme-runtime-card[hidden] { + display: none; +} + +#panel-tls #acme-runtime-card .certificate-operation-heading { + display: contents; +} + +#panel-tls #acme-runtime-card .certificate-operation-heading>div { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 2px 10px; +} + +#panel-tls #acme-runtime-card #acme-runtime-message { + font-size: 12.5px; +} + +#panel-tls #acme-runtime-card>.fine { + grid-column: 1; + margin: 0; + font-size: 11.5px; +} + +.certificate-toolbar { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px 12px; + margin: 0 0 10px; +} + +.certificate-toolbar input[type=search] { + flex: 0 1 320px; + min-width: 200px; +} + +.certificate-filters { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.certificate-filters button { + min-height: 28px; + padding: 2px 11px; + border: 1px solid var(--line); + background: transparent; + color: var(--muted); + font-size: 12px; +} + +.certificate-filters button[aria-pressed=true] { + border-color: var(--accent); + color: var(--accent); +} + +#panel-tls .certificate-inventory-card { + padding: 0; + overflow: hidden; +} + +#certificate-list { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: 0; +} + +.certificate-list-head, +.certificate-row-summary { + display: grid; + grid-template-columns: 10px minmax(150px, 1.15fr) minmax(0, 1.3fr) minmax(150px, 1fr) minmax(120px, .9fr) 14px; + align-items: center; + gap: 8px 14px; + padding: 10px 14px; +} + +.certificate-list-head { + color: var(--muted); + font: 10px var(--mono); + letter-spacing: .08em; + text-transform: uppercase; + border-bottom: 1px solid var(--line); +} + +#certificate-list>.certificate-row { + padding: 0; + border: 0; + border-bottom: 1px solid var(--line); + border-radius: 0; + background: transparent; +} + +#certificate-list>.certificate-row[hidden] { + display: none; +} + +.certificate-row-summary { + list-style: none; + cursor: pointer; +} + +.certificate-row-summary::-webkit-details-marker { + display: none; +} + +.certificate-row-summary:hover, +.certificate-row[open]>.certificate-row-summary { + background: var(--panel2); +} + +.certificate-row[open]>.certificate-row-summary { + box-shadow: inset 3px 0 0 var(--accent); +} + +.certificate-row-chevron::before { + content: "▸"; + color: var(--muted); +} + +.certificate-row[open] .certificate-row-chevron::before { + content: "▾"; +} + +.certificate-state-dot { + width: 8px; + height: 8px; + border-radius: 50%; + background: var(--muted); +} + +.certificate-state-dot[data-tone=ok] { + background: var(--green); +} + +.certificate-state-dot[data-tone=warn] { + background: var(--accent); +} + +.certificate-state-dot[data-tone=bad] { + background: var(--red); +} + +.certificate-row .certificate-card-identity { + display: grid; + gap: 4px; + min-width: 0; +} + +.certificate-row .certificate-card-identity .entity-title { + font-weight: 600; + overflow-wrap: anywhere; +} + +.certificate-row .certificate-coverage { + min-width: 0; +} + +.certificate-validity { + display: grid; + gap: 5px; + min-width: 0; + font-size: 12px; +} + +.certificate-validity[data-tone=warn] .certificate-validity-text { + color: var(--accent); +} + +.certificate-validity[data-tone=bad] .certificate-validity-text { + color: var(--red); +} + +.certificate-validity-bar { + display: block; + height: 4px; + background: var(--line); + border-radius: var(--rp-progress-radius, 0px); + overflow: hidden; +} + +.certificate-validity-bar>i { + display: block; + height: 100%; + background: var(--green); +} + +.certificate-validity[data-tone=warn] .certificate-validity-bar>i { + background: var(--accent); +} + +.certificate-validity[data-tone=bad] .certificate-validity-bar>i { + background: var(--red); +} + +.certificate-usage-cell { + display: flex; + align-items: baseline; + flex-wrap: wrap; + gap: 2px 8px; + min-width: 0; +} + +.certificate-row-body { + display: grid; + grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); + gap: 12px; + padding: 4px 14px 14px 38px; + background: var(--panel2); + box-shadow: inset 3px 0 0 var(--accent); +} + +.certificate-row-body>.certificate-usage { + align-self: start; +} + +#panel-tls .certificate-inventory-card .certificate-library-footer { + padding: 12px 14px 14px; +} + +.certificate-row-side { + display: grid; + align-content: start; + gap: 12px; + min-width: 0; +} + +.certificate-section { + display: grid; + align-content: start; + gap: 8px; + min-width: 0; + padding: 11px 13px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel); +} + +.certificate-section h4 { + display: flex; + align-items: center; + gap: 8px; + margin: 0; + font-size: 13px; +} + +.certificate-section p { + margin: 0; +} + +.certificate-usage-group { + display: grid; + gap: 0; +} + +.certificate-usage-group>.small-label { + margin: 4px 0; +} + +.certificate-usage-row { + display: grid; + grid-template-columns: minmax(80px, auto) minmax(0, 1fr) auto auto; + align-items: center; + gap: 4px 10px; + padding: 5px 0; + border-top: 1px solid var(--line); +} + +.certificate-usage-row .mono { + font-family: var(--mono); + font-size: 12px; + overflow-wrap: anywhere; +} + +.certificate-usage-row .pill { + white-space: normal; + overflow-wrap: anywhere; +} + +.certificate-usage-open { + min-height: 24px; + padding: 0 8px; + color: var(--accent); +} + +.certificate-kv { + display: grid; + grid-template-columns: minmax(110px, auto) minmax(0, 1fr); + gap: 5px 12px; + margin: 0; + font-size: 12px; +} + +.certificate-kv dt { + color: var(--muted); +} + +.certificate-kv dd { + margin: 0; + overflow-wrap: anywhere; +} + +.certificate-file-paths { + font-family: var(--mono); + font-size: 11px; + color: var(--muted); + white-space: pre-line; + overflow-wrap: anywhere; +} + +.certificate-row .entity-actions { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +#certificate-list>.empty { + padding: 14px; + margin: 0; +} + +.certificate-assign-dialog { + width: min(1040px, calc(100vw - 32px)); +} + +.certificate-assign-dialog .window-heading { + flex-wrap: wrap; +} + +.certificate-assign-dialog .window-heading>div:first-child { + margin-right: auto; +} + +.certificate-assign-domains { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.certificate-assign-body { + display: grid; + gap: 12px; +} + +.certificate-assign-select { + display: inline-flex; + align-items: center; + gap: 4px; + margin-left: auto; +} + +.certificate-assign-table { + display: grid; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + max-height: min(56vh, 560px); + overflow: auto; +} + +.certificate-assign-row { + display: grid; + grid-template-columns: 24px minmax(110px, .8fr) minmax(0, 1.4fr) minmax(150px, 1fr) minmax(130px, .9fr); + align-items: center; + gap: 4px 12px; + margin: 0; + padding: 8px 12px; + border-top: 1px solid var(--line); + cursor: pointer; +} + +.certificate-assign-row.certificate-assign-head { + border-top: 0; + color: var(--muted); + font: 10px var(--mono); + letter-spacing: .08em; + text-transform: uppercase; + cursor: default; + position: sticky; + top: 0; + background: var(--panel); + z-index: 1; +} + +.certificate-assign-row.is-changed { + background: var(--panel2); +} + +.certificate-assign-row.is-disabled { + cursor: not-allowed; + opacity: .7; +} + +.certificate-assign-row .pill { + justify-self: start; + white-space: normal; +} + +.certificate-assign-row b, +.certificate-assign-row .fine { + overflow-wrap: anywhere; +} + +.certificate-assign-footer { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px 14px; + padding-top: 10px; + border-top: 1px solid var(--line); +} + +.certificate-assign-footer p { + flex: 1 1 320px; + margin: 0; +} + +.certificate-assign-actions { + display: flex; + gap: 6px; +} + +#panel-tls .renewal-entry-identity { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 10px; +} + +#panel-tls .renewal-meta { + grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); + align-items: center; +} + +#panel-tls .renewal-meta-arrow { + color: var(--muted); +} + +#panel-tls .renewal-actions [data-action=renewalForce] { + border-color: color-mix(in srgb, var(--red) 55%, var(--line)); + color: var(--red); +} + +#panel-tls .renewal-actions :is([data-action=renewalDisable], [data-action=renewalEnable]) { + order: 9; + margin-left: auto; +} + +.certificate-source { + display: grid; + gap: 10px; + margin: 0 0 8px; +} + +.certificate-source-modes { + display: flex; + flex-wrap: wrap; + width: max-content; + max-width: 100%; + border: 1px solid var(--line); + border-radius: var(--rp-radius-control, 0px); + overflow: hidden; +} + +.certificate-source-modes button { + min-height: 32px; + padding: 4px 14px; + border: 0; + border-left: 1px solid var(--line); + border-radius: 0 !important; + background: transparent; + color: var(--muted); +} + +.certificate-source-modes button:first-child { + border-left: 0; +} + +.certificate-source-modes button.is-selected { + background: var(--panel2); + color: var(--accent); + box-shadow: inset 0 -2px 0 var(--accent); + font-weight: 600; +} + +.certificate-source-acme { + display: grid; + grid-template-columns: repeat(2, minmax(0, 360px)); + gap: 10px 14px; +} + +.certificate-source-acme[hidden], +.certificate-dns-provider[hidden], +.provider-combo-list[hidden], +#panel-tls .provider-picker-legacy[hidden] { + display: none; +} + +.certificate-source-acme>label, +.certificate-dns-provider { + display: grid; + gap: 4px; + margin: 0; +} + +.provider-combo { + position: relative; +} + +.provider-combo input { + width: 100%; + padding-right: 26px; +} + +.provider-combo::after { + content: "▾"; + position: absolute; + right: 10px; + top: 50%; + transform: translateY(-50%); + color: var(--muted); + pointer-events: none; +} + +.provider-combo-list { + position: absolute; + z-index: 20; + left: 0; + right: 0; + top: calc(100% + 2px); + max-height: 240px; + overflow: auto; + margin: 0; + padding: 4px 0; + list-style: none; + border: 1px solid var(--line); + border-radius: var(--rp-radius-control, 0px); + background: var(--panel); + box-shadow: 0 12px 30px var(--shadow-strong); +} + +.provider-combo-list li { + padding: 6px 10px; + cursor: pointer; +} + +.provider-combo-list li:hover, +.provider-combo-list li.is-active { + background: var(--panel2); +} + +.provider-combo-list li[aria-selected=true] { + box-shadow: inset 3px 0 0 var(--accent); +} + +.provider-combo-list .provider-combo-empty { + color: var(--muted); + cursor: default; +} + +@media (max-width: 600px) { + .cert-summary { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .cert-summary-tile b { + font-size: 16px; + } +} + +@media (max-width: 900px) { + .certificate-list-head { + display: none; + } + + .certificate-row-summary { + grid-template-columns: 10px minmax(0, 1fr) 14px; + } + + .certificate-row-summary>:is(.certificate-coverage, .certificate-validity, .certificate-usage-cell) { + grid-column: 2; + } + + .certificate-row-summary>.certificate-row-chevron { + grid-column: 3; + grid-row: 1; + } + + .certificate-row-body { + grid-template-columns: minmax(0, 1fr); + padding-left: 14px; + } + + .certificate-assign-row { + grid-template-columns: 24px minmax(0, 1fr); + } + + .certificate-assign-row>:nth-child(n+3) { + grid-column: 2; + } + + .certificate-assign-row.certificate-assign-head { + display: none; + } + + .certificate-source-acme { + grid-template-columns: minmax(0, 1fr); + } + + #panel-tls .renewal-meta { + grid-template-columns: minmax(0, 1fr); + } + + #panel-tls .renewal-meta-arrow { + display: none; + } + + .certificate-usage-row { + grid-template-columns: minmax(0, 1fr) auto; + } + + .certificate-usage-row>.fine, + .certificate-usage-row>.pill { + grid-column: 1 / -1; + } +} diff --git a/src/admin/web/css/55-policy.css b/src/admin/web/css/55-policy.css index 4aaa76e..97be139 100644 --- a/src/admin/web/css/55-policy.css +++ b/src/admin/web/css/55-policy.css @@ -1,4 +1,3 @@ -/* Shared global, vhost, Docker and location HTTP policy editor. */ .http-policy-editor, .policy-visual, .policy-rules, @@ -457,8 +456,6 @@ min-width: 520px; } -/* Docker service "HTTP policies" uses the same disclosure row as the other sections. */ - .docker-policy-editor>.http-policy-editor { margin-top: 10px; } diff --git a/src/admin/web/css/60-monitoring.css b/src/admin/web/css/60-monitoring.css index 5cca71a..5cd234c 100644 --- a/src/admin/web/css/60-monitoring.css +++ b/src/admin/web/css/60-monitoring.css @@ -251,40 +251,6 @@ html[data-dashboard-density] #panel-overview .dashboard-overview-grid>.card.pool flex: 0 0 auto; } -.traffic-donut-layout { - display: grid; - grid-template-columns: 148px minmax(0, 1fr); - gap: 14px; - align-items: center; -} - -.traffic-donut { - position: relative; - width: 148px; - aspect-ratio: 1; - border-radius: 50%; - background: var(--chart-surface); - box-shadow: inset 0 0 0 1px var(--line); -} - -.traffic-donut:before { - content: ""; - position: absolute; - inset: 23%; - border-radius: 50%; - background: var(--chart-surface-alt); - box-shadow: 0 0 0 1px var(--line); -} - -.traffic-donut>span { - position: absolute; - inset: 0; - z-index: 1; - display: grid; - place-items: center; - font: 700 16px var(--mono); -} - #panel-traffic .traffic-tabs { margin: 12px 0 14px; } @@ -1559,4 +1525,311 @@ html[data-table-density=ultra] .file-log-inline-detail pre { #panel-cache .cache-pager>button:last-child { border-radius: 0 0 max(0px, calc(var(--rp-radius-control, 0px) - 1px)) 0 !important; } -} \ No newline at end of file +} +#panel-traffic .traffic-toolbar { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px 12px; +} + +#panel-traffic .traffic-toolbar>label { + display: flex; + align-items: center; + gap: 8px; + margin: 0; +} + +#panel-traffic .traffic-toolbar select { + min-width: 240px; +} + +#panel-traffic .traffic-toolbar .cache-toolbar-status { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 12px; + margin-left: auto; +} + +.traffic-recent { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.traffic-recent-chip { + min-height: 24px; + padding: 1px 9px; + border: 1px solid var(--line); + background: transparent; + color: var(--muted); + font: 11px var(--mono); +} + +.traffic-recent-chip[aria-pressed=true] { + border-color: var(--accent); + color: var(--accent); +} + +.traffic-kpis { + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + gap: var(--ui-gap, 10px); + margin: 0 0 10px; +} + +.traffic-kpis .stat { + border-left: 3px solid var(--line); +} + +.traffic-kpis .stat:first-child { + border-left-color: var(--green); +} + +.traffic-kpis .stat.is-warn { + border-left-color: var(--accent); +} + +.traffic-kpis .stat strong { + display: block; + margin: 6px 0 4px; + font: 600 20px var(--mono); + overflow-wrap: anywhere; +} + +.traffic-kpis .stat small { + color: var(--muted); +} + +.traffic-capture { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 10px; + margin: 0 0 12px; + padding: 7px 12px; + border: 1px solid var(--line); + border-radius: var(--rp-radius-surface, 0px); + background: var(--panel); +} + +.traffic-capture .fine { + margin: 0; +} + +.traffic-capture-pills { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px; +} + +.traffic-capture-help { + flex: 1 1 260px; +} + +.traffic-capture-open, +.traffic-more { + min-height: 24px; + padding: 0 8px; + color: var(--accent); +} + +.traffic-distribution { + display: grid; + gap: 12px; +} + +.traffic-stack-grid { + display: grid; + grid-template-columns: 130px minmax(0, 1fr); + align-items: start; + gap: 14px 16px; +} + +.traffic-stack-grid>.fine { + margin: 0; + padding-top: 1px; +} + +.traffic-stack-block { + display: grid; + gap: 6px; + min-width: 0; +} + +.traffic-stack { + display: flex; + height: 12px; + overflow: hidden; + border-radius: var(--rp-progress-radius, 0px); + background: var(--chart-surface); + box-shadow: inset 0 0 0 1px var(--line); +} + +.traffic-stack>i { + display: block; + height: 100%; + min-width: 2px; +} + +.traffic-stack-legend { + display: flex; + flex-wrap: wrap; + gap: 4px 16px; +} + +.traffic-stack-legend li { + justify-content: flex-start; + gap: 6px; +} + +.traffic-stack-legend li>b { + font: 600 11px var(--mono); +} + +.traffic-share { + color: var(--muted); + font: 11px var(--mono); +} + +.traffic-stack-list { + display: grid; + margin-top: 8px; +} + +.traffic-stack-list li { + display: grid; + grid-template-columns: minmax(0, 1fr) auto 52px; + gap: 8px; +} + +.traffic-stack-list .traffic-share { + text-align: right; +} + +.traffic-chart-grid.traffic-two { + grid-template-columns: repeat(2, minmax(0, 1fr)); +} + +.traffic-chart-grid.traffic-three { + grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); +} + +.traffic-chart-grid.traffic-three>.traffic-wide-chart { + grid-column: auto; +} + +.traffic-card-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; +} + +#panel-traffic .traffic-bar-chart { + display: grid; + gap: 2px; +} + +#panel-traffic .traffic-bar-row { + grid-template-columns: minmax(0, 1fr) auto 52px; + gap: 2px 10px; + padding: 3px 0; +} + +#panel-traffic .traffic-bar-row>.traffic-bar-track { + grid-column: 1 / -1; + height: 4px; + box-shadow: none; +} + +#panel-traffic .traffic-bar-row.is-other .traffic-bar-label { + color: var(--muted); + font-style: italic; +} + +#panel-traffic .traffic-bar-row.is-other .traffic-bar-fill { + background: var(--muted); + opacity: .5; +} + +#panel-traffic .traffic-bar-row .traffic-share { + text-align: right; +} + +#panel-traffic .traffic-bar-label { + justify-self: start; + max-width: 100%; + padding: 0; + border: 0; + background: transparent; + color: var(--text); + text-align: left; + min-height: 0; + height: auto; +} + +#panel-traffic .traffic-bar-label:hover { + color: var(--accent); +} + +#panel-traffic .empty .quiet { + min-height: 24px; + padding: 0 6px; + color: var(--accent); +} + +@media (max-width: 1100px) { + .traffic-kpis { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + + .traffic-chart-grid.traffic-three { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (max-width: 720px) { + .traffic-kpis { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .traffic-stack-grid, + .traffic-chart-grid.traffic-two, + .traffic-chart-grid.traffic-three { + grid-template-columns: minmax(0, 1fr); + } + + #panel-traffic .traffic-toolbar .cache-toolbar-status { + margin-left: 0; + } + + #panel-traffic .traffic-toolbar select { + min-width: 0; + width: 100%; + } + + #panel-traffic .traffic-bar-row { + grid-template-columns: minmax(0, 1fr) auto 46px; + } +} + +#panel-traffic .traffic-chart-card h3.subheading, +#panel-traffic .traffic-distribution h3.subheading { + margin: 0 0 10px; + font-size: 14px; + font-weight: 650; + letter-spacing: 0; + text-transform: none; + color: var(--text); +} + +#panel-traffic .traffic-card-head h3.subheading { + margin: 0; +} + +#panel-traffic .traffic-card-head { + margin: 0 0 10px; +} diff --git a/src/admin/web/css/70-responsive.css b/src/admin/web/css/70-responsive.css index 941003d..8e2dfe4 100644 --- a/src/admin/web/css/70-responsive.css +++ b/src/admin/web/css/70-responsive.css @@ -395,14 +395,6 @@ grid-template-columns: 1fr; } - .traffic-donut-layout { - grid-template-columns: 120px minmax(0, 1fr); - } - - .traffic-donut { - width: 120px; - } - .lb-sim-inputs { grid-template-columns: 1fr; } diff --git a/src/admin/web/docker.js b/src/admin/web/docker.js index 9c1884e..c8202b6 100644 --- a/src/admin/web/docker.js +++ b/src/admin/web/docker.js @@ -503,8 +503,6 @@ } catch (error) { showBubble(`${t("dockerTestFailed")}: ${error.message}`, "error"); } finally { testButton.disabled = false; } }); - // Collapsed: one row (state, name/ID, endpoint, transport security, status, Enabled). - // Expanded: provisioning, diagnostics and four sections holding every field. const section = (number, key, cls) => { const box = el("section", undefined, `location-card docker-agent-section ${cls}`), heading = el("h4", undefined, "location-card-title"), grid = el("div", undefined, "field-grid docker-agent-grid"); heading.append(el("span", number, "location-step"), el("span", t(key))); box.append(heading, grid); return [box, grid]; }; const [connectionBox, connectionGrid] = section("1", "dockerAgentSectionConnection", "docker-agent-connection"); const [authBox, authGrid] = section("2", "dockerAgentSectionAuth", "docker-agent-auth"); @@ -607,8 +605,6 @@ control.disabled = sections.length === 0; control.dataset.i18n = key; control.textContent = t(key); control.setAttribute("aria-expanded", String(allOpen)); } - // Only statistics sections near the viewport are redrawn on live updates; - // a section scrolled into view is refreshed right away. let metricsFrame = 0; const metricsObserver = typeof IntersectionObserver === "function" ? new IntersectionObserver(entries => { let revealed = false; @@ -665,8 +661,6 @@ history.snapshot = value; history.metrics = value; metricHistory.set(route.pool_id, history); } } - // History is sampled always; the DOM is touched only for open sections of - // the visible panel (a section is refreshed when it is opened). if (typeof currentPanel !== "undefined" && currentPanel !== "docker-vhosts") return; for (const section of document.querySelectorAll("#docker-discovery-list .docker-service-metrics")) { if (!section.open || section.dockerInView === false) continue; @@ -912,7 +906,6 @@ details.addEventListener("change", sync); sync(); return details; } - // HTTP policies: an ordinary Docker service section, like Security or Proxy timeouts. function policyEditor(assignment, row) { const details = el("details", undefined, "docker-policy-editor"), summary = el("summary"), state = el("small", "", "fine"); summary.append(el("span", t("policyTitle")), state); details.append(summary); @@ -1046,10 +1039,6 @@ const headActions = el("div", undefined, "docker-service-head-actions"); headActions.append(runtimeSummary(runtime, assignment, stale), quickActions, visibility); top.append(publishLabel, meta, headActions); row.append(top); const editor = el("details", undefined, "docker-service-editor"), editorSummary = el("summary"), editorTitle = el("span", t("dockerConfigureService")), editorHint = el("small", "", "fine docker-config-hint"); editorSummary.append(editorTitle, editorHint); editor.append(editorSummary); - // The editor is the largest part of a service card (hundreds of elements - // each); build it on first open, or right before saving, instead of for - // every service on every render. Until then the summary, search and quick - // actions use the stored assignment. const hintFor = ({ hostname, domain, targetLabel, scheme, h2, h3, aliasCount }) => `${expandedHost(hostname || technical, domain) || hostname || technical} → ${String(scheme || "http").toUpperCase()} · ${targetLabel} · H1${h2 ? "/H2" : ""}${h3 ? "/H3" : ""}${aliasCount ? ` · +${aliasCount} ${t("dockerAliasesShort")}` : ""}`; const initialHost = assignment?.hostname || service?.technical_name || ""; let host = null, apply = null, editorBuilt = false; diff --git a/src/admin/web/host404.js b/src/admin/web/host404.js index a11c48a..6959ce3 100644 --- a/src/admin/web/host404.js +++ b/src/admin/web/host404.js @@ -52,7 +52,6 @@ const mode = group === "cloudflare" ? (CLOUDFLARE_KINDS.includes($("notfound-variant").value) ? $("notfound-variant").value : "cloudflare") : group; $("notfound-mode").value = mode; syncMode(); } - // Preview of the selected page through the sandboxed /api/pages/preview. let previewTimer = null; function previewUrl(mode = $("notfound-mode").value, status = $("notfound-status").value, host = editing) { const params = new URLSearchParams({ kind: mode, status: String(status || 404) }); @@ -163,6 +162,6 @@ form.addEventListener("submit", async event => { event.preventDefault(); if (!envelope || busy) return; const invalid = [...form.elements].find(input => input.willValidate && !input.checkValidity()); if (invalid) { invalid.reportValidity(); return; } if (revision !== envelope.revision) { toast(t("stale"), true); return; } try { const item = collect(), next = structuredClone(envelope.config.not_found_hosts || []); if (!editing && next.some(value => value.id === item.id)) throw new Error(t("notfoundDuplicate")); const index = next.findIndex(value => value.id === editing); if (index < 0) next.push(item); else next[index] = item; if (await saveSection("not-found-hosts", next)) { dirty = false; editing = item.id; dialog.close(); render(); } } catch (error) { toast(error.message, true); } }); $("notfound-new").addEventListener("click", () => { window.rustProxyDrafts.prepare(); load(); }); $("notfound-search").addEventListener("input", render); $("notfound-sort")?.addEventListener("change", event => { listPrefs.sort = event.target.value; void saveListPrefs(); render(); }); $("notfound-sort-direction")?.addEventListener("click", () => { listPrefs.descending = !listPrefs.descending; syncSortDirection(); void saveListPrefs(); render(); }); $("notfound-close").addEventListener("click", closeEditor); $("notfound-reset").addEventListener("click", async () => { if (await allowDiscard()) load(editing ? structuredClone((envelope?.config.not_found_hosts || []).find(item => item.id === editing) || defaults()) : defaults()); }); dialog.addEventListener("cancel", event => { event.preventDefault(); closeEditor(); }); window.rustProxyDrafts.register("notfound", { labelKey: "notfound", isOpen: () => dialog.open, isDirty: () => dirty, suspend: suspendDraft, restore: restoreDraft, close: () => { dirty = false; if (dialog.open) dialog.close(); } }); - window.rustProxyNotFound = { render, applyPreferences, reset() { dialog.close(); editing = null; revision = null; dirty = false; listPrefs = { sort: "id", descending: false }; list.replaceChildren(); $("notfound-search").value = ""; if ($("notfound-sort")) $("notfound-sort").value = listPrefs.sort; syncSortDirection(); } }; + window.rustProxyNotFound = { render, edit(id) { const item = (envelope?.config.not_found_hosts || []).find(entry => entry.id === id); if (!item) return false; window.rustProxyDrafts.prepare(); load(structuredClone(item)); return true; }, applyPreferences, reset() { dialog.close(); editing = null; revision = null; dirty = false; listPrefs = { sort: "id", descending: false }; list.replaceChildren(); $("notfound-search").value = ""; if ($("notfound-sort")) $("notfound-sort").value = listPrefs.sort; syncSortDirection(); } }; if (envelope) render(); })(); diff --git a/src/admin/web/index.html b/src/admin/web/index.html index f5351da..80b33c8 100644 --- a/src/admin/web/index.html +++ b/src/admin/web/index.html @@ -954,7 +954,8 @@ +