0.38.3
This commit is contained in:
1 parent
8bdec5c757
commit
9e81cce271
23 files changed
+670
-19
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
# RustProxy source and documentation maintenance
|
# RustProxy source and documentation maintenance
|
||||||
|
|
||||||
Current source version: **0.38.2**. The Cargo package and binary are named `rust-proxy`.
|
Current source version: **0.38.3**. The Cargo package and binary are named `rust-proxy`.
|
||||||
|
|
||||||
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
|
Before editing, read [README.md](README.md), the relevant [documentation guide](docs/README.md) and the actual code and tests. Historical release experiments are not current specifications. Use the bundled `src/admin/openapi.json` for API routes and payloads; the source implementation is authoritative for runtime behavior.
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
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.
|
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.38.3 — Docker vhosts ready for production
|
||||||
|
|
||||||
|
- **Security and access for Docker apps:** the per-service editor has a new **Security and access** section with HTTP method policy, per-client IP rate limit, country access, security headers (HSTS, nosniff, X-Frame-Options, Referrer-Policy) and the verified Cloudflare client IP, the same engine as ordinary vhosts. Unused options are not stored, existing assignments are unchanged.
|
||||||
|
- **HTTP Basic Auth for Docker apps:** **Require login (HTTP Basic Auth)** protects a Docker app with its own users (realm, require HTTPS, credential forwarding, up to 64 users), like on ordinary vhosts; passwords are stored only as Argon2id hashes.
|
||||||
|
- **Diagnostic headers for Docker apps:** Server-Timing, selected backend and backend time can be switched on per Docker app.
|
||||||
|
- **Published apps:** a toolbar button in **Docker vhosts** opens one searchable list of all published Docker apps with address, aliases, container, agent, backend and status; **Configure** jumps to the service editor.
|
||||||
|
- **Collapse services per agent:** each agent heading has **Collapse services**; the state is remembered in the browser and search still finds collapsed services.
|
||||||
|
- **Fix:** the HTTP method and country pickers inside the vhost editor had no gap between the search field and the first option.
|
||||||
|
|
||||||
## 0.38.2 — Server-Timing, STALE and REVALIDATED
|
## 0.38.2 — Server-Timing, STALE and REVALIDATED
|
||||||
|
|
||||||
- **Server-Timing is appended, not replaced:** on a MISS or BYPASS the origin's own `Server-Timing` metrics (`db;dur=…`, `app;dur=…`) now reach the client, with RustProxy's field after them; before, RustProxy removed them. Several RustProxy hops each append their own field. On a response served from the cache the stored origin metrics are removed, also when timing headers are off, because they described the request that filled the cache.
|
- **Server-Timing is appended, not replaced:** on a MISS or BYPASS the origin's own `Server-Timing` metrics (`db;dur=…`, `app;dur=…`) now reach the client, with RustProxy's field after them; before, RustProxy removed them. Several RustProxy hops each append their own field. On a response served from the cache the stored origin metrics are removed, also when timing headers are off, because they described the request that filled the cache.
|
||||||
|
|||||||
Generated
+1
-1
@@ -1943,7 +1943,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-proxy"
|
name = "rust-proxy"
|
||||||
version = "0.38.2"
|
version = "0.38.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rust-proxy"
|
name = "rust-proxy"
|
||||||
version = "0.38.2"
|
version = "0.38.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.99.1"
|
rust-version = "1.99.1"
|
||||||
description = "RustProxy - independent reverse proxy with local administration"
|
description = "RustProxy - independent reverse proxy with local administration"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
var version = "0.38.2" // overridden by the package builder using -ldflags -X main.version
|
var version = "0.38.3" // overridden by the package builder using -ldflags -X main.version
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
Listen string
|
Listen string
|
||||||
|
|||||||
@@ -143,8 +143,24 @@ In **Docker vhosts**, select the service and set:
|
|||||||
| **Frontend protocols** | HTTP/1.1 is always available. Enable/disable HTTP/2 and HTTP/3 independently per Docker vhost (both enabled by default). H2/H3 require corresponding frontend listener support; switching them does not change the selected HTTP/HTTPS backend scheme. H3 disabled also removes its advertisement. |
|
| **Frontend protocols** | HTTP/1.1 is always available. Enable/disable HTTP/2 and HTTP/3 independently per Docker vhost (both enabled by default). H2/H3 require corresponding frontend listener support; switching them does not change the selected HTTP/HTTPS backend scheme. H3 disabled also removes its advertisement. |
|
||||||
| **Force HTTPS / WebSockets** | Enable only when needed and when the right frontend listeners exist. |
|
| **Force HTTPS / WebSockets** | Enable only when needed and when the right frontend listeners exist. |
|
||||||
| **Cache / compression / transforms** | Optional; obey the global limits and privacy policy of the application. With **Cache** enabled, **Cache for this vhost** sets a default TTL (empty = global default) and the same cache rules editor as an ordinary vhost (templates, VCL import/preview, tester, *Ignore global cache rules*); see [Cache rules](CACHE.md#cache-rules-vcl-style). Stored as `cache_default_ttl_seconds`, `cache_rules` and `cache_ignore_global_rules` on the assignment.
|
| **Cache / compression / transforms** | Optional; obey the global limits and privacy policy of the application. With **Cache** enabled, **Cache for this vhost** sets a default TTL (empty = global default) and the same cache rules editor as an ordinary vhost (templates, VCL import/preview, tester, *Ignore global cache rules*); see [Cache rules](CACHE.md#cache-rules-vcl-style). Stored as `cache_default_ttl_seconds`, `cache_rules` and `cache_ignore_global_rules` on the assignment.
|
||||||
|
| **Security and access** | Everything an internet-facing app usually needs, without creating an ordinary vhost: **HTTP Basic Auth** (see below), **HTTP methods** (allow only / block listed, the same method picker as vhosts), **per-client IP rate limit** (requests per window and burst; exceeded requests get `429`), **country access** (block or allow only listed countries via GeoIP; country rules of ACL profiles also apply), **security headers** (HSTS with max-age and includeSubDomains, `X-Content-Type-Options: nosniff`, `X-Frame-Options`, `Referrer-Policy`) and **Use verified Cloudflare client IP** when the app is behind Cloudflare. The summary line of the section shows what is active. Stored as `method_policy`, `rate_limit`, `security_headers` and `cloudflare_client_ip`; unused options are not stored. Docker apps have no login of their own; to require one, publish the app through an ordinary vhost with HTTP Basic Auth, forward auth or OIDC. |
|
||||||
|
| **Diagnostic headers** | `Server-Timing`, the selected backend (`X-Rust-Proxy-Backend`) and the backend time, for testing; keep them off in production. Stored as `timing_headers`, `backend_header`, `backend_timing_header`. |
|
||||||
| **Health / ACL / timeouts** | **Access control** shows the agent default ACL profiles pre-selected (*Agent default in use: …*). Unchecking or changing them overrides the default for this service only; leaving them as they are keeps following the agent default. **Public vhost (no agent default ACL)** publishes the service without the agent default profiles (`inherit_acl_profiles: false`) and disables the per-app ACL; global block/allow rules still apply. Up to eight reusable ACL profiles per app; selected profiles appear as removable badges and the summary line shows the effective state. Optional inline ACL remains independently enforced. Explicit denies and country blocks beat merged allows. Test allowed and blocked clients. |
|
| **Health / ACL / timeouts** | **Access control** shows the agent default ACL profiles pre-selected (*Agent default in use: …*). Unchecking or changing them overrides the default for this service only; leaving them as they are keeps following the agent default. **Public vhost (no agent default ACL)** publishes the service without the agent default profiles (`inherit_acl_profiles: false`) and disables the per-app ACL; global block/allow rules still apply. Up to eight reusable ACL profiles per app; selected profiles appear as removable badges and the summary line shows the effective state. Optional inline ACL remains independently enforced. Explicit denies and country blocks beat merged allows. Test allowed and blocked clients. |
|
||||||
|
|
||||||
|
### HTTP Basic Auth for Docker apps
|
||||||
|
|
||||||
|
**Require login (HTTP Basic Auth)** in **Security and access** protects one Docker app with its own users, exactly like Basic Auth on an ordinary vhost: realm, *Require HTTPS for Basic Auth*, *Forward verified Authorization to the backend* and up to 64 users. Passwords are hashed with Argon2id when you press **Apply changes**; only the hashes are stored (`basic_auth` on the assignment), an empty password field keeps the stored one. Wrong passwords are rate-limited per client like on vhosts.
|
||||||
|
|
||||||
|
- Over plain HTTP (no TLS listener) switch off *Require HTTPS for Basic Auth*, otherwise every login is refused.
|
||||||
|
- Switching the login off keeps the users, so it can be switched on again without new passwords.
|
||||||
|
- Forward auth (Authelia, authentik, Tinyauth) and OIDC are not available for Docker apps: OIDC needs a redirect URL registered per hostname at the identity provider. Publish such an app as an ordinary vhost when it needs them.
|
||||||
|
|
||||||
|
### Published apps and long lists
|
||||||
|
|
||||||
|
**Published apps** in the toolbar opens one list of every published Docker app on all agents: address with aliases (the address opens the app), container and image, agent, backend address and live status (up, down, checking, missing). The search filters by address, container, image or agent; **Configure** closes the list, expands the right agent and Compose group, opens the service editor and scrolls to it.
|
||||||
|
|
||||||
|
**Collapse services** in each agent heading hides that agent's service list and leaves a one-line summary (*N services hidden, M published*). The choice is remembered in the browser. Searching shows the matching services of collapsed agents too, and **Configure** in Published apps expands the agent.
|
||||||
|
|
||||||
To deliberately assign a domain not covered by any of the agent's **selected certificates**, enable **Accept certificate/domain mismatch** immediately below **Backend host IP** in the per-service editor and confirm the risk. This records `allow_certificate_mismatch: true` on that publication only. Without consent, the server rejects the incompatible mapping. The client browser may still reject the TLS handshake; a matching SAN certificate is strongly preferred. The agent's own outbound TLS fingerprint validation is unaffected.
|
To deliberately assign a domain not covered by any of the agent's **selected certificates**, enable **Accept certificate/domain mismatch** immediately below **Backend host IP** in the per-service editor and confirm the risk. This records `allow_certificate_mismatch: true` on that publication only. Without consent, the server rejects the incompatible mapping. The client browser may still reject the TLS handshake; a matching SAN certificate is strongly preferred. The agent's own outbound TLS fingerprint validation is unaffected.
|
||||||
|
|
||||||
Use the per-service **Publish** on/off switch to expose or remove the generated Vhost; toggling it saves immediately. Test the resulting hostname with **Open app**. Edits to an already published service use its own **Apply changes** action; switching Publish off removes the proxy publication but does not stop the Docker container. Hidden rows in the page are only a browser view preference, not a security policy.
|
Use the per-service **Publish** on/off switch to expose or remove the generated Vhost; toggling it saves immediately. Test the resulting hostname with **Open app**. Edits to an already published service use its own **Apply changes** action; switching Publish off removes the proxy publication but does not stop the Docker container. Hidden rows in the page are only a browser view preference, not a security policy.
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ RustProxy is a single service that combines a reverse proxy, a static/PHP web se
|
|||||||
- Headless mode without the panel: configuration from a read-only JSON file, catch-all `*` host, reload by `SIGHUP`/`systemctl reload` and a `/healthz` endpoint ([Headless mode](HEADLESS.md)).
|
- Headless mode without the panel: configuration from a read-only JSON file, catch-all `*` host, reload by `SIGHUP`/`systemctl reload` and a `/healthz` endpoint ([Headless mode](HEADLESS.md)).
|
||||||
- Revision history with diff and one-click restore.
|
- Revision history with diff and one-click restore.
|
||||||
- Encrypted full backups and validated offline restore; encrypted Secret Store for credentials.
|
- Encrypted full backups and validated offline restore; encrypted Secret Store for credentials.
|
||||||
- Docker and Podman discovery through a separate agent: publish containers as Vhosts with one switch, one-time agent provisioning codes, publishing from container labels, multiple domains and certificate lists per agent, host and container diagnostics with history, Docker alerts, Prometheus host metrics and optional Docker Overview cards; the Grafana dashboard covers several RustProxy servers.
|
- Docker and Podman discovery through a separate agent: publish containers as Vhosts with one switch, one-time agent provisioning codes, publishing from container labels, multiple domains and certificate lists per agent, per-app HTTP Basic Auth, method policy, rate limit, country access, security and diagnostic headers, a searchable list of published apps, host and container diagnostics with history, Docker alerts, Prometheus host metrics and optional Docker Overview cards; the Grafana dashboard covers several RustProxy servers.
|
||||||
- Nginx Proxy Manager import with a dry-run plan.
|
- Nginx Proxy Manager import with a dry-run plan.
|
||||||
- Managed install/update scripts with rollback, DEB/RPM packages, Docker image and an OPNsense plugin.
|
- Managed install/update scripts with rollback, DEB/RPM packages, Docker image and an OPNsense plugin.
|
||||||
- Panel in English and Polish, light and dark themes, adjustable density and corner style, plus a default-on stable dialog position option for tabbed editors.
|
- Panel in English and Polish, light and dark themes, adjustable density and corner style, plus a default-on stable dialog position option for tabbed editors.
|
||||||
|
|||||||
+1
-1
@@ -196,7 +196,7 @@ In a container, mount the file read-only (RustProxy never writes it) and keep `/
|
|||||||
`GET /healthz` on `--health-listen` answers `200` while every vhost with backends has at least one healthy backend and `503` otherwise:
|
`GET /healthz` on `--health-listen` answers `200` while every vhost with backends has at least one healthy backend and `503` otherwise:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{"status":"ok","mode":"headless","version":"0.38.2","revision":4,"uptime_seconds":120,
|
{"status":"ok","mode":"headless","version":"0.38.3","revision":4,"uptime_seconds":120,
|
||||||
"last_reload":{"ok":true,"at_unix":1794743660,"error":null},
|
"last_reload":{"ok":true,"at_unix":1794743660,"error":null},
|
||||||
"vhosts_without_healthy_backends":[],
|
"vhosts_without_healthy_backends":[],
|
||||||
"pools":[{"vhost":"app","healthy":3,"backends":3}]}
|
"pools":[{"vhost":"app","healthy":3,"backends":3}]}
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ ENV_FILE=integrations/routeros-oci-build/.env \
|
|||||||
bash integrations/routeros-oci-build/build-routeros-oci.sh push
|
bash integrations/routeros-oci-build/build-routeros-oci.sh push
|
||||||
```
|
```
|
||||||
|
|
||||||
For example, with RustProxy version `0.38.2` and the defaults this publishes:
|
For example, with RustProxy version `0.38.3` and the defaults this publishes:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
oci.example.net/network/rustproxy:0.38.2
|
oci.example.net/network/rustproxy:0.38.3
|
||||||
oci.example.net/network/rustproxy:latest
|
oci.example.net/network/rustproxy:latest
|
||||||
oci.example.net/network/rustproxy:routeros
|
oci.example.net/network/rustproxy:routeros
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1572,6 +1572,36 @@
|
|||||||
"dockerVhosts": "Docker vhosts",
|
"dockerVhosts": "Docker vhosts",
|
||||||
"dockerVhostsIntro": "Published TCP ports discovered by configured Docker/Podman agents. Map each service to a name under one of the agent domains (its master domain), add aliases, choose the Docker host IP, and inspect or tune live backend health for every published service.",
|
"dockerVhostsIntro": "Published TCP ports discovered by configured Docker/Podman agents. Map each service to a name under one of the agent domains (its master domain), add aliases, choose the Docker host IP, and inspect or tune live backend health for every published service.",
|
||||||
"dockerDiscovery": "DOCKER DISCOVERY",
|
"dockerDiscovery": "DOCKER DISCOVERY",
|
||||||
|
"dockerPublishedOpen": "Published apps",
|
||||||
|
"dockerPublishedTitle": "Published Docker apps",
|
||||||
|
"dockerPublishedSearch": "Search address, container, image or agent",
|
||||||
|
"dockerPublishedAddress": "Address",
|
||||||
|
"dockerPublishedService": "Container",
|
||||||
|
"dockerPublishedAgent": "Agent",
|
||||||
|
"dockerPublishedBackend": "Backend",
|
||||||
|
"dockerPublishedUp": "up",
|
||||||
|
"dockerPublishedDown": "down",
|
||||||
|
"dockerPublishedChecking": "checking",
|
||||||
|
"dockerPublishedConfigure": "Configure",
|
||||||
|
"dockerPublishedOpenNew": "Opens the app in a new tab",
|
||||||
|
"dockerPublishedEmpty": "No Docker app is published yet.",
|
||||||
|
"dockerPublishedNoMatches": "No published app matches the search.",
|
||||||
|
"dockerAgentCollapseServices": "Collapse services",
|
||||||
|
"dockerAgentExpandServices": "Expand services",
|
||||||
|
"dockerAgentServicesCollapsed": "{count} services hidden ({published} published). Search or Published apps still finds them.",
|
||||||
|
"dockerBasicSection": "HTTP Basic Auth",
|
||||||
|
"dockerBasicEnabled": "Require login (HTTP Basic Auth)",
|
||||||
|
"dockerBasicHelp": "Passwords are hashed with Argon2id when you press Apply changes; only the hashes are stored. Over plain HTTP switch off \"Require HTTPS for Basic Auth\", otherwise the login is refused. Credentials reach the container only with forwarding switched on.",
|
||||||
|
"dockerSecurity": "Security and access",
|
||||||
|
"dockerSecurityNone": "No Basic Auth, method, rate, country or header policy",
|
||||||
|
"dockerMethodsShort": "methods",
|
||||||
|
"dockerCountriesShort": "countries",
|
||||||
|
"dockerHeadersShort": "security headers",
|
||||||
|
"dockerCountryHelp": "Uses the GeoIP database. Country rules from ACL profiles also apply.",
|
||||||
|
"dockerSecurityHeaders": "Security headers",
|
||||||
|
"dockerClientIp": "Client IP",
|
||||||
|
"dockerDiagnostics": "Diagnostic headers",
|
||||||
|
"dockerDiagnosticsHelp": "Server-Timing, selected backend and backend time in responses; for testing, off in production",
|
||||||
"dockerRefresh": "Refresh agents",
|
"dockerRefresh": "Refresh agents",
|
||||||
"dockerAgentsSettings": "Docker agents settings",
|
"dockerAgentsSettings": "Docker agents settings",
|
||||||
"dockerAgents": "Docker agents",
|
"dockerAgents": "Docker agents",
|
||||||
|
|||||||
@@ -1572,6 +1572,36 @@
|
|||||||
"dockerVhosts": "Docker vhosty",
|
"dockerVhosts": "Docker vhosty",
|
||||||
"dockerVhostsIntro": "Opublikowane porty TCP wykryte przez skonfigurowanych agentów Docker/Podman. Przypisz każdej usłudze nazwę w jednej z domen agenta (jej domenie master), dodaj aliasy, wybierz IP hosta Docker oraz sprawdzaj i dostrajaj stan backendu każdej opublikowanej usługi.",
|
"dockerVhostsIntro": "Opublikowane porty TCP wykryte przez skonfigurowanych agentów Docker/Podman. Przypisz każdej usłudze nazwę w jednej z domen agenta (jej domenie master), dodaj aliasy, wybierz IP hosta Docker oraz sprawdzaj i dostrajaj stan backendu każdej opublikowanej usługi.",
|
||||||
"dockerDiscovery": "WYKRYWANIE DOCKERA",
|
"dockerDiscovery": "WYKRYWANIE DOCKERA",
|
||||||
|
"dockerPublishedOpen": "Opublikowane aplikacje",
|
||||||
|
"dockerPublishedTitle": "Opublikowane aplikacje Docker",
|
||||||
|
"dockerPublishedSearch": "Szukaj adresu, kontenera, obrazu lub agenta",
|
||||||
|
"dockerPublishedAddress": "Adres",
|
||||||
|
"dockerPublishedService": "Kontener",
|
||||||
|
"dockerPublishedAgent": "Agent",
|
||||||
|
"dockerPublishedBackend": "Backend",
|
||||||
|
"dockerPublishedUp": "działa",
|
||||||
|
"dockerPublishedDown": "nie działa",
|
||||||
|
"dockerPublishedChecking": "sprawdzanie",
|
||||||
|
"dockerPublishedConfigure": "Konfiguruj",
|
||||||
|
"dockerPublishedOpenNew": "Otwiera aplikację w nowej karcie",
|
||||||
|
"dockerPublishedEmpty": "Nie opublikowano jeszcze żadnej aplikacji Docker.",
|
||||||
|
"dockerPublishedNoMatches": "Żadna opublikowana aplikacja nie pasuje do wyszukiwania.",
|
||||||
|
"dockerAgentCollapseServices": "Zwiń usługi",
|
||||||
|
"dockerAgentExpandServices": "Rozwiń usługi",
|
||||||
|
"dockerAgentServicesCollapsed": "Ukryto {count} usług ({published} opublikowanych). Wyszukiwanie i Opublikowane aplikacje nadal je znajdują.",
|
||||||
|
"dockerBasicSection": "HTTP Basic Auth",
|
||||||
|
"dockerBasicEnabled": "Wymagaj logowania (HTTP Basic Auth)",
|
||||||
|
"dockerBasicHelp": "Hasła są haszowane Argon2id przy Zastosuj zmiany; zapisywane są tylko skróty. Po zwykłym HTTP wyłącz „Wymagaj HTTPS dla Basic Auth”, inaczej logowanie zostanie odrzucone. Dane logowania trafiają do kontenera tylko z włączonym przekazywaniem.",
|
||||||
|
"dockerSecurity": "Bezpieczeństwo i dostęp",
|
||||||
|
"dockerSecurityNone": "Bez Basic Auth, limitów metod, zapytań, krajów i nagłówków",
|
||||||
|
"dockerMethodsShort": "metody",
|
||||||
|
"dockerCountriesShort": "kraje",
|
||||||
|
"dockerHeadersShort": "nagłówki bezpieczeństwa",
|
||||||
|
"dockerCountryHelp": "Korzysta z bazy GeoIP. Reguły krajów z profili ACL działają niezależnie.",
|
||||||
|
"dockerSecurityHeaders": "Nagłówki bezpieczeństwa",
|
||||||
|
"dockerClientIp": "Adres IP klienta",
|
||||||
|
"dockerDiagnostics": "Nagłówki diagnostyczne",
|
||||||
|
"dockerDiagnosticsHelp": "Server-Timing, wybrany backend i czas backendu w odpowiedziach; do testów, na produkcji wyłączone",
|
||||||
"dockerRefresh": "Odśwież agentów",
|
"dockerRefresh": "Odśwież agentów",
|
||||||
"dockerAgentsSettings": "Ustawienia agentów Dockera",
|
"dockerAgentsSettings": "Ustawienia agentów Dockera",
|
||||||
"dockerAgents": "Agenty Dockera",
|
"dockerAgents": "Agenty Dockera",
|
||||||
|
|||||||
+10
-2
@@ -2,7 +2,7 @@
|
|||||||
"openapi": "3.0.3",
|
"openapi": "3.0.3",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "RustProxy Administration API",
|
"title": "RustProxy Administration API",
|
||||||
"version": "0.38.2",
|
"version": "0.38.3",
|
||||||
"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."
|
"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": [
|
"servers": [
|
||||||
@@ -3460,7 +3460,15 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description": "Explicit, persistent administrator opt-in: allow assigning a named public certificate to hostnames not covered by its DNS SAN. This does not suppress TLS client warnings, validate the certificate less during agent polling, or disable backend TLS verification. Requires a named certificate."
|
"description": "Explicit, persistent administrator opt-in: allow assigning a named public certificate to hostnames not covered by its DNS SAN. This does not suppress TLS client warnings, validate the certificate less during agent polling, or disable backend TLS verification. Requires a named certificate."
|
||||||
}
|
},
|
||||||
|
"timing_headers": { "type": "boolean", "default": false, "description": "Since 0.38.3. Server-Timing diagnostics for this Docker vhost." },
|
||||||
|
"backend_header": { "type": "boolean", "default": false, "description": "Since 0.38.3. X-Rust-Proxy-Backend with the generated backend id." },
|
||||||
|
"backend_timing_header": { "type": "boolean", "default": false, "description": "Since 0.38.3. X-RustProxy-Backend-Time with the origin response-header latency." },
|
||||||
|
"cloudflare_client_ip": { "type": "boolean", "default": false, "description": "Since 0.38.3. Use verified Cloudflare client-IP and country headers, as on ordinary vhosts." },
|
||||||
|
"method_policy": { "type": "object", "description": "Since 0.38.3. Same format as the vhost method_policy: mode off, allow or block with a list of methods." },
|
||||||
|
"rate_limit": { "type": "object", "nullable": true, "default": null, "description": "Since 0.38.3. Same format as the vhost rate_limit (per-client IP limit and country_access); null = off." },
|
||||||
|
"security_headers": { "type": "object", "nullable": true, "default": null, "description": "Since 0.38.3. Same format as the vhost security_headers (HSTS, nosniff, frame_options, referrer_policy, CSP, permissions policy); null = none." },
|
||||||
|
"basic_auth": { "type": "object", "nullable": true, "default": null, "description": "Since 0.38.3. Same format as the vhost basic_auth: enabled, realm, require_tls, forward_credentials and users with Argon2id password_hash from POST /api/basic-auth/hash; null = no login." }
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"service_key",
|
"service_key",
|
||||||
|
|||||||
+6
-1
@@ -257,7 +257,12 @@ fn docker_runtime_views(state: &Arc<App>) -> (Vec<Value>, Vec<Value>, Value) {
|
|||||||
for assignment in &agent.assignments {
|
for assignment in &agent.assignments {
|
||||||
let pool_id = crate::docker::generated_id(&agent.id, &assignment.service_key);
|
let pool_id = crate::docker::generated_id(&agent.id, &assignment.service_key);
|
||||||
ids.insert(pool_id.clone());
|
ids.insert(pool_id.clone());
|
||||||
routes.push(json!({"agent_id": &agent.id, "service_key": &assignment.service_key, "pool_id": pool_id}));
|
let hosts = if assignment.enabled {
|
||||||
|
crate::docker::assignment_hosts(assignment, agent).unwrap_or_default()
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
};
|
||||||
|
routes.push(json!({"agent_id": &agent.id, "service_key": &assignment.service_key, "pool_id": pool_id, "enabled": assignment.enabled, "hosts": hosts}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for publication in &publications {
|
for publication in &publications {
|
||||||
|
|||||||
@@ -969,6 +969,11 @@ dialog .vh-form,
|
|||||||
max-height: calc((calc(min(82vh, 760px))) / var(--ui-scale, 1));
|
max-height: calc((calc(min(82vh, 760px))) / var(--ui-scale, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#location-help-dialog.is-wide {
|
||||||
|
width: calc((calc(min(1180px, 100vw - 28px))) / var(--ui-scale, 1));
|
||||||
|
max-height: calc((calc(min(88vh, 960px))) / var(--ui-scale, 1));
|
||||||
|
}
|
||||||
|
|
||||||
#location-help-body {
|
#location-help-body {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|||||||
@@ -1696,6 +1696,8 @@ html.app-loading,
|
|||||||
}
|
}
|
||||||
|
|
||||||
.acl-picker-search,
|
.acl-picker-search,
|
||||||
|
.vh-field .acl-picker-search,
|
||||||
|
.docker-field .acl-picker-search,
|
||||||
.docker-agent-grid .acl-picker-search {
|
.docker-agent-grid .acl-picker-search {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@@ -294,6 +294,8 @@
|
|||||||
.docker-acl-editor,
|
.docker-acl-editor,
|
||||||
.docker-cache-editor,
|
.docker-cache-editor,
|
||||||
.docker-protocol-editor,
|
.docker-protocol-editor,
|
||||||
|
.docker-security-editor,
|
||||||
|
.docker-diagnostics-editor,
|
||||||
.docker-timeout-editor {
|
.docker-timeout-editor {
|
||||||
border-top: 1px solid var(--line);
|
border-top: 1px solid var(--line);
|
||||||
padding-top: 9px;
|
padding-top: 9px;
|
||||||
@@ -303,6 +305,8 @@
|
|||||||
.docker-acl-editor>summary,
|
.docker-acl-editor>summary,
|
||||||
.docker-cache-editor>summary,
|
.docker-cache-editor>summary,
|
||||||
.docker-protocol-editor>summary,
|
.docker-protocol-editor>summary,
|
||||||
|
.docker-security-editor>summary,
|
||||||
|
.docker-diagnostics-editor>summary,
|
||||||
.docker-timeout-editor>summary {
|
.docker-timeout-editor>summary {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -3255,3 +3259,177 @@ html[data-dashboard-density=normal] #panel-overview .stat>span,
|
|||||||
gap: var(--ui-gap-sm, 8px);
|
gap: var(--ui-gap-sm, 8px);
|
||||||
padding: 0 8px 8px;
|
padding: 0 8px 8px;
|
||||||
}
|
}
|
||||||
|
.docker-security-grid,
|
||||||
|
.docker-diagnostics-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(150px, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 12px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-security-grid>label,
|
||||||
|
.docker-security-grid>div.docker-field {
|
||||||
|
display: grid;
|
||||||
|
gap: 5px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-security-grid .docker-wide-field {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-security-grid .docker-subheading {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
padding-top: 8px;
|
||||||
|
border-top: 1px dashed var(--line);
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: .04em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-security-grid .docker-subheading:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
border-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-security-grid .docker-field input:not([type=checkbox]),
|
||||||
|
.docker-security-grid .docker-field select {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 38px;
|
||||||
|
height: 38px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-agent-collapsed-note {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-service-row.is-highlighted {
|
||||||
|
outline: 2px solid var(--green);
|
||||||
|
outline-offset: 2px;
|
||||||
|
transition: outline-color .4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-search {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-wrap {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table th,
|
||||||
|
.docker-published-table td {
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 7px 8px;
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table th {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table td>small,
|
||||||
|
.docker-published-table td>b {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table td>small {
|
||||||
|
color: var(--muted);
|
||||||
|
margin-top: 2px;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table td>b,
|
||||||
|
.docker-published-hosts>a {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table td:nth-child(5),
|
||||||
|
.docker-published-table td:nth-child(6) {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table .docker-label-badge {
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.docker-security-grid,
|
||||||
|
.docker-diagnostics-grid {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-actions>div {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table .docker-published-aliases {
|
||||||
|
white-space: normal;
|
||||||
|
overflow: visible;
|
||||||
|
text-overflow: clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-aliases>a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table .pill {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1.2;
|
||||||
|
white-space: nowrap;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-published-table td {
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-basic-users {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-basic-user {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.3fr) minmax(110px, auto) auto;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-basic-user input {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 38px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docker-security-grid .docker-basic-add {
|
||||||
|
justify-self: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.docker-basic-user {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1744,6 +1744,8 @@
|
|||||||
.docker-acl-editor>summary,
|
.docker-acl-editor>summary,
|
||||||
.docker-cache-editor>summary,
|
.docker-cache-editor>summary,
|
||||||
.docker-protocol-editor>summary,
|
.docker-protocol-editor>summary,
|
||||||
|
.docker-security-editor>summary,
|
||||||
|
.docker-diagnostics-editor>summary,
|
||||||
.docker-timeout-editor>summary,
|
.docker-timeout-editor>summary,
|
||||||
.docker-passive-health-editor>summary {
|
.docker-passive-health-editor>summary {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@@ -1754,6 +1756,8 @@
|
|||||||
.docker-acl-editor>summary::-webkit-details-marker,
|
.docker-acl-editor>summary::-webkit-details-marker,
|
||||||
.docker-cache-editor>summary::-webkit-details-marker,
|
.docker-cache-editor>summary::-webkit-details-marker,
|
||||||
.docker-protocol-editor>summary::-webkit-details-marker,
|
.docker-protocol-editor>summary::-webkit-details-marker,
|
||||||
|
.docker-security-editor>summary::-webkit-details-marker,
|
||||||
|
.docker-diagnostics-editor>summary::-webkit-details-marker,
|
||||||
.docker-timeout-editor>summary::-webkit-details-marker,
|
.docker-timeout-editor>summary::-webkit-details-marker,
|
||||||
.docker-passive-health-editor>summary::-webkit-details-marker {
|
.docker-passive-health-editor>summary::-webkit-details-marker {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -1764,6 +1768,8 @@
|
|||||||
.docker-acl-editor>summary::before,
|
.docker-acl-editor>summary::before,
|
||||||
.docker-cache-editor>summary::before,
|
.docker-cache-editor>summary::before,
|
||||||
.docker-protocol-editor>summary::before,
|
.docker-protocol-editor>summary::before,
|
||||||
|
.docker-security-editor>summary::before,
|
||||||
|
.docker-diagnostics-editor>summary::before,
|
||||||
.docker-timeout-editor>summary::before,
|
.docker-timeout-editor>summary::before,
|
||||||
.docker-passive-health-editor>summary::before {
|
.docker-passive-health-editor>summary::before {
|
||||||
content: "›";
|
content: "›";
|
||||||
@@ -1781,6 +1787,8 @@
|
|||||||
.docker-acl-editor[open]>summary::before,
|
.docker-acl-editor[open]>summary::before,
|
||||||
.docker-cache-editor[open]>summary::before,
|
.docker-cache-editor[open]>summary::before,
|
||||||
.docker-protocol-editor[open]>summary::before,
|
.docker-protocol-editor[open]>summary::before,
|
||||||
|
.docker-security-editor[open]>summary::before,
|
||||||
|
.docker-diagnostics-editor[open]>summary::before,
|
||||||
.docker-timeout-editor[open]>summary::before,
|
.docker-timeout-editor[open]>summary::before,
|
||||||
.docker-passive-health-editor[open]>summary::before {
|
.docker-passive-health-editor[open]>summary::before {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
@@ -1811,6 +1819,8 @@
|
|||||||
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-acl-editor,
|
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-acl-editor,
|
||||||
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-cache-editor,
|
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-cache-editor,
|
||||||
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-protocol-editor,
|
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-protocol-editor,
|
||||||
|
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-security-editor,
|
||||||
|
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-diagnostics-editor,
|
||||||
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-timeout-editor {
|
.docker-service-editor[open]:not(.docker-service-metrics)>.docker-timeout-editor {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
@@ -1819,6 +1829,8 @@
|
|||||||
.docker-acl-editor>summary:focus-visible,
|
.docker-acl-editor>summary:focus-visible,
|
||||||
.docker-cache-editor>summary:focus-visible,
|
.docker-cache-editor>summary:focus-visible,
|
||||||
.docker-protocol-editor>summary:focus-visible,
|
.docker-protocol-editor>summary:focus-visible,
|
||||||
|
.docker-security-editor>summary:focus-visible,
|
||||||
|
.docker-diagnostics-editor>summary:focus-visible,
|
||||||
.docker-timeout-editor>summary:focus-visible,
|
.docker-timeout-editor>summary:focus-visible,
|
||||||
.docker-health-editor>summary:focus-visible {
|
.docker-health-editor>summary:focus-visible {
|
||||||
outline: 2px solid var(--green);
|
outline: 2px solid var(--green);
|
||||||
@@ -1983,6 +1995,8 @@
|
|||||||
.docker-acl-editor>summary,
|
.docker-acl-editor>summary,
|
||||||
.docker-cache-editor>summary,
|
.docker-cache-editor>summary,
|
||||||
.docker-protocol-editor>summary,
|
.docker-protocol-editor>summary,
|
||||||
|
.docker-security-editor>summary,
|
||||||
|
.docker-diagnostics-editor>summary,
|
||||||
.docker-timeout-editor>summary,
|
.docker-timeout-editor>summary,
|
||||||
.docker-passive-health-editor>summary {
|
.docker-passive-health-editor>summary {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
@@ -1994,6 +2008,8 @@
|
|||||||
.docker-acl-editor>summary>span,
|
.docker-acl-editor>summary>span,
|
||||||
.docker-cache-editor>summary>span,
|
.docker-cache-editor>summary>span,
|
||||||
.docker-protocol-editor>summary>span,
|
.docker-protocol-editor>summary>span,
|
||||||
|
.docker-security-editor>summary>span,
|
||||||
|
.docker-diagnostics-editor>summary>span,
|
||||||
.docker-timeout-editor>summary>span,
|
.docker-timeout-editor>summary>span,
|
||||||
.docker-passive-health-editor>summary>span {
|
.docker-passive-health-editor>summary>span {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@@ -2004,6 +2020,8 @@
|
|||||||
.docker-acl-editor>summary>small,
|
.docker-acl-editor>summary>small,
|
||||||
.docker-cache-editor>summary>small,
|
.docker-cache-editor>summary>small,
|
||||||
.docker-protocol-editor>summary>small,
|
.docker-protocol-editor>summary>small,
|
||||||
|
.docker-security-editor>summary>small,
|
||||||
|
.docker-diagnostics-editor>summary>small,
|
||||||
.docker-timeout-editor>summary>small,
|
.docker-timeout-editor>summary>small,
|
||||||
.docker-passive-health-editor>summary>small {
|
.docker-passive-health-editor>summary>small {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
@@ -2018,6 +2036,8 @@
|
|||||||
.docker-acl-editor>summary>span,
|
.docker-acl-editor>summary>span,
|
||||||
.docker-cache-editor>summary>span,
|
.docker-cache-editor>summary>span,
|
||||||
.docker-protocol-editor>summary>span,
|
.docker-protocol-editor>summary>span,
|
||||||
|
.docker-security-editor>summary>span,
|
||||||
|
.docker-diagnostics-editor>summary>span,
|
||||||
.docker-timeout-editor>summary>span,
|
.docker-timeout-editor>summary>span,
|
||||||
.docker-passive-health-editor>summary>span {
|
.docker-passive-health-editor>summary>span {
|
||||||
flex: 0 0 190px;
|
flex: 0 0 190px;
|
||||||
|
|||||||
+183
-3
@@ -358,6 +358,75 @@
|
|||||||
body.replaceChildren(el("p", t("dockerLabelHelpIntro"), "location-doc-intro"), table, exampleHead, pre, el("p", t("dockerLabelHelpNote"), "fine"), docs);
|
body.replaceChildren(el("p", t("dockerLabelHelpIntro"), "location-doc-intro"), table, exampleHead, pre, el("p", t("dockerLabelHelpNote"), "fine"), docs);
|
||||||
dialog.showModal();
|
dialog.showModal();
|
||||||
}
|
}
|
||||||
|
function publishedApps() {
|
||||||
|
const agents = cfg().agents || [], out = [];
|
||||||
|
for (const route of poolRoutes) {
|
||||||
|
if (route.enabled === false || !(route.hosts || []).length) continue;
|
||||||
|
const agent = agents.find(item => item.id === route.agent_id); if (!agent) continue;
|
||||||
|
const service = (obs(agent.id)?.inventory?.services || []).find(item => item.key === route.service_key);
|
||||||
|
const member = poolIndex.get(route.pool_id)?.members?.[0];
|
||||||
|
out.push({ agent, route, service, member, hosts: route.hosts });
|
||||||
|
}
|
||||||
|
return out.sort((a, b) => `${a.agent.name}\u0000${a.hosts[0]}`.localeCompare(`${b.agent.name}\u0000${b.hosts[0]}`, locale(), { numeric: true, sensitivity: "base" }));
|
||||||
|
}
|
||||||
|
function revealService(agentId, serviceKey) {
|
||||||
|
const row = [...document.querySelectorAll("#docker-discovery-list .docker-service-row")].find(item => item.dataset.viewKey === viewKey(agentId, serviceKey)); if (!row) return;
|
||||||
|
const card = row.closest(".docker-agent-card"); if (card?.classList.contains("is-services-collapsed")) setAgentCollapsed(card, false);
|
||||||
|
const group = row.closest(".docker-service-group"); if (group) group.open = true;
|
||||||
|
if (row.hidden) { if ($("docker-search")) $("docker-search").value = ""; showHidden = true; applyViewFilters(); }
|
||||||
|
const editor = row.querySelector(".docker-service-editor"); if (editor) editor.open = true;
|
||||||
|
row.scrollIntoView({ block: "start", behavior: "smooth" }); row.classList.add("is-highlighted"); setTimeout(() => row.classList.remove("is-highlighted"), 2000);
|
||||||
|
}
|
||||||
|
function openPublishedList() {
|
||||||
|
const dialog = $("location-help-dialog"), title = $("location-help-title"), body = $("location-help-body"); if (!dialog || !title || !body) return;
|
||||||
|
const apps = publishedApps();
|
||||||
|
title.textContent = `${t("dockerPublishedTitle")} (${apps.length})`;
|
||||||
|
const search = el("input", "", "docker-published-search"); search.type = "search"; search.placeholder = t("dockerPublishedSearch"); search.setAttribute("aria-label", t("dockerPublishedSearch"));
|
||||||
|
const table = el("table", undefined, "docker-published-table"), head = el("thead"), headRow = el("tr"), tbody = el("tbody");
|
||||||
|
for (const key of ["dockerPublishedAddress", "dockerPublishedService", "dockerPublishedAgent", "dockerPublishedBackend", "status", ""]) headRow.append(el("th", key ? t(key) : ""));
|
||||||
|
head.append(headRow); table.append(head, tbody);
|
||||||
|
for (const item of apps) {
|
||||||
|
const tr = el("tr"), address = el("td", undefined, "docker-published-hosts"), url = proxiedUrl(item.agent, item.hosts[0], "");
|
||||||
|
const appLink = (host, cls) => { const node = el("a", host, cls); const target = proxiedUrl(item.agent, host, ""); node.href = target || "#"; node.target = "_blank"; node.rel = "noopener noreferrer"; node.title = t("dockerPublishedOpenNew"); return node; };
|
||||||
|
address.append(appLink(item.hosts[0], "docker-published-main"));
|
||||||
|
if (item.hosts.length > 1) { const aliases = el("small", undefined, "fine docker-published-aliases"); item.hosts.slice(1).forEach((host, index) => { if (index) aliases.append(", "); aliases.append(appLink(host)); }); address.append(aliases); }
|
||||||
|
const service = el("td"); service.append(el("b", item.service?.technical_name || item.route.service_key)); if (item.service) service.append(el("small", `${item.service.container_name} · ${item.service.image}`, "fine"));
|
||||||
|
if (item.route.source === "labels") service.append(el("span", t("dockerLabelPublished"), "pill live docker-label-badge"));
|
||||||
|
const statusKey = !item.service ? "dockerServiceMissing" : item.member?.status === "up" ? "dockerPublishedUp" : item.member?.status === "down" ? "dockerPublishedDown" : "dockerPublishedChecking";
|
||||||
|
const statusCls = !item.service || item.member?.status === "down" ? "danger" : item.member?.status === "up" ? "live" : "warn";
|
||||||
|
const status = el("td"); status.append(el("span", t(statusKey), `pill ${statusCls}`));
|
||||||
|
const actions = el("td", undefined, "docker-published-actions"), configure = el("button", t("dockerPublishedConfigure"), "quiet"); configure.type = "button"; configure.addEventListener("click", () => { dialog.close(); revealService(item.agent.id, item.route.service_key); });
|
||||||
|
const open = el("a", `${t("dockerOpenApp")} ↗`, "outline docker-published-open"); open.href = url || "#"; open.target = "_blank"; open.rel = "noopener noreferrer"; open.title = t("dockerPublishedOpenNew"); open.hidden = !url;
|
||||||
|
const actionRow = el("div"); actionRow.append(open, configure); actions.append(actionRow);
|
||||||
|
tr.append(address, service, el("td", item.agent.name || item.agent.id), el("td", item.member?.address || item.member?.url || "-", "mono"), status, actions);
|
||||||
|
tr.dataset.search = `${item.hosts.join(" ")} ${item.route.service_key} ${item.service?.container_name || ""} ${item.service?.image || ""} ${item.agent.name || ""} ${item.agent.id}`.toLowerCase();
|
||||||
|
tbody.append(tr);
|
||||||
|
}
|
||||||
|
const empty = el("p", t(apps.length ? "dockerPublishedNoMatches" : "dockerPublishedEmpty"), "fine docker-published-empty"); empty.hidden = !!apps.length;
|
||||||
|
search.addEventListener("input", () => { const query = search.value.trim().toLowerCase(); let visible = 0; for (const tr of tbody.children) { tr.hidden = !!query && !tr.dataset.search.includes(query); if (!tr.hidden) visible += 1; } empty.hidden = visible > 0; });
|
||||||
|
const wrap = el("div", undefined, "docker-published-wrap"); wrap.append(table);
|
||||||
|
body.replaceChildren(search, wrap, empty);
|
||||||
|
dialog.classList.add("is-wide"); dialog.addEventListener("close", () => dialog.classList.remove("is-wide"), { once: true });
|
||||||
|
dialog.showModal(); search.focus();
|
||||||
|
}
|
||||||
|
const AGENT_COLLAPSE_KEY = "rustproxy.docker.collapsedAgents";
|
||||||
|
function collapsedAgents() { try { return new Set(JSON.parse(localStorage.getItem(AGENT_COLLAPSE_KEY) || "[]")); } catch { return new Set(); } }
|
||||||
|
function setAgentCollapsed(card, collapsed) {
|
||||||
|
const set = collapsedAgents(); if (collapsed) set.add(card.dataset.agentId); else set.delete(card.dataset.agentId);
|
||||||
|
try { localStorage.setItem(AGENT_COLLAPSE_KEY, JSON.stringify([...set].slice(-64))); } catch { }
|
||||||
|
card.classList.toggle("is-services-collapsed", collapsed); card._syncCollapse?.(); applyViewFilters();
|
||||||
|
}
|
||||||
|
function agentCollapseControl(card, list) {
|
||||||
|
const button = el("button", "", "quiet docker-agent-collapse"), note = el("p", "", "fine docker-agent-collapsed-note"); button.type = "button";
|
||||||
|
card._syncCollapse = () => {
|
||||||
|
const collapsed = card.classList.contains("is-services-collapsed"), rows = [...list.querySelectorAll(".docker-service-row")], published = rows.filter(row => row.dockerSort?.published === 0).length;
|
||||||
|
button.textContent = t(collapsed ? "dockerAgentExpandServices" : "dockerAgentCollapseServices"); button.setAttribute("aria-expanded", String(!collapsed));
|
||||||
|
note.textContent = t("dockerAgentServicesCollapsed").replace("{count}", rows.length).replace("{published}", published); note.hidden = !collapsed;
|
||||||
|
};
|
||||||
|
button.addEventListener("click", () => setAgentCollapsed(card, !card.classList.contains("is-services-collapsed")));
|
||||||
|
card.classList.toggle("is-services-collapsed", collapsedAgents().has(card.dataset.agentId)); card._syncCollapse();
|
||||||
|
return { button, note };
|
||||||
|
}
|
||||||
function agentSettingsRow(agent = null, options = {}) {
|
function agentSettingsRow(agent = null, options = {}) {
|
||||||
const value = agent || { id: "", name: "", enabled: true, endpoint: "https://127.0.0.1:9876", token: "", tls_fingerprint_sha256: null, domains: [], poll_interval_seconds: 30, certificate_ids: [], acl_profile_id: null, default_target_ip: null, listener_ids: [firstListener()], assignments: [] };
|
const value = agent || { id: "", name: "", enabled: true, endpoint: "https://127.0.0.1:9876", token: "", tls_fingerprint_sha256: null, domains: [], poll_interval_seconds: 30, certificate_ids: [], acl_profile_id: null, default_target_ip: null, listener_ids: [firstListener()], assignments: [] };
|
||||||
const row = el("div", undefined, "docker-agent-settings entity"); row.dataset.originalId = agent?.id || ""; row._assignments = structuredClone(value.assignments || []);
|
const row = el("div", undefined, "docker-agent-settings entity"); row.dataset.originalId = agent?.id || ""; row._assignments = structuredClone(value.assignments || []);
|
||||||
@@ -698,6 +767,113 @@
|
|||||||
cache_ignore_global_rules: details?._rules?.ignoreGlobal?.() === true,
|
cache_ignore_global_rules: details?._rules?.ignoreGlobal?.() === true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
function selectFrom(values, current, cls) { const control = el("select", undefined, cls); for (const [value, key] of values) { const option = el("option", t(key)); option.value = value; control.append(option); } control.value = current; return control; }
|
||||||
|
function basicAuthControls(assignment) {
|
||||||
|
const basic = assignment?.basic_auth || {}, enabled = input("", "checkbox", "docker-basic-enabled"); enabled.checked = basic.enabled === true;
|
||||||
|
const realm = input(basic.realm || "Restricted", "text", "docker-basic-realm"); realm.maxLength = 128;
|
||||||
|
const requireTls = input("", "checkbox", "docker-basic-tls"); requireTls.checked = basic.require_tls !== false;
|
||||||
|
const forward = input("", "checkbox", "docker-basic-forward"); forward.checked = basic.forward_credentials === true;
|
||||||
|
const users = el("div", undefined, "docker-basic-users docker-wide-field");
|
||||||
|
const addRow = (user = {}) => {
|
||||||
|
if (users.children.length >= 64) { toast(t("basic.too_many_users"), true); return; }
|
||||||
|
const row = el("div", undefined, "docker-basic-user"), name = input(user.username || "", "text", "docker-basic-username"), password = input("", "password", "docker-basic-password");
|
||||||
|
name.maxLength = 128; name.placeholder = t("username"); name.autocomplete = "off"; password.maxLength = 128; password.autocomplete = "new-password"; password.placeholder = user.password_hash ? t("basicKeepPassword") : t("basicPassword");
|
||||||
|
const state = el("small", t(user.password_hash ? "basicHashSaved" : "basicHashRequired"), "fine"), remove = el("button", t("remove"), "quiet"); remove.type = "button";
|
||||||
|
remove.addEventListener("click", () => { row.remove(); users.dispatchEvent(new Event("change", { bubbles: true })); });
|
||||||
|
row.userHash = user.password_hash || ""; row._state = state; row.append(name, password, state, remove); users.append(row);
|
||||||
|
};
|
||||||
|
for (const user of basic.users || []) addRow(user);
|
||||||
|
const add = el("button", t("basicAddUser"), "outline docker-basic-add"); add.type = "button"; add.addEventListener("click", () => { addRow(); users.dispatchEvent(new Event("change", { bubbles: true })); });
|
||||||
|
const fields = [checkboxField("dockerBasicEnabled", enabled), labeled("basicRealm", realm), checkboxField("basicRequireTls", requireTls), checkboxField("basicForward", forward), users, add, el("p", t("dockerBasicHelp"), "fine docker-wide-field")];
|
||||||
|
const sync = () => { for (const control of [realm, requireTls, forward, add, ...users.querySelectorAll("input, button")]) control.disabled = !enabled.checked; };
|
||||||
|
enabled.addEventListener("change", sync); users.addEventListener("change", sync); sync();
|
||||||
|
return { fields, enabled, count: () => users.children.length };
|
||||||
|
}
|
||||||
|
async function prepareBasicAuth(row) {
|
||||||
|
if (row.querySelector(".docker-basic-enabled")?.checked !== true) return;
|
||||||
|
for (const user of row.querySelectorAll(".docker-basic-user")) {
|
||||||
|
const name = user.querySelector(".docker-basic-username").value.trim(), password = user.querySelector(".docker-basic-password");
|
||||||
|
if (!name) throw new Error(t("basic.invalid_username"));
|
||||||
|
if (!password.value) { if (!user.userHash) throw new Error(t("basicHashRequired")); continue; }
|
||||||
|
const result = await api("/api/basic-auth/hash", { method: "POST", body: JSON.stringify({ username: name, password: password.value }) });
|
||||||
|
user.userHash = result.password_hash; password.value = ""; password.placeholder = t("basicKeepPassword"); user._state.textContent = t("basicHashSaved");
|
||||||
|
}
|
||||||
|
if (!row.querySelector(".docker-basic-user")) throw new Error(t("basic.users_required"));
|
||||||
|
}
|
||||||
|
function collectBasicAuth(row) {
|
||||||
|
const enabled = row.querySelector(".docker-basic-enabled")?.checked === true, users = [...row.querySelectorAll(".docker-basic-user")].map(user => ({ username: user.querySelector(".docker-basic-username").value.trim(), password_hash: user.userHash })).filter(user => user.username && user.password_hash);
|
||||||
|
if (!enabled && !users.length) return null;
|
||||||
|
return { enabled, realm: row.querySelector(".docker-basic-realm")?.value.trim() || "Restricted", require_tls: row.querySelector(".docker-basic-tls")?.checked === true, forward_credentials: row.querySelector(".docker-basic-forward")?.checked === true, users };
|
||||||
|
}
|
||||||
|
function securityEditor(assignment) {
|
||||||
|
const details = el("details", undefined, "docker-security-editor"), summary = el("summary"), state = el("small", "", "fine"); summary.append(el("span", t("dockerSecurity")), state); details.append(summary);
|
||||||
|
const grid = el("div", undefined, "field-grid docker-security-grid");
|
||||||
|
const method = assignment?.method_policy || {}, methodMode = selectFrom([["off", "vhOff"], ["allow", "locationMethodAllow"], ["block", "locationMethodBlock"]], method.mode || "off", "docker-method-mode");
|
||||||
|
const methodList = document.createElement("textarea"); methodList.className = "docker-method-list"; methodList.rows = 3; methodList.maxLength = 1024; methodList.value = (method.methods || []).join("\n");
|
||||||
|
const methodListField = labeled("vhMethodList", methodList); methodListField.classList.add("docker-wide-field");
|
||||||
|
const rate = assignment?.rate_limit || {}, access = rate.country_access || {};
|
||||||
|
const rateEnabled = input("", "checkbox", "docker-rate-enabled"); rateEnabled.checked = rate.enabled === true;
|
||||||
|
const requests = numberInput(rate.requests ?? 120, "docker-rate-requests", 1, 1000000), windowSeconds = numberInput(rate.window_seconds ?? 60, "docker-rate-window", 1, 3600), burst = numberInput(rate.burst ?? 30, "docker-rate-burst", 0, 1000000);
|
||||||
|
const countryMode = selectFrom([["off", "vhOff"], ["block", "vhCountryBlock"], ["allow", "vhCountryAllow"]], access.mode || "off", "docker-country-mode");
|
||||||
|
const countryList = document.createElement("textarea"); countryList.className = "docker-country-list"; countryList.rows = 2; countryList.maxLength = 1024; countryList.value = (access.countries || []).join("\n");
|
||||||
|
const countryListField = labeled("vhCountryList", countryList, t("dockerCountryHelp")); countryListField.classList.add("docker-wide-field");
|
||||||
|
const security = assignment?.security_headers || {}, hsts = security.hsts || {};
|
||||||
|
const hstsEnabled = input("", "checkbox", "docker-hsts"); hstsEnabled.checked = hsts.enabled === true;
|
||||||
|
const hstsAge = numberInput(hsts.max_age_seconds ?? 31536000, "docker-hsts-age", 0, 63072000), hstsSub = input("", "checkbox", "docker-hsts-sub"); hstsSub.checked = hsts.include_subdomains === true;
|
||||||
|
const nosniff = input("", "checkbox", "docker-nosniff"); nosniff.checked = security.nosniff === true;
|
||||||
|
const frame = selectFrom([["preserve", "vhPreserve"], ["deny", "vhDeny"], ["sameorigin", "vhSameorigin"]], security.frame_options || "preserve", "docker-frame");
|
||||||
|
const referrer = input(security.referrer_policy || "", "text", "docker-referrer"); referrer.maxLength = 256; referrer.placeholder = "strict-origin-when-cross-origin";
|
||||||
|
const cloudflare = input("", "checkbox", "docker-cloudflare-ip"); cloudflare.checked = assignment?.cloudflare_client_ip === true;
|
||||||
|
const heading = key => el("h4", t(key), "docker-subheading"), basic = basicAuthControls(assignment);
|
||||||
|
grid.append(heading("dockerBasicSection"), ...basic.fields,
|
||||||
|
heading("vhTrafficMethodsSection"), labeled("vhMethodMode", methodMode), methodListField,
|
||||||
|
heading("vhTrafficRateSection"), checkboxField("vhRateEnabled", rateEnabled), labeled("vhRateRequests", requests), labeled("vhRateWindow", windowSeconds), labeled("vhRateBurst", burst),
|
||||||
|
heading("vhTrafficCountrySection"), labeled("vhCountryMode", countryMode), countryListField,
|
||||||
|
heading("dockerSecurityHeaders"), checkboxField("vhHsts", hstsEnabled), labeled("vhHstsAge", hstsAge), checkboxField("vhHstsSub", hstsSub), checkboxField("vhNosniff", nosniff), labeled("vhFrame", frame), labeled("vhReferrer", referrer),
|
||||||
|
heading("dockerClientIp"), checkboxField("vhCloudflareClientIp", cloudflare));
|
||||||
|
details.append(grid);
|
||||||
|
window.rustProxyMethodPicker?.attach(methodList);
|
||||||
|
window.rustProxyCountryPicker?.attach(countryList);
|
||||||
|
const sync = () => {
|
||||||
|
methodList.disabled = methodMode.value === "off"; countryList.disabled = countryMode.value === "off";
|
||||||
|
for (const control of [requests, windowSeconds, burst]) control.disabled = !rateEnabled.checked;
|
||||||
|
for (const control of [hstsAge, hstsSub]) control.disabled = !hstsEnabled.checked;
|
||||||
|
const parts = [];
|
||||||
|
if (basic.enabled.checked) parts.push(`Basic Auth (${basic.count()})`);
|
||||||
|
if (methodMode.value !== "off") parts.push(t("dockerMethodsShort"));
|
||||||
|
if (rateEnabled.checked) parts.push(`${requests.value}/${windowSeconds.value}s`);
|
||||||
|
if (countryMode.value !== "off") parts.push(t("dockerCountriesShort"));
|
||||||
|
if (hstsEnabled.checked || nosniff.checked || frame.value !== "preserve" || referrer.value.trim()) parts.push(t("dockerHeadersShort"));
|
||||||
|
state.textContent = parts.length ? parts.join(" · ") : t("dockerSecurityNone");
|
||||||
|
};
|
||||||
|
details.addEventListener("input", sync); details.addEventListener("change", sync); sync();
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
function collectSecurity(row) {
|
||||||
|
const q = cls => row.querySelector(cls), lines = value => String(value || "").split(/[\s,;]+/).map(item => item.trim().toUpperCase()).filter(Boolean);
|
||||||
|
const methodMode = q(".docker-method-mode")?.value || "off", countryMode = q(".docker-country-mode")?.value || "off", rateEnabled = q(".docker-rate-enabled")?.checked === true;
|
||||||
|
const countries = countryMode === "off" ? [] : lines(q(".docker-country-list")?.value);
|
||||||
|
const rate = rateEnabled || countryMode !== "off" ? { enabled: rateEnabled, requests: Number(q(".docker-rate-requests").value), window_seconds: Number(q(".docker-rate-window").value), burst: Number(q(".docker-rate-burst").value), country_access: { mode: countryMode, countries } } : null;
|
||||||
|
const hsts = q(".docker-hsts")?.checked === true, nosniff = q(".docker-nosniff")?.checked === true, frame = q(".docker-frame")?.value || "preserve", referrer = q(".docker-referrer")?.value.trim() || "";
|
||||||
|
const security = hsts || nosniff || frame !== "preserve" || referrer ? { hsts: { enabled: hsts, max_age_seconds: Number(q(".docker-hsts-age").value), include_subdomains: q(".docker-hsts-sub")?.checked === true, preload: false }, nosniff, frame_options: frame, referrer_policy: referrer || null } : null;
|
||||||
|
return {
|
||||||
|
method_policy: { mode: methodMode, methods: methodMode === "off" ? [] : lines(q(".docker-method-list")?.value) },
|
||||||
|
rate_limit: rate, security_headers: security,
|
||||||
|
cloudflare_client_ip: q(".docker-cloudflare-ip")?.checked === true,
|
||||||
|
basic_auth: collectBasicAuth(row),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function diagnosticsEditor(assignment) {
|
||||||
|
const details = el("details", undefined, "docker-diagnostics-editor"), summary = el("summary"); summary.append(el("span", t("dockerDiagnostics")), el("small", t("dockerDiagnosticsHelp"), "fine")); details.append(summary);
|
||||||
|
const grid = el("div", undefined, "field-grid docker-diagnostics-grid");
|
||||||
|
const box = (cls, value) => { const node = input("", "checkbox", cls); node.checked = value === true; return node; };
|
||||||
|
grid.append(checkboxField("vhTimingHeaders", box("docker-timing-headers", assignment?.timing_headers)), checkboxField("vhBackendHeader", box("docker-backend-header", assignment?.backend_header)), checkboxField("vhBackendTimingHeader", box("docker-backend-timing-header", assignment?.backend_timing_header)));
|
||||||
|
details.append(grid); return details;
|
||||||
|
}
|
||||||
|
function collectDiagnostics(row) {
|
||||||
|
const on = cls => row.querySelector(cls)?.checked === true;
|
||||||
|
return { timing_headers: on(".docker-timing-headers"), backend_header: on(".docker-backend-header"), backend_timing_header: on(".docker-backend-timing-header") };
|
||||||
|
}
|
||||||
function timeoutEditor(assignment) {
|
function timeoutEditor(assignment) {
|
||||||
const value = { ...defaultProxyTimeouts(), ...(assignment?.proxy_timeouts || {}) }, details = el("details", undefined, "docker-timeout-editor"), summary = el("summary"); summary.append(el("span", t("dockerProxyTimeouts")), el("small", t("dockerProxyTimeoutsHelp"), "fine")); details.append(summary);
|
const value = { ...defaultProxyTimeouts(), ...(assignment?.proxy_timeouts || {}) }, details = el("details", undefined, "docker-timeout-editor"), summary = el("summary"); summary.append(el("span", t("dockerProxyTimeouts")), el("small", t("dockerProxyTimeoutsHelp"), "fine")); details.append(summary);
|
||||||
const grid = el("div", undefined, "field-grid docker-timeout-grid");
|
const grid = el("div", undefined, "field-grid docker-timeout-grid");
|
||||||
@@ -711,7 +887,7 @@
|
|||||||
service_key: row.dataset.key, hostname: row.querySelector(".docker-hostname").value.trim().toLowerCase().replace(/\.$/, ""), domain: row.querySelector(".docker-master-domain")?.value || null, aliases: row._readAliases?.() || [], target_ip: row.querySelector(".docker-target-ip").value || null,
|
service_key: row.dataset.key, hostname: row.querySelector(".docker-hostname").value.trim().toLowerCase().replace(/\.$/, ""), domain: row.querySelector(".docker-master-domain")?.value || null, aliases: row._readAliases?.() || [], target_ip: row.querySelector(".docker-target-ip").value || null,
|
||||||
enabled: true, scheme: row.querySelector(".docker-scheme").value, preserve_host: row.querySelector(".docker-preserve-host").checked, force_ssl: row.querySelector(".docker-force-ssl").checked, websockets: row.querySelector(".docker-websockets").checked, http2_enabled: row.querySelector(".docker-http2-enabled").checked, http3_enabled: row.querySelector(".docker-http3-enabled").checked, cache_enabled: row.querySelector(".docker-cache-enabled").checked, transform_enabled: row.querySelector(".docker-transform-enabled").checked, compression_enabled: row.querySelector(".docker-compression-enabled").checked,
|
enabled: true, scheme: row.querySelector(".docker-scheme").value, preserve_host: row.querySelector(".docker-preserve-host").checked, force_ssl: row.querySelector(".docker-force-ssl").checked, websockets: row.querySelector(".docker-websockets").checked, http2_enabled: row.querySelector(".docker-http2-enabled").checked, http3_enabled: row.querySelector(".docker-http3-enabled").checked, cache_enabled: row.querySelector(".docker-cache-enabled").checked, transform_enabled: row.querySelector(".docker-transform-enabled").checked, compression_enabled: row.querySelector(".docker-compression-enabled").checked,
|
||||||
compression_zstd: null, compression_br: null, compression_gzip: null, compression_deflate: null,
|
compression_zstd: null, compression_br: null, compression_gzip: null, compression_deflate: null,
|
||||||
acl_profile_id: null, ...collectAcl(row), ...collectCache(row),
|
acl_profile_id: null, ...collectAcl(row), ...collectCache(row), ...collectSecurity(row), ...collectDiagnostics(row),
|
||||||
allow_certificate_mismatch: row.querySelector(".docker-cert-mismatch")?.checked === true,
|
allow_certificate_mismatch: row.querySelector(".docker-cert-mismatch")?.checked === true,
|
||||||
acl: inline && row.querySelector(".docker-acl-public")?.checked !== true ? { default: row.querySelector(".docker-acl-default").value, rules: parseRules(row.querySelector(".docker-acl-rules").value) } : null,
|
acl: inline && row.querySelector(".docker-acl-public")?.checked !== true ? { default: row.querySelector(".docker-acl-default").value, rules: parseRules(row.querySelector(".docker-acl-rules").value) } : null,
|
||||||
proxy_timeouts: { connect_timeout_seconds: Number(row.querySelector(".docker-proxy-connect").value), response_header_timeout_seconds: Number(row.querySelector(".docker-proxy-header").value), read_timeout_seconds: Number(row.querySelector(".docker-proxy-read").value), send_timeout_seconds: Number(row.querySelector(".docker-proxy-send").value) },
|
proxy_timeouts: { connect_timeout_seconds: Number(row.querySelector(".docker-proxy-connect").value), response_header_timeout_seconds: Number(row.querySelector(".docker-proxy-header").value), read_timeout_seconds: Number(row.querySelector(".docker-proxy-read").value), send_timeout_seconds: Number(row.querySelector(".docker-proxy-send").value) },
|
||||||
@@ -722,6 +898,7 @@
|
|||||||
const current = structuredClone(cfg()), agent = current.agents.find(item => item.id === agentId); if (!agent) return false;
|
const current = structuredClone(cfg()), agent = current.agents.find(item => item.id === agentId); if (!agent) return false;
|
||||||
const index = (agent.assignments || []).findIndex(item => item.service_key === row.dataset.key);
|
const index = (agent.assignments || []).findIndex(item => item.service_key === row.dataset.key);
|
||||||
if (publish) {
|
if (publish) {
|
||||||
|
await prepareBasicAuth(row);
|
||||||
const assignment = collectAssignment(row); if (!assignment.hostname) throw new Error(t("dockerHostnameRequired"));
|
const assignment = collectAssignment(row); if (!assignment.hostname) throw new Error(t("dockerHostnameRequired"));
|
||||||
const domains = agentDomains(agent);
|
const domains = agentDomains(agent);
|
||||||
if (!assignment.domain && !assignment.hostname.includes(".")) throw new Error(t("dockerDomainsRequired"));
|
if (!assignment.domain && !assignment.hostname.includes(".")) throw new Error(t("dockerDomainsRequired"));
|
||||||
@@ -860,7 +1037,7 @@
|
|||||||
protocolOptions.append(h1, checkboxField("dockerHttp2Enabled", h2Enabled), checkboxField("dockerHttp3Enabled", h3Enabled));
|
protocolOptions.append(h1, checkboxField("dockerHttp2Enabled", h2Enabled), checkboxField("dockerHttp3Enabled", h3Enabled));
|
||||||
protocolBox.append(protocolSummary, protocolOptions);
|
protocolBox.append(protocolSummary, protocolOptions);
|
||||||
route.append(hostField, aliases.node, backendIpSettings, labeled("dockerBackendScheme", scheme), switches); syncHostHelp();
|
route.append(hostField, aliases.node, backendIpSettings, labeled("dockerBackendScheme", scheme), switches); syncHostHelp();
|
||||||
editor.append(route, protocolBox, aclEditor(assignment, agent), cacheEditor(assignment, agent, key, cacheEnabled), timeoutEditor(assignment), healthEditor(assignment), passiveHealthEditor(assignment));
|
editor.append(route, protocolBox, aclEditor(assignment, agent), securityEditor(assignment), cacheEditor(assignment, agent, key, cacheEnabled), diagnosticsEditor(assignment), timeoutEditor(assignment), healthEditor(assignment), passiveHealthEditor(assignment));
|
||||||
const actions = el("div", undefined, "docker-service-actions"), apply = el("button", t("dockerApplyService"), "outline docker-apply"); apply.type = "button"; apply.disabled = !publish.checked; apply.addEventListener("click", async () => { apply.disabled = true; try { await saveAssignment(agent.id, row, true); } catch (error) { toast(error.message, true); } finally { if (row.isConnected) apply.disabled = !publish.checked; } }); actions.append(apply); editor.append(actions); row.append(editor);
|
const actions = el("div", undefined, "docker-service-actions"), apply = el("button", t("dockerApplyService"), "outline docker-apply"); apply.type = "button"; apply.disabled = !publish.checked; apply.addEventListener("click", async () => { apply.disabled = true; try { await saveAssignment(agent.id, row, true); } catch (error) { toast(error.message, true); } finally { if (row.isConnected) apply.disabled = !publish.checked; } }); actions.append(apply); editor.append(actions); row.append(editor);
|
||||||
if (agent.enabled !== false && assignment && assignment.enabled !== false) row.append(statisticsSection(agent, key));
|
if (agent.enabled !== false && assignment && assignment.enabled !== false) row.append(statisticsSection(agent, key));
|
||||||
function updateHint() { syncCertificateHint(); const targetLabel = target.selectedOptions?.[0]?.textContent || t("dockerBackendIpAuto"), aliasCount = aliases.count(); editorHint.textContent = `${expandedHost(host.value.trim() || technical, domainSelect.value) || host.value.trim() || technical} → ${scheme.value.toUpperCase()} · ${targetLabel} · H1${h2Enabled.checked ? "/H2" : ""}${h3Enabled.checked ? "/H3" : ""}${aliasCount ? ` · +${aliasCount} ${t("dockerAliasesShort")}` : ""}`; } updateHint();
|
function updateHint() { syncCertificateHint(); const targetLabel = target.selectedOptions?.[0]?.textContent || t("dockerBackendIpAuto"), aliasCount = aliases.count(); editorHint.textContent = `${expandedHost(host.value.trim() || technical, domainSelect.value) || host.value.trim() || technical} → ${scheme.value.toUpperCase()} · ${targetLabel} · H1${h2Enabled.checked ? "/H2" : ""}${h3Enabled.checked ? "/H3" : ""}${aliasCount ? ` · +${aliasCount} ${t("dockerAliasesShort")}` : ""}`; } updateHint();
|
||||||
@@ -910,7 +1087,7 @@
|
|||||||
box.append(agentDetails);
|
box.append(agentDetails);
|
||||||
const rows = el("div", undefined, "docker-service-list"), assignments = new Map((agent.assignments || []).map(item => [item.service_key, item]));
|
const rows = el("div", undefined, "docker-service-list"), assignments = new Map((agent.assignments || []).map(item => [item.service_key, item]));
|
||||||
for (const route of poolRoutes) if (route.agent_id === agent.id && route.source === "labels" && route.assignment && !assignments.has(route.service_key)) assignments.set(route.service_key, { ...route.assignment, from_labels: true });
|
for (const route of poolRoutes) if (route.agent_id === agent.id && route.source === "labels" && route.assignment && !assignments.has(route.service_key)) assignments.set(route.service_key, { ...route.assignment, from_labels: true });
|
||||||
for (const service of inv.services || []) rows.append(assignmentRow(agent, inv, service, assignments.get(service.key), false)); for (const item of agent.assignments || []) if (!(inv.services || []).some(service => service.key === item.service_key)) rows.append(assignmentRow(agent, inv, null, item, true)); if (!rows.children.length) rows.append(el("p", t("dockerNoPublishedPorts"), "empty")); groupServiceRows(agent, rows); box.append(rows); target.append(box);
|
for (const service of inv.services || []) rows.append(assignmentRow(agent, inv, service, assignments.get(service.key), false)); for (const item of agent.assignments || []) if (!(inv.services || []).some(service => service.key === item.service_key)) rows.append(assignmentRow(agent, inv, null, item, true)); if (!rows.children.length) rows.append(el("p", t("dockerNoPublishedPorts"), "empty")); groupServiceRows(agent, rows); const collapse = agentCollapseControl(box, rows); badges.prepend(collapse.button); box.append(collapse.note, rows); target.append(box);
|
||||||
}
|
}
|
||||||
applyViewFilters();
|
applyViewFilters();
|
||||||
renderDockerMetrics();
|
renderDockerMetrics();
|
||||||
@@ -968,6 +1145,8 @@
|
|||||||
}
|
}
|
||||||
for (const group of card.querySelectorAll(".docker-service-group")) group.hidden = ![...group.querySelectorAll(".docker-service-row")].some(row => !row.hidden);
|
for (const group of card.querySelectorAll(".docker-service-group")) group.hidden = ![...group.querySelectorAll(".docker-service-row")].some(row => !row.hidden);
|
||||||
card.hidden = rows.length ? visible === 0 : (!!query && !(card.dataset.searchText || "").includes(query));
|
card.hidden = rows.length ? visible === 0 : (!!query && !(card.dataset.searchText || "").includes(query));
|
||||||
|
const list = card.querySelector(".docker-service-list"), collapsed = card.classList.contains("is-services-collapsed") && !query;
|
||||||
|
if (list) list.hidden = collapsed; const note = card.querySelector(".docker-agent-collapsed-note"); if (note) note.hidden = !collapsed;
|
||||||
}
|
}
|
||||||
const hideDisabled = $("docker-hide-disabled");
|
const hideDisabled = $("docker-hide-disabled");
|
||||||
if (hideDisabled) {
|
if (hideDisabled) {
|
||||||
@@ -1035,6 +1214,7 @@
|
|||||||
applyViewFilters();
|
applyViewFilters();
|
||||||
});
|
});
|
||||||
$("docker-show-hidden")?.addEventListener("click", () => { showHidden = !showHidden; applyViewFilters(); });
|
$("docker-show-hidden")?.addEventListener("click", () => { showHidden = !showHidden; applyViewFilters(); });
|
||||||
|
$("docker-published-open")?.addEventListener("click", openPublishedList);
|
||||||
$("docker-agent-add")?.addEventListener("click", () => { const target = $("docker-agent-settings-list"); target.querySelector(".empty")?.remove(); target.append(agentSettingsRow()); setSettingsDirty("docker-agents-form"); });
|
$("docker-agent-add")?.addEventListener("click", () => { const target = $("docker-agent-settings-list"); target.querySelector(".empty")?.remove(); target.append(agentSettingsRow()); setSettingsDirty("docker-agents-form"); });
|
||||||
$("docker-agent-provision")?.addEventListener("click", () => { const target = $("docker-agent-settings-list"); target.querySelector(".empty")?.remove(); const row = agentSettingsRow(null, { provision: true }); target.append(row); setSettingsDirty("docker-agents-form"); row.scrollIntoView({ block: "nearest" }); row.focusProvision(); });
|
$("docker-agent-provision")?.addEventListener("click", () => { const target = $("docker-agent-settings-list"); target.querySelector(".empty")?.remove(); const row = agentSettingsRow(null, { provision: true }); target.append(row); setSettingsDirty("docker-agents-form"); row.scrollIntoView({ block: "nearest" }); row.focusProvision(); });
|
||||||
$("docker-agents-form")?.addEventListener("input", () => setSettingsDirty("docker-agents-form")); $("docker-agents-form")?.addEventListener("change", () => setSettingsDirty("docker-agents-form"));
|
$("docker-agents-form")?.addEventListener("input", () => setSettingsDirty("docker-agents-form")); $("docker-agents-form")?.addEventListener("change", () => setSettingsDirty("docker-agents-form"));
|
||||||
|
|||||||
@@ -951,7 +951,8 @@
|
|||||||
type="button">↑</button><label class="check compact-check docker-live-switch"
|
type="button">↑</button><label class="check compact-check docker-live-switch"
|
||||||
title="Refresh this view from RustProxy memory every 5 seconds"><input
|
title="Refresh this view from RustProxy memory every 5 seconds"><input
|
||||||
id="docker-live-refresh" type="checkbox" /><span data-i18n="dockerLiveView">Live
|
id="docker-live-refresh" type="checkbox" /><span data-i18n="dockerLiveView">Live
|
||||||
view</span></label><button class="outline" data-i18n="dockerRefresh"
|
view</span></label><button class="primary" data-i18n="dockerPublishedOpen"
|
||||||
|
id="docker-published-open" type="button">Published apps</button><button class="outline" data-i18n="dockerRefresh"
|
||||||
id="docker-refresh" type="button">Refresh agents</button><button class="outline"
|
id="docker-refresh" type="button">Refresh agents</button><button class="outline"
|
||||||
data-i18n="dockerExpandAllMetrics" id="docker-metrics-toggle-all" type="button"
|
data-i18n="dockerExpandAllMetrics" id="docker-metrics-toggle-all" type="button"
|
||||||
aria-expanded="false" disabled>Expand all statistics</button><button class="quiet"
|
aria-expanded="false" disabled>Expand all statistics</button><button class="quiet"
|
||||||
|
|||||||
@@ -194,6 +194,27 @@ pub struct Assignment {
|
|||||||
pub proxy_timeouts: crate::vhost::ProxyTimeouts,
|
pub proxy_timeouts: crate::vhost::ProxyTimeouts,
|
||||||
pub health_check: crate::balance::HealthCheck,
|
pub health_check: crate::balance::HealthCheck,
|
||||||
pub passive_health: crate::balance::PassiveHealth,
|
pub passive_health: crate::balance::PassiveHealth,
|
||||||
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||||
|
pub timing_headers: bool,
|
||||||
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||||
|
pub backend_header: bool,
|
||||||
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||||
|
pub backend_timing_header: bool,
|
||||||
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||||
|
pub cloudflare_client_ip: bool,
|
||||||
|
#[serde(default, skip_serializing_if = "is_default_method_policy")]
|
||||||
|
pub method_policy: crate::vhost::MethodPolicy,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub rate_limit: Option<crate::rate_limit::Settings>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub security_headers: Option<crate::security::SecurityHeaders>,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub basic_auth: Option<crate::basic_auth::Settings>,
|
||||||
|
#[serde(default, rename = "login_vhost_id", skip_serializing)]
|
||||||
|
pub legacy_login_vhost_id: Option<serde::de::IgnoredAny>,
|
||||||
|
}
|
||||||
|
fn is_default_method_policy(value: &crate::vhost::MethodPolicy) -> bool {
|
||||||
|
*value == crate::vhost::MethodPolicy::default()
|
||||||
}
|
}
|
||||||
impl Default for Assignment {
|
impl Default for Assignment {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
@@ -228,6 +249,15 @@ impl Default for Assignment {
|
|||||||
proxy_timeouts: crate::vhost::ProxyTimeouts::default(),
|
proxy_timeouts: crate::vhost::ProxyTimeouts::default(),
|
||||||
health_check: crate::balance::HealthCheck::default(),
|
health_check: crate::balance::HealthCheck::default(),
|
||||||
passive_health: crate::balance::PassiveHealth::default(),
|
passive_health: crate::balance::PassiveHealth::default(),
|
||||||
|
timing_headers: false,
|
||||||
|
backend_header: false,
|
||||||
|
backend_timing_header: false,
|
||||||
|
cloudflare_client_ip: false,
|
||||||
|
method_policy: crate::vhost::MethodPolicy::default(),
|
||||||
|
rate_limit: None,
|
||||||
|
security_headers: None,
|
||||||
|
basic_auth: None,
|
||||||
|
legacy_login_vhost_id: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -543,6 +573,25 @@ impl Settings {
|
|||||||
.proxy_timeouts
|
.proxy_timeouts
|
||||||
.validate()
|
.validate()
|
||||||
.context("invalid Docker assignment proxy timeouts")?;
|
.context("invalid Docker assignment proxy timeouts")?;
|
||||||
|
assignment
|
||||||
|
.method_policy
|
||||||
|
.validate()
|
||||||
|
.context("invalid Docker assignment HTTP methods")?;
|
||||||
|
if let Some(rate_limit) = &mut assignment.rate_limit {
|
||||||
|
rate_limit
|
||||||
|
.validate()
|
||||||
|
.context("invalid Docker assignment rate limit")?;
|
||||||
|
}
|
||||||
|
if let Some(security) = &assignment.security_headers {
|
||||||
|
security
|
||||||
|
.compile()
|
||||||
|
.context("invalid Docker assignment security headers")?;
|
||||||
|
}
|
||||||
|
if let Some(basic) = &assignment.basic_auth {
|
||||||
|
basic
|
||||||
|
.compile()
|
||||||
|
.context("invalid Docker assignment Basic Auth")?;
|
||||||
|
}
|
||||||
crate::balance::Settings {
|
crate::balance::Settings {
|
||||||
health_check: assignment.health_check.clone(),
|
health_check: assignment.health_check.clone(),
|
||||||
passive_health: assignment.passive_health.clone(),
|
passive_health: assignment.passive_health.clone(),
|
||||||
|
|||||||
+31
-3
@@ -389,10 +389,28 @@ fn build_vhost(
|
|||||||
"load_balancing": {
|
"load_balancing": {
|
||||||
"health_check": assignment.health_check.clone(),
|
"health_check": assignment.health_check.clone(),
|
||||||
"passive_health": assignment.passive_health.clone()
|
"passive_health": assignment.passive_health.clone()
|
||||||
}
|
},
|
||||||
|
"timing_headers": assignment.timing_headers,
|
||||||
|
"backend_header": assignment.backend_header,
|
||||||
|
"backend_timing_header": assignment.backend_timing_header,
|
||||||
|
"cloudflare_client_ip": assignment.cloudflare_client_ip,
|
||||||
|
"method_policy": &assignment.method_policy
|
||||||
});
|
});
|
||||||
let mut host: crate::vhost::Vhost =
|
let mut host: crate::vhost::Vhost =
|
||||||
serde_json::from_value(value).context("build Docker vhost")?;
|
serde_json::from_value(value).context("build Docker vhost")?;
|
||||||
|
if let Some(rate_limit) = &assignment.rate_limit {
|
||||||
|
host.rate_limit = rate_limit.clone();
|
||||||
|
}
|
||||||
|
if let Some(security) = &assignment.security_headers {
|
||||||
|
host.security_headers = security.clone();
|
||||||
|
}
|
||||||
|
if let Some(basic) = assignment.basic_auth.as_ref().filter(|basic| basic.enabled) {
|
||||||
|
host.basic_auth = basic.clone();
|
||||||
|
host.authentication = Some(crate::auth_provider::Choice {
|
||||||
|
provider: crate::auth_provider::IdentityProvider::Basic,
|
||||||
|
method: crate::auth_provider::IntegrationMethod::Basic,
|
||||||
|
});
|
||||||
|
}
|
||||||
host.transient_unavailable = target.is_none();
|
host.transient_unavailable = target.is_none();
|
||||||
Ok(host)
|
Ok(host)
|
||||||
}
|
}
|
||||||
@@ -418,10 +436,20 @@ pub fn effective_config(
|
|||||||
.iter()
|
.iter()
|
||||||
.filter(|assignment| assignment.enabled)
|
.filter(|assignment| assignment.enabled)
|
||||||
{
|
{
|
||||||
generated.push(build_vhost(agent, assignment, inventory, &certificates)?);
|
generated.push(build_vhost(
|
||||||
|
agent,
|
||||||
|
assignment,
|
||||||
|
inventory,
|
||||||
|
&certificates,
|
||||||
|
)?);
|
||||||
}
|
}
|
||||||
for publication in publications.iter().filter(|item| item.agent_id == agent.id) {
|
for publication in publications.iter().filter(|item| item.agent_id == agent.id) {
|
||||||
match build_vhost(agent, &publication.assignment, inventory, &certificates) {
|
match build_vhost(
|
||||||
|
agent,
|
||||||
|
&publication.assignment,
|
||||||
|
inventory,
|
||||||
|
&certificates,
|
||||||
|
) {
|
||||||
Ok(host) => generated.push(host),
|
Ok(host) => generated.push(host),
|
||||||
Err(error) => tracing::warn!(
|
Err(error) => tracing::warn!(
|
||||||
agent = %agent.id,
|
agent = %agent.id,
|
||||||
|
|||||||
@@ -1054,4 +1054,94 @@ mod tests {
|
|||||||
assert_eq!(found.len(), 1);
|
assert_eq!(found.len(), 1);
|
||||||
assert_eq!(found[0].message.as_deref(), Some("restarting"));
|
assert_eq!(found[0].message.as_deref(), Some("restarting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn security_agent(assignment: Assignment) -> Agent {
|
||||||
|
Agent {
|
||||||
|
id: "node1".into(),
|
||||||
|
name: "Node 1".into(),
|
||||||
|
endpoint: "http://10.0.0.2:9876".into(),
|
||||||
|
token: "012345678901234567890123".into(),
|
||||||
|
base_domain: "docker1.lab.local".into(),
|
||||||
|
listener_ids: vec!["http".into()],
|
||||||
|
assignments: vec![assignment],
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn docker_assignment_carries_diagnostics_methods_rate_limit_and_security_headers() {
|
||||||
|
let mut desired = crate::config::demo_config("127.0.0.1:9000".parse().unwrap());
|
||||||
|
let assignment: Assignment = serde_json::from_value(serde_json::json!({
|
||||||
|
"service_key": "container:app:8080/tcp",
|
||||||
|
"hostname": "app",
|
||||||
|
"timing_headers": true,
|
||||||
|
"backend_header": true,
|
||||||
|
"backend_timing_header": true,
|
||||||
|
"cloudflare_client_ip": true,
|
||||||
|
"method_policy": {"mode": "allow", "methods": ["GET", "HEAD", "POST"]},
|
||||||
|
"rate_limit": {"enabled": true, "requests": 50, "window_seconds": 10, "burst": 5,
|
||||||
|
"country_access": {"mode": "block", "countries": ["RU"]}},
|
||||||
|
"security_headers": {"hsts": {"enabled": true, "max_age_seconds": 600}, "nosniff": true, "frame_options": "deny"}
|
||||||
|
}))
|
||||||
|
.unwrap();
|
||||||
|
desired.docker_agents.agents.push(security_agent(assignment));
|
||||||
|
let effective = effective_config(desired, &observation(service(), vec![])).unwrap();
|
||||||
|
let host = effective.vhosts.last().unwrap();
|
||||||
|
assert!(host.timing_headers && host.backend_header && host.backend_timing_header);
|
||||||
|
assert!(host.cloudflare_client_ip);
|
||||||
|
assert_eq!(host.method_policy.methods, ["GET", "HEAD", "POST"]);
|
||||||
|
assert!(host.rate_limit.enabled);
|
||||||
|
assert_eq!(host.rate_limit.requests, 50);
|
||||||
|
assert_eq!(host.rate_limit.country_access.countries, ["RU"]);
|
||||||
|
assert!(host.security_headers.hsts.enabled && host.security_headers.nosniff);
|
||||||
|
assert!(!host.transient_unavailable);
|
||||||
|
let plain = serde_json::to_value(Assignment::default()).unwrap();
|
||||||
|
for key in ["timing_headers", "method_policy", "rate_limit", "security_headers"] {
|
||||||
|
assert!(plain.get(key).is_none(), "{key} must not be stored when unused");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn assignment_from_the_removed_login_option_still_loads_and_drops_it() {
|
||||||
|
let assignment: Assignment = serde_json::from_value(serde_json::json!({
|
||||||
|
"service_key": "container:app:8080/tcp",
|
||||||
|
"hostname": "app",
|
||||||
|
"login_vhost_id": "sso"
|
||||||
|
}))
|
||||||
|
.unwrap();
|
||||||
|
assert!(serde_json::to_value(&assignment).unwrap().get("login_vhost_id").is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn docker_assignment_basic_auth_protects_the_generated_vhost() {
|
||||||
|
let mut desired = crate::config::demo_config("127.0.0.1:9000".parse().unwrap());
|
||||||
|
let hash = crate::auth::hash_sync("Correct-Horse-12345").unwrap();
|
||||||
|
let assignment: Assignment = serde_json::from_value(serde_json::json!({
|
||||||
|
"service_key": "container:app:8080/tcp",
|
||||||
|
"hostname": "app",
|
||||||
|
"basic_auth": {"enabled": true, "realm": "Ops", "require_tls": false,
|
||||||
|
"users": [{"username": "ops", "password_hash": hash}]}
|
||||||
|
}))
|
||||||
|
.unwrap();
|
||||||
|
desired.docker_agents.agents.push(security_agent(assignment.clone()));
|
||||||
|
let effective = effective_config(desired.clone(), &observation(service(), vec![])).unwrap();
|
||||||
|
let host = effective.vhosts.last().unwrap();
|
||||||
|
assert!(host.basic_auth.enabled && !host.basic_auth.require_tls);
|
||||||
|
assert_eq!(host.basic_auth.users[0].username, "ops");
|
||||||
|
assert_eq!(
|
||||||
|
host.authentication.map(|choice| choice.provider),
|
||||||
|
Some(crate::auth_provider::IdentityProvider::Basic)
|
||||||
|
);
|
||||||
|
let mut settings = desired.docker_agents.clone();
|
||||||
|
settings.validate(&desired.listeners).unwrap();
|
||||||
|
settings.agents[0].assignments[0].basic_auth.as_mut().unwrap().users.clear();
|
||||||
|
let error = settings.validate(&desired.listeners).unwrap_err();
|
||||||
|
assert!(format!("{error:#}").contains("basic.users_required"), "{error:#}");
|
||||||
|
let mut off = assignment;
|
||||||
|
off.basic_auth.as_mut().unwrap().enabled = false;
|
||||||
|
desired.docker_agents.agents[0].assignments[0] = off;
|
||||||
|
let effective = effective_config(desired, &observation(service(), vec![])).unwrap();
|
||||||
|
let host = effective.vhosts.last().unwrap();
|
||||||
|
assert!(!host.basic_auth.enabled && host.authentication.is_none());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -51,5 +51,5 @@ const events = openapi.paths["/api/events"].get;
|
|||||||
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
|
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
|
||||||
assert.equal(logsFlag?.schema?.type, "boolean");
|
assert.equal(logsFlag?.schema?.type, "boolean");
|
||||||
assert.equal(logsFlag?.schema?.default, true);
|
assert.equal(logsFlag?.schema?.default, true);
|
||||||
assert.equal(openapi.info.version, "0.38.2");
|
assert.equal(openapi.info.version, "0.38.3");
|
||||||
console.log("Panel refresh/API contract checks: OK");
|
console.log("Panel refresh/API contract checks: OK");
|
||||||
Reference in new issue
Block a user