Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af36e083ee | |||
| 6ce6bfdb79 | |||
| b492ccf5f9 | |||
| 43a0dfdadc | |||
| 789d733b72 | |||
| 3ef0424454 | |||
| 1d6a96f971 | |||
| 1d4b567d96 | |||
| 737da4a3b1 | |||
| ee99051c29 | |||
| e12c25b85d | |||
| ee50b3451f | |||
| 00b506670f | |||
| d4da521a91 | |||
| f21876c473 | |||
| 1cc3599f10 | |||
| 8e3a3c01e4 | |||
| e95b86fdeb | |||
| 18169dcbc2 | |||
| 0b406069ee | |||
| c4777a5477 | |||
| c7eb190c3b | |||
| f9ef6e66c3 | |||
| 5e28394de5 | |||
| 9ae721b79f | |||
| 4692044099 | |||
| 08e24e5d40 | |||
| 1358649550 | |||
| d249bcf9f2 | |||
| 1f5e4a59a0 | |||
| d74079c66d | |||
| 84c1c81906 | |||
| ffffa62999 | |||
| 4150848842 | |||
| a278ef3b23 | |||
| 6b2ba163df | |||
| 66dcf75fea | |||
| 39dd8f0f47 | |||
| 7a2aee20eb | |||
| 0e9c2a7bc9 | |||
| dcdff4d414 | |||
| b9ab5006a8 | |||
| 7a32eeb411 | |||
| c2c6454302 | |||
| d035fd3165 | |||
| 7b906de79f | |||
| 6ba3fa4b17 | |||
| 5df34bfae6 |
@@ -0,0 +1,2 @@
|
||||
# Local Fabrica runs: records, logs and artifacts (Fabrica core docs/FORMATS.md)
|
||||
runs/
|
||||
@@ -0,0 +1,11 @@
|
||||
# Ianitor Domi declares itself to Fabrica (Fabrica core docs/FORMATS.md, "Fabrica: the app"): a server part only,
|
||||
# the reverse proxy with its control plane and web UI, deployed by .fabrica/artifex/deploy.yaml through the server's
|
||||
# fabrica-deploy@ianitor. Fabrica's Apps screen shows one card for it: Deploy, then the Custos card. The colour is
|
||||
# the murex accent (packages/ui/src/tokens.css, --accent).
|
||||
name: Ianitor
|
||||
icon: globe
|
||||
color: "#e0a3dc"
|
||||
parts:
|
||||
server:
|
||||
pipeline: deploy
|
||||
input: ianitor
|
||||
@@ -0,0 +1,15 @@
|
||||
# Ianitor Domi onto the server (Fabrica docs/04_deploy.md): `fabrica deploy ianitor`, or Fabrica's Apps → Ianitor →
|
||||
# Deploy. The NixOS runner starts fabrica-deploy@ianitor: the server's clone is fast-forwarded, the flake input
|
||||
# `ianitor` updated (inputs.ianitor.nixosModules.ianitor, docs/deploy/configuration-server.patch), the system
|
||||
# switched, the health check asked, and the switch rolled back if it does not answer. After a deploy run
|
||||
# deploy/test-access.sh from a LAN machine (CLAUDE.md).
|
||||
name: deploy
|
||||
on:
|
||||
manual: true
|
||||
runner: nixos
|
||||
steps:
|
||||
- id: approve
|
||||
approve: "Deploy Ianitor ${{ commit }} to the server?"
|
||||
- id: switch
|
||||
needs: [approve]
|
||||
deploy: ianitor
|
||||
@@ -0,0 +1,39 @@
|
||||
# Ianitor Domi: the five test layers (ROADMAP §5) on a push to main, or by hand. Layer 1 (the differential
|
||||
# suite against Caddy) runs inside the workspace tests; layer 2 is scripts/conformance.sh (h2spec, testssl.sh);
|
||||
# layer 3 tests/fuzz/run.sh (cargo-fuzz, 2 minutes a target; any crash fails); layer 4 the NixOS VM tests;
|
||||
# layer 5 scripts/bench.sh (load and a 5-minute soak against Caddy; results kept as artifacts).
|
||||
# Runner: label `nixos`, on a host with /dev/kvm and Nix's `kvm` system feature (the VM tests; on Hyper-V,
|
||||
# nested virtualisation on), outbound HTTPS (crates.io, cache.nixos.org) and about 20 GB free. Every tool comes
|
||||
# from the flake's `ci` shell, so the runner needs only Nix with flakes.
|
||||
name: layers
|
||||
on:
|
||||
push: [main]
|
||||
manual: true
|
||||
runner: nixos
|
||||
env:
|
||||
CARGO_TERM_COLOR: "never"
|
||||
CARGO_BUILD_JOBS: "8"
|
||||
steps:
|
||||
- id: workspace-tests
|
||||
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c cargo test --workspace --no-fail-fast
|
||||
- id: conformance
|
||||
needs: [workspace-tests]
|
||||
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/conformance.sh
|
||||
artifacts: ["bench/conformance/*"]
|
||||
- id: fuzz
|
||||
needs: [workspace-tests]
|
||||
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c tests/fuzz/run.sh 120
|
||||
- id: vm-apply-reverts
|
||||
nix: .#checks.x86_64-linux.vm-apply-reverts
|
||||
- id: vm-engine-switch
|
||||
nix: .#checks.x86_64-linux.vm-engine-switch
|
||||
- id: vm-intermediate-renewal
|
||||
nix: .#checks.x86_64-linux.vm-intermediate-renewal
|
||||
- id: vm-control-loopback
|
||||
nix: .#checks.x86_64-linux.vm-control-loopback
|
||||
- id: vm-sockets
|
||||
nix: .#checks.x86_64-linux.vm-sockets
|
||||
- id: load
|
||||
needs: [conformance, fuzz]
|
||||
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/bench.sh fabrica-runner
|
||||
artifacts: ["bench/results/**"]
|
||||
@@ -0,0 +1,53 @@
|
||||
# Ianitor Domi: the Gitea release of a v* tag (docs/release.md). Ianitor ships no binary (the server builds it with
|
||||
# Nix and the deploy pipeline switches it in), so a release is its notes and screenshots of the web UI, published under
|
||||
# a SHA256SUMS signed by domi-release through Custos; release-notes.md is also the release's text on Gitea.
|
||||
# The Windows runner (the Fabrica app on Mark's PC) runs it: `fabrica`, node and pnpm are on every step's PATH.
|
||||
# No Gitea webhook to the hub yet: a pushed tag is started on demand (the hub's POST /api/runs, ref v<version>).
|
||||
# `notes` is Fabrica's release notes since the previous v* tag (Fabrica docs/12_release_kit.md); `shots` takes the
|
||||
# same files as `fabrica aula shots` (core docs/FORMATS.md, "Fabrica: the Aula page") from the built web UI against
|
||||
# the demo control plane with invented data, in headless Edge. No landing page while app.yaml has no `aula: true`.
|
||||
# `pin` publishes the Nix build's NAR hashes (.fabrica/nix/pin.json, written by scripts/nix-pin.sh on Linux at a
|
||||
# clean commit and committed before the tag) as ianitor-nix.json, and refuses a pin made from other code than the
|
||||
# tag's (its recorded source tree must be the tag's); that check is the gate, since pipelines cannot depend on one
|
||||
# another. The `verify-nix` pipeline rebuilds the tag on the NixOS runner and compares (docs/verify.md).
|
||||
name: release
|
||||
on:
|
||||
tag: "v*"
|
||||
manual: true
|
||||
runner: windows
|
||||
steps:
|
||||
- id: version
|
||||
run: node scripts/check-version.mjs ${{ version }}
|
||||
- id: install
|
||||
run: pnpm install --frozen-lockfile
|
||||
- id: check
|
||||
needs: [install]
|
||||
run: pnpm --filter web check
|
||||
- id: test
|
||||
needs: [install]
|
||||
run: pnpm --filter web test
|
||||
- id: notes
|
||||
run: fabrica notes
|
||||
artifacts: ["target/notes/release-notes.md", "target/notes/release-notes.json"]
|
||||
- id: shots
|
||||
needs: [check, test]
|
||||
run: node apps/web/scripts/shots.mjs
|
||||
artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"]
|
||||
- id: pin
|
||||
needs: [version]
|
||||
run: node scripts/release-pin.mjs ${{ version }} ${{ tag }} ${{ commit }}
|
||||
artifacts: ["target/nix/ianitor-nix.json"]
|
||||
- id: approve
|
||||
needs: [version, notes, shots, pin]
|
||||
approve: "Publish Ianitor ${{ tag }}: its notes and screenshots?"
|
||||
- id: publish
|
||||
needs: [approve]
|
||||
publish:
|
||||
gitea-release: true
|
||||
files:
|
||||
- "**/release-notes.md"
|
||||
- "**/release-notes.json"
|
||||
- "**/aula-*.png"
|
||||
- "**/aula.json"
|
||||
- "**/ianitor-nix.json"
|
||||
sums: domi-release
|
||||
@@ -0,0 +1,18 @@
|
||||
# Ianitor Domi: the verifiable build (docs/verify.md). On a v* tag the NixOS runner builds .#ianitor and
|
||||
# .#ianitor-web from the tag (the run record keeps each output's store path and NAR hash), rebuilds each output
|
||||
# derivation once more, and compares with the pin the release publishes (.fabrica/nix/pin.json at the tag: the
|
||||
# source tree, nixpkgs and every hash); any difference fails the run. Runner: label `nixos`, Nix with flakes,
|
||||
# node and jq from the `ci` shell; no KVM needed.
|
||||
name: verify-nix
|
||||
on:
|
||||
tag: "v*"
|
||||
manual: true
|
||||
runner: nixos
|
||||
steps:
|
||||
- id: ianitor
|
||||
nix: .#ianitor
|
||||
- id: web
|
||||
nix: .#ianitor-web
|
||||
- id: pin
|
||||
needs: [ianitor, web]
|
||||
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/nix-pin.sh --check
|
||||
@@ -0,0 +1,18 @@
|
||||
The first release of Ianitor Domi: a reverse proxy for a home server, built on Cloudflare's Pingora, with Caddy as a
|
||||
tested fallback, a small Domi certificate authority, and a web UI where every change takes three clicks or fewer.
|
||||
|
||||
- **Hosts in plain words.** Add a host, say where its traffic goes, pick a Domi or Let's Encrypt certificate and
|
||||
whether visitors sign in first (Authelia forward-auth). Each host is checked for health and shows healthy,
|
||||
degraded or down.
|
||||
- **Changes that undo themselves.** Every change is compiled, tried, and watched for 60 seconds; if a host stops
|
||||
answering, it is reverted on its own. Routes live in a git repository, one file per host, with Undo and a
|
||||
history you can restore any kept version from.
|
||||
- **Two engines.** Pingora serves; Caddy is built from the same routes, compared host by host, and can take over at
|
||||
runtime in about two seconds.
|
||||
- **The Domi CA.** Certificates for hosts reached only from home, and device certificates (mTLS) for phones,
|
||||
computers and Domi apps, from an intermediate whose root stays offline.
|
||||
- **Share links**, signed and time-limited, for a single host.
|
||||
- **NixOS-native.** A flake with the module and VM tests; deployed through Fabrica.
|
||||
|
||||
The changes below are the merges since the first commit; PR 3 to 5 are the control plane (phase 2), the decisions
|
||||
on the open points, and the web UI, the Domi CA and the NixOS module (phase 3).
|
||||
@@ -4,7 +4,8 @@ Ianitor is a reverse proxy built on Cloudflare's Pingora, with a small Domi CA,
|
||||
NixOS-native, with Caddy as a tested fallback. MPL-2.0. Plan, decisions and status: docs/ROADMAP.md — read it first.
|
||||
|
||||
## Layout
|
||||
crates/core config model, schema, compilers (Pingora runtime + Caddy JSON), CA. Pure: no I/O, no network.
|
||||
crates/core config model, schema, compilers (Pingora runtime + Caddy JSON), CA (Ianitor's view of the shared
|
||||
crate domi-pki, pinned by tag). Pure: no I/O, no network.
|
||||
crates/edge Pingora data plane. Reads compiled config, serves traffic. Never decides policy.
|
||||
crates/control API, git routes repo, apply/rollback, share links, PKI flows. Loopback only. Never serves public traffic.
|
||||
apps/web Svelte 5 (runes, TypeScript strict). A client of the API; no logic.
|
||||
@@ -13,17 +14,28 @@ tests/diff same requests against Ianitor and Caddy, responses compared.
|
||||
tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only.
|
||||
tests/fuzz cargo-fuzz targets.
|
||||
deploy/nixos NixOS module + VM tests.
|
||||
scripts version check, release pin, test layers 2 and 5 (conformance, bench), the Nix pin. Releases: docs/release.md.
|
||||
bench layer 5 results as data (CSV/JSON), layer 2 outputs.
|
||||
|
||||
## Commands
|
||||
cargo test --workspace # quote test counts per crate; an exit code alone is not green
|
||||
cargo run -p ianitor-control -- --dev
|
||||
pnpm --filter web dev # 127.0.0.1 only, never --host
|
||||
node apps/web/scripts/shots.mjs # the release's screenshots (demo data, headless Edge) -> target/aula (docs/release.md)
|
||||
node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry the version
|
||||
scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci)
|
||||
tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions
|
||||
scripts/bench.sh <label> # layer 5: load and soak vs Caddy -> bench/results
|
||||
scripts/nix-pin.sh # reproducible build check; writes .fabrica/nix/pin.json before a tag
|
||||
nix build .#ianitor
|
||||
nix flake check # includes NixOS VM tests (Linux + KVM)
|
||||
|
||||
On Windows, build and test in WSL2 Debian (ROADMAP §8.3: Pingora's Windows support is best effort; edge, diff and
|
||||
ACME tests are Linux-only). Use a Linux target dir, and put caddy, pebble and pebble-challtestsrv on PATH (`nix profile add nixpkgs#caddy nixpkgs#pebble`):
|
||||
wsl -d Debian -- bash -lc 'cd /mnt/f/Akce/Ianitor && CARGO_TARGET_DIR=$HOME/ianitor-target cargo test --workspace'
|
||||
On Windows, build and test in WSL2 Ubuntu (distro `Ubuntu`, 26.04, root; ROADMAP §8.3: Pingora's Windows support is
|
||||
best effort; edge, diff and ACME tests are Linux-only). Rust from rustup in $HOME (stable; nightly for cargo-fuzz), a
|
||||
Linux target dir, and caddy, pebble and pebble-challtestsrv on PATH: with Nix, `nix profile add nixpkgs#caddy
|
||||
nixpkgs#pebble`; without it (as now), `apt install pebble testssl.sh golang-go` and
|
||||
`go install github.com/caddyserver/caddy/v2/cmd/caddy@v2.11.7` (apt's Caddy 2.6 is too old for the diff suite):
|
||||
wsl -d Ubuntu -- bash -lc 'cd /mnt/f/Akce/Ianitor && PATH=$HOME/.cargo/bin:$HOME/go/bin:$PATH CARGO_TARGET_DIR=$HOME/ianitor-target cargo test --workspace'
|
||||
One-time per clone: git config core.hooksPath .githooks (self-test: bash .githooks/test-pre-commit.sh)
|
||||
|
||||
## Rules
|
||||
@@ -31,6 +43,10 @@ One-time per clone: git config core.hooksPath .githooks (self-test: bash .gith
|
||||
- Never in git: target/, node_modules/, dist/, binaries, private keys, files over 5 MB. A pre-commit hook enforces it.
|
||||
- $GITEA_TOKEN never echoed or written anywhere. Secrets come only from Custos or systemd credentials, never the Nix store.
|
||||
- ianitor-control and every dev server listen on 127.0.0.1 only; only ianitor-edge binds public ports.
|
||||
- Disks (Mark's machine): never write, move or delete anything on C:, and nothing on D: either. Everything goes on F:
|
||||
(build output, clones, caches, temp files, tools, WSL swap), under F:\C-Drive-Migration when it replaces a C: path.
|
||||
The only file kept on C: is C:\Users\chode\.wslconfig (WSL reads it only there; it points swap to F:). Every agent's
|
||||
brief repeats this rule.
|
||||
- Route files, API bodies, CSRs, headers and share tokens are hostile input: typed Result, no unwrap() on input paths, no swallowed errors.
|
||||
- Every route change goes through the core compiler and the differential tests.
|
||||
- Tests first only where the risk is: parsing, CA, share tokens, forward-auth, apply/rollback, secret injection.
|
||||
|
||||
Generated
+29
-3
@@ -859,6 +859,21 @@ dependencies = [
|
||||
"syn 3.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "domi-pki"
|
||||
version = "1.0.0"
|
||||
source = "git+https://gitea.marek-novak.cz/mnovak/domi-pki?tag=v1.0.0#b1ec5b3196fc22355270f381e5a7748c50e3380d"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"rcgen",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"thiserror 2.0.21",
|
||||
"time",
|
||||
"x509-parser 0.18.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.3"
|
||||
@@ -1319,24 +1334,26 @@ name = "ianitor-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"rcgen",
|
||||
"domi-pki",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.21",
|
||||
"time",
|
||||
"toml",
|
||||
"unicode-normalization",
|
||||
"url",
|
||||
"x509-parser 0.18.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ianitor-diff"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"ianitor-control",
|
||||
"ianitor-core",
|
||||
"ianitor-edge",
|
||||
@@ -1375,6 +1392,15 @@ dependencies = [
|
||||
"x509-parser 0.18.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ianitor-fuzz"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ianitor-core",
|
||||
"ianitor-edge",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ianitor-testkit"
|
||||
version = "0.1.0"
|
||||
|
||||
+12
-1
@@ -1,6 +1,15 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = ["crates/core", "crates/edge", "crates/control", "tests/diff", "tests/support"]
|
||||
members = [
|
||||
"crates/core",
|
||||
"crates/edge",
|
||||
"crates/control",
|
||||
"tests/diff",
|
||||
"tests/fuzz",
|
||||
"tests/support",
|
||||
]
|
||||
# cargo-fuzz's own workspace (libFuzzer flags): tests/fuzz/fuzz.
|
||||
exclude = ["tests/fuzz/fuzz"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
@@ -13,6 +22,8 @@ publish = false
|
||||
ianitor-core = { path = "crates/core" }
|
||||
ianitor-edge = { path = "crates/edge" }
|
||||
ianitor-testkit = { path = "tests/support" }
|
||||
# The Domi CA, shared with Fabrica (docs/32_coherence.md T3a); pinned by tag.
|
||||
domi-pki = { git = "https://gitea.marek-novak.cz/mnovak/domi-pki", tag = "v1.0.0" }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.145"
|
||||
toml = "1.2.1"
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# Ianitor Domi
|
||||
|
||||
[](docs/verify.md)
|
||||
|
||||
*Ianitor* is Latin for the doorkeeper: it decides who comes through the door (routing, TLS) and checks
|
||||
credentials (certificates). Ianitor Domi is a reverse proxy for a home server, built on Cloudflare's
|
||||
[Pingora](https://github.com/cloudflare/pingora), with a small certificate authority for your own devices, a web
|
||||
UI, an API, and a NixOS module. MPL-2.0.
|
||||
|
||||
- **Routes in git.** One TOML file per host in a repository (`hosts/wiki.example.toml`), schema-checked. Every
|
||||
change is a commit, applied live without `nixos-rebuild`, watched for 60 seconds, and reverted by itself if the
|
||||
host stops answering. Undo is one click; any older state can be restored.
|
||||
- **Two processes.** `ianitor-edge` serves traffic and decides nothing; `ianitor-control` (API and UI, loopback
|
||||
and Unix sockets only) edits the routes and tells edge what to serve. Traffic keeps flowing when control stops.
|
||||
- **TLS your way.** Let's Encrypt for public names; for everything internal, the Domi CA: the root stays offline,
|
||||
the intermediate on the server is renewed yearly, device certificates enable mTLS for a host.
|
||||
- **What a home server needs, and no more.** Forward-auth to Authelia (existing protected services keep working),
|
||||
header rules whose values can be systemd credentials (never written anywhere), websockets, health checks,
|
||||
share links (an expiring, optionally password-protected link to one path), a truncated, opt-in visit log.
|
||||
- **Caddy as the fallback.** The same route model compiles to Caddy JSON too, and one click switches engines at
|
||||
runtime. Differential tests send the same requests to both on every build, so the fallback stays honest.
|
||||
|
||||
It is one person's project for one home network, published because the approach may be useful to others. It is
|
||||
not a general-purpose proxy: no HTTP/3, no load-balancing policies beyond round robin over healthy upstreams, no
|
||||
plugin system. Status, decisions and what is not done: [docs/ROADMAP.md](docs/ROADMAP.md).
|
||||
|
||||
## Why Pingora
|
||||
|
||||
Pingora is a library, not a server: Ianitor owns the request path (host lookup, forward-auth, share links,
|
||||
header rules, upstream choice) in plain Rust, and gets HTTP/1, HTTP/2, websockets, TLS (rustls) and connection
|
||||
pooling from code that serves a large share of the web at Cloudflare. A memory-safe data plane with no config
|
||||
language between the routes and the code was the point; speed was not, and the numbers below say so.
|
||||
|
||||
Caddy is excellent, and Ianitor keeps it as the fallback engine. What Ianitor adds on top is the workflow: routes
|
||||
as reviewed commits with automatic rollback, a CA for the house, and a UI where every common action takes at most
|
||||
three clicks.
|
||||
|
||||
## Benchmarks (honest ones)
|
||||
|
||||
Load and soak runs against Caddy 2 on the same machine, the same route and the same upstream
|
||||
(`scripts/bench.sh`, ROADMAP §5 layer 5). Results are committed as data in [bench/](bench/), with the machine
|
||||
described beside them; [bench/README.md](bench/README.md) summarises them, including where Caddy wins. Two caveats
|
||||
apply to every number there: the load generator, the proxies and the upstream share one machine, and edge runs
|
||||
Pingora with two worker threads (a home server's budget), so Caddy is also measured with `GOMAXPROCS=2`.
|
||||
|
||||
## Install (NixOS)
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
inputs.ianitor.url = "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git";
|
||||
# configuration
|
||||
imports = [ inputs.ianitor.nixosModules.ianitor ];
|
||||
services.ianitor = {
|
||||
enable = true;
|
||||
edge.openFirewall = true;
|
||||
shareLinkKeyFile = "/run/secrets/ianitor-share-link-key"; # never a store path; the module refuses one
|
||||
};
|
||||
```
|
||||
|
||||
Then `ianitor-control token create --name laptop --config /etc/ianitor/control.toml` for the API, or the web UI
|
||||
behind Authelia ([docs/api.md](docs/api.md), "Sign-in"). Beside an existing Caddy, edge can sit behind it on a Unix
|
||||
socket: [docs/deploy/beside-caddy.md](docs/deploy/beside-caddy.md). The CA: [docs/pki.md](docs/pki.md).
|
||||
|
||||
## Tests
|
||||
|
||||
Five layers (ROADMAP §5), all in the `layers` pipeline (`.fabrica/artifex/layers.yaml`):
|
||||
|
||||
| Layer | What | Run it |
|
||||
| :-- | :-- | :-- |
|
||||
| 1 Differential | the same request corpus against Ianitor and Caddy, answers compared | `cargo test -p ianitor-diff` |
|
||||
| 2 Conformance | h2spec and testssl.sh against both engines | `scripts/conformance.sh` |
|
||||
| 3 Fuzzing | route files, header rules, share tokens, share-link paths, the CA's PEM and CSR parsing | `tests/fuzz/run.sh` |
|
||||
| 4 NixOS VM tests | rollback, engine switch, CA renewal, loopback-only control, the sockets | `nix flake check` (KVM) |
|
||||
| 5 Load and soak | against Caddy, results kept as data | `scripts/bench.sh` |
|
||||
|
||||
`cargo test --workspace` runs the unit, integration and layer 1 tests; most of them need Linux (Pingora's Windows
|
||||
support is best effort), Caddy and Pebble on PATH: `nix develop .#ci`.
|
||||
|
||||
## Releases and verification
|
||||
|
||||
A release is a signed manifest, not a binary: `SHA256SUMS` signed by `domi-release` (through Custos) over the
|
||||
release notes, screenshots of the UI and `ianitor-nix.json`, the NAR hashes of the Nix build at the tagged commit.
|
||||
Anyone can rebuild the pinned commit and compare the hashes: [docs/verify.md](docs/verify.md). What is checked
|
||||
so far is narrower than "reproducible": the output derivations are rebuilt once and compared, with dependencies
|
||||
from the binary cache, and that has not run yet; the first pin needs a machine with Nix.
|
||||
|
||||
## Support
|
||||
|
||||
The source is free. If Ianitor is useful to you, you can **adopt a red panda**: support the project, and a fifth of
|
||||
everything it receives goes to the [Red Panda Network](https://redpandanetwork.org), remitted once a year with the
|
||||
receipt published. How it works and where it stands: [docs/support.md](docs/support.md).
|
||||
|
||||
## Licence
|
||||
|
||||
[MPL-2.0](LICENSE). Pingora is Apache-2.0; Caddy, used only as a separate fallback process, Apache-2.0.
|
||||
@@ -9,7 +9,8 @@
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings",
|
||||
"test": "vitest run"
|
||||
"test": "vitest run",
|
||||
"shots": "node scripts/shots.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ianitor/ui": "workspace:*"
|
||||
|
||||
@@ -0,0 +1,418 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// The release's screenshots of the web UI (docs/release.md):
|
||||
// node apps/web/scripts/shots.mjs [--out <dir>] (default: <repo>/target/aula)
|
||||
// Builds the UI, serves it on 127.0.0.1 with /api/v1 answered by the demo control plane
|
||||
// (tests/demo.ts: invented data only), photographs each shot of demo.ts's SHOTS in headless Edge
|
||||
// or Chrome over DevTools, and writes aula-<name>.png and aula.json in the format of Fabrica's
|
||||
// core docs/FORMATS.md ("Fabrica: the Aula page"). On every way out the browser's process tree
|
||||
// and the server are stopped and the temporary folder is removed.
|
||||
// Exit codes: 0 done, 1 a problem, 130 cancelled.
|
||||
|
||||
import { spawn, spawnSync } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
||||
import { createServer as createHttpServer } from "node:http";
|
||||
import { tmpdir } from "node:os";
|
||||
import { basename, delimiter, dirname, extname, join, normalize, resolve, sep } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { build, createServer as createViteServer } from "vite";
|
||||
|
||||
const web = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const repo = resolve(web, "../..");
|
||||
const WAIT_MS = 20_000;
|
||||
|
||||
function usage(msg) {
|
||||
console.error(`shots: ${msg}\nusage: node apps/web/scripts/shots.mjs [--out <dir>]`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let out = join(repo, "target", "aula");
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
const a = process.argv[i];
|
||||
if (a === "--out" && process.argv[i + 1]) out = resolve(process.argv[++i]);
|
||||
else usage(`unknown argument ${a}`);
|
||||
}
|
||||
|
||||
const log = (m) => console.log(`shots: ${m}`);
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
// ---------- cleanup on every way out ----------
|
||||
|
||||
const cleanups = [];
|
||||
let cleaning = false;
|
||||
async function cleanup() {
|
||||
if (cleaning) return;
|
||||
cleaning = true;
|
||||
for (const f of cleanups.reverse()) {
|
||||
try {
|
||||
await f();
|
||||
} catch (e) {
|
||||
console.error(`shots: cleanup: ${e?.message ?? e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
process.on("SIGINT", () => void cleanup().then(() => process.exit(130)));
|
||||
process.on("SIGTERM", () => void cleanup().then(() => process.exit(130)));
|
||||
|
||||
// ---------- the output folder ----------
|
||||
|
||||
function clearOutput() {
|
||||
mkdirSync(out, { recursive: true });
|
||||
for (const n of readdirSync(out)) {
|
||||
if (n === "aula.json" || (n.startsWith("aula-") && n.endsWith(".png"))) rmSync(join(out, n), { force: true });
|
||||
}
|
||||
}
|
||||
|
||||
/** Width and height from the PNG's IHDR, not assumed. */
|
||||
function pngSize(png) {
|
||||
const sig = "89504e470d0a1a0a";
|
||||
if (png.length < 24 || png.subarray(0, 8).toString("hex") !== sig || png.subarray(12, 16).toString("latin1") !== "IHDR") {
|
||||
throw new Error("the browser's capture is not a PNG");
|
||||
}
|
||||
return { width: png.readUInt32BE(16), height: png.readUInt32BE(20) };
|
||||
}
|
||||
|
||||
// ---------- the demo control plane and the built UI on 127.0.0.1 ----------
|
||||
|
||||
const TYPES = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
".js": "text/javascript; charset=utf-8",
|
||||
".css": "text/css; charset=utf-8",
|
||||
".json": "application/json",
|
||||
".svg": "image/svg+xml",
|
||||
".png": "image/png",
|
||||
".ico": "image/x-icon",
|
||||
".woff": "font/woff",
|
||||
".woff2": "font/woff2",
|
||||
".txt": "text/plain; charset=utf-8",
|
||||
};
|
||||
|
||||
function serve(dist, api) {
|
||||
const index = readFileSync(join(dist, "index.html"));
|
||||
const server = createHttpServer((req, res) => {
|
||||
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
||||
if (url.pathname.startsWith("/api/v1/") || url.pathname === "/api/v1") {
|
||||
const chunks = [];
|
||||
req.on("data", (c) => chunks.push(c));
|
||||
req.on("end", () => {
|
||||
let body = {};
|
||||
try {
|
||||
body = chunks.length ? JSON.parse(Buffer.concat(chunks).toString("utf8")) : {};
|
||||
} catch {
|
||||
body = {};
|
||||
}
|
||||
const a = api(req.method ?? "GET", url.pathname.slice("/api/v1".length) + url.search, body);
|
||||
res.writeHead(a.status, { "Content-Type": "application/json", "Cache-Control": "no-store" });
|
||||
res.end(a.text ?? undefined);
|
||||
});
|
||||
return;
|
||||
}
|
||||
// The built files; any other path is the app's own route, answered with index.html.
|
||||
const file = normalize(join(dist, decodeURIComponent(url.pathname)));
|
||||
if (file.startsWith(dist + sep) && existsSync(file) && statSync(file).isFile()) {
|
||||
res.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" });
|
||||
res.end(readFileSync(file));
|
||||
return;
|
||||
}
|
||||
res.writeHead(200, { "Content-Type": TYPES[".html"], "Cache-Control": "no-store" });
|
||||
res.end(index);
|
||||
});
|
||||
return new Promise((ok, fail) => {
|
||||
server.once("error", fail);
|
||||
server.listen(0, "127.0.0.1", () => ok(server));
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- the browser ----------
|
||||
|
||||
function findBrowser() {
|
||||
const named = process.env.IANITOR_SHOTS_BROWSER;
|
||||
if (named) {
|
||||
if (!existsSync(named)) throw new Error(`IANITOR_SHOTS_BROWSER: ${named} does not exist`);
|
||||
return named;
|
||||
}
|
||||
const candidates = [];
|
||||
if (process.platform === "win32") {
|
||||
for (const base of [process.env["ProgramFiles(x86)"], process.env.ProgramFiles, process.env.LOCALAPPDATA].filter(Boolean)) {
|
||||
candidates.push(join(base, "Microsoft", "Edge", "Application", "msedge.exe"), join(base, "Google", "Chrome", "Application", "chrome.exe"));
|
||||
}
|
||||
} else {
|
||||
for (const dir of (process.env.PATH ?? "").split(delimiter).filter(Boolean)) {
|
||||
for (const n of ["chromium", "chromium-browser", "google-chrome", "google-chrome-stable", "microsoft-edge"]) candidates.push(join(dir, n));
|
||||
}
|
||||
candidates.push("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
|
||||
}
|
||||
const found = candidates.find((c) => existsSync(c));
|
||||
if (!found) throw new Error("no Microsoft Edge or Chrome found; set IANITOR_SHOTS_BROWSER to a Chromium browser");
|
||||
return found;
|
||||
}
|
||||
|
||||
/** Only what a program needs to run, the user folders in the temporary folder, nothing of the runner's. */
|
||||
function cleanEnv(home) {
|
||||
const keep = /^(SystemRoot|SystemDrive|windir|ComSpec|PATH|PATHEXT|OS|PROCESSOR_.*|NUMBER_OF_PROCESSORS|ProgramFiles.*|ProgramW6432|CommonProgramFiles.*|CommonProgramW6432|ProgramData|ALLUSERSPROFILE|PUBLIC|LANG|TZ)$/i;
|
||||
const env = {};
|
||||
for (const [k, v] of Object.entries(process.env)) if (keep.test(k) && v !== undefined) env[k] = v;
|
||||
for (const d of ["home", "appdata", "local", "temp"]) mkdirSync(join(home, d), { recursive: true });
|
||||
Object.assign(env, {
|
||||
HOME: join(home, "home"),
|
||||
USERPROFILE: join(home, "home"),
|
||||
APPDATA: join(home, "appdata"),
|
||||
LOCALAPPDATA: join(home, "local"),
|
||||
TEMP: join(home, "temp"),
|
||||
TMP: join(home, "temp"),
|
||||
TMPDIR: join(home, "temp"),
|
||||
});
|
||||
return env;
|
||||
}
|
||||
|
||||
/** Edge may start its browser again as a new process, outside the tree: on Windows, anything still
|
||||
* running with a profile in the temporary folder is stopped by its command line. */
|
||||
function sweep(exe, tmp) {
|
||||
if (process.platform !== "win32") return;
|
||||
const script = "Get-CimInstance Win32_Process -Filter \"Name='$env:SHOTS_EXE'\" | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($env:SHOTS_TMP) } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }";
|
||||
spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script], {
|
||||
stdio: "ignore",
|
||||
windowsHide: true,
|
||||
env: { ...cleanEnv(join(tmp, "sweep")), SHOTS_EXE: basename(exe), SHOTS_TMP: tmp },
|
||||
});
|
||||
}
|
||||
|
||||
function killTree(child) {
|
||||
if (!child.pid || child.exitCode !== null) return;
|
||||
if (process.platform === "win32") {
|
||||
spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
||||
} else {
|
||||
try {
|
||||
process.kill(-child.pid, "SIGKILL");
|
||||
} catch {
|
||||
child.kill("SIGKILL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Starts the browser; one that has not opened DevTools after 20 s is killed and started again, twice. */
|
||||
async function startBrowser(exe, tmp, size) {
|
||||
for (let attempt = 1; ; attempt++) {
|
||||
try {
|
||||
return await launch(exe, join(tmp, `profile-${attempt}`), join(tmp, `user-${attempt}`), size);
|
||||
} catch (e) {
|
||||
if (attempt === 3 || e.fatal) throw e;
|
||||
log(`${e.message}; starting it again`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function launch(exe, profile, user, size) {
|
||||
mkdirSync(profile, { recursive: true });
|
||||
const args = [
|
||||
"--headless=new",
|
||||
"--remote-debugging-port=0",
|
||||
"--remote-debugging-address=127.0.0.1",
|
||||
`--user-data-dir=${profile}`,
|
||||
"--no-first-run",
|
||||
"--no-default-browser-check",
|
||||
"--disable-extensions",
|
||||
"--disable-sync",
|
||||
"--disable-background-networking",
|
||||
"--disable-component-update",
|
||||
"--disable-default-apps",
|
||||
"--disable-features=Translate,OptimizationHints,MediaRouter,msSmartScreenProtection",
|
||||
"--hide-scrollbars",
|
||||
"--mute-audio",
|
||||
"--force-color-profile=srgb",
|
||||
"--force-device-scale-factor=1",
|
||||
`--window-size=${size.width},${size.height}`,
|
||||
"about:blank",
|
||||
];
|
||||
const child = spawn(exe, args, { env: cleanEnv(user), stdio: ["ignore", "ignore", "pipe"], windowsHide: true, detached: process.platform !== "win32" });
|
||||
const stop = async () => {
|
||||
killTree(child);
|
||||
for (let i = 0; i < 50 && child.exitCode === null && child.signalCode === null; i++) await sleep(100);
|
||||
};
|
||||
cleanups.push(stop);
|
||||
let stderr = "";
|
||||
child.stderr.on("data", (d) => (stderr = (stderr + d).slice(-2000)));
|
||||
const fail = async (msg, fatal = false) => {
|
||||
await stop();
|
||||
const tail = stderr.trim().split(/\r?\n/).slice(-3).join(" | ");
|
||||
throw Object.assign(new Error(`${msg}${tail ? `; it said: ${tail}` : ""}`), { fatal });
|
||||
};
|
||||
let exited = null;
|
||||
child.on("exit", (code) => (exited = code ?? -1));
|
||||
child.on("error", (e) => (exited = e.message));
|
||||
|
||||
const portFile = join(profile, "DevToolsActivePort");
|
||||
const deadline = Date.now() + 20_000;
|
||||
let seen = "no DevToolsActivePort yet";
|
||||
for (;;) {
|
||||
if (exited !== null) await fail(`the browser exited before it was ready (${exited})`, typeof exited === "string");
|
||||
if (existsSync(portFile)) {
|
||||
const port = Number(readFileSync(portFile, "utf8").split(/\r?\n/)[0]);
|
||||
if (port > 0) {
|
||||
try {
|
||||
const list = await (await fetch(`http://127.0.0.1:${port}/json/list`)).json();
|
||||
const page = list.find((t) => t.type === "page" && t.webSocketDebuggerUrl);
|
||||
if (page) return page.webSocketDebuggerUrl;
|
||||
seen = `no page among ${list.length} targets on port ${port}`;
|
||||
await fetch(`http://127.0.0.1:${port}/json/new?about:blank`, { method: "PUT" }).catch(() => {});
|
||||
} catch (e) {
|
||||
seen = `port ${port}: ${e.cause?.message ?? e.message}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Date.now() > deadline) await fail(`the browser's DevTools did not answer within 20 s (${seen})`);
|
||||
await sleep(200);
|
||||
}
|
||||
}
|
||||
|
||||
/** A minimal DevTools client over Node's WebSocket. */
|
||||
async function devtools(url) {
|
||||
const ws = new WebSocket(url);
|
||||
await new Promise((ok, fail) => {
|
||||
ws.onopen = ok;
|
||||
ws.onerror = () => fail(new Error("cannot open the browser's DevTools socket"));
|
||||
});
|
||||
let id = 0;
|
||||
const pending = new Map();
|
||||
ws.onmessage = (m) => {
|
||||
const msg = JSON.parse(String(m.data));
|
||||
const p = msg.id !== undefined && pending.get(msg.id);
|
||||
if (!p) return;
|
||||
pending.delete(msg.id);
|
||||
if (msg.error) p.fail(new Error(`${p.method}: ${msg.error.message}`));
|
||||
else p.ok(msg.result);
|
||||
};
|
||||
ws.onclose = () => {
|
||||
for (const p of pending.values()) p.fail(new Error("the browser closed its DevTools socket"));
|
||||
pending.clear();
|
||||
};
|
||||
cleanups.push(() => ws.close());
|
||||
const send = (method, params = {}) =>
|
||||
new Promise((ok, fail) => {
|
||||
const n = ++id;
|
||||
pending.set(n, { ok, fail, method });
|
||||
ws.send(JSON.stringify({ id: n, method, params }));
|
||||
});
|
||||
/** The value of an expression in the page; a page being replaced answers again later. */
|
||||
const evaluate = async (expression) => {
|
||||
const r = await send("Runtime.evaluate", { expression, awaitPromise: true, returnByValue: true });
|
||||
if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description ?? r.exceptionDetails.text);
|
||||
return r.result.value;
|
||||
};
|
||||
return { send, evaluate };
|
||||
}
|
||||
|
||||
async function until(what, test) {
|
||||
const deadline = Date.now() + WAIT_MS;
|
||||
let last = null;
|
||||
while (Date.now() < deadline) {
|
||||
try {
|
||||
if (await test()) return;
|
||||
} catch (e) {
|
||||
last = e;
|
||||
}
|
||||
await sleep(100);
|
||||
}
|
||||
throw new Error(`waited ${WAIT_MS / 1000} s for ${what}${last ? ` (${last.message})` : ""}`);
|
||||
}
|
||||
|
||||
// ---------- the shots ----------
|
||||
|
||||
async function main() {
|
||||
clearOutput();
|
||||
const tmp = mkdtempSync(join(tmpdir(), "ianitor-shots-"));
|
||||
cleanups.push(async () => {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
try {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
return;
|
||||
} catch {
|
||||
await sleep(250);
|
||||
}
|
||||
}
|
||||
console.error(`shots: could not remove ${tmp}`);
|
||||
});
|
||||
|
||||
// The demo's shots and answers, from the TypeScript the tests use.
|
||||
const loader = await createViteServer({
|
||||
root: web,
|
||||
configFile: false,
|
||||
logLevel: "error",
|
||||
appType: "custom",
|
||||
server: { middlewareMode: true, hmr: false, ws: false },
|
||||
optimizeDeps: { noDiscovery: true, include: [] },
|
||||
});
|
||||
let demo;
|
||||
try {
|
||||
demo = await loader.ssrLoadModule("/tests/demo.ts");
|
||||
} finally {
|
||||
await loader.close();
|
||||
}
|
||||
const { SHOTS, SIZE, demoApi } = demo;
|
||||
|
||||
log("building the web UI");
|
||||
const dist = join(tmp, "dist");
|
||||
await build({ root: web, logLevel: "warn", build: { outDir: dist, emptyOutDir: true } });
|
||||
|
||||
const server = await serve(dist, demoApi());
|
||||
cleanups.push(() => new Promise((r) => server.close(() => r())));
|
||||
server.closeAllConnections && cleanups.push(() => server.closeAllConnections());
|
||||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
log(`demo control plane and UI on ${base}`);
|
||||
|
||||
const exe = findBrowser();
|
||||
log(`browser: ${exe}`);
|
||||
cleanups.push(() => sweep(exe, tmp));
|
||||
const page = await devtools(await startBrowser(exe, tmp, SIZE));
|
||||
await page.send("Page.enable");
|
||||
await page.send("Emulation.setDeviceMetricsOverride", { width: SIZE.width, height: SIZE.height, deviceScaleFactor: 1, mobile: false });
|
||||
|
||||
const taken = [];
|
||||
for (const shot of SHOTS) {
|
||||
const url = base + shot.path;
|
||||
try {
|
||||
// A fresh load per shot: mark the old page, so a page that has not been replaced yet does not count.
|
||||
await page.evaluate("window.__ianitorShotsOld = true").catch(() => {});
|
||||
await page.send("Page.navigate", { url });
|
||||
await until(`${url} to load`, () => page.evaluate("!window.__ianitorShotsOld && document.readyState === 'complete'"));
|
||||
for (const sel of shot.click ?? []) {
|
||||
const q = JSON.stringify(sel);
|
||||
await until(`${sel} to click`, () => page.evaluate(`(() => { const e = document.querySelector(${q}); if (!e) return false; e.click(); return true; })()`));
|
||||
}
|
||||
const w = JSON.stringify(shot.wait);
|
||||
await until(shot.wait, () => page.evaluate(`!!document.querySelector(${w})`));
|
||||
await page.evaluate("document.fonts.ready.then(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r(true)))))");
|
||||
await sleep(400);
|
||||
} catch (e) {
|
||||
try {
|
||||
const failed = await page.send("Page.captureScreenshot", { format: "png" });
|
||||
writeFileSync(join(out, `aula-${shot.name}-failed.png`), Buffer.from(failed.data, "base64"));
|
||||
} catch {
|
||||
/* nothing to save */
|
||||
}
|
||||
throw new Error(`shot ${shot.name}: ${e.message}; the page was ${url}; what it showed is aula-${shot.name}-failed.png`);
|
||||
}
|
||||
const png = Buffer.from((await page.send("Page.captureScreenshot", { format: "png" })).data, "base64");
|
||||
const { width, height } = pngSize(png);
|
||||
const file = `aula-${shot.name}.png`;
|
||||
writeFileSync(join(out, file), png);
|
||||
taken.push({ name: shot.name, title: shot.title, file, width, height, sha256: createHash("sha256").update(png).digest("hex") });
|
||||
log(`${file} ${width}x${height}`);
|
||||
}
|
||||
writeFileSync(join(out, "aula.json"), `${JSON.stringify({ v: 1, shots: taken })}\n`);
|
||||
log(`${taken.length} shots and aula.json in ${out}`);
|
||||
}
|
||||
|
||||
let code = 0;
|
||||
try {
|
||||
await main();
|
||||
} catch (e) {
|
||||
console.error(`shots: ${e?.message ?? e}`);
|
||||
code = 1;
|
||||
} finally {
|
||||
await cleanup();
|
||||
}
|
||||
process.exit(code);
|
||||
@@ -0,0 +1,97 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// The release's screenshots (docs/release.md): every shot's screen is drawn from the demo control
|
||||
// plane alone (each click and wait selector found, no call unanswered), and nothing the demo
|
||||
// serves or the page shows names a real host, address or person.
|
||||
|
||||
import { cleanup, render, waitFor } from "@testing-library/svelte";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import App from "../src/App.svelte";
|
||||
import { app } from "../src/lib/app.svelte";
|
||||
import { SHOTS, demoApi } from "./demo";
|
||||
|
||||
const ALLOWED_TLDS = new Set(["test", "example", "invalid"]);
|
||||
const DOC_NETS = ["192.0.2.", "198.51.100.", "203.0.113."];
|
||||
const FORBIDDEN = ["mark", "marek", "novak", "flowers", "esp32", "hyperv"];
|
||||
|
||||
/** What in a text could be real: addresses outside the documentation ranges, names outside .test. */
|
||||
function realLooking(text: string): string[] {
|
||||
const found: string[] = [];
|
||||
for (const m of text.matchAll(/(?<![\w.])\d{1,3}(?:\.\d{1,3}){3}(?![\w.])/g)) {
|
||||
if (m[0] !== "127.0.0.1" && !DOC_NETS.some((n) => m[0].startsWith(n))) found.push(m[0]);
|
||||
}
|
||||
for (const m of text.matchAll(/(?<![\w.-])(?:[a-z0-9-]+\.)+([a-z][a-z0-9-]*)(?![\w-])/gi)) {
|
||||
if (!ALLOWED_TLDS.has(m[1].toLowerCase())) found.push(m[0]);
|
||||
}
|
||||
for (const w of FORBIDDEN) if (new RegExp(`\\b${w}\\b`, "i").test(text)) found.push(w);
|
||||
return found;
|
||||
}
|
||||
|
||||
let served: { status: number; path: string; text: string | null }[] = [];
|
||||
|
||||
function start(path: string) {
|
||||
history.replaceState({}, "", path);
|
||||
app.path = path;
|
||||
app.panel = null;
|
||||
app.overview = null;
|
||||
app.etag = null;
|
||||
app.signedOut = false;
|
||||
app.switchResult = null;
|
||||
app.renewedUntil = null;
|
||||
app.dismissed = [];
|
||||
served = [];
|
||||
const api = demoApi();
|
||||
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.pathname + input.search : input.url;
|
||||
const path = url.replace(/^.*\/api\/v1/, "");
|
||||
const a = api(init?.method ?? "GET", path, init?.body ? JSON.parse(String(init.body)) : {});
|
||||
served.push({ status: a.status, path, text: a.text });
|
||||
return new Response(a.text, { status: a.status, headers: { "Content-Type": "application/json" } });
|
||||
}) as typeof fetch;
|
||||
render(App);
|
||||
}
|
||||
|
||||
function pageText(): string[] {
|
||||
const out: string[] = [];
|
||||
const walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
||||
for (let n = walk.nextNode(); n; n = walk.nextNode()) if (n.textContent?.trim()) out.push(n.textContent);
|
||||
document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>("input, textarea").forEach((i) => out.push(i.value));
|
||||
document.querySelectorAll("[href]").forEach((a) => out.push(a.getAttribute("href") ?? ""));
|
||||
return out;
|
||||
}
|
||||
|
||||
afterEach(() => cleanup());
|
||||
|
||||
describe("realLooking", () => {
|
||||
it("passes invented names and refuses real-looking ones", () => {
|
||||
expect(realLooking("wiki.home.test http://192.0.2.10:3000 on 127.0.0.1 for ada")).toEqual([]);
|
||||
expect(realLooking("http://10.0.0.2:3000")).toEqual(["10.0.0.2"]);
|
||||
expect(realLooking("gitea.example.cz and Mark's phone")).toEqual(["gitea.example.cz", "mark"]);
|
||||
expect(realLooking("flowers.stage")).toEqual(["flowers.stage", "flowers"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("the release's screenshots from the demo control plane", () => {
|
||||
for (const shot of SHOTS) {
|
||||
it(`${shot.name}: drawn from invented data only`, async () => {
|
||||
start(shot.path);
|
||||
for (const sel of shot.click ?? []) {
|
||||
const el = await waitFor(() => {
|
||||
const e = document.querySelector<HTMLElement>(sel);
|
||||
expect(e, `click ${sel}`).not.toBeNull();
|
||||
return e as HTMLElement;
|
||||
}, { timeout: 5000 });
|
||||
el.click();
|
||||
}
|
||||
await waitFor(() => expect(document.querySelector(shot.wait), `wait ${shot.wait}`).not.toBeNull(), { timeout: 5000 });
|
||||
|
||||
expect(served.filter((s) => s.status === 404).map((s) => s.path)).toEqual([]);
|
||||
// Control's codes (apply.kept, pki.renew_due) are dotted words, not names.
|
||||
const json = served.map((s) => (s.text ?? "").replace(/"(?:code|message_code|error_code)":"[^"]*"/g, ""));
|
||||
const seen = [...json, ...pageText()];
|
||||
expect(seen.flatMap(realLooking)).toEqual([]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,236 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// The demo control plane for the release's screenshots (docs/release.md): control's answers
|
||||
// (docs/api.md) for a small invented home server, built on the click smoke test's stand-in
|
||||
// (mockApi.ts), whose routes answer every call the demo does not replace. Everything here is
|
||||
// invented: hostnames under .test, addresses in the documentation ranges (RFC 5737), people ada
|
||||
// and felix, made-up commits and fingerprints. demo.test.ts renders every shot from it and fails
|
||||
// on any other name or address.
|
||||
|
||||
import { apply, host, mockRoutes, newMock, respond, type Route } from "./mockApi";
|
||||
|
||||
/** One screenshot: the page, the selectors clicked in order, and the selector that means "drawn". */
|
||||
export interface Shot {
|
||||
name: string;
|
||||
title: string;
|
||||
path: string;
|
||||
click?: string[];
|
||||
wait: string;
|
||||
}
|
||||
|
||||
/** The viewport in CSS pixels; the PNGs are this size. */
|
||||
export const SIZE = { width: 1440, height: 900 } as const;
|
||||
|
||||
export const SHOTS: Shot[] = [
|
||||
{ name: "hosts", title: "Every host, its health and where it sends traffic", path: "/", wait: "[aria-label=Hosts] .ia-row:nth-child(8) .ia-host" },
|
||||
{ name: "host", title: "Editing a host", path: "/hosts/wiki.home.test/edit", wait: "#host-form input[readonly]" },
|
||||
{ name: "engine", title: "Pingora serving, Caddy ready as the fallback", path: "/", click: ["[data-engine-chip]"], wait: "dialog.ia-popover[open] .ia-card" },
|
||||
{ name: "history", title: "History: going back to a kept version", path: "/history/ch_0006", wait: "section.detail ul li:nth-child(2)" },
|
||||
{ name: "certificates", title: "The Domi CA and the device certificates", path: "/certificates", wait: "ul.devices li:nth-child(5)" },
|
||||
];
|
||||
|
||||
type Json = Record<string, unknown>;
|
||||
|
||||
const DAY = 86_400;
|
||||
const at = (s: number) => new Date(Date.now() + s * 1000).toISOString();
|
||||
|
||||
interface Health {
|
||||
state: string;
|
||||
latency?: number | null;
|
||||
upstreams?: Json[];
|
||||
failure?: Json | null;
|
||||
}
|
||||
|
||||
function demoHost(hostname: string, upstreams: string[], h: Health, over: Json = {}): Json {
|
||||
const base = host(hostname, false);
|
||||
return {
|
||||
...base,
|
||||
upstreams,
|
||||
health: {
|
||||
state: h.state,
|
||||
last_check_at: h.state === "unknown" ? null : at(-4),
|
||||
latency_ms: h.latency ?? null,
|
||||
since: at(-6 * DAY),
|
||||
failure: h.failure ?? null,
|
||||
upstreams: h.upstreams ?? [],
|
||||
},
|
||||
...over,
|
||||
};
|
||||
}
|
||||
|
||||
const MUSIC = ["http://192.0.2.20:4533", "http://192.0.2.21:4533"];
|
||||
|
||||
function hosts(): Json[] {
|
||||
return [
|
||||
demoHost("wiki.home.test", ["http://192.0.2.10:3000"], { state: "healthy", latency: 9 }, { share_links: true }),
|
||||
demoHost("photos.home.test", ["http://192.0.2.11:2342"], { state: "healthy", latency: 23 }),
|
||||
demoHost("recipes.home.test", ["http://192.0.2.12:9000"], { state: "healthy", latency: 14 }, { added_at: at(-2 * 3600) }),
|
||||
demoHost("music.home.test", MUSIC, {
|
||||
state: "degraded",
|
||||
latency: 18,
|
||||
failure: { kind: "refused", upstream: MUSIC[1], count: 3, of: 3 },
|
||||
upstreams: [
|
||||
{ url: MUSIC[0], state: "healthy", last_check_at: at(-4), latency_ms: 18, failure_kind: null },
|
||||
{ url: MUSIC[1], state: "down", last_check_at: at(-4), latency_ms: null, failure_kind: "refused" },
|
||||
],
|
||||
}),
|
||||
demoHost("cameras.home.test", ["https://192.0.2.30:7443"], { state: "healthy", latency: 31 }, { device_certs: true }),
|
||||
demoHost("status.home.test", ["http://192.0.2.40:3001"], { state: "healthy", latency: 6 }, { tls: "letsencrypt", auth: "none" }),
|
||||
demoHost("printer.home.test", ["http://192.0.2.50:631"], { state: "unknown" }, { websockets: false }),
|
||||
];
|
||||
}
|
||||
|
||||
function lastApply(): Json {
|
||||
return {
|
||||
...apply("ch_0008", "kept", "Added recipes.home.test", ["recipes.home.test"]),
|
||||
created_at: at(-2 * 3600 - 70),
|
||||
finished_at: at(-2 * 3600),
|
||||
reason: { code: "apply.kept", message: "recipes.home.test is live. Health checks passed for 60 s." },
|
||||
commit_short: "c41d7e2",
|
||||
push: { state: "pushed", at: at(-2 * 3600), error_code: null, next_try_at: null },
|
||||
};
|
||||
}
|
||||
|
||||
function intermediate(): Json {
|
||||
return { state: "ok", subject: "Demo Intermediate CA", not_after: at(212 * DAY), days_left: 212, renewal: null, banner: null };
|
||||
}
|
||||
|
||||
function overview(): Json {
|
||||
const list = hosts();
|
||||
const count = (s: string) => list.filter((h) => (h.health as Json).state === s).length;
|
||||
return {
|
||||
counts: { hosts: list.length, healthy: count("healthy"), degraded: count("degraded"), down: count("down"), unknown: count("unknown") },
|
||||
hosts: list,
|
||||
engine: {
|
||||
running: "pingora",
|
||||
state: "running",
|
||||
since: at(-6 * DAY),
|
||||
target: null,
|
||||
switchable: true,
|
||||
fallback_ready: {
|
||||
built_at: at(-2 * 3600),
|
||||
current: true,
|
||||
compared: list.length,
|
||||
matched: list.length,
|
||||
differences: ["Every host: Caddy adds its own Server and Via headers to answers, and a Content-Type when your service sends none."],
|
||||
},
|
||||
last_error: null,
|
||||
notes: [],
|
||||
},
|
||||
last_apply: lastApply(),
|
||||
undo: {
|
||||
available: true,
|
||||
target: { change_id: "ch_0008", summary: "Added recipes.home.test", kept_at: at(-2 * 3600), commit_short: "c41d7e2" },
|
||||
effect: "Removes recipes.home.test",
|
||||
blocked: null,
|
||||
},
|
||||
active_apply: null,
|
||||
repo: { name: "home-routes", last_push_at: at(-2 * 3600), unpushed: 0, push_error_code: null },
|
||||
intermediate: intermediate(),
|
||||
site: { forward_auth_configured: true, acme_configured: true, secrets: ["photos_api_key"], watch_seconds: 60, share_links_available: true, auth_logout_url: "https://auth.home.test/logout" },
|
||||
paused: null,
|
||||
paused_reason: null,
|
||||
health_error: null,
|
||||
rev: "rev-demo-8",
|
||||
viewer: { name: "ada", via: "authelia" },
|
||||
};
|
||||
}
|
||||
|
||||
function spec(hostname: string): Json | null {
|
||||
const row = hosts().find((h) => h.hostname === hostname);
|
||||
if (!row) return null;
|
||||
const wiki = hostname === "wiki.home.test";
|
||||
return {
|
||||
hostname,
|
||||
upstreams: row.upstreams,
|
||||
tls: row.tls,
|
||||
auth: row.auth,
|
||||
websockets: row.websockets,
|
||||
share_links: row.share_links,
|
||||
device_certs: row.device_certs,
|
||||
access_log: wiki ? "truncated" : "off",
|
||||
health_check: (row.health as Json).state === "unknown" ? null : { path: wiki ? "/healthz" : "/", interval_secs: 30 },
|
||||
request_headers: [],
|
||||
response_headers: wiki ? [{ action: "set", name: "X-Frame-Options", value: "SAMEORIGIN" }] : [],
|
||||
};
|
||||
}
|
||||
|
||||
const HISTORY = [
|
||||
{ change_id: "ch_0008", summary: "Added recipes.home.test", kind: "add", state: "kept", ago: 2 * 3600, commit_short: "c41d7e2", hosts: ["recipes.home.test"], reason_short: null },
|
||||
{ change_id: "ch_0007", summary: "Changed music.home.test", kind: "edit", state: "kept", ago: 1 * DAY, commit_short: "8e03b5a", hosts: ["music.home.test"], reason_short: null },
|
||||
{ change_id: "ch_0006", summary: "Turned share links on for wiki.home.test", kind: "share_links", state: "kept", ago: 2 * DAY, commit_short: "5a9f210", hosts: ["wiki.home.test"], reason_short: null },
|
||||
{ change_id: "ch_0005", summary: "Changed photos.home.test", kind: "edit", state: "reverted", ago: 3 * DAY, commit_short: null, hosts: ["photos.home.test"], reason_short: "photos.home.test answered 502 during the watch" },
|
||||
{ change_id: "ch_0004", summary: "Added cameras.home.test", kind: "add", state: "kept", ago: 5 * DAY, commit_short: "0b7c4e9", hosts: ["cameras.home.test"], reason_short: null },
|
||||
{ change_id: "ch_0003", summary: "Added printer.home.test", kind: "add", state: "kept", ago: 9 * DAY, commit_short: "e2d81f6", hosts: ["printer.home.test"], reason_short: null },
|
||||
{ change_id: "ch_0002", summary: "Added status.home.test", kind: "add", state: "kept", ago: 12 * DAY, commit_short: "73a6c05", hosts: ["status.home.test"], reason_short: null },
|
||||
{ change_id: "ch_0001", summary: "Added wiki.home.test", kind: "add", state: "kept", ago: 20 * DAY, commit_short: "1f4b9a3", hosts: ["wiki.home.test"], reason_short: null },
|
||||
];
|
||||
|
||||
function history(): Json {
|
||||
return { entries: HISTORY.map(({ ago, ...e }) => ({ ...e, at: at(-ago) })), next_before: null };
|
||||
}
|
||||
|
||||
function restorePreview(id: string): Json {
|
||||
if (id === "ch_0008") return { restorable: false, same_as_current: true, changes: [], blocked: { code: "restore.same", message: "This version is the same as the current one." } };
|
||||
return {
|
||||
restorable: true,
|
||||
same_as_current: false,
|
||||
changes: [
|
||||
{ hostname: "recipes.home.test", effect: "removed", fields: [] },
|
||||
{ hostname: "music.home.test", effect: "changed", fields: [{ field: "upstreams", from: MUSIC.join(", "), to: MUSIC[0] }] },
|
||||
],
|
||||
blocked: null,
|
||||
};
|
||||
}
|
||||
|
||||
function certs(): Json {
|
||||
const device = (id: string, name: string, kind: string, made: number, until: number, revoked: number | null = null) => ({
|
||||
id,
|
||||
name,
|
||||
kind,
|
||||
created_at: at(-made * DAY),
|
||||
not_after: at(until * DAY),
|
||||
state: revoked === null ? "valid" : "revoked",
|
||||
revoked_at: revoked === null ? null : at(-revoked * DAY),
|
||||
});
|
||||
return {
|
||||
intermediate: intermediate(),
|
||||
root: { offline: true, subject: "Demo Root CA", not_after: at(3000 * DAY), sha256: "5c0f9e2a71d84b36a8e1f40c2d9b7e6315a2c8d04f9b1e7a6c3d5f8e0b2a4c61" },
|
||||
devices: [
|
||||
device("dv_1", "ada's phone", "phone", 40, 325),
|
||||
device("dv_2", "felix's laptop", "computer", 61, 304),
|
||||
device("dv_3", "Kitchen tablet", "phone", 345, 20),
|
||||
device("dv_4", "Notes app on the desk PC", "app", 12, 353),
|
||||
device("dv_5", "Old phone", "phone", 200, 165, 30),
|
||||
],
|
||||
device_lifetime_days: 365,
|
||||
device_valid_until: null,
|
||||
server_lifetime_days: 90,
|
||||
approval: "manual",
|
||||
requests: [],
|
||||
};
|
||||
}
|
||||
|
||||
/** The demo's own answers, first; the smoke test's stand-in answers the rest. */
|
||||
export function demoRoutes(): Route[] {
|
||||
return [
|
||||
["GET", /^\/overview$/, () => [200, overview()]],
|
||||
["GET", /^\/hosts\/([^/?]+)$/, (mm) => {
|
||||
const s = spec(decodeURIComponent(mm[1]));
|
||||
return s ? [200, { host: s, rev: "rev-demo-8" }] : [404, { error: { code: "host.not_found", message: "There is no such host.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "demo" }];
|
||||
}],
|
||||
["GET", /^\/history(\?.*)?$/, () => [200, history()]],
|
||||
["GET", /^\/history\/([^/]+)\/restore-preview$/, (mm) => [200, restorePreview(decodeURIComponent(mm[1]))]],
|
||||
["GET", /^\/certs$/, () => [200, certs()]],
|
||||
["GET", /^\/settings$/, () => [200, { repo: { name: "home-routes", last_push_at: at(-2 * 3600) }, watch_seconds: 60 }]],
|
||||
...mockRoutes(newMock()),
|
||||
];
|
||||
}
|
||||
|
||||
/** Control's API for the demo: `path` is what follows /api/v1 (with its query). */
|
||||
export function demoApi(): (method: string, path: string, body: Json) => { status: number; text: string | null } {
|
||||
const routes = demoRoutes();
|
||||
return (method, path, body) => respond(routes, method.toUpperCase(), path, body);
|
||||
}
|
||||
+32
-15
@@ -3,7 +3,8 @@
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// A stateful stand-in for control's API, shaped like the real answers (docs/api.md), so the
|
||||
// smoke tests can walk every §4 flow and count its clicks.
|
||||
// smoke tests can walk every §4 flow and count its clicks. Its builders and routes are also the
|
||||
// base of the screenshots' demo control plane (demo.ts, docs/release.md).
|
||||
|
||||
type Json = Record<string, unknown>;
|
||||
|
||||
@@ -22,7 +23,7 @@ export interface Mock {
|
||||
const now = () => new Date().toISOString();
|
||||
const later = (s: number) => new Date(Date.now() + s * 1000).toISOString();
|
||||
|
||||
function host(hostname: string, share: boolean) {
|
||||
export function host(hostname: string, share: boolean) {
|
||||
return {
|
||||
hostname,
|
||||
upstreams: ["http://10.0.0.2:3000"],
|
||||
@@ -37,7 +38,7 @@ function host(hostname: string, share: boolean) {
|
||||
};
|
||||
}
|
||||
|
||||
function apply(id: string, state: string, summary: string, hosts: string[]) {
|
||||
export function apply(id: string, state: string, summary: string, hosts: string[]) {
|
||||
return {
|
||||
id,
|
||||
change_id: id,
|
||||
@@ -58,12 +59,30 @@ function apply(id: string, state: string, summary: string, hosts: string[]) {
|
||||
};
|
||||
}
|
||||
|
||||
export function installMock(): Mock {
|
||||
const m: Mock = {
|
||||
/** One API call: method, the path after /api/v1, and its answer as [status, body]. */
|
||||
export type Route = [string, RegExp, (mm: RegExpMatchArray, body: Json) => [number, unknown]];
|
||||
|
||||
export function newMock(): Mock {
|
||||
return {
|
||||
calls: [],
|
||||
state: { engine: "pingora", switching: 0, intermediate: "due", renewal: false, requestPolls: 0, hostsAdded: [] },
|
||||
};
|
||||
}
|
||||
|
||||
/** The first route that matches answers, with server_time added as control does; else control's 404. */
|
||||
export function respond(routes: Route[], method: string, path: string, body: Json): { status: number; text: string | null } {
|
||||
for (const [mm, re, f] of routes) {
|
||||
const match = path.match(re);
|
||||
if (mm === method && match) {
|
||||
const [status, data] = f(match, body);
|
||||
const withTime = data && typeof data === "object" ? { ...(data as Json), server_time: now() } : data;
|
||||
return { status, text: status === 204 ? null : JSON.stringify(withTime) };
|
||||
}
|
||||
}
|
||||
return { status: 404, text: JSON.stringify({ error: { code: "request.not_found", message: "There is no such API call.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "x" }) };
|
||||
}
|
||||
|
||||
export function mockRoutes(m: Mock): Route[] {
|
||||
const overview = (): Json => ({
|
||||
counts: { hosts: 2 + m.state.hostsAdded.length, healthy: 2, degraded: 0, down: 0, unknown: 0 },
|
||||
hosts: [host("wiki.home.test", true), host("photos.home.test", false), ...m.state.hostsAdded.map((h) => host(h, false))],
|
||||
@@ -108,7 +127,7 @@ export function installMock(): Mock {
|
||||
server_time: now(),
|
||||
});
|
||||
|
||||
const routes: [string, RegExp, (mm: RegExpMatchArray, body: Json) => [number, unknown]][] = [
|
||||
return [
|
||||
["GET", /^\/overview$/, () => [200, overview()]],
|
||||
["POST", /^\/hosts\/validate/, () => [200, { message: "This host can be applied." }]],
|
||||
["POST", /^\/hosts$/, (_, b) => {
|
||||
@@ -152,6 +171,11 @@ export function installMock(): Mock {
|
||||
["POST", /^\/tokens$/, (_, b) => [201, { id: "tk_1", name: b.name, token: "ian_tk1_secretvalue", expires_at: later(365 * 86400) }]],
|
||||
["GET", /^\/share-links$/, () => [200, { items: [], epoch: 0 }]],
|
||||
];
|
||||
}
|
||||
|
||||
export function installMock(): Mock {
|
||||
const m = newMock();
|
||||
const routes = mockRoutes(m);
|
||||
|
||||
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.pathname + input.search : input.url;
|
||||
@@ -159,15 +183,8 @@ export function installMock(): Mock {
|
||||
const method = (init?.method ?? "GET").toUpperCase();
|
||||
const body = init?.body ? JSON.parse(String(init.body)) : {};
|
||||
m.calls.push({ method, path, body });
|
||||
for (const [mm, re, f] of routes) {
|
||||
const match = path.match(re);
|
||||
if (mm === method && match) {
|
||||
const [status, data] = f(match, body);
|
||||
const withTime = data && typeof data === "object" ? { ...(data as Json), server_time: now() } : data;
|
||||
return new Response(status === 204 ? null : JSON.stringify(withTime), { status, headers: { "Content-Type": "application/json" } });
|
||||
}
|
||||
}
|
||||
return new Response(JSON.stringify({ error: { code: "request.not_found", message: "There is no such API call.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "x" }), { status: 404, headers: { "Content-Type": "application/json" } });
|
||||
const a = respond(routes, method, path, body);
|
||||
return new Response(a.text, { status: a.status, headers: { "Content-Type": "application/json" } });
|
||||
}) as typeof fetch;
|
||||
|
||||
return m;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# Benchmarks and conformance (ROADMAP §5 layers 2 and 5)
|
||||
|
||||
Data, not marketing: every run's raw output is committed here, and this page summarises it, including where Caddy
|
||||
wins.
|
||||
|
||||
| Folder | What | Made by |
|
||||
| :-- | :-- | :-- |
|
||||
| `results/<date>-<label>.csv` and `results/<date>-<label>/` | load and soak runs: one CSV row per engine, scenario and concurrency; oha's raw JSON; `machine.txt` | `scripts/bench.sh <label>` |
|
||||
| `conformance/` | h2spec and testssl.sh outputs for Ianitor and for Caddy | `scripts/conformance.sh` |
|
||||
|
||||
## How the runs are made
|
||||
|
||||
`tests/diff/src/bin/pair.rs` (`ianitor-pair`) compiles one route, `localhost` → a small upstream that answers
|
||||
`200 ok`, for both engines with Ianitor's compilers, and starts Ianitor's edge (in its own process with the
|
||||
upstream in a child) and two Caddys: one as Go starts it (every core) and one with `GOMAXPROCS=2`. Edge runs Pingora
|
||||
with **two worker threads** (`crates/edge/src/lib.rs`), a deliberate budget for a home server, so the second Caddy
|
||||
is the like-for-like comparison and the first shows what Caddy does with the whole machine.
|
||||
|
||||
[oha](https://github.com/hatoo/oha) then drives each engine in turn, the same way:
|
||||
|
||||
| Scenario | What it measures |
|
||||
| :-- | :-- |
|
||||
| `https-h1-keepalive`, 1/16/64/256 connections | HTTP/1.1 over TLS, connections reused: the proxy path itself |
|
||||
| `https-h2`, 1/16/64/256 connections | the same over HTTP/2 |
|
||||
| `https-h1-new-conn`, 16 connections | a new TLS handshake per request |
|
||||
| `http-redirect`, 64 connections | the plain-HTTP listener's 308 (no upstream) |
|
||||
| `soak-https-h1`, 32 connections, 5 minutes | latency and errors over time, memory after (`rss_kb_after`) |
|
||||
|
||||
Caveats that apply to every number: the load generator, both proxies and the upstream share one machine and its
|
||||
cores; loopback has no network latency, so small differences in CPU per request dominate; the upstream is trivial.
|
||||
Compare rows of one file with each other, not numbers across machines. `machine.txt` records the CPU, the kernel,
|
||||
whether it is WSL2, the build (release or debug) and the tool versions.
|
||||
|
||||
## Results
|
||||
|
||||
### Load and soak: 2026-11-18, WSL2 Ubuntu 26.04 (`results/2026-11-18-wsl2-ubuntu.csv`)
|
||||
|
||||
AMD Ryzen 7 5800X3D (16 threads), 32 GB, WSL2 kernel 6.18; release build; Caddy v2.11.7 built with Go 1.26.8 from
|
||||
its official module (no Nix on this machine: Caddy reports its version as "unknown"); oha 1.17; 15 s a run, one run
|
||||
each. Requests per second (higher is better), and p99 latency in ms:
|
||||
|
||||
| Scenario | Ianitor (2 threads) | Caddy (all cores) | Caddy (GOMAXPROCS=2) |
|
||||
| :-- | --: | --: | --: |
|
||||
| HTTP/1.1, keep-alive, 1 conn | 1,861 / 9.0 | 1,757 / 2.5 | **2,351** / 0.8 |
|
||||
| HTTP/2, 1 conn | **2,173** / 0.8 | 1,375 / 1.4 | 1,588 / 1.4 |
|
||||
| HTTP/1.1, 16 conns | 3,843 / 28.8 | 6,905 / 45.5 | **7,759** / 11.2 |
|
||||
| HTTP/2, 16 conns | 4,723 / 27.5 | **6,090** / 35.6 | 3,426 / 28.6 |
|
||||
| HTTP/1.1, 64 conns | 6,596 / 50.9 | **15,653** / 31.3 | 6,561 / 39.8 |
|
||||
| HTTP/2, 64 conns | **11,726** / 23.2 | 8,472 / 59.6 | 5,708 / 37.3 |
|
||||
| HTTP/1.1, 256 conns | 4,421 / 155.6 | **12,632** / 101.9 | 4,473 / 147.0 |
|
||||
| HTTP/2, 256 conns | 3,981 / 146.6 | **10,077** / 101.9 | 3,607 / 134.4 |
|
||||
| New TLS connection per request, 16 | 1,218 / 50.6 | **2,236** / 65.0 | 1,823 / 21.4 |
|
||||
| Plain-HTTP redirect, 64 | 13,582 / 32.4 | **54,027** / 16.3 | 17,027 / 15.5 |
|
||||
| Soak, HTTP/1.1, 32 conns, 5 min | 6,245 / 31.3 | **13,031** / 35.4 | (not run) |
|
||||
|
||||
Every request of every run succeeded (success rate 1.0, no unexpected status). Memory (resident, after each run, the
|
||||
process that serves the port): Ianitor 13 MB at the start, 56 MB after the soak; Caddy 60 MB and 77 MB.
|
||||
|
||||
**Where Caddy wins:** almost everywhere with the whole machine, by about 2× under HTTP/1.1 load and 4× on the
|
||||
plain-HTTP redirect; with the same two cores it is still ahead on HTTP/1.1 at 1 to 16 connections, on new TLS
|
||||
connections (about 1.5×, so rustls handshakes cost Ianitor more than Go's) and on the redirect.
|
||||
**Where Ianitor wins:** HTTP/2 at 1 and 64 connections (ahead of both Caddys), HTTP/2 at 16 and 256 connections
|
||||
against Caddy on two cores, and memory, which stays below Caddy's in every run. At 64 and 256 HTTP/1.1 connections
|
||||
Ianitor and Caddy on two cores are even.
|
||||
|
||||
How much to read into it: one run each, on a desktop that was doing other things; a 2-second smoke run of the same
|
||||
script just before gave Ianitor 14,341 requests/s on HTTP/1.1 with 16 connections, against 3,843 here, so single
|
||||
numbers move a lot on this machine. The ordering at 64 connections and above, the redirect and the handshake cost
|
||||
were the same in both runs. For a home server, every row is far beyond what it will see; the numbers are here to
|
||||
keep the comparison honest, not to choose an engine.
|
||||
|
||||
### Conformance: 2026-11-18, same machine (`conformance/`)
|
||||
|
||||
| | h2spec (145 cases) | testssl.sh 3.2.2 |
|
||||
| :-- | :-- | :-- |
|
||||
| Ianitor | 144 passed, 1 skipped, **0 failed** | A+; TLS 1.2 and 1.3; no server cipher order (rustls follows the client) |
|
||||
| Caddy 2.11.7 | 140 passed, 1 skipped, **4 failed** | A+; TLS 1.2 and 1.3; server cipher order; session tickets valid 7 days (LOW) |
|
||||
|
||||
Caddy's four h2spec failures (Go's HTTP/2 server): HEADERS larger than SETTINGS_MAX_FRAME_SIZE (4.2/3), several
|
||||
SETTINGS_INITIAL_WINDOW_SIZE values (6.5.3/1), a connection-specific header field and a `TE` other than
|
||||
`trailers` (8.1.2.2/1 and 2). The two HIGH findings testssl.sh reports for both engines belong to the throwaway test
|
||||
certificate (a validity of about 2,100 years, no CRL or OCSP URL), not to the engines; HSTS and security headers
|
||||
are the routes' business (header rules), not set on the test route.
|
||||
@@ -0,0 +1,4 @@
|
||||
1: Sends a HEADERS frame that contains the connection-specific header field
|
||||
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||
2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
|
||||
3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
@@ -0,0 +1,314 @@
|
||||
Generic tests for HTTP/2 server
|
||||
1. Starting HTTP/2
|
||||
1: Sends a client connection preface
|
||||
✔ 1: Sends a client connection preface
|
||||
|
||||
2. Streams and Multiplexing
|
||||
1: Sends a PRIORITY frame on idle stream
|
||||
✔ 1: Sends a PRIORITY frame on idle stream
|
||||
2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
|
||||
✔ 2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
|
||||
3: Sends a PRIORITY frame on half-closed (remote) stream
|
||||
✔ 3: Sends a PRIORITY frame on half-closed (remote) stream
|
||||
4: Sends a RST_STREAM frame on half-closed (remote) stream
|
||||
✔ 4: Sends a RST_STREAM frame on half-closed (remote) stream
|
||||
5: Sends a PRIORITY frame on closed stream
|
||||
✔ 5: Sends a PRIORITY frame on closed stream
|
||||
|
||||
3. Frame Definitions
|
||||
3.1. DATA
|
||||
1: Sends a DATA frame
|
||||
✔ 1: Sends a DATA frame
|
||||
2: Sends multiple DATA frames
|
||||
✔ 2: Sends multiple DATA frames
|
||||
3: Sends a DATA frame with padding
|
||||
✔ 3: Sends a DATA frame with padding
|
||||
|
||||
3.2. HEADERS
|
||||
1: Sends a HEADERS frame
|
||||
✔ 1: Sends a HEADERS frame
|
||||
2: Sends a HEADERS frame with padding
|
||||
✔ 2: Sends a HEADERS frame with padding
|
||||
3: Sends a HEADERS frame with priority
|
||||
✔ 3: Sends a HEADERS frame with priority
|
||||
|
||||
3.3. PRIORITY
|
||||
1: Sends a PRIORITY frame with priority 1
|
||||
✔ 1: Sends a PRIORITY frame with priority 1
|
||||
2: Sends a PRIORITY frame with priority 256
|
||||
✔ 2: Sends a PRIORITY frame with priority 256
|
||||
3: Sends a PRIORITY frame with stream dependency
|
||||
✔ 3: Sends a PRIORITY frame with stream dependency
|
||||
4: Sends a PRIORITY frame with exclusive
|
||||
✔ 4: Sends a PRIORITY frame with exclusive
|
||||
5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
|
||||
✔ 5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
|
||||
|
||||
3.4. RST_STREAM
|
||||
1: Sends a RST_STREAM frame
|
||||
✔ 1: Sends a RST_STREAM frame
|
||||
|
||||
3.5. SETTINGS
|
||||
1: Sends a SETTINGS frame
|
||||
✔ 1: Sends a SETTINGS frame
|
||||
|
||||
3.7. PING
|
||||
1: Sends a PING frame
|
||||
✔ 1: Sends a PING frame
|
||||
|
||||
3.8. GOAWAY
|
||||
1: Sends a GOAWAY frame
|
||||
✔ 1: Sends a GOAWAY frame
|
||||
|
||||
3.9. WINDOW_UPDATE
|
||||
1: Sends a WINDOW_UPDATE frame with stream ID 0
|
||||
✔ 1: Sends a WINDOW_UPDATE frame with stream ID 0
|
||||
2: Sends a WINDOW_UPDATE frame with stream ID 1
|
||||
✔ 2: Sends a WINDOW_UPDATE frame with stream ID 1
|
||||
|
||||
3.10. CONTINUATION
|
||||
1: Sends a CONTINUATION frame
|
||||
✔ 1: Sends a CONTINUATION frame
|
||||
2: Sends multiple CONTINUATION frames
|
||||
✔ 2: Sends multiple CONTINUATION frames
|
||||
|
||||
4. HTTP Message Exchanges
|
||||
1: Sends a GET request
|
||||
✔ 1: Sends a GET request
|
||||
2: Sends a HEAD request
|
||||
✔ 2: Sends a HEAD request
|
||||
3: Sends a POST request
|
||||
✔ 3: Sends a POST request
|
||||
4: Sends a POST request with trailers
|
||||
✔ 4: Sends a POST request with trailers
|
||||
|
||||
5. HPACK
|
||||
1: Sends a indexed header field representation
|
||||
✔ 1: Sends a indexed header field representation
|
||||
2: Sends a literal header field with incremental indexing - indexed name
|
||||
✔ 2: Sends a literal header field with incremental indexing - indexed name
|
||||
3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
|
||||
✔ 3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
|
||||
4: Sends a literal header field with incremental indexing - new name
|
||||
✔ 4: Sends a literal header field with incremental indexing - new name
|
||||
5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
|
||||
✔ 5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
|
||||
6: Sends a literal header field without indexing - indexed name
|
||||
✔ 6: Sends a literal header field without indexing - indexed name
|
||||
7: Sends a literal header field without indexing - indexed name (with Huffman coding)
|
||||
✔ 7: Sends a literal header field without indexing - indexed name (with Huffman coding)
|
||||
8: Sends a literal header field without indexing - new name
|
||||
✔ 8: Sends a literal header field without indexing - new name
|
||||
9: Sends a literal header field without indexing - new name (huffman encoded)
|
||||
✔ 9: Sends a literal header field without indexing - new name (huffman encoded)
|
||||
10: Sends a literal header field never indexed - indexed name
|
||||
✔ 10: Sends a literal header field never indexed - indexed name
|
||||
11: Sends a literal header field never indexed - indexed name (huffman encoded)
|
||||
✔ 11: Sends a literal header field never indexed - indexed name (huffman encoded)
|
||||
12: Sends a literal header field never indexed - new name
|
||||
✔ 12: Sends a literal header field never indexed - new name
|
||||
13: Sends a literal header field never indexed - new name (huffman encoded)
|
||||
✔ 13: Sends a literal header field never indexed - new name (huffman encoded)
|
||||
14: Sends a dynamic table size update
|
||||
✔ 14: Sends a dynamic table size update
|
||||
15: Sends multiple dynamic table size update
|
||||
✔ 15: Sends multiple dynamic table size update
|
||||
|
||||
Hypertext Transfer Protocol Version 2 (HTTP/2)
|
||||
3. Starting HTTP/2
|
||||
3.5. HTTP/2 Connection Preface
|
||||
1: Sends client connection preface
|
||||
✔ 1: Sends client connection preface
|
||||
2: Sends invalid connection preface
|
||||
✔ 2: Sends invalid connection preface
|
||||
|
||||
4. HTTP Frames
|
||||
4.1. Frame Format
|
||||
1: Sends a frame with unknown type
|
||||
✔ 1: Sends a frame with unknown type
|
||||
2: Sends a frame with undefined flag
|
||||
✔ 2: Sends a frame with undefined flag
|
||||
3: Sends a frame with reserved field bit
|
||||
✔ 3: Sends a frame with reserved field bit
|
||||
|
||||
4.2. Frame Size
|
||||
1: Sends a DATA frame with 2^14 octets in length
|
||||
✔ 1: Sends a DATA frame with 2^14 octets in length
|
||||
2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
✔ 2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
× 3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
-> The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.
|
||||
Expected: GOAWAY Frame (Error Code: FRAME_SIZE_ERROR)
|
||||
Connection closed
|
||||
Actual: DATA Frame (length:63, flags:0x01, stream_id:1)
|
||||
|
||||
4.3. Header Compression and Decompression
|
||||
1: Sends invalid header block fragment
|
||||
✔ 1: Sends invalid header block fragment
|
||||
2: Sends a PRIORITY frame while sending the header blocks
|
||||
✔ 2: Sends a PRIORITY frame while sending the header blocks
|
||||
3: Sends a HEADERS frame to another stream while sending the header blocks
|
||||
✔ 3: Sends a HEADERS frame to another stream while sending the header blocks
|
||||
|
||||
5. Streams and Multiplexing
|
||||
5.1. Stream States
|
||||
1: idle: Sends a DATA frame
|
||||
✔ 1: idle: Sends a DATA frame
|
||||
2: idle: Sends a RST_STREAM frame
|
||||
✔ 2: idle: Sends a RST_STREAM frame
|
||||
3: idle: Sends a WINDOW_UPDATE frame
|
||||
✔ 3: idle: Sends a WINDOW_UPDATE frame
|
||||
4: idle: Sends a CONTINUATION frame
|
||||
✔ 4: idle: Sends a CONTINUATION frame
|
||||
5: half closed (remote): Sends a DATA frame
|
||||
✔ 5: half closed (remote): Sends a DATA frame
|
||||
6: half closed (remote): Sends a HEADERS frame
|
||||
✔ 6: half closed (remote): Sends a HEADERS frame
|
||||
7: half closed (remote): Sends a CONTINUATION frame
|
||||
✔ 7: half closed (remote): Sends a CONTINUATION frame
|
||||
8: closed: Sends a DATA frame after sending RST_STREAM frame
|
||||
✔ 8: closed: Sends a DATA frame after sending RST_STREAM frame
|
||||
9: closed: Sends a HEADERS frame after sending RST_STREAM frame
|
||||
✔ 9: closed: Sends a HEADERS frame after sending RST_STREAM frame
|
||||
10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
|
||||
✔ 10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
|
||||
11: closed: Sends a DATA frame
|
||||
✔ 11: closed: Sends a DATA frame
|
||||
12: closed: Sends a HEADERS frame
|
||||
✔ 12: closed: Sends a HEADERS frame
|
||||
13: closed: Sends a CONTINUATION frame
|
||||
✔ 13: closed: Sends a CONTINUATION frame
|
||||
|
||||
5.1.1. Stream Identifiers
|
||||
1: Sends even-numbered stream identifier
|
||||
✔ 1: Sends even-numbered stream identifier
|
||||
2: Sends stream identifier that is numerically smaller than previous
|
||||
✔ 2: Sends stream identifier that is numerically smaller than previous
|
||||
|
||||
5.1.2. Stream Concurrency
|
||||
1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
||||
✔ 1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
||||
|
||||
5.3. Stream Priority
|
||||
5.3.1. Stream Dependencies
|
||||
1: Sends HEADERS frame that depend on itself
|
||||
✔ 1: Sends HEADERS frame that depend on itself
|
||||
2: Sends PRIORITY frame that depend on itself
|
||||
✔ 2: Sends PRIORITY frame that depend on itself
|
||||
|
||||
5.4. Error Handling
|
||||
5.4.1. Connection Error Handling
|
||||
1: Sends an invalid PING frame for connection close
|
||||
✔ 1: Sends an invalid PING frame for connection close
|
||||
|
||||
5.5. Extending HTTP/2
|
||||
1: Sends an unknown extension frame
|
||||
✔ 1: Sends an unknown extension frame
|
||||
2: Sends an unknown extension frame in the middle of a header block
|
||||
✔ 2: Sends an unknown extension frame in the middle of a header block
|
||||
|
||||
6. Frame Definitions
|
||||
6.1. DATA
|
||||
1: Sends a DATA frame with 0x0 stream identifier
|
||||
✔ 1: Sends a DATA frame with 0x0 stream identifier
|
||||
2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
||||
✔ 2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
||||
3: Sends a DATA frame with invalid pad length
|
||||
✔ 3: Sends a DATA frame with invalid pad length
|
||||
|
||||
6.2. HEADERS
|
||||
1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
|
||||
✔ 1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
|
||||
2: Sends a HEADERS frame to another stream while sending a HEADERS frame
|
||||
✔ 2: Sends a HEADERS frame to another stream while sending a HEADERS frame
|
||||
3: Sends a HEADERS frame with 0x0 stream identifier
|
||||
✔ 3: Sends a HEADERS frame with 0x0 stream identifier
|
||||
4: Sends a HEADERS frame with invalid pad length
|
||||
✔ 4: Sends a HEADERS frame with invalid pad length
|
||||
|
||||
6.3. PRIORITY
|
||||
1: Sends a PRIORITY frame with 0x0 stream identifier
|
||||
✔ 1: Sends a PRIORITY frame with 0x0 stream identifier
|
||||
2: Sends a PRIORITY frame with a length other than 5 octets
|
||||
✔ 2: Sends a PRIORITY frame with a length other than 5 octets
|
||||
|
||||
6.4. RST_STREAM
|
||||
1: Sends a RST_STREAM frame with 0x0 stream identifier
|
||||
✔ 1: Sends a RST_STREAM frame with 0x0 stream identifier
|
||||
2: Sends a RST_STREAM frame on a idle stream
|
||||
✔ 2: Sends a RST_STREAM frame on a idle stream
|
||||
3: Sends a RST_STREAM frame with a length other than 4 octets
|
||||
✔ 3: Sends a RST_STREAM frame with a length other than 4 octets
|
||||
|
||||
6.5. SETTINGS
|
||||
1: Sends a SETTINGS frame with ACK flag and payload
|
||||
✔ 1: Sends a SETTINGS frame with ACK flag and payload
|
||||
2: Sends a SETTINGS frame with a stream identifier other than 0x0
|
||||
✔ 2: Sends a SETTINGS frame with a stream identifier other than 0x0
|
||||
3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
||||
✔ 3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
||||
|
||||
6.5.2. Defined SETTINGS Parameters
|
||||
1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
||||
✔ 1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
||||
2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
||||
✔ 2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
||||
3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
||||
✔ 3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
||||
4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
||||
✔ 4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
||||
5: Sends a SETTINGS frame with unknown identifier
|
||||
✔ 5: Sends a SETTINGS frame with unknown identifier
|
||||
|
||||
6.5.3. Settings Synchronization
|
||||
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||
× 1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||
-> The endpoint MUST process the values in the settings in the order they apper.
|
||||
Expected: SETTINGS Frame (length:0, flags:0x01, stream_id:0)
|
||||
Actual: Connection closed
|
||||
2: Sends a SETTINGS frame without ACK flag
|
||||
✔ 2: Sends a SETTINGS frame without ACK flag
|
||||
|
||||
6.7. PING
|
||||
1: Sends a PING frame
|
||||
✔ 1: Sends a PING frame
|
||||
2: Sends a PING frame with ACK
|
||||
✔ 2: Sends a PING frame with ACK
|
||||
3: Sends a PING frame with a stream identifier field value other than 0x0
|
||||
✔ 3: Sends a PING frame with a stream identifier field value other than 0x0
|
||||
4: Sends a PING frame with a length field value other than 8
|
||||
✔ 4: Sends a PING frame with a length field value other than 8
|
||||
|
||||
6.8. GOAWAY
|
||||
1: Sends a GOAWAY frame with a stream identifier other than 0x0
|
||||
✔ 1: Sends a GOAWAY frame with a stream identifier other than 0x0
|
||||
|
||||
6.9. WINDOW_UPDATE
|
||||
1: Sends a WINDOW_UPDATE frame with a flow control window increment of 0
|
||||
✔ 1: Sends a WINDOW_UPDATE frame with a flow control window increment of 0
|
||||
2: Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
|
||||
✔ 2: Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
|
||||
3: Sends a WINDOW_UPDATE frame with a length other than 4 octets
|
||||
✔ 3: Sends a WINDOW_UPDATE frame with a length other than 4 octets
|
||||
|
||||
6.9.1. The Flow-Control Window
|
||||
1: Sends SETTINGS frame to set the initial window size to 1 and sends HEADERS frame
|
||||
✔ 1: Sends SETTINGS frame to set the initial window size to 1 and sends HEADERS frame
|
||||
2: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1
|
||||
✔ 2: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1
|
||||
3: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream
|
||||
✔ 3: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream
|
||||
|
||||
6.9.2. Initial Flow-Control Window Size
|
||||
1: Changes SETTINGS_INITIAL_WINDOW_SIZE after sending HEADERS frame
|
||||
✔ 1: Changes SETTINGS_INITIAL_WINDOW_SIZE after sending HEADERS frame
|
||||
2: Sends a SETTINGS frame for window size to be negative
|
||||
2: Sends a SETTINGS frame for window size to be negative
|
||||
3: Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
|
||||
✔ 3: Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
|
||||
|
||||
6.10. CONTINUATION
|
||||
1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
|
||||
✔ 1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
|
||||
2: Sends a CONTINUATION frame followed by any frame other than CONTINUATION
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
|
||||
Start 2026-11-18 18:02:54 -->> 127.0.0.1:30028 (localhost) <<--
|
||||
|
||||
A record via: supplied IP "127.0.0.1"
|
||||
rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
|
||||
Service detected: HTTP
|
||||
|
||||
Testing protocols via sockets except NPN+ALPN
|
||||
|
||||
SSLv2 not offered (OK)
|
||||
SSLv3 not offered (OK)
|
||||
TLS 1 not offered
|
||||
TLS 1.1 not offered
|
||||
TLS 1.2 offered (OK)
|
||||
TLS 1.3 offered (OK): final
|
||||
NPN/SPDY not offered
|
||||
ALPN/HTTP2 h2, http/1.1 (offered)
|
||||
|
||||
Testing cipher categories
|
||||
|
||||
NULL ciphers (no encryption) not offered (OK)
|
||||
Anonymous NULL Ciphers (no authentication) not offered (OK)
|
||||
Export ciphers (w/o ADH+NULL) not offered (OK)
|
||||
LOW: 64 Bit + DES, RC[2,4], MD5 (w/o export) not offered (OK)
|
||||
Triple DES Ciphers / IDEA not offered
|
||||
Obsoleted CBC ciphers (AES, ARIA etc.) not offered
|
||||
Strong encryption (AEAD ciphers) with no FS not offered
|
||||
Forward Secrecy strong encryption (AEAD ciphers) offered (OK)
|
||||
|
||||
|
||||
Testing server's cipher preferences
|
||||
|
||||
Hexcode Cipher Suite Name (OpenSSL) KeyExch. Encryption Bits Cipher Suite Name (IANA/RFC)
|
||||
-----------------------------------------------------------------------------------------------------------------------------
|
||||
SSLv2
|
||||
-
|
||||
SSLv3
|
||||
-
|
||||
TLSv1
|
||||
-
|
||||
TLSv1.1
|
||||
-
|
||||
TLSv1.2 (server order -- server prioritizes ChaCha ciphers when preferred by clients)
|
||||
xc02b ECDHE-ECDSA-AES128-GCM-SHA256 ECDH 253 AESGCM 128 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
|
||||
xc02c ECDHE-ECDSA-AES256-GCM-SHA384 ECDH 253 AESGCM 256 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
xcca9 ECDHE-ECDSA-CHACHA20-POLY1305 ECDH 253 ChaCha20 256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
|
||||
TLSv1.3 (no server order, thus listed by strength)
|
||||
x1302 TLS_AES_256_GCM_SHA384 ECDH/MLKEM AESGCM 256 TLS_AES_256_GCM_SHA384
|
||||
x1303 TLS_CHACHA20_POLY1305_SHA256 ECDH/MLKEM ChaCha20 256 TLS_CHACHA20_POLY1305_SHA256
|
||||
x1301 TLS_AES_128_GCM_SHA256 ECDH/MLKEM AESGCM 128 TLS_AES_128_GCM_SHA256
|
||||
|
||||
Has server cipher order? yes (OK) -- only for < TLS 1.3
|
||||
|
||||
|
||||
Testing robust forward secrecy (FS) -- omitting Null Authentication/Encryption, 3DES, RC4
|
||||
|
||||
FS is offered (OK) TLS_AES_256_GCM_SHA384
|
||||
TLS_CHACHA20_POLY1305_SHA256
|
||||
ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
TLS_AES_128_GCM_SHA256
|
||||
ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
KEMs offered X25519MLKEM768
|
||||
Elliptic curves offered: prime256v1 X25519
|
||||
TLS 1.2 sig_algs offered: ECDSA+SHA512 ECDSA+SHA384 ECDSA+SHA256
|
||||
TLS 1.3 sig_algs offered: ECDSA+SHA256
|
||||
|
||||
Testing server defaults (Server Hello)
|
||||
|
||||
TLS extensions (standard) "server name/#0" "EC point formats/#11"
|
||||
"application layer protocol negotiation/#16"
|
||||
"extended master secret/#23" "session ticket/#35"
|
||||
"supported versions/#43" "key share/#51"
|
||||
"renegotiation info/#65281"
|
||||
Session Ticket RFC 5077 hint 604800 seconds but: FS requires session ticket keys to be rotated < daily !
|
||||
SSL Session ID support yes
|
||||
Session Resumption Tickets: yes, ID: yes
|
||||
TLS clock skew Random values, no fingerprinting possible
|
||||
Certificate Compression none
|
||||
Client Authentication none
|
||||
Signature Algorithm ECDSA with SHA256
|
||||
Server key size EC 256 bits (curve P-256)
|
||||
Server key usage Digital Signature
|
||||
Server extended key usage TLS Web Server Authentication
|
||||
Serial 29F7BED5DF8BBC472F523278F287E910BD19DC07 (OK: length 20)
|
||||
Fingerprints SHA1 76D4AE2FBE2B32E3C3380B7FAFFC515CF672FE23
|
||||
SHA256 0D5E04B7C6D8AD0D952CD17CE75AF5B0263F167F8179214877C8B1D58A7B54AA
|
||||
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
|
||||
subjectAltName (SAN) localhost
|
||||
Trust (hostname) Ok via SAN and CN (SNI mandatory)
|
||||
Chain of trust Ok
|
||||
EV cert (experimental) no
|
||||
Certificate Validity (UTC) 755730 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
|
||||
>= 10 years is way too long
|
||||
ETS/"eTLS", visibility info not present
|
||||
Certificate Revocation List --
|
||||
OCSP URI --
|
||||
NOT ok -- neither CRL nor OCSP URI provided
|
||||
OCSP stapling not offered
|
||||
OCSP must staple extension --
|
||||
DNS CAA RR (experimental) not offered
|
||||
Certificate Transparency --
|
||||
Certificates provided 1
|
||||
Issuer Ianitor Pair Test CA
|
||||
Intermediate Bad OCSP (exp.) Ok
|
||||
|
||||
|
||||
Testing HTTP header response @ "/"
|
||||
|
||||
HTTP Status Code 200 OK
|
||||
HTTP clock skew 0 sec from localtime
|
||||
Strict Transport Security not offered
|
||||
Public Key Pinning --
|
||||
Server banner (no "Server" line in header, interesting!)
|
||||
Application banner --
|
||||
Cookie(s) (none issued at "/")
|
||||
Security headers --
|
||||
Reverse Proxy banner Via: 1.1 Caddy
|
||||
|
||||
|
||||
Testing vulnerabilities
|
||||
|
||||
Heartbleed (CVE-2014-0160) not vulnerable (OK), no heartbeat extension
|
||||
CCS (CVE-2014-0224) not vulnerable (OK)
|
||||
Ticketbleed (CVE-2016-9244), experiment. not vulnerable (OK)
|
||||
ROBOT Server does not support any cipher suites that use RSA key transport
|
||||
Secure Renegotiation (RFC 5746) supported (OK)
|
||||
Secure Client-Initiated Renegotiation not vulnerable (OK)
|
||||
CRIME, TLS (CVE-2012-4929) not vulnerable (OK)
|
||||
BREACH (CVE-2013-3587) no gzip/deflate/compress/br HTTP compression (OK) - only supplied "/" tested
|
||||
POODLE, SSL (CVE-2014-3566) not vulnerable (OK), no SSLv3 support
|
||||
TLS_FALLBACK_SCSV (RFC 7507) No fallback possible (OK), no protocol below TLS 1.2 offered
|
||||
SWEET32 (CVE-2016-2183, CVE-2016-6329) not vulnerable (OK)
|
||||
FREAK (CVE-2015-0204) not vulnerable (OK)
|
||||
DROWN (CVE-2016-0800, CVE-2016-0703) not vulnerable on this host and port (OK)
|
||||
no RSA certificate, thus certificate can't be used with SSLv2 elsewhere
|
||||
LOGJAM (CVE-2015-4000), experimental not vulnerable (OK): no DH EXPORT ciphers, no DH key detected with <= TLS 1.2
|
||||
BEAST (CVE-2011-3389) not vulnerable (OK), no SSL3 or TLS1
|
||||
LUCKY13 (CVE-2013-0169), experimental not vulnerable (OK)
|
||||
Winshock (CVE-2014-6321), experimental not vulnerable (OK)
|
||||
RC4 (CVE-2013-2566, CVE-2015-2808) no RC4 ciphers detected (OK)
|
||||
|
||||
|
||||
Running client simulations (HTTP) via sockets
|
||||
|
||||
Browser Protocol Cipher Suite Name (OpenSSL) Forward Secrecy
|
||||
------------------------------------------------------------------------------------------------
|
||||
Android 7.0 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
Android 8.1 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 253 bit ECDH (X25519)
|
||||
Android 9.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 10.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 11/12 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 13/14 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 15 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||
Chrome 101 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Chromium 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||
Firefox 100 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Firefox 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||
IE 8 Win 7 No connection
|
||||
IE 11 Win 7 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
IE 11 Win 8.1 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
IE 11 Win Phone 8.1 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
IE 11 Win 10 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
Edge 15 Win 10 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 253 bit ECDH (X25519)
|
||||
Edge 101 Win 10 21H2 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Edge 133 Win 11 23H2 TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||
Safari 18.4 (iOS 18.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Safari 15.4 (macOS 12.3.1) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Safari 18.4 (macOS 15.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Java 7u25 No connection
|
||||
Java 8u442 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Java 11.0.2 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 256 bit ECDH (P-256)
|
||||
Java 17.0.3 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Java 21.0.6 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
go 1.17.8 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
LibreSSL 3.3.6 (macOS) TLSv1.3 TLS_CHACHA20_POLY1305_SHA256 253 bit ECDH (X25519)
|
||||
OpenSSL 1.0.2e TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
OpenSSL 1.1.1d (Debian) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
OpenSSL 3.0.15 (Debian) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
OpenSSL 3.5.0 (git) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||
Apple Mail (16.0) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
Thunderbird (91.9) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
|
||||
|
||||
Rating (experimental)
|
||||
|
||||
Rating specs (not complete) SSL Labs's 'SSL Server Rating Guide' (version 2009r from 2025-05-16)
|
||||
Specification documentation https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide
|
||||
Protocol Support (weighted) 100 (30)
|
||||
Key Exchange (weighted) 100 (30)
|
||||
Cipher Strength (weighted) 90 (36)
|
||||
Final Score 96
|
||||
Overall Grade A+
|
||||
|
||||
Done 2026-11-18 18:05:17 [ 150s] -->> 127.0.0.1:30028 (localhost) <<--
|
||||
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
Generic tests for HTTP/2 server
|
||||
1. Starting HTTP/2
|
||||
1: Sends a client connection preface
|
||||
✔ 1: Sends a client connection preface
|
||||
|
||||
2. Streams and Multiplexing
|
||||
1: Sends a PRIORITY frame on idle stream
|
||||
✔ 1: Sends a PRIORITY frame on idle stream
|
||||
2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
|
||||
✔ 2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
|
||||
3: Sends a PRIORITY frame on half-closed (remote) stream
|
||||
✔ 3: Sends a PRIORITY frame on half-closed (remote) stream
|
||||
4: Sends a RST_STREAM frame on half-closed (remote) stream
|
||||
✔ 4: Sends a RST_STREAM frame on half-closed (remote) stream
|
||||
5: Sends a PRIORITY frame on closed stream
|
||||
✔ 5: Sends a PRIORITY frame on closed stream
|
||||
|
||||
3. Frame Definitions
|
||||
3.1. DATA
|
||||
1: Sends a DATA frame
|
||||
✔ 1: Sends a DATA frame
|
||||
2: Sends multiple DATA frames
|
||||
✔ 2: Sends multiple DATA frames
|
||||
3: Sends a DATA frame with padding
|
||||
✔ 3: Sends a DATA frame with padding
|
||||
|
||||
3.2. HEADERS
|
||||
1: Sends a HEADERS frame
|
||||
✔ 1: Sends a HEADERS frame
|
||||
2: Sends a HEADERS frame with padding
|
||||
✔ 2: Sends a HEADERS frame with padding
|
||||
3: Sends a HEADERS frame with priority
|
||||
✔ 3: Sends a HEADERS frame with priority
|
||||
|
||||
3.3. PRIORITY
|
||||
1: Sends a PRIORITY frame with priority 1
|
||||
✔ 1: Sends a PRIORITY frame with priority 1
|
||||
2: Sends a PRIORITY frame with priority 256
|
||||
✔ 2: Sends a PRIORITY frame with priority 256
|
||||
3: Sends a PRIORITY frame with stream dependency
|
||||
✔ 3: Sends a PRIORITY frame with stream dependency
|
||||
4: Sends a PRIORITY frame with exclusive
|
||||
✔ 4: Sends a PRIORITY frame with exclusive
|
||||
5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
|
||||
✔ 5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
|
||||
|
||||
3.4. RST_STREAM
|
||||
1: Sends a RST_STREAM frame
|
||||
✔ 1: Sends a RST_STREAM frame
|
||||
|
||||
3.5. SETTINGS
|
||||
1: Sends a SETTINGS frame
|
||||
✔ 1: Sends a SETTINGS frame
|
||||
|
||||
3.7. PING
|
||||
1: Sends a PING frame
|
||||
✔ 1: Sends a PING frame
|
||||
|
||||
3.8. GOAWAY
|
||||
1: Sends a GOAWAY frame
|
||||
✔ 1: Sends a GOAWAY frame
|
||||
|
||||
3.9. WINDOW_UPDATE
|
||||
1: Sends a WINDOW_UPDATE frame with stream ID 0
|
||||
✔ 1: Sends a WINDOW_UPDATE frame with stream ID 0
|
||||
2: Sends a WINDOW_UPDATE frame with stream ID 1
|
||||
✔ 2: Sends a WINDOW_UPDATE frame with stream ID 1
|
||||
|
||||
3.10. CONTINUATION
|
||||
1: Sends a CONTINUATION frame
|
||||
✔ 1: Sends a CONTINUATION frame
|
||||
2: Sends multiple CONTINUATION frames
|
||||
✔ 2: Sends multiple CONTINUATION frames
|
||||
|
||||
4. HTTP Message Exchanges
|
||||
1: Sends a GET request
|
||||
✔ 1: Sends a GET request
|
||||
2: Sends a HEAD request
|
||||
✔ 2: Sends a HEAD request
|
||||
3: Sends a POST request
|
||||
✔ 3: Sends a POST request
|
||||
4: Sends a POST request with trailers
|
||||
✔ 4: Sends a POST request with trailers
|
||||
|
||||
5. HPACK
|
||||
1: Sends a indexed header field representation
|
||||
✔ 1: Sends a indexed header field representation
|
||||
2: Sends a literal header field with incremental indexing - indexed name
|
||||
✔ 2: Sends a literal header field with incremental indexing - indexed name
|
||||
3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
|
||||
✔ 3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
|
||||
4: Sends a literal header field with incremental indexing - new name
|
||||
✔ 4: Sends a literal header field with incremental indexing - new name
|
||||
5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
|
||||
✔ 5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
|
||||
6: Sends a literal header field without indexing - indexed name
|
||||
✔ 6: Sends a literal header field without indexing - indexed name
|
||||
7: Sends a literal header field without indexing - indexed name (with Huffman coding)
|
||||
✔ 7: Sends a literal header field without indexing - indexed name (with Huffman coding)
|
||||
8: Sends a literal header field without indexing - new name
|
||||
✔ 8: Sends a literal header field without indexing - new name
|
||||
9: Sends a literal header field without indexing - new name (huffman encoded)
|
||||
✔ 9: Sends a literal header field without indexing - new name (huffman encoded)
|
||||
10: Sends a literal header field never indexed - indexed name
|
||||
✔ 10: Sends a literal header field never indexed - indexed name
|
||||
11: Sends a literal header field never indexed - indexed name (huffman encoded)
|
||||
✔ 11: Sends a literal header field never indexed - indexed name (huffman encoded)
|
||||
12: Sends a literal header field never indexed - new name
|
||||
✔ 12: Sends a literal header field never indexed - new name
|
||||
13: Sends a literal header field never indexed - new name (huffman encoded)
|
||||
✔ 13: Sends a literal header field never indexed - new name (huffman encoded)
|
||||
14: Sends a dynamic table size update
|
||||
✔ 14: Sends a dynamic table size update
|
||||
15: Sends multiple dynamic table size update
|
||||
✔ 15: Sends multiple dynamic table size update
|
||||
|
||||
Hypertext Transfer Protocol Version 2 (HTTP/2)
|
||||
3. Starting HTTP/2
|
||||
3.5. HTTP/2 Connection Preface
|
||||
1: Sends client connection preface
|
||||
✔ 1: Sends client connection preface
|
||||
2: Sends invalid connection preface
|
||||
✔ 2: Sends invalid connection preface
|
||||
|
||||
4. HTTP Frames
|
||||
4.1. Frame Format
|
||||
1: Sends a frame with unknown type
|
||||
✔ 1: Sends a frame with unknown type
|
||||
2: Sends a frame with undefined flag
|
||||
✔ 2: Sends a frame with undefined flag
|
||||
3: Sends a frame with reserved field bit
|
||||
✔ 3: Sends a frame with reserved field bit
|
||||
|
||||
4.2. Frame Size
|
||||
1: Sends a DATA frame with 2^14 octets in length
|
||||
✔ 1: Sends a DATA frame with 2^14 octets in length
|
||||
2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
✔ 2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
✔ 3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||
|
||||
4.3. Header Compression and Decompression
|
||||
1: Sends invalid header block fragment
|
||||
✔ 1: Sends invalid header block fragment
|
||||
2: Sends a PRIORITY frame while sending the header blocks
|
||||
✔ 2: Sends a PRIORITY frame while sending the header blocks
|
||||
3: Sends a HEADERS frame to another stream while sending the header blocks
|
||||
✔ 3: Sends a HEADERS frame to another stream while sending the header blocks
|
||||
|
||||
5. Streams and Multiplexing
|
||||
5.1. Stream States
|
||||
1: idle: Sends a DATA frame
|
||||
✔ 1: idle: Sends a DATA frame
|
||||
2: idle: Sends a RST_STREAM frame
|
||||
✔ 2: idle: Sends a RST_STREAM frame
|
||||
3: idle: Sends a WINDOW_UPDATE frame
|
||||
✔ 3: idle: Sends a WINDOW_UPDATE frame
|
||||
4: idle: Sends a CONTINUATION frame
|
||||
✔ 4: idle: Sends a CONTINUATION frame
|
||||
5: half closed (remote): Sends a DATA frame
|
||||
✔ 5: half closed (remote): Sends a DATA frame
|
||||
6: half closed (remote): Sends a HEADERS frame
|
||||
✔ 6: half closed (remote): Sends a HEADERS frame
|
||||
7: half closed (remote): Sends a CONTINUATION frame
|
||||
✔ 7: half closed (remote): Sends a CONTINUATION frame
|
||||
8: closed: Sends a DATA frame after sending RST_STREAM frame
|
||||
✔ 8: closed: Sends a DATA frame after sending RST_STREAM frame
|
||||
9: closed: Sends a HEADERS frame after sending RST_STREAM frame
|
||||
✔ 9: closed: Sends a HEADERS frame after sending RST_STREAM frame
|
||||
10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
|
||||
✔ 10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
|
||||
11: closed: Sends a DATA frame
|
||||
✔ 11: closed: Sends a DATA frame
|
||||
12: closed: Sends a HEADERS frame
|
||||
✔ 12: closed: Sends a HEADERS frame
|
||||
13: closed: Sends a CONTINUATION frame
|
||||
✔ 13: closed: Sends a CONTINUATION frame
|
||||
|
||||
5.1.1. Stream Identifiers
|
||||
1: Sends even-numbered stream identifier
|
||||
✔ 1: Sends even-numbered stream identifier
|
||||
2: Sends stream identifier that is numerically smaller than previous
|
||||
✔ 2: Sends stream identifier that is numerically smaller than previous
|
||||
|
||||
5.1.2. Stream Concurrency
|
||||
1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
||||
✔ 1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
||||
|
||||
5.3. Stream Priority
|
||||
5.3.1. Stream Dependencies
|
||||
1: Sends HEADERS frame that depend on itself
|
||||
✔ 1: Sends HEADERS frame that depend on itself
|
||||
2: Sends PRIORITY frame that depend on itself
|
||||
✔ 2: Sends PRIORITY frame that depend on itself
|
||||
|
||||
5.4. Error Handling
|
||||
5.4.1. Connection Error Handling
|
||||
1: Sends an invalid PING frame for connection close
|
||||
✔ 1: Sends an invalid PING frame for connection close
|
||||
|
||||
5.5. Extending HTTP/2
|
||||
1: Sends an unknown extension frame
|
||||
✔ 1: Sends an unknown extension frame
|
||||
2: Sends an unknown extension frame in the middle of a header block
|
||||
✔ 2: Sends an unknown extension frame in the middle of a header block
|
||||
|
||||
6. Frame Definitions
|
||||
6.1. DATA
|
||||
1: Sends a DATA frame with 0x0 stream identifier
|
||||
✔ 1: Sends a DATA frame with 0x0 stream identifier
|
||||
2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
||||
✔ 2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
||||
3: Sends a DATA frame with invalid pad length
|
||||
✔ 3: Sends a DATA frame with invalid pad length
|
||||
|
||||
6.2. HEADERS
|
||||
1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
|
||||
✔ 1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
|
||||
2: Sends a HEADERS frame to another stream while sending a HEADERS frame
|
||||
✔ 2: Sends a HEADERS frame to another stream while sending a HEADERS frame
|
||||
3: Sends a HEADERS frame with 0x0 stream identifier
|
||||
✔ 3: Sends a HEADERS frame with 0x0 stream identifier
|
||||
4: Sends a HEADERS frame with invalid pad length
|
||||
✔ 4: Sends a HEADERS frame with invalid pad length
|
||||
|
||||
6.3. PRIORITY
|
||||
1: Sends a PRIORITY frame with 0x0 stream identifier
|
||||
✔ 1: Sends a PRIORITY frame with 0x0 stream identifier
|
||||
2: Sends a PRIORITY frame with a length other than 5 octets
|
||||
✔ 2: Sends a PRIORITY frame with a length other than 5 octets
|
||||
|
||||
6.4. RST_STREAM
|
||||
1: Sends a RST_STREAM frame with 0x0 stream identifier
|
||||
✔ 1: Sends a RST_STREAM frame with 0x0 stream identifier
|
||||
2: Sends a RST_STREAM frame on a idle stream
|
||||
✔ 2: Sends a RST_STREAM frame on a idle stream
|
||||
3: Sends a RST_STREAM frame with a length other than 4 octets
|
||||
✔ 3: Sends a RST_STREAM frame with a length other than 4 octets
|
||||
|
||||
6.5. SETTINGS
|
||||
1: Sends a SETTINGS frame with ACK flag and payload
|
||||
✔ 1: Sends a SETTINGS frame with ACK flag and payload
|
||||
2: Sends a SETTINGS frame with a stream identifier other than 0x0
|
||||
✔ 2: Sends a SETTINGS frame with a stream identifier other than 0x0
|
||||
3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
||||
✔ 3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
||||
|
||||
6.5.2. Defined SETTINGS Parameters
|
||||
1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
||||
✔ 1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
||||
2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
||||
✔ 2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
||||
3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
||||
✔ 3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
||||
4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
||||
✔ 4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
||||
5: Sends a SETTINGS frame with unknown identifier
|
||||
✔ 5: Sends a SETTINGS frame with unknown identifier
|
||||
|
||||
6.5.3. Settings Synchronization
|
||||
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,196 @@
|
||||
|
||||
Start 2026-11-18 18:00:21 -->> 127.0.0.1:24056 (localhost) <<--
|
||||
|
||||
A record via: supplied IP "127.0.0.1"
|
||||
rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
|
||||
Service detected: HTTP
|
||||
|
||||
Testing protocols via sockets except NPN+ALPN
|
||||
|
||||
SSLv2 not offered (OK)
|
||||
SSLv3 not offered (OK)
|
||||
TLS 1 not offered
|
||||
TLS 1.1 not offered
|
||||
TLS 1.2 offered (OK)
|
||||
TLS 1.3 offered (OK): final
|
||||
NPN/SPDY not offered
|
||||
ALPN/HTTP2 h2, http/1.1 (offered)
|
||||
|
||||
Testing cipher categories
|
||||
|
||||
NULL ciphers (no encryption) not offered (OK)
|
||||
Anonymous NULL Ciphers (no authentication) not offered (OK)
|
||||
Export ciphers (w/o ADH+NULL) not offered (OK)
|
||||
LOW: 64 Bit + DES, RC[2,4], MD5 (w/o export) not offered (OK)
|
||||
Triple DES Ciphers / IDEA not offered
|
||||
Obsoleted CBC ciphers (AES, ARIA etc.) not offered
|
||||
Strong encryption (AEAD ciphers) with no FS not offered
|
||||
Forward Secrecy strong encryption (AEAD ciphers) offered (OK)
|
||||
|
||||
|
||||
Testing server's cipher preferences
|
||||
|
||||
Hexcode Cipher Suite Name (OpenSSL) KeyExch. Encryption Bits Cipher Suite Name (IANA/RFC)
|
||||
-----------------------------------------------------------------------------------------------------------------------------
|
||||
SSLv2
|
||||
-
|
||||
SSLv3
|
||||
-
|
||||
TLSv1
|
||||
-
|
||||
TLSv1.1
|
||||
-
|
||||
TLSv1.2 (no server order, thus listed by strength)
|
||||
xc02c ECDHE-ECDSA-AES256-GCM-SHA384 ECDH 253 AESGCM 256 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
xcca9 ECDHE-ECDSA-CHACHA20-POLY1305 ECDH 253 ChaCha20 256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
|
||||
xc02b ECDHE-ECDSA-AES128-GCM-SHA256 ECDH 253 AESGCM 128 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
|
||||
TLSv1.3 (no server order, thus listed by strength)
|
||||
x1302 TLS_AES_256_GCM_SHA384 ECDH 253 AESGCM 256 TLS_AES_256_GCM_SHA384
|
||||
x1303 TLS_CHACHA20_POLY1305_SHA256 ECDH 253 ChaCha20 256 TLS_CHACHA20_POLY1305_SHA256
|
||||
x1301 TLS_AES_128_GCM_SHA256 ECDH 253 AESGCM 128 TLS_AES_128_GCM_SHA256
|
||||
|
||||
Has server cipher order? no
|
||||
(limited sense as client will pick)
|
||||
|
||||
Testing robust forward secrecy (FS) -- omitting Null Authentication/Encryption, 3DES, RC4
|
||||
|
||||
FS is offered (OK) TLS_AES_256_GCM_SHA384
|
||||
TLS_CHACHA20_POLY1305_SHA256
|
||||
ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
TLS_AES_128_GCM_SHA256
|
||||
ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
Elliptic curves offered: prime256v1 secp384r1 X25519
|
||||
TLS 1.2 sig_algs offered: ECDSA+SHA256
|
||||
TLS 1.3 sig_algs offered: ECDSA+SHA256
|
||||
|
||||
Testing server defaults (Server Hello)
|
||||
|
||||
TLS extensions (standard) "server name/#0"
|
||||
"application layer protocol negotiation/#16"
|
||||
"extended master secret/#23"
|
||||
"supported versions/#43" "key share/#51"
|
||||
"renegotiation info/#65281"
|
||||
Session Ticket RFC 5077 hint 86400 seconds, session tickets keys seems to be rotated < daily
|
||||
SSL Session ID support yes
|
||||
Session Resumption Tickets: yes, ID: yes
|
||||
TLS clock skew Random values, no fingerprinting possible
|
||||
Certificate Compression none
|
||||
Client Authentication none
|
||||
Signature Algorithm ECDSA with SHA256
|
||||
Server key size EC 256 bits (curve P-256)
|
||||
Server key usage Digital Signature
|
||||
Server extended key usage TLS Web Server Authentication
|
||||
Serial 29F7BED5DF8BBC472F523278F287E910BD19DC07 (OK: length 20)
|
||||
Fingerprints SHA1 76D4AE2FBE2B32E3C3380B7FAFFC515CF672FE23
|
||||
SHA256 0D5E04B7C6D8AD0D952CD17CE75AF5B0263F167F8179214877C8B1D58A7B54AA
|
||||
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
|
||||
subjectAltName (SAN) localhost
|
||||
Trust (hostname) Ok via SAN and CN (SNI mandatory)
|
||||
Chain of trust Ok
|
||||
EV cert (experimental) no
|
||||
Certificate Validity (UTC) 755730 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
|
||||
>= 10 years is way too long
|
||||
ETS/"eTLS", visibility info not present
|
||||
Certificate Revocation List --
|
||||
OCSP URI --
|
||||
NOT ok -- neither CRL nor OCSP URI provided
|
||||
OCSP stapling not offered
|
||||
OCSP must staple extension --
|
||||
DNS CAA RR (experimental) not offered
|
||||
Certificate Transparency --
|
||||
Certificates provided 1
|
||||
Issuer Ianitor Pair Test CA
|
||||
Intermediate Bad OCSP (exp.) Ok
|
||||
|
||||
|
||||
Testing HTTP header response @ "/"
|
||||
|
||||
HTTP Status Code 200 OK
|
||||
HTTP clock skew 0 sec from localtime
|
||||
Strict Transport Security not offered
|
||||
Public Key Pinning --
|
||||
Server banner (no "Server" line in header, interesting!)
|
||||
Application banner --
|
||||
Cookie(s) (none issued at "/")
|
||||
Security headers --
|
||||
Reverse Proxy banner --
|
||||
|
||||
|
||||
Testing vulnerabilities
|
||||
|
||||
Heartbleed (CVE-2014-0160) not vulnerable (OK), no heartbeat extension
|
||||
CCS (CVE-2014-0224) not vulnerable (OK)
|
||||
Ticketbleed (CVE-2016-9244), experiment. not vulnerable (OK), no session ticket extension
|
||||
ROBOT Server does not support any cipher suites that use RSA key transport
|
||||
Secure Renegotiation (RFC 5746) supported (OK)
|
||||
Secure Client-Initiated Renegotiation not vulnerable (OK) -- mitigated (1 successful reneg within 10 in 33s(timeout))
|
||||
CRIME, TLS (CVE-2012-4929) not vulnerable (OK)
|
||||
BREACH (CVE-2013-3587) no gzip/deflate/compress/br HTTP compression (OK) - only supplied "/" tested
|
||||
POODLE, SSL (CVE-2014-3566) not vulnerable (OK), no SSLv3 support
|
||||
TLS_FALLBACK_SCSV (RFC 7507) No fallback possible (OK), no protocol below TLS 1.2 offered
|
||||
SWEET32 (CVE-2016-2183, CVE-2016-6329) not vulnerable (OK)
|
||||
FREAK (CVE-2015-0204) not vulnerable (OK)
|
||||
DROWN (CVE-2016-0800, CVE-2016-0703) not vulnerable on this host and port (OK)
|
||||
no RSA certificate, thus certificate can't be used with SSLv2 elsewhere
|
||||
LOGJAM (CVE-2015-4000), experimental not vulnerable (OK): no DH EXPORT ciphers, no DH key detected with <= TLS 1.2
|
||||
BEAST (CVE-2011-3389) not vulnerable (OK), no SSL3 or TLS1
|
||||
LUCKY13 (CVE-2013-0169), experimental not vulnerable (OK)
|
||||
Winshock (CVE-2014-6321), experimental not vulnerable (OK)
|
||||
RC4 (CVE-2013-2566, CVE-2015-2808) no RC4 ciphers detected (OK)
|
||||
|
||||
|
||||
Running client simulations (HTTP) via sockets
|
||||
|
||||
Browser Protocol Cipher Suite Name (OpenSSL) Forward Secrecy
|
||||
------------------------------------------------------------------------------------------------
|
||||
Android 7.0 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
Android 8.1 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 253 bit ECDH (X25519)
|
||||
Android 9.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 10.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 11/12 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 13/14 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Android 15 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Chrome 101 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Chromium 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Firefox 100 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Firefox 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
IE 8 Win 7 No connection
|
||||
IE 11 Win 7 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||
IE 11 Win 8.1 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||
IE 11 Win Phone 8.1 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||
IE 11 Win 10 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||
Edge 15 Win 10 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 253 bit ECDH (X25519)
|
||||
Edge 101 Win 10 21H2 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Edge 133 Win 11 23H2 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Safari 18.4 (iOS 18.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Safari 15.4 (macOS 12.3.1) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Safari 18.4 (macOS 15.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
Java 7u25 No connection
|
||||
Java 8u442 (OpenJDK) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||
Java 11.0.2 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 256 bit ECDH (P-256)
|
||||
Java 17.0.3 (OpenJDK) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||
Java 21.0.6 (OpenJDK) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||
go 1.17.8 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
LibreSSL 3.3.6 (macOS) TLSv1.3 TLS_CHACHA20_POLY1305_SHA256 253 bit ECDH (X25519)
|
||||
OpenSSL 1.0.2e TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||
OpenSSL 1.1.1d (Debian) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||
OpenSSL 3.0.15 (Debian) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||
OpenSSL 3.5.0 (git) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||
Apple Mail (16.0) TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||
Thunderbird (91.9) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||
|
||||
|
||||
Rating (experimental)
|
||||
|
||||
Rating specs (not complete) SSL Labs's 'SSL Server Rating Guide' (version 2009r from 2025-05-16)
|
||||
Specification documentation https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide
|
||||
Protocol Support (weighted) 100 (30)
|
||||
Key Exchange (weighted) 100 (30)
|
||||
Cipher Strength (weighted) 90 (36)
|
||||
Final Score 96
|
||||
Overall Grade A+
|
||||
|
||||
Done 2026-11-18 18:02:27 [ 131s] -->> 127.0.0.1:24056 (localhost) <<--
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"build":"release","caddy_version":"unknown","edge_threads":2}
|
||||
@@ -0,0 +1,33 @@
|
||||
engine,scenario,connections,duration_s,requests,rps,p50_ms,p90_ms,p99_ms,max_ms,success_rate,non_2xx,rss_kb_after
|
||||
ianitor,https-h1-keepalive,1,15,27924,1861,0.3,0.34,9.03,82.42,1.0,0,13228
|
||||
ianitor,https-h2,1,15,32594,2173,0.37,0.41,0.77,33.56,1.0,0,13444
|
||||
ianitor,https-h1-keepalive,16,15.03,57767,3843,1.85,11.28,28.77,130.96,1.0,0,15408
|
||||
ianitor,https-h2,16,15,70840,4723,1.51,9.54,27.5,80.67,1.0,0,16388
|
||||
ianitor,https-h1-keepalive,64,15.04,99114,6596,4.94,27.15,50.88,137.67,1.0,0,21272
|
||||
ianitor,https-h2,64,15.02,176136,11726,4.55,7.93,23.21,65.82,1.0,0,24520
|
||||
ianitor,https-h1-keepalive,256,15.02,66156,4421,52.26,98.36,155.59,307.77,1.0,0,38620
|
||||
ianitor,https-h2,256,15,59482,3981,60.98,101.34,146.55,233.81,1.0,0,52184
|
||||
ianitor,https-h1-new-conn,16,15,18250,1218,8.57,30.28,50.64,122.99,1.0,0,52200
|
||||
ianitor,http-redirect,64,15,203706,13582,1.84,15.68,32.41,87.56,1.0,203706,55620
|
||||
caddy,https-h1-keepalive,1,15,26362,1757,0.46,0.53,2.48,106.04,1.0,0,59828
|
||||
caddy,https-h2,1,15,20631,1375,0.64,0.72,1.4,33.45,1.0,0,60084
|
||||
caddy,https-h1-keepalive,16,15.01,103603,6905,0.54,2.83,45.47,162.27,1.0,0,65660
|
||||
caddy,https-h2,16,15.02,91438,6090,0.74,5.56,35.64,134.4,1.0,0,69348
|
||||
caddy,https-h1-keepalive,64,15.02,234993,15653,1.94,9.85,31.3,146.84,1.0,0,79068
|
||||
caddy,https-h2,64,15.01,127103,8472,2.46,19.38,59.58,156.96,1.0,0,82992
|
||||
caddy,https-h1-keepalive,256,15.02,189465,12632,13.37,48.12,101.94,418.37,1.0,0,130136
|
||||
caddy,https-h2,256,15.09,151866,10077,19.21,53.91,101.9,464.76,1.0,0,130716
|
||||
caddy,https-h1-new-conn,16,15,33531,2236,2.41,16.71,65.02,173.34,1.0,0,98300
|
||||
caddy,http-redirect,64,15.02,811365,54027,0.23,2.49,16.27,82.11,1.0,811365,104520
|
||||
caddy_gomaxprocs2,https-h1-keepalive,1,15,35264,2351,0.41,0.48,0.79,48.27,1.0,0,56800
|
||||
caddy_gomaxprocs2,https-h2,1,15,23823,1588,0.59,0.68,1.41,27.62,1.0,0,57684
|
||||
caddy_gomaxprocs2,https-h1-keepalive,16,15,116399,7759,1.57,3.49,11.23,60.1,1.0,0,61076
|
||||
caddy_gomaxprocs2,https-h2,16,15,51386,3426,2.71,11,28.59,68.23,1.0,0,61652
|
||||
caddy_gomaxprocs2,https-h1-keepalive,64,15.02,98458,6561,7.37,19.47,39.84,166.73,1.0,0,68012
|
||||
caddy_gomaxprocs2,https-h2,64,15,85584,5708,10.26,19.29,37.34,79.44,1.0,0,68616
|
||||
caddy_gomaxprocs2,https-h1-keepalive,256,15,66867,4473,52.61,92.37,147.03,218.19,1.0,0,95680
|
||||
caddy_gomaxprocs2,https-h2,256,15.01,53887,3607,68.4,97.91,134.35,193.25,1.0,0,98972
|
||||
caddy_gomaxprocs2,https-h1-new-conn,16,15,27335,1823,7.93,14.23,21.39,67.37,1.0,0,78728
|
||||
caddy_gomaxprocs2,http-redirect,64,15,255374,17027,2.85,8.19,15.52,59.82,1.0,255374,79764
|
||||
ianitor,soak-https-h1,32,300.04,1873622,6245,3.23,10.32,31.29,134.28,1.0,0,55588
|
||||
caddy,soak-https-h1,32,300,3909309,13031,0.81,4,35.44,204.14,1.0,0,76592
|
||||
|
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.018795747,
|
||||
"slowest": 0.0821075,
|
||||
"fastest": 0.0000375,
|
||||
"average": 0.001179247194193746,
|
||||
"requestsPerSec": 54027.367684395205,
|
||||
"totalData": 0,
|
||||
"sizePerRequest": 0,
|
||||
"sizePerSec": 0.0
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 54027.367684395205,
|
||||
"latency_ms": {
|
||||
"min": 0.038,
|
||||
"mean": 1.179,
|
||||
"p50": 0.23,
|
||||
"p95": 5.971,
|
||||
"p99": 16.271,
|
||||
"max": 82.108
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0000375": 1,
|
||||
"0.0082445": 782396,
|
||||
"0.0164515": 21154,
|
||||
"0.024658500000000003": 4721,
|
||||
"0.032865500000000006": 1979,
|
||||
"0.041072500000000005": 642,
|
||||
"0.04927950000000001": 285,
|
||||
"0.05748650000000001": 97,
|
||||
"0.0656935": 69,
|
||||
"0.07390050000000001": 13,
|
||||
"0.0821075": 8
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0001,
|
||||
"p25": 0.0001339,
|
||||
"p50": 0.0002301,
|
||||
"p75": 0.0006239,
|
||||
"p90": 0.0024874,
|
||||
"p95": 0.0059708,
|
||||
"p99": 0.0162705,
|
||||
"p99.9": 0.035564001,
|
||||
"p99.99": 0.058229699
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"NaN": 0
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": null,
|
||||
"p25": null,
|
||||
"p50": null,
|
||||
"p75": null,
|
||||
"p90": null,
|
||||
"p95": null,
|
||||
"p99": null,
|
||||
"p99.9": null,
|
||||
"p99.99": null
|
||||
},
|
||||
"rps": {
|
||||
"mean": 54291.93014905917,
|
||||
"stddev": 35527.321305323385,
|
||||
"max": 242214.53287198595,
|
||||
"min": 34.10571407133535,
|
||||
"percentiles": {
|
||||
"p10": 10336.487801940571,
|
||||
"p25": 27170.358145573246,
|
||||
"p50": 50733.48409950603,
|
||||
"p75": 75221.81432615055,
|
||||
"p90": 101909.04267567223,
|
||||
"p95": 115807.99195777836,
|
||||
"p99": 156641.40862929283,
|
||||
"p99.9": 221158.1045172193,
|
||||
"p99.99": 242214.53287198595
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0003536109375000002,
|
||||
"fastest": 0.0001347,
|
||||
"slowest": 0.0007735
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000012493750000000002,
|
||||
"fastest": 3.3e-6,
|
||||
"slowest": 0.0000612
|
||||
},
|
||||
"firstByte": {
|
||||
"average": null,
|
||||
"fastest": null,
|
||||
"slowest": null
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"308": 811365
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 61
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.002358804,
|
||||
"slowest": 0.1060408,
|
||||
"fastest": 0.0003051,
|
||||
"average": 0.0005643368714058144,
|
||||
"requestsPerSec": 1757.2569983442186,
|
||||
"totalData": 79086,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 5271.57102647843
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 1757.2569983442186,
|
||||
"latency_ms": {
|
||||
"min": 0.305,
|
||||
"mean": 0.564,
|
||||
"p50": 0.462,
|
||||
"p95": 0.581,
|
||||
"p99": 2.482,
|
||||
"max": 106.041
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0003051": 1,
|
||||
"0.01087867": 26273,
|
||||
"0.02145224": 84,
|
||||
"0.03202581": 2,
|
||||
"0.042599380000000006": 1,
|
||||
"0.05317295000000001": 0,
|
||||
"0.06374652": 0,
|
||||
"0.07432009": 0,
|
||||
"0.08489366000000001": 0,
|
||||
"0.09546723000000001": 0,
|
||||
"0.10604080000000002": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.000409,
|
||||
"p25": 0.0004393,
|
||||
"p50": 0.000462,
|
||||
"p75": 0.0004879,
|
||||
"p90": 0.0005264,
|
||||
"p95": 0.0005808,
|
||||
"p99": 0.0024822,
|
||||
"p99.9": 0.0170555,
|
||||
"p99.99": 0.0262408
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0003048": 1,
|
||||
"0.01087831": 26273,
|
||||
"0.021451820000000003": 84,
|
||||
"0.032025330000000005": 2,
|
||||
"0.042598840000000006": 1,
|
||||
"0.05317235000000001": 0,
|
||||
"0.06374586": 0,
|
||||
"0.07431937": 0,
|
||||
"0.08489288": 0,
|
||||
"0.09546639000000001": 0,
|
||||
"0.1060399": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0004086,
|
||||
"p25": 0.0004391,
|
||||
"p50": 0.0004617,
|
||||
"p75": 0.0004876,
|
||||
"p90": 0.0005262,
|
||||
"p95": 0.0005805,
|
||||
"p99": 0.0024819,
|
||||
"p99.9": 0.0170542,
|
||||
"p99.99": 0.0262398
|
||||
},
|
||||
"rps": {
|
||||
"mean": 1850.6971373175163,
|
||||
"stddev": 606.3350485897364,
|
||||
"max": 2964.7198339758224,
|
||||
"min": 9.387873121017195,
|
||||
"percentiles": {
|
||||
"p10": 907.2763563781903,
|
||||
"p25": 1902.682782723684,
|
||||
"p50": 2064.026089289704,
|
||||
"p75": 2140.8910184526935,
|
||||
"p90": 2218.8603126577123,
|
||||
"p95": 2277.2205488101326,
|
||||
"p99": 2732.8211824008627,
|
||||
"p99.9": 2906.8077437358256,
|
||||
"p99.99": 2964.7198339758224
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.104945,
|
||||
"fastest": 0.104945,
|
||||
"slowest": 0.104945
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000049,
|
||||
"fastest": 0.000049,
|
||||
"slowest": 0.000049
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0005640438625293983,
|
||||
"fastest": 0.0003048,
|
||||
"slowest": 0.1060399
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 26362
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.005755808,
|
||||
"slowest": 0.162273399,
|
||||
"fastest": 0.0001583,
|
||||
"average": 0.0023110564513672536,
|
||||
"requestsPerSec": 6905.283634214395,
|
||||
"totalData": 310809,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 20712.6521300779
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 6905.283634214395,
|
||||
"latency_ms": {
|
||||
"min": 0.158,
|
||||
"mean": 2.311,
|
||||
"p50": 0.541,
|
||||
"p95": 9.38,
|
||||
"p99": 45.474,
|
||||
"max": 162.273
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001583": 1,
|
||||
"0.0163698099": 100653,
|
||||
"0.0325813198": 1436,
|
||||
"0.0487928297": 579,
|
||||
"0.0650043396": 448,
|
||||
"0.0812158495": 237,
|
||||
"0.0974273594": 87,
|
||||
"0.1136388693": 95,
|
||||
"0.1298503792": 37,
|
||||
"0.1460618891": 23,
|
||||
"0.162273399": 7
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0003378,
|
||||
"p25": 0.0004132,
|
||||
"p50": 0.0005407,
|
||||
"p75": 0.0007883,
|
||||
"p90": 0.0028318,
|
||||
"p95": 0.0093798,
|
||||
"p99": 0.0454738,
|
||||
"p99.9": 0.1078016,
|
||||
"p99.99": 0.1442385
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001582": 1,
|
||||
"0.0163696899": 100653,
|
||||
"0.0325811798": 1436,
|
||||
"0.0487926697": 579,
|
||||
"0.0650041596": 448,
|
||||
"0.0812156495": 237,
|
||||
"0.0974271394": 87,
|
||||
"0.1136386293": 95,
|
||||
"0.1298501192": 37,
|
||||
"0.1460616091": 23,
|
||||
"0.162273099": 7
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0003376,
|
||||
"p25": 0.0004129,
|
||||
"p50": 0.0005404,
|
||||
"p75": 0.000788,
|
||||
"p90": 0.0028315,
|
||||
"p95": 0.0093795,
|
||||
"p99": 0.0454736,
|
||||
"p99.9": 0.1078014,
|
||||
"p99.99": 0.1442384
|
||||
},
|
||||
"rps": {
|
||||
"mean": 8816.869812683235,
|
||||
"stddev": 9654.48862151181,
|
||||
"max": 102040.81632706436,
|
||||
"min": 9.23774728294758,
|
||||
"percentiles": {
|
||||
"p10": 71.65839012260524,
|
||||
"p25": 562.980644725513,
|
||||
"p50": 5954.0918983284055,
|
||||
"p75": 14172.200194270597,
|
||||
"p90": 23184.081607967128,
|
||||
"p95": 25967.809489617168,
|
||||
"p99": 31011.019449626285,
|
||||
"p99.9": 90090.0900897522,
|
||||
"p99.99": 102040.81632706436
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.10573826875,
|
||||
"fastest": 0.104618,
|
||||
"slowest": 0.1067038
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.00002766875,
|
||||
"fastest": 4.4e-6,
|
||||
"slowest": 0.0000726
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.002310793509174426,
|
||||
"fastest": 0.0001582,
|
||||
"slowest": 0.162273099
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 103603
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.019466287,
|
||||
"slowest": 0.418366599,
|
||||
"fastest": 0.0001414,
|
||||
"average": 0.020236639322692318,
|
||||
"requestsPerSec": 12631.607300467853,
|
||||
"totalData": 568395,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 37843.88800099845
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 12631.607300467853,
|
||||
"latency_ms": {
|
||||
"min": 0.141,
|
||||
"mean": 20.237,
|
||||
"p50": 13.367,
|
||||
"p95": 62.893,
|
||||
"p99": 101.938,
|
||||
"max": 418.367
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001414": 1,
|
||||
"0.0419639199": 164473,
|
||||
"0.0837864398": 21159,
|
||||
"0.12560895970000002": 3121,
|
||||
"0.16743147960000002": 413,
|
||||
"0.2092539995": 109,
|
||||
"0.25107651940000003": 74,
|
||||
"0.2928990393": 56,
|
||||
"0.3347215592": 57,
|
||||
"0.37654407910000004": 1,
|
||||
"0.418366599": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.001623,
|
||||
"p25": 0.0041708,
|
||||
"p50": 0.0133667,
|
||||
"p75": 0.0291072,
|
||||
"p90": 0.0481165,
|
||||
"p95": 0.0628933,
|
||||
"p99": 0.1019375,
|
||||
"p99.9": 0.2090671,
|
||||
"p99.99": 0.315375999
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001413": 1,
|
||||
"0.0419638299": 164474,
|
||||
"0.0837863598": 21158,
|
||||
"0.1256088897": 3121,
|
||||
"0.16743141960000002": 413,
|
||||
"0.20925394950000004": 109,
|
||||
"0.2510764794": 74,
|
||||
"0.2928990093": 56,
|
||||
"0.33472153920000003": 57,
|
||||
"0.37654406910000005": 1,
|
||||
"0.41836659900000006": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0016227,
|
||||
"p25": 0.0041704,
|
||||
"p50": 0.0133662,
|
||||
"p75": 0.0291072,
|
||||
"p90": 0.0481162,
|
||||
"p95": 0.0628933,
|
||||
"p99": 0.1019374,
|
||||
"p99.9": 0.2090671,
|
||||
"p99.99": 0.315375899
|
||||
},
|
||||
"rps": {
|
||||
"mean": 13597.939292163925,
|
||||
"stddev": 14012.504961474926,
|
||||
"max": 236966.8246483339,
|
||||
"min": 9.57544396545946,
|
||||
"percentiles": {
|
||||
"p10": 425.0616339369942,
|
||||
"p25": 3834.2010735762588,
|
||||
"p50": 10721.39684484533,
|
||||
"p75": 19647.584381209752,
|
||||
"p90": 30381.068796506184,
|
||||
"p95": 38585.73140269472,
|
||||
"p99": 52505.77563531388,
|
||||
"p99.9": 177777.77777749032,
|
||||
"p99.99": 236966.8246483339
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.1512655573359374,
|
||||
"fastest": 0.0959749,
|
||||
"slowest": 0.329047699
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 7.044140625000001e-6,
|
||||
"fastest": 2.1e-6,
|
||||
"slowest": 0.0000847
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.020236338316702285,
|
||||
"fastest": 0.0001413,
|
||||
"slowest": 0.418366599
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 189465
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 255
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.016419583,
|
||||
"slowest": 0.1468448,
|
||||
"fastest": 0.00015,
|
||||
"average": 0.004074690958513652,
|
||||
"requestsPerSec": 15653.33192115294,
|
||||
"totalData": 704979,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 46947.20975951568
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 15653.33192115294,
|
||||
"latency_ms": {
|
||||
"min": 0.15,
|
||||
"mean": 4.075,
|
||||
"p50": 1.944,
|
||||
"p95": 14.783,
|
||||
"p99": 31.295,
|
||||
"max": 146.845
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.00015": 1,
|
||||
"0.01481948": 223296,
|
||||
"0.029488959999999998": 8852,
|
||||
"0.04415843999999999": 2005,
|
||||
"0.05882791999999999": 541,
|
||||
"0.07349739999999999": 156,
|
||||
"0.08816687999999999": 100,
|
||||
"0.10283635999999999": 16,
|
||||
"0.11750583999999999": 12,
|
||||
"0.13217532": 1,
|
||||
"0.1468448": 13
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0005266,
|
||||
"p25": 0.0009285,
|
||||
"p50": 0.0019443,
|
||||
"p75": 0.004467,
|
||||
"p90": 0.0098493,
|
||||
"p95": 0.0147829,
|
||||
"p99": 0.0312955,
|
||||
"p99.9": 0.0617255,
|
||||
"p99.99": 0.1070583
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001499": 1,
|
||||
"0.014819379999999998": 223296,
|
||||
"0.02948886": 8852,
|
||||
"0.04415834": 2005,
|
||||
"0.058827819999999996": 541,
|
||||
"0.07349729999999999": 156,
|
||||
"0.08816677999999999": 100,
|
||||
"0.10283625999999998": 16,
|
||||
"0.11750573999999998": 12,
|
||||
"0.13217522": 1,
|
||||
"0.1468447": 13
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0005264,
|
||||
"p25": 0.0009283,
|
||||
"p50": 0.001944,
|
||||
"p75": 0.0044668,
|
||||
"p90": 0.009849,
|
||||
"p95": 0.0147826,
|
||||
"p99": 0.0312954,
|
||||
"p99.9": 0.0617254,
|
||||
"p99.99": 0.1070583
|
||||
},
|
||||
"rps": {
|
||||
"mean": 15870.712525652865,
|
||||
"stddev": 10795.299117141303,
|
||||
"max": 76762.0376831455,
|
||||
"min": 12.236681901335633,
|
||||
"percentiles": {
|
||||
"p10": 1616.6841807453031,
|
||||
"p25": 7000.07000069973,
|
||||
"p50": 15302.907552435288,
|
||||
"p75": 22911.704146311884,
|
||||
"p90": 30499.662252063812,
|
||||
"p95": 34871.79487179422,
|
||||
"p99": 44062.454641590186,
|
||||
"p99.9": 64894.77655739068,
|
||||
"p99.99": 76762.0376831455
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.06819543281250003,
|
||||
"fastest": 0.043867,
|
||||
"slowest": 0.0927161
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000013640625000000001,
|
||||
"fastest": 2.9e-6,
|
||||
"slowest": 0.0000837
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.004074481777389089,
|
||||
"fastest": 0.0001499,
|
||||
"slowest": 0.1468447
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 234993
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 64
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.004018174,
|
||||
"slowest": 0.1733402,
|
||||
"fastest": 0.0009088,
|
||||
"average": 0.0071451484561748865,
|
||||
"requestsPerSec": 2235.8677262956508,
|
||||
"totalData": 100593,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 6704.4040358678385
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 2235.8677262956508,
|
||||
"latency_ms": {
|
||||
"min": 0.909,
|
||||
"mean": 7.145,
|
||||
"p50": 2.415,
|
||||
"p95": 30.459,
|
||||
"p99": 65.017,
|
||||
"max": 173.34
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0009088": 1,
|
||||
"0.018151940000000002": 30515,
|
||||
"0.03539508": 1809,
|
||||
"0.05263822": 583,
|
||||
"0.06988136": 346,
|
||||
"0.08712450000000001": 183,
|
||||
"0.10436764": 61,
|
||||
"0.12161078": 26,
|
||||
"0.13885392": 2,
|
||||
"0.15609705999999998": 1,
|
||||
"0.1733402": 4
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0014034,
|
||||
"p25": 0.0017098,
|
||||
"p50": 0.0024147,
|
||||
"p75": 0.0070902,
|
||||
"p90": 0.0167069,
|
||||
"p95": 0.0304586,
|
||||
"p99": 0.065017399,
|
||||
"p99.9": 0.1041768,
|
||||
"p99.99": 0.1636814
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0009085": 1,
|
||||
"0.018151639999999997": 30515,
|
||||
"0.035394779999999994": 1809,
|
||||
"0.05263791999999999": 583,
|
||||
"0.06988106": 346,
|
||||
"0.08712419999999998": 183,
|
||||
"0.10436733999999999": 61,
|
||||
"0.12161047999999999": 26,
|
||||
"0.13885361999999998": 2,
|
||||
"0.15609675999999997": 1,
|
||||
"0.17333989999999996": 4
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0014031,
|
||||
"p25": 0.0017094,
|
||||
"p50": 0.0024144,
|
||||
"p75": 0.0070898,
|
||||
"p90": 0.0167066,
|
||||
"p95": 0.0304584,
|
||||
"p99": 0.065017099,
|
||||
"p99.9": 0.1041765,
|
||||
"p99.99": 0.1636812
|
||||
},
|
||||
"rps": {
|
||||
"mean": 2726.7928945700846,
|
||||
"stddev": 2523.963895476176,
|
||||
"max": 30326.004549011384,
|
||||
"min": 11.541386836124897,
|
||||
"percentiles": {
|
||||
"p10": 76.16146230007695,
|
||||
"p25": 442.6280301577233,
|
||||
"p50": 2197.4802226779657,
|
||||
"p75": 4400.528063367616,
|
||||
"p90": 6141.490492499327,
|
||||
"p95": 7287.263944700669,
|
||||
"p99": 8893.829905502533,
|
||||
"p99.9": 17117.958294430544,
|
||||
"p99.99": 30326.004549011384
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.003323362418895918,
|
||||
"fastest": 0.0005222,
|
||||
"slowest": 0.1078611
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 9.968837762070787e-6,
|
||||
"fastest": 2.4e-6,
|
||||
"slowest": 0.0086609
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.007144812531209925,
|
||||
"fastest": 0.0009085,
|
||||
"slowest": 0.1733399
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 33531
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.001672101,
|
||||
"slowest": 0.0334476,
|
||||
"fastest": 0.0003876,
|
||||
"average": 0.0007189138965634228,
|
||||
"requestsPerSec": 1375.313355810829,
|
||||
"totalData": 61893,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 4125.740089724682
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 1375.313355810829,
|
||||
"latency_ms": {
|
||||
"min": 0.388,
|
||||
"mean": 0.719,
|
||||
"p50": 0.639,
|
||||
"p95": 0.768,
|
||||
"p99": 1.396,
|
||||
"max": 33.448
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0003876": 1,
|
||||
"0.0036936": 20527,
|
||||
"0.0069996": 30,
|
||||
"0.0103056": 18,
|
||||
"0.0136116": 8,
|
||||
"0.016917599999999998": 11,
|
||||
"0.020223599999999998": 17,
|
||||
"0.023529599999999998": 4,
|
||||
"0.026835599999999998": 1,
|
||||
"0.030141599999999998": 5,
|
||||
"0.0334476": 9
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0005769,
|
||||
"p25": 0.0006077,
|
||||
"p50": 0.0006393,
|
||||
"p75": 0.0006773,
|
||||
"p90": 0.0007196,
|
||||
"p95": 0.000768,
|
||||
"p99": 0.0013964,
|
||||
"p99.9": 0.0197775,
|
||||
"p99.99": 0.0331157
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0003872": 1,
|
||||
"0.0036931500000000005": 20527,
|
||||
"0.006999100000000001": 30,
|
||||
"0.010305050000000003": 18,
|
||||
"0.013611000000000003": 8,
|
||||
"0.016916950000000004": 11,
|
||||
"0.020222900000000005": 17,
|
||||
"0.023528850000000004": 4,
|
||||
"0.026834800000000006": 1,
|
||||
"0.030140750000000008": 5,
|
||||
"0.0334467": 9
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0005765,
|
||||
"p25": 0.0006073,
|
||||
"p50": 0.0006389,
|
||||
"p75": 0.0006768,
|
||||
"p90": 0.000719,
|
||||
"p95": 0.0007672,
|
||||
"p99": 0.0013961,
|
||||
"p99.9": 0.0197764,
|
||||
"p99.99": 0.0331148
|
||||
},
|
||||
"rps": {
|
||||
"mean": 1442.112017183624,
|
||||
"stddev": 341.72586892201025,
|
||||
"max": 2276.636648790987,
|
||||
"min": 11.322450820113986,
|
||||
"percentiles": {
|
||||
"p10": 1316.8157369609844,
|
||||
"p25": 1455.165317174096,
|
||||
"p50": 1519.3527557260143,
|
||||
"p75": 1565.6476040373018,
|
||||
"p90": 1614.6611229969456,
|
||||
"p95": 1665.1229589234974,
|
||||
"p99": 2058.6297760206025,
|
||||
"p99.9": 2184.646305762854,
|
||||
"p99.99": 2276.636648790987
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.085987001,
|
||||
"fastest": 0.085987001,
|
||||
"slowest": 0.085987001
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.0000567,
|
||||
"fastest": 0.0000567,
|
||||
"slowest": 0.0000567
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0007184533032814724,
|
||||
"fastest": 0.0003872,
|
||||
"slowest": 0.0334467
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 20631
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.016245923,
|
||||
"slowest": 0.1344025,
|
||||
"fastest": 0.0002386,
|
||||
"average": 0.0026058178862726437,
|
||||
"requestsPerSec": 6090.337123469872,
|
||||
"totalData": 274314,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 18267.814832456912
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 6090.337123469872,
|
||||
"latency_ms": {
|
||||
"min": 0.239,
|
||||
"mean": 2.606,
|
||||
"p50": 0.74,
|
||||
"p95": 11.112,
|
||||
"p99": 35.638,
|
||||
"max": 134.403
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0002386": 1,
|
||||
"0.01365499": 87639,
|
||||
"0.02707138": 2257,
|
||||
"0.04048777": 831,
|
||||
"0.05390416": 291,
|
||||
"0.06732055": 224,
|
||||
"0.08073694000000001": 106,
|
||||
"0.09415333000000001": 41,
|
||||
"0.10756972000000001": 36,
|
||||
"0.12098611000000001": 8,
|
||||
"0.1344025": 4
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0004685,
|
||||
"p25": 0.000564799,
|
||||
"p50": 0.0007405,
|
||||
"p75": 0.001199,
|
||||
"p90": 0.0055644,
|
||||
"p95": 0.0111118,
|
||||
"p99": 0.035638,
|
||||
"p99.9": 0.079941899,
|
||||
"p99.99": 0.1125405
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002382": 1,
|
||||
"0.013654620000000001": 87639,
|
||||
"0.027071040000000005": 2257,
|
||||
"0.04048746000000001": 831,
|
||||
"0.05390388000000001": 291,
|
||||
"0.0673203": 224,
|
||||
"0.08073672000000001": 106,
|
||||
"0.09415314000000001": 41,
|
||||
"0.10756956000000001": 36,
|
||||
"0.12098598": 8,
|
||||
"0.1344024": 4
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0004682,
|
||||
"p25": 0.0005643,
|
||||
"p50": 0.00074,
|
||||
"p75": 0.0011984,
|
||||
"p90": 0.0055637,
|
||||
"p95": 0.0111114,
|
||||
"p99": 0.0356376,
|
||||
"p99.9": 0.079941499,
|
||||
"p99.99": 0.1125401
|
||||
},
|
||||
"rps": {
|
||||
"mean": 7202.567464768243,
|
||||
"stddev": 7170.45659781321,
|
||||
"max": 95238.0952529792,
|
||||
"min": 10.48230115860863,
|
||||
"percentiles": {
|
||||
"p10": 89.10433128134964,
|
||||
"p25": 1628.27690727568,
|
||||
"p50": 5737.593757498369,
|
||||
"p75": 10941.475826973277,
|
||||
"p90": 16276.041666666271,
|
||||
"p95": 19174.22983510327,
|
||||
"p99": 23237.613629521147,
|
||||
"p99.9": 94339.62262990378,
|
||||
"p99.99": 95238.0952529792
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.06899092577442661,
|
||||
"fastest": 0.067862099,
|
||||
"slowest": 0.071486299
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000049345408910955866,
|
||||
"fastest": 6.8e-6,
|
||||
"slowest": 0.0001534
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.002605233972582489,
|
||||
"fastest": 0.0002382,
|
||||
"slowest": 0.1344024
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 91438
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.091610981,
|
||||
"slowest": 0.4647646,
|
||||
"fastest": 0.0002843,
|
||||
"average": 0.025152170551815487,
|
||||
"requestsPerSec": 10076.790356672924,
|
||||
"totalData": 455598,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 30188.824809597045
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 10076.790356672924,
|
||||
"latency_ms": {
|
||||
"min": 0.284,
|
||||
"mean": 25.152,
|
||||
"p50": 19.212,
|
||||
"p95": 67.038,
|
||||
"p99": 101.9,
|
||||
"max": 464.765
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0002843": 1,
|
||||
"0.04673233": 129811,
|
||||
"0.09318036": 19798,
|
||||
"0.13962839": 1883,
|
||||
"0.18607642": 290,
|
||||
"0.23252445": 68,
|
||||
"0.27897248": 7,
|
||||
"0.32542051000000005": 4,
|
||||
"0.37186854": 2,
|
||||
"0.41831657": 0,
|
||||
"0.4647646": 2
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0034031,
|
||||
"p25": 0.0089379,
|
||||
"p50": 0.0192123,
|
||||
"p75": 0.0348282,
|
||||
"p90": 0.0539113,
|
||||
"p95": 0.0670376,
|
||||
"p99": 0.1019004,
|
||||
"p99.9": 0.1601791,
|
||||
"p99.99": 0.2271948
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002841": 1,
|
||||
"0.046732130000000004": 129812,
|
||||
"0.09318016": 19797,
|
||||
"0.13962819": 1883,
|
||||
"0.18607622000000001": 290,
|
||||
"0.23252425000000002": 68,
|
||||
"0.27897228": 7,
|
||||
"0.32542031000000005": 4,
|
||||
"0.37186834": 2,
|
||||
"0.41831637": 0,
|
||||
"0.4647644": 2
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0034026,
|
||||
"p25": 0.0089373,
|
||||
"p50": 0.0192114,
|
||||
"p75": 0.0348281,
|
||||
"p90": 0.0539112,
|
||||
"p95": 0.0670375,
|
||||
"p99": 0.1018999,
|
||||
"p99.9": 0.160179,
|
||||
"p99.99": 0.2271945
|
||||
},
|
||||
"rps": {
|
||||
"mean": 10605.623717862149,
|
||||
"stddev": 9230.80300616933,
|
||||
"max": 111524.16356901842,
|
||||
"min": 13.229543332436503,
|
||||
"percentiles": {
|
||||
"p10": 700.1890510437828,
|
||||
"p25": 3572.5222006737363,
|
||||
"p50": 8740.584590863515,
|
||||
"p75": 15748.425157488562,
|
||||
"p90": 22083.06218462441,
|
||||
"p95": 26421.169962431315,
|
||||
"p99": 36228.81099223658,
|
||||
"p99.9": 94490.19983400247,
|
||||
"p99.99": 111524.16356901842
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.10547651010452719,
|
||||
"fastest": 0.072120499,
|
||||
"slowest": 0.216904999
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 6.99253157388741e-6,
|
||||
"fastest": 2.6e-6,
|
||||
"slowest": 0.0000909
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.025151754616056263,
|
||||
"fastest": 0.0002841,
|
||||
"slowest": 0.4647644
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 151866
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 209
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.010748297,
|
||||
"slowest": 0.1569616,
|
||||
"fastest": 0.0002245,
|
||||
"average": 0.007512949975279854,
|
||||
"requestsPerSec": 8471.729555642152,
|
||||
"totalData": 381309,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 25402.39783223913
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 8471.729555642152,
|
||||
"latency_ms": {
|
||||
"min": 0.225,
|
||||
"mean": 7.513,
|
||||
"p50": 2.461,
|
||||
"p95": 30.522,
|
||||
"p99": 59.582,
|
||||
"max": 156.962
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0002245": 1,
|
||||
"0.01589821": 110166,
|
||||
"0.03157192": 10984,
|
||||
"0.047245630000000004": 3570,
|
||||
"0.06291934": 1396,
|
||||
"0.07859305000000001": 648,
|
||||
"0.09426676": 225,
|
||||
"0.10994047": 54,
|
||||
"0.12561418": 19,
|
||||
"0.14128789": 29,
|
||||
"0.1569616": 11
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0006895,
|
||||
"p25": 0.0011646,
|
||||
"p50": 0.0024605,
|
||||
"p75": 0.00967,
|
||||
"p90": 0.0193773,
|
||||
"p95": 0.0305215,
|
||||
"p99": 0.0595816,
|
||||
"p99.9": 0.0907694,
|
||||
"p99.99": 0.1363714
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002243": 2,
|
||||
"0.015897989999999997": 110165,
|
||||
"0.03157167999999999": 10984,
|
||||
"0.04724536999999999": 3570,
|
||||
"0.06291905999999999": 1396,
|
||||
"0.07859274999999998": 648,
|
||||
"0.09426643999999998": 225,
|
||||
"0.10994012999999998": 54,
|
||||
"0.12561382": 19,
|
||||
"0.14128750999999998": 29,
|
||||
"0.15696119999999997": 11
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0006892,
|
||||
"p25": 0.0011644,
|
||||
"p50": 0.0024601,
|
||||
"p75": 0.0096697,
|
||||
"p90": 0.0193772,
|
||||
"p95": 0.0305214,
|
||||
"p99": 0.059581,
|
||||
"p99.9": 0.090769,
|
||||
"p99.99": 0.1363713
|
||||
},
|
||||
"rps": {
|
||||
"mean": 9967.99791405974,
|
||||
"stddev": 13712.545585557658,
|
||||
"max": 225806.45161368826,
|
||||
"min": 14.836949345171242,
|
||||
"percentiles": {
|
||||
"p10": 99.03931860948775,
|
||||
"p25": 1900.6842463286118,
|
||||
"p50": 6768.69852968809,
|
||||
"p75": 14186.26901124974,
|
||||
"p90": 23539.826569824312,
|
||||
"p95": 30052.75447548217,
|
||||
"p99": 40046.05296090477,
|
||||
"p99.9": 198019.80198021766,
|
||||
"p99.99": 225806.45161368826
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.05095217967317911,
|
||||
"fastest": 0.0345505,
|
||||
"slowest": 0.0871411
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.00001849738794520989,
|
||||
"fastest": 2.8e-6,
|
||||
"slowest": 0.0001439
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.007512631878932849,
|
||||
"fastest": 0.0002243,
|
||||
"slowest": 0.1569612
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 127103
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 64
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 300.003628013,
|
||||
"slowest": 0.204141902,
|
||||
"fastest": 0.0001267,
|
||||
"average": 0.0024508333589749417,
|
||||
"requestsPerSec": 13030.97907812834,
|
||||
"totalData": 11727927,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 39092.61723825485
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 13030.97907812834,
|
||||
"latency_ms": {
|
||||
"min": 0.127,
|
||||
"mean": 2.451,
|
||||
"p50": 0.814,
|
||||
"p95": 9.595,
|
||||
"p99": 35.443,
|
||||
"max": 204.142
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001267": 1,
|
||||
"0.0205282202": 3832478,
|
||||
"0.0409297404": 44599,
|
||||
"0.0613312606": 17472,
|
||||
"0.08173278079999999": 8451,
|
||||
"0.10213430099999998": 3901,
|
||||
"0.12253582119999999": 1613,
|
||||
"0.1429373414": 628,
|
||||
"0.1633388616": 108,
|
||||
"0.1837403818": 52,
|
||||
"0.204141902": 6
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0003553,
|
||||
"p25": 0.0004996,
|
||||
"p50": 0.000814401,
|
||||
"p75": 0.0014808,
|
||||
"p90": 0.0039954,
|
||||
"p95": 0.009594901,
|
||||
"p99": 0.035443086,
|
||||
"p99.9": 0.092844401,
|
||||
"p99.99": 0.131851711
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001265": 1,
|
||||
"0.020528030200000002": 3832479,
|
||||
"0.0409295604": 44599,
|
||||
"0.0613310906": 17472,
|
||||
"0.0817326208": 8450,
|
||||
"0.102134151": 3901,
|
||||
"0.1225356812": 1613,
|
||||
"0.1429372114": 628,
|
||||
"0.1633387416": 108,
|
||||
"0.1837402718": 52,
|
||||
"0.204141802": 6
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0003551,
|
||||
"p25": 0.0004994,
|
||||
"p50": 0.0008142,
|
||||
"p75": 0.001480599,
|
||||
"p90": 0.003995,
|
||||
"p95": 0.009594501,
|
||||
"p99": 0.035442386,
|
||||
"p99.9": 0.092844301,
|
||||
"p99.99": 0.131851411
|
||||
},
|
||||
"rps": {
|
||||
"mean": 14634.436809419303,
|
||||
"stddev": 15168.46742844932,
|
||||
"max": 294117.6473096741,
|
||||
"min": 9.362568264827344,
|
||||
"percentiles": {
|
||||
"p10": 98.58917898976765,
|
||||
"p25": 2112.314582785661,
|
||||
"p50": 11046.39485840811,
|
||||
"p75": 23341.580691840434,
|
||||
"p90": 34526.24339761367,
|
||||
"p95": 40115.57930451167,
|
||||
"p99": 47730.69837527305,
|
||||
"p99.9": 143884.89209655894,
|
||||
"p99.99": 254237.2882263559
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0650016463125,
|
||||
"fastest": 0.048728695,
|
||||
"slowest": 0.068113693
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000017812499999999993,
|
||||
"fastest": 5e-6,
|
||||
"slowest": 0.0000669
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0024505522780103343,
|
||||
"fastest": 0.0001265,
|
||||
"slowest": 0.204141802
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 3909309
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 32
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.002150269,
|
||||
"slowest": 0.059823898,
|
||||
"fastest": 0.0000588,
|
||||
"average": 0.003753154335351309,
|
||||
"requestsPerSec": 17026.55922116867,
|
||||
"totalData": 0,
|
||||
"sizePerRequest": 0,
|
||||
"sizePerSec": 0.0
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 17026.55922116867,
|
||||
"latency_ms": {
|
||||
"min": 0.059,
|
||||
"mean": 3.753,
|
||||
"p50": 2.855,
|
||||
"p95": 10.46,
|
||||
"p99": 15.523,
|
||||
"max": 59.824
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0000588": 1,
|
||||
"0.0060353098": 206113,
|
||||
"0.0120118196": 41464,
|
||||
"0.0179883294": 6588,
|
||||
"0.0239648392": 1003,
|
||||
"0.029941349000000003": 160,
|
||||
"0.035917858799999994": 17,
|
||||
"0.041894368599999995": 17,
|
||||
"0.0478708784": 9,
|
||||
"0.0538473882": 1,
|
||||
"0.059823898": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0004776,
|
||||
"p25": 0.0012618,
|
||||
"p50": 0.0028546,
|
||||
"p75": 0.0051908,
|
||||
"p90": 0.0081868,
|
||||
"p95": 0.0104601,
|
||||
"p99": 0.0155229,
|
||||
"p99.9": 0.023271099,
|
||||
"p99.99": 0.0379197
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"NaN": 0
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": null,
|
||||
"p25": null,
|
||||
"p50": null,
|
||||
"p75": null,
|
||||
"p90": null,
|
||||
"p95": null,
|
||||
"p99": null,
|
||||
"p99.9": null,
|
||||
"p99.99": null
|
||||
},
|
||||
"rps": {
|
||||
"mean": 16989.314383689936,
|
||||
"stddev": 5376.689770903059,
|
||||
"max": 30322.50291176298,
|
||||
"min": 74.45073966809896,
|
||||
"percentiles": {
|
||||
"p10": 9528.872483624458,
|
||||
"p25": 13226.556445362341,
|
||||
"p50": 17339.41059512616,
|
||||
"p75": 20818.11384085071,
|
||||
"p90": 23923.92392392406,
|
||||
"p95": 25248.73004899496,
|
||||
"p99": 27751.523317314095,
|
||||
"p99.9": 30022.82034574568,
|
||||
"p99.99": 30322.50291176298
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0003298953124999999,
|
||||
"fastest": 0.0001012,
|
||||
"slowest": 0.0007817
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000013368750000000005,
|
||||
"fastest": 2.1e-6,
|
||||
"slowest": 0.0001601
|
||||
},
|
||||
"firstByte": {
|
||||
"average": null,
|
||||
"fastest": null,
|
||||
"slowest": null
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"308": 255374
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 61
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.002064744,
|
||||
"slowest": 0.0482662,
|
||||
"fastest": 0.0002228,
|
||||
"average": 0.0004213640438123845,
|
||||
"requestsPerSec": 2350.676430329636,
|
||||
"totalData": 105792,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 7051.829318515038
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 2350.676430329636,
|
||||
"latency_ms": {
|
||||
"min": 0.223,
|
||||
"mean": 0.421,
|
||||
"p50": 0.406,
|
||||
"p95": 0.512,
|
||||
"p99": 0.79,
|
||||
"max": 48.266
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0002228": 1,
|
||||
"0.005027139999999999": 35256,
|
||||
"0.00983148": 4,
|
||||
"0.014635819999999999": 2,
|
||||
"0.019440159999999998": 0,
|
||||
"0.0242445": 0,
|
||||
"0.029048839999999996": 0,
|
||||
"0.033853180000000004": 0,
|
||||
"0.03865752": 0,
|
||||
"0.04346186": 0,
|
||||
"0.0482662": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0003478,
|
||||
"p25": 0.0003683,
|
||||
"p50": 0.0004057,
|
||||
"p75": 0.0004461,
|
||||
"p90": 0.0004799,
|
||||
"p95": 0.0005116,
|
||||
"p99": 0.00079,
|
||||
"p99.9": 0.0017707,
|
||||
"p99.99": 0.0072501
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002226": 1,
|
||||
"0.005026879999999999": 35256,
|
||||
"0.009831159999999999": 4,
|
||||
"0.014635439999999998": 2,
|
||||
"0.019439719999999997": 0,
|
||||
"0.024243999999999998": 0,
|
||||
"0.029048279999999996": 0,
|
||||
"0.03385256": 0,
|
||||
"0.03865684": 0,
|
||||
"0.04346112": 0,
|
||||
"0.0482654": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0003476,
|
||||
"p25": 0.000368,
|
||||
"p50": 0.000405401,
|
||||
"p75": 0.0004458,
|
||||
"p90": 0.0004796,
|
||||
"p95": 0.0005113,
|
||||
"p99": 0.0007898,
|
||||
"p99.9": 0.0017704,
|
||||
"p99.99": 0.0072498
|
||||
},
|
||||
"rps": {
|
||||
"mean": 2355.480608037043,
|
||||
"stddev": 305.6269134036098,
|
||||
"max": 2831.543393402497,
|
||||
"min": 20.57096778175026,
|
||||
"percentiles": {
|
||||
"p10": 2072.5388601034974,
|
||||
"p25": 2184.2463829920093,
|
||||
"p50": 2404.625244382889,
|
||||
"p75": 2567.3149992811614,
|
||||
"p90": 2671.983228166774,
|
||||
"p95": 2712.7499246459897,
|
||||
"p99": 2765.600032777776,
|
||||
"p99.9": 2813.7875590392805,
|
||||
"p99.99": 2831.543393402497
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0469521,
|
||||
"fastest": 0.0469521,
|
||||
"slowest": 0.0469521
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.0000333,
|
||||
"fastest": 0.0000333,
|
||||
"slowest": 0.0000333
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.00042111634077245856,
|
||||
"fastest": 0.0002226,
|
||||
"slowest": 0.0482654
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 35264
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.004796639,
|
||||
"slowest": 0.0601028,
|
||||
"fastest": 0.0001558,
|
||||
"average": 0.0020574272899509124,
|
||||
"requestsPerSec": 7758.519012341544,
|
||||
"totalData": 349197,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 23272.358059980503
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 7758.519012341544,
|
||||
"latency_ms": {
|
||||
"min": 0.156,
|
||||
"mean": 2.057,
|
||||
"p50": 1.57,
|
||||
"p95": 4.809,
|
||||
"p99": 11.228,
|
||||
"max": 60.103
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001558": 1,
|
||||
"0.006150500000000001": 112848,
|
||||
"0.0121452": 2589,
|
||||
"0.018139900000000004": 600,
|
||||
"0.024134600000000003": 198,
|
||||
"0.0301293": 67,
|
||||
"0.036124": 41,
|
||||
"0.0421187": 19,
|
||||
"0.0481134": 4,
|
||||
"0.0541081": 6,
|
||||
"0.0601028": 26
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0007209,
|
||||
"p25": 0.0010639,
|
||||
"p50": 0.0015703,
|
||||
"p75": 0.0022893,
|
||||
"p90": 0.0034932,
|
||||
"p95": 0.0048093,
|
||||
"p99": 0.0112279,
|
||||
"p99.9": 0.0279622,
|
||||
"p99.99": 0.058274
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001556": 1,
|
||||
"0.0061503": 112848,
|
||||
"0.012145000000000001": 2589,
|
||||
"0.0181397": 600,
|
||||
"0.0241344": 198,
|
||||
"0.0301291": 68,
|
||||
"0.036123800000000005": 40,
|
||||
"0.0421185": 19,
|
||||
"0.0481132": 4,
|
||||
"0.0541079": 6,
|
||||
"0.0601026": 26
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0007205,
|
||||
"p25": 0.0010637,
|
||||
"p50": 0.00157,
|
||||
"p75": 0.0022891,
|
||||
"p90": 0.0034929,
|
||||
"p95": 0.004809,
|
||||
"p99": 0.0112276,
|
||||
"p99.9": 0.0279619,
|
||||
"p99.99": 0.0582734
|
||||
},
|
||||
"rps": {
|
||||
"mean": 8219.237452143676,
|
||||
"stddev": 15997.850144047194,
|
||||
"max": 624999.999635083,
|
||||
"min": 16.93494441104497,
|
||||
"percentiles": {
|
||||
"p10": 3525.5603122639604,
|
||||
"p25": 6021.67804094736,
|
||||
"p50": 8276.48809921183,
|
||||
"p75": 10083.084617246475,
|
||||
"p90": 11154.99412101651,
|
||||
"p95": 11714.174150721796,
|
||||
"p99": 13102.489472998985,
|
||||
"p99.9": 23999.999999885404,
|
||||
"p99.99": 624999.999635083
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.054984587499999994,
|
||||
"fastest": 0.0524595,
|
||||
"slowest": 0.0572887
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000028637499999999998,
|
||||
"fastest": 5.5e-6,
|
||||
"slowest": 0.0000644
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0020571085423671497,
|
||||
"fastest": 0.0001556,
|
||||
"slowest": 0.0601026
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 116399
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.0046378,
|
||||
"slowest": 0.2181895,
|
||||
"fastest": 0.0004581,
|
||||
"average": 0.05724174818779055,
|
||||
"requestsPerSec": 4473.48352520712,
|
||||
"totalData": 200601,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 13369.26640108567
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 4473.48352520712,
|
||||
"latency_ms": {
|
||||
"min": 0.458,
|
||||
"mean": 57.242,
|
||||
"p50": 52.612,
|
||||
"p95": 108.747,
|
||||
"p99": 147.025,
|
||||
"max": 218.19
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0004581": 1,
|
||||
"0.022231240000000003": 3857,
|
||||
"0.04400438000000001": 19941,
|
||||
"0.06577752000000002": 22166,
|
||||
"0.08755066000000002": 12520,
|
||||
"0.10932380000000001": 5131,
|
||||
"0.13109694000000002": 1990,
|
||||
"0.15287008000000002": 715,
|
||||
"0.17464322000000002": 325,
|
||||
"0.19641636": 197,
|
||||
"0.2181895": 24
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.026986199,
|
||||
"p25": 0.038062098,
|
||||
"p50": 0.0526119,
|
||||
"p75": 0.0716704,
|
||||
"p90": 0.092374001,
|
||||
"p95": 0.108747,
|
||||
"p99": 0.147025301,
|
||||
"p99.9": 0.192869101,
|
||||
"p99.99": 0.211826801
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0004579": 1,
|
||||
"0.02223103": 3858,
|
||||
"0.044004159999999994": 19942,
|
||||
"0.06577728999999999": 22164,
|
||||
"0.08755041999999999": 12520,
|
||||
"0.10932354999999999": 5131,
|
||||
"0.13109668": 1990,
|
||||
"0.15286981": 715,
|
||||
"0.17464294": 325,
|
||||
"0.19641607": 197,
|
||||
"0.2181892": 24
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.026985899,
|
||||
"p25": 0.038061798,
|
||||
"p50": 0.0526117,
|
||||
"p75": 0.0716702,
|
||||
"p90": 0.092373801,
|
||||
"p95": 0.1087468,
|
||||
"p99": 0.147025101,
|
||||
"p99.9": 0.192868801,
|
||||
"p99.99": 0.211826601
|
||||
},
|
||||
"rps": {
|
||||
"mean": 4502.987802008221,
|
||||
"stddev": 2838.169442761876,
|
||||
"max": 27472.52747257541,
|
||||
"min": 11.687827478316159,
|
||||
"percentiles": {
|
||||
"p10": 1059.415555751777,
|
||||
"p25": 2416.7237281992957,
|
||||
"p50": 4248.945730340718,
|
||||
"p75": 6224.462136195428,
|
||||
"p90": 8056.292066082553,
|
||||
"p95": 9484.02849244303,
|
||||
"p99": 12308.56027073252,
|
||||
"p99.9": 15449.593194153273,
|
||||
"p99.99": 27472.52747257541
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.08048447843750003,
|
||||
"fastest": 0.0477648,
|
||||
"slowest": 0.128978001
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 6.845703125000003e-6,
|
||||
"fastest": 1.9e-6,
|
||||
"slowest": 0.0001189
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.057241450203732384,
|
||||
"fastest": 0.0004579,
|
||||
"slowest": 0.2181892
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 66867
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 256
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.016737208,
|
||||
"slowest": 0.166731802,
|
||||
"fastest": 0.0002387,
|
||||
"average": 0.009739633160423882,
|
||||
"requestsPerSec": 6560.679502835979,
|
||||
"totalData": 295374,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 19669.65232917859
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 6560.679502835979,
|
||||
"latency_ms": {
|
||||
"min": 0.239,
|
||||
"mean": 9.74,
|
||||
"p50": 7.366,
|
||||
"p95": 25.614,
|
||||
"p99": 39.844,
|
||||
"max": 166.732
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0002387": 1,
|
||||
"0.0168880102": 84981,
|
||||
"0.0335373204": 11313,
|
||||
"0.0501866306": 1763,
|
||||
"0.0668359408": 285,
|
||||
"0.083485251": 48,
|
||||
"0.10013456119999999": 11,
|
||||
"0.11678387139999999": 18,
|
||||
"0.1334331816": 0,
|
||||
"0.1500824918": 30,
|
||||
"0.166731802": 8
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.002615,
|
||||
"p25": 0.004519,
|
||||
"p50": 0.0073656,
|
||||
"p75": 0.012175101,
|
||||
"p90": 0.019472301,
|
||||
"p95": 0.025613601,
|
||||
"p99": 0.0398441,
|
||||
"p99.9": 0.0704864,
|
||||
"p99.99": 0.148703101
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002386": 1,
|
||||
"0.0168879202": 84981,
|
||||
"0.0335372404": 11313,
|
||||
"0.050186560600000006": 1763,
|
||||
"0.06683588080000001": 285,
|
||||
"0.08348520100000001": 48,
|
||||
"0.10013452120000002": 11,
|
||||
"0.11678384140000002": 18,
|
||||
"0.13343316160000002": 0,
|
||||
"0.15008248180000003": 30,
|
||||
"0.166731802": 8
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0026147,
|
||||
"p25": 0.0045188,
|
||||
"p50": 0.0073654,
|
||||
"p75": 0.012174901,
|
||||
"p90": 0.0194718,
|
||||
"p95": 0.025613501,
|
||||
"p99": 0.0398437,
|
||||
"p99.9": 0.0704862,
|
||||
"p99.99": 0.148702901
|
||||
},
|
||||
"rps": {
|
||||
"mean": 6556.6940634554,
|
||||
"stddev": 3500.6037679130523,
|
||||
"max": 15039.886184643516,
|
||||
"min": 12.601282651797792,
|
||||
"percentiles": {
|
||||
"p10": 1600.5601960686654,
|
||||
"p25": 3829.294099863541,
|
||||
"p50": 6613.557793476607,
|
||||
"p75": 9481.541254791226,
|
||||
"p90": 11020.38771727662,
|
||||
"p95": 11861.919218320745,
|
||||
"p99": 13184.246013603382,
|
||||
"p99.9": 14657.947067384583,
|
||||
"p99.99": 15039.886184643516
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.086538041625,
|
||||
"fastest": 0.072438501,
|
||||
"slowest": 0.112627201
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000011654687500000001,
|
||||
"fastest": 2.3e-6,
|
||||
"slowest": 0.0000813
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.009739357007140051,
|
||||
"fastest": 0.0002386,
|
||||
"slowest": 0.166731802
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 98458
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 62
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.001670186,
|
||||
"slowest": 0.0673689,
|
||||
"fastest": 0.0011287,
|
||||
"average": 0.008770213088567843,
|
||||
"requestsPerSec": 1823.1969947936036,
|
||||
"totalData": 82005,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 5466.3913406474885
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 1823.1969947936036,
|
||||
"latency_ms": {
|
||||
"min": 1.129,
|
||||
"mean": 8.77,
|
||||
"p50": 7.934,
|
||||
"p95": 16.433,
|
||||
"p99": 21.387,
|
||||
"max": 67.369
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0011287": 1,
|
||||
"0.007752719999999999": 13146,
|
||||
"0.014376739999999999": 11573,
|
||||
"0.021000759999999997": 2294,
|
||||
"0.027624779999999998": 264,
|
||||
"0.0342488": 36,
|
||||
"0.04087282": 5,
|
||||
"0.04749684": 0,
|
||||
"0.05412086": 0,
|
||||
"0.06074488": 4,
|
||||
"0.0673689": 12
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0043039,
|
||||
"p25": 0.0057605,
|
||||
"p50": 0.007934,
|
||||
"p75": 0.0109823,
|
||||
"p90": 0.0142346,
|
||||
"p95": 0.0164328,
|
||||
"p99": 0.0213872,
|
||||
"p99.9": 0.0316213,
|
||||
"p99.99": 0.0657409
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0011284": 1,
|
||||
"0.0077524099999999995": 13146,
|
||||
"0.014376419999999999": 11573,
|
||||
"0.02100043": 2294,
|
||||
"0.02762444": 264,
|
||||
"0.03424845": 36,
|
||||
"0.04087246": 5,
|
||||
"0.04749647": 0,
|
||||
"0.05412048": 0,
|
||||
"0.06074449": 4,
|
||||
"0.0673685": 12
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0043036,
|
||||
"p25": 0.0057602,
|
||||
"p50": 0.0079337,
|
||||
"p75": 0.010982,
|
||||
"p90": 0.0142343,
|
||||
"p95": 0.0164326,
|
||||
"p99": 0.0213869,
|
||||
"p99.9": 0.031621,
|
||||
"p99.99": 0.0657406
|
||||
},
|
||||
"rps": {
|
||||
"mean": 1865.6878466656424,
|
||||
"stddev": 806.3740144583545,
|
||||
"max": 11855.364552481875,
|
||||
"min": 16.184712891285667,
|
||||
"percentiles": {
|
||||
"p10": 861.5676222887545,
|
||||
"p25": 1401.4294580472636,
|
||||
"p50": 1864.589375984081,
|
||||
"p75": 2333.1541200459365,
|
||||
"p90": 2783.662991200708,
|
||||
"p95": 3027.329477837645,
|
||||
"p99": 3653.885679051755,
|
||||
"p99.9": 10213.702074165707,
|
||||
"p99.99": 11855.364552481875
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0041902446019754635,
|
||||
"fastest": 0.0004388,
|
||||
"slowest": 0.0623406
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 9.343519297603825e-6,
|
||||
"fastest": 2.9e-6,
|
||||
"slowest": 0.0060626
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.008769826130455488,
|
||||
"fastest": 0.0011284,
|
||||
"slowest": 0.0673685
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 27335
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.00223488,
|
||||
"slowest": 0.027620101,
|
||||
"fastest": 0.0003776,
|
||||
"average": 0.000624054979473615,
|
||||
"requestsPerSec": 1587.96340615619,
|
||||
"totalData": 71469,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 4763.89021846857
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 1587.96340615619,
|
||||
"latency_ms": {
|
||||
"min": 0.378,
|
||||
"mean": 0.624,
|
||||
"p50": 0.588,
|
||||
"p95": 0.749,
|
||||
"p99": 1.414,
|
||||
"max": 27.62
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0003776": 1,
|
||||
"0.0031018501": 23752,
|
||||
"0.0058261002": 39,
|
||||
"0.0085503503": 8,
|
||||
"0.011274600400000001": 6,
|
||||
"0.013998850500000002": 7,
|
||||
"0.0167231006": 3,
|
||||
"0.0194473507": 4,
|
||||
"0.0221716008": 2,
|
||||
"0.0248958509": 0,
|
||||
"0.027620101": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0004916,
|
||||
"p25": 0.000546801,
|
||||
"p50": 0.0005879,
|
||||
"p75": 0.0006248,
|
||||
"p90": 0.0006784,
|
||||
"p95": 0.0007492,
|
||||
"p99": 0.0014144,
|
||||
"p99.9": 0.0080586,
|
||||
"p99.99": 0.020332001
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0003773": 1,
|
||||
"0.0031015101": 23752,
|
||||
"0.0058257202": 39,
|
||||
"0.008549930300000001": 8,
|
||||
"0.0112741404": 6,
|
||||
"0.0139983505": 7,
|
||||
"0.016722560600000002": 3,
|
||||
"0.0194467707": 4,
|
||||
"0.0221709808": 2,
|
||||
"0.0248951909": 0,
|
||||
"0.027619401": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0004912,
|
||||
"p25": 0.0005464,
|
||||
"p50": 0.0005876,
|
||||
"p75": 0.0006244,
|
||||
"p90": 0.0006778,
|
||||
"p95": 0.0007487,
|
||||
"p99": 0.0014141,
|
||||
"p99.9": 0.0080579,
|
||||
"p99.99": 0.020331301
|
||||
},
|
||||
"rps": {
|
||||
"mean": 1599.664298342526,
|
||||
"stddev": 304.009822680561,
|
||||
"max": 2298.6384130292395,
|
||||
"min": 22.371764542278953,
|
||||
"percentiles": {
|
||||
"p10": 1407.332200765958,
|
||||
"p25": 1555.193828990857,
|
||||
"p50": 1635.2728350521156,
|
||||
"p75": 1724.647679116921,
|
||||
"p90": 1864.2417714440055,
|
||||
"p95": 1952.522263121158,
|
||||
"p99": 2060.3893950522333,
|
||||
"p99.9": 2196.7293141324017,
|
||||
"p99.99": 2298.6384130292395
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.042964001,
|
||||
"fastest": 0.042964001,
|
||||
"slowest": 0.042964001
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.0000416,
|
||||
"fastest": 0.0000416,
|
||||
"slowest": 0.0000416
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0006236448253788323,
|
||||
"fastest": 0.0003773,
|
||||
"slowest": 0.027619401
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 23823
|
||||
},
|
||||
"errorDistribution": {}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.001381334,
|
||||
"slowest": 0.068229001,
|
||||
"fastest": 0.000343,
|
||||
"average": 0.004648210778032954,
|
||||
"requestsPerSec": 3426.4844587011153,
|
||||
"totalData": 154158,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 10276.253670760798
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 3426.4844587011153,
|
||||
"latency_ms": {
|
||||
"min": 0.343,
|
||||
"mean": 4.648,
|
||||
"p50": 2.706,
|
||||
"p95": 15.93,
|
||||
"p99": 28.589,
|
||||
"max": 68.229
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.000343": 1,
|
||||
"0.0071316001": 43052,
|
||||
"0.0139202002": 5052,
|
||||
"0.0207088003": 1967,
|
||||
"0.0274974004": 727,
|
||||
"0.034286000500000004": 326,
|
||||
"0.041074600600000004": 170,
|
||||
"0.047863200700000004": 39,
|
||||
"0.054651800800000004": 31,
|
||||
"0.061440400900000004": 10,
|
||||
"0.068229001": 11
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0012123,
|
||||
"p25": 0.0018349,
|
||||
"p50": 0.0027058,
|
||||
"p75": 0.0047379,
|
||||
"p90": 0.0109985,
|
||||
"p95": 0.0159298,
|
||||
"p99": 0.0285888,
|
||||
"p99.9": 0.048228701,
|
||||
"p99.99": 0.066864201
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0003426": 1,
|
||||
"0.0071311801": 43054,
|
||||
"0.013919760199999999": 5051,
|
||||
"0.020708340299999996": 1966,
|
||||
"0.027496920399999996": 727,
|
||||
"0.034285500499999996": 326,
|
||||
"0.04107408059999999": 170,
|
||||
"0.0478626607": 39,
|
||||
"0.054651240799999994": 31,
|
||||
"0.06143982089999999": 10,
|
||||
"0.068228401": 11
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0012119,
|
||||
"p25": 0.0018345,
|
||||
"p50": 0.0027053,
|
||||
"p75": 0.0047372,
|
||||
"p90": 0.0109979,
|
||||
"p95": 0.0159293,
|
||||
"p99": 0.0285884,
|
||||
"p99.9": 0.048228201,
|
||||
"p99.99": 0.066863801
|
||||
},
|
||||
"rps": {
|
||||
"mean": 3546.8989902223993,
|
||||
"stddev": 2152.2391804070685,
|
||||
"max": 10022.550739138387,
|
||||
"min": 17.735496354468726,
|
||||
"percentiles": {
|
||||
"p10": 402.51977378388324,
|
||||
"p25": 1761.7675710406404,
|
||||
"p50": 3641.1817657709794,
|
||||
"p75": 5219.1127508323925,
|
||||
"p90": 6473.0697975499825,
|
||||
"p95": 6961.979280318372,
|
||||
"p99": 7505.5541100411665,
|
||||
"p99.9": 8746.143193799813,
|
||||
"p99.99": 10022.550739138387
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.051438553954384715,
|
||||
"fastest": 0.0489099,
|
||||
"slowest": 0.0550978
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.00004745068695753747,
|
||||
"fastest": 5.9e-6,
|
||||
"slowest": 0.0001463
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.004647635703109795,
|
||||
"fastest": 0.0003426,
|
||||
"slowest": 0.068228401
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 51386
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.012466199,
|
||||
"slowest": 0.193254797,
|
||||
"fastest": 0.0082419,
|
||||
"average": 0.07044534605138456,
|
||||
"requestsPerSec": 3606.5360136235668,
|
||||
"totalData": 161661,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 10768.450556829126
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 3606.5360136235668,
|
||||
"latency_ms": {
|
||||
"min": 8.242,
|
||||
"mean": 70.445,
|
||||
"p50": 68.399,
|
||||
"p95": 108.55,
|
||||
"p99": 134.345,
|
||||
"max": 193.255
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0082419": 1,
|
||||
"0.0267431897": 314,
|
||||
"0.045244479399999996": 5069,
|
||||
"0.0637457691": 16265,
|
||||
"0.0822470588": 18675,
|
||||
"0.1007483485": 9007,
|
||||
"0.1192496382": 3235,
|
||||
"0.1377509279": 894,
|
||||
"0.1562522176": 282,
|
||||
"0.1747535073": 134,
|
||||
"0.193254797": 11
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.045255097,
|
||||
"p25": 0.055998799,
|
||||
"p50": 0.068398696,
|
||||
"p75": 0.082402895,
|
||||
"p90": 0.097909198,
|
||||
"p95": 0.108549894,
|
||||
"p99": 0.1343454,
|
||||
"p99.9": 0.16636569,
|
||||
"p99.99": 0.184468389
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0082417": 1,
|
||||
"0.0267429697": 314,
|
||||
"0.0452442394": 5069,
|
||||
"0.0637455091": 16265,
|
||||
"0.0822467788": 18675,
|
||||
"0.1007480485": 9007,
|
||||
"0.1192493182": 3235,
|
||||
"0.1377505879": 894,
|
||||
"0.1562518576": 282,
|
||||
"0.17475312729999998": 134,
|
||||
"0.193254397": 11
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.045254597,
|
||||
"p25": 0.055998399,
|
||||
"p50": 0.068398296,
|
||||
"p75": 0.082402395,
|
||||
"p90": 0.097908798,
|
||||
"p95": 0.108549494,
|
||||
"p99": 0.134345,
|
||||
"p99.9": 0.16636519,
|
||||
"p99.99": 0.184467989
|
||||
},
|
||||
"rps": {
|
||||
"mean": 3725.090712920856,
|
||||
"stddev": 2222.2177970570033,
|
||||
"max": 16580.998176093126,
|
||||
"min": 6.566850926593501,
|
||||
"percentiles": {
|
||||
"p10": 973.9627296928842,
|
||||
"p25": 2110.573975617737,
|
||||
"p50": 3578.244662804117,
|
||||
"p75": 5078.101712142901,
|
||||
"p90": 6638.108968707412,
|
||||
"p95": 7661.599258034662,
|
||||
"p99": 9869.689259000877,
|
||||
"p99.9": 15037.59398495838,
|
||||
"p99.99": 16580.998176093126
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.09872306716434409,
|
||||
"fastest": 0.061666496,
|
||||
"slowest": 0.16976059
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 8.837910609237815e-6,
|
||||
"fastest": 2.2e-6,
|
||||
"slowest": 0.0002139
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0704447562041305,
|
||||
"fastest": 0.0082417,
|
||||
"slowest": 0.193254397
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 53887
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 256
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.003713894,
|
||||
"slowest": 0.079442,
|
||||
"fastest": 0.0003078,
|
||||
"average": 0.011152737680442688,
|
||||
"requestsPerSec": 5708.453293970816,
|
||||
"totalData": 256752,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 17112.56305031752
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 5708.453293970816,
|
||||
"latency_ms": {
|
||||
"min": 0.308,
|
||||
"mean": 11.153,
|
||||
"p50": 10.255,
|
||||
"p95": 23.188,
|
||||
"p99": 37.342,
|
||||
"max": 79.442
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0003078": 1,
|
||||
"0.008221220000000001": 29665,
|
||||
"0.016134640000000002": 40765,
|
||||
"0.024048060000000003": 11332,
|
||||
"0.03196148": 2270,
|
||||
"0.039874900000000005": 924,
|
||||
"0.04778832": 384,
|
||||
"0.05570174": 149,
|
||||
"0.06361516": 53,
|
||||
"0.07152858000000001": 36,
|
||||
"0.07944200000000001": 5
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0029656,
|
||||
"p25": 0.006794,
|
||||
"p50": 0.010255,
|
||||
"p75": 0.0141449,
|
||||
"p90": 0.0192869,
|
||||
"p95": 0.023187701,
|
||||
"p99": 0.037342,
|
||||
"p99.9": 0.0562323,
|
||||
"p99.99": 0.069859
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0003075": 1,
|
||||
"0.00822094": 29666,
|
||||
"0.016134379999999997": 40765,
|
||||
"0.024047819999999994": 11332,
|
||||
"0.03196126": 2269,
|
||||
"0.0398747": 924,
|
||||
"0.04778813999999999": 384,
|
||||
"0.055701579999999994": 149,
|
||||
"0.06361502": 53,
|
||||
"0.07152845999999999": 36,
|
||||
"0.0794419": 5
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0029654,
|
||||
"p25": 0.0067934,
|
||||
"p50": 0.0102546,
|
||||
"p75": 0.0141444,
|
||||
"p90": 0.0192867,
|
||||
"p95": 0.0231829,
|
||||
"p99": 0.0373416,
|
||||
"p99.9": 0.0562318,
|
||||
"p99.99": 0.0698585
|
||||
},
|
||||
"rps": {
|
||||
"mean": 5707.375447740455,
|
||||
"stddev": 2140.898003961851,
|
||||
"max": 11484.619921158206,
|
||||
"min": 14.114883663505633,
|
||||
"percentiles": {
|
||||
"p10": 2605.1060077752104,
|
||||
"p25": 4484.076433120714,
|
||||
"p50": 6039.862488436646,
|
||||
"p75": 7197.16168271699,
|
||||
"p90": 8168.052443084634,
|
||||
"p95": 8824.33487843727,
|
||||
"p99": 9585.405967167944,
|
||||
"p99.9": 10336.384071932633,
|
||||
"p99.99": 11484.619921158206
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0747351895878197,
|
||||
"fastest": 0.057600001,
|
||||
"slowest": 0.106284601
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000016428272808001737,
|
||||
"fastest": 2.1e-6,
|
||||
"slowest": 0.0002039
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.011152140165720274,
|
||||
"fastest": 0.0003075,
|
||||
"slowest": 0.0794419
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 85584
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 64
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.002780824,
|
||||
"slowest": 0.087557499,
|
||||
"fastest": 0.0000344,
|
||||
"average": 0.0047049367742727334,
|
||||
"requestsPerSec": 13582.01538704289,
|
||||
"totalData": 0,
|
||||
"sizePerRequest": 0,
|
||||
"sizePerSec": 0.0
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 13582.01538704289,
|
||||
"latency_ms": {
|
||||
"min": 0.034,
|
||||
"mean": 4.705,
|
||||
"p50": 1.837,
|
||||
"p95": 20.83,
|
||||
"p99": 32.408,
|
||||
"max": 87.557
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0000344": 1,
|
||||
"0.0087867099": 171211,
|
||||
"0.0175390198": 15640,
|
||||
"0.0262913297": 11298,
|
||||
"0.035043639599999996": 4412,
|
||||
"0.043795949499999993": 805,
|
||||
"0.0525482594": 220,
|
||||
"0.061300569299999996": 98,
|
||||
"0.0700528792": 19,
|
||||
"0.0788051891": 0,
|
||||
"0.087557499": 2
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0007834,
|
||||
"p25": 0.0011793,
|
||||
"p50": 0.0018371,
|
||||
"p75": 0.0035278,
|
||||
"p90": 0.0156791,
|
||||
"p95": 0.0208298,
|
||||
"p99": 0.032408,
|
||||
"p99.9": 0.048070499,
|
||||
"p99.99": 0.062111599
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"NaN": 0
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": null,
|
||||
"p25": null,
|
||||
"p50": null,
|
||||
"p75": null,
|
||||
"p90": null,
|
||||
"p95": null,
|
||||
"p99": null,
|
||||
"p99.9": null,
|
||||
"p99.99": null
|
||||
},
|
||||
"rps": {
|
||||
"mean": 14750.279700369903,
|
||||
"stddev": 14560.69116016888,
|
||||
"max": 68204.77433420006,
|
||||
"min": 40.72341066709136,
|
||||
"percentiles": {
|
||||
"p10": 88.6061368610332,
|
||||
"p25": 1208.1854564674761,
|
||||
"p50": 11023.921910545645,
|
||||
"p75": 25486.68727293039,
|
||||
"p90": 37901.03026744765,
|
||||
"p95": 41947.83877439307,
|
||||
"p99": 48502.425121255284,
|
||||
"p99.9": 55047.724862357965,
|
||||
"p99.99": 68204.77433420006
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0003320484374999999,
|
||||
"fastest": 0.000121,
|
||||
"slowest": 0.0007906
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000012546875,
|
||||
"fastest": 2.9e-6,
|
||||
"slowest": 0.0001175
|
||||
},
|
||||
"firstByte": {
|
||||
"average": null,
|
||||
"fastest": null,
|
||||
"slowest": null
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"308": 203706
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 62
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.002190688,
|
||||
"slowest": 0.082422398,
|
||||
"fastest": 0.0002387,
|
||||
"average": 0.0005324675257484613,
|
||||
"requestsPerSec": 1861.3948176473145,
|
||||
"totalData": 83772,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 5583.984482146851
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 1861.3948176473145,
|
||||
"latency_ms": {
|
||||
"min": 0.239,
|
||||
"mean": 0.532,
|
||||
"p50": 0.3,
|
||||
"p95": 0.412,
|
||||
"p99": 9.03,
|
||||
"max": 82.422
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0002387": 1,
|
||||
"0.0084570698": 27612,
|
||||
"0.0166754396": 250,
|
||||
"0.0248938094": 59,
|
||||
"0.0331121792": 1,
|
||||
"0.041330549": 0,
|
||||
"0.0495489188": 0,
|
||||
"0.0577672886": 0,
|
||||
"0.0659856584": 0,
|
||||
"0.0742040282": 0,
|
||||
"0.082422398": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0002824,
|
||||
"p25": 0.0002911,
|
||||
"p50": 0.0003002,
|
||||
"p75": 0.0003116,
|
||||
"p90": 0.0003388,
|
||||
"p95": 0.000412,
|
||||
"p99": 0.009029999,
|
||||
"p99.9": 0.0171978,
|
||||
"p99.99": 0.023654
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002385": 1,
|
||||
"0.008456779800000001": 27612,
|
||||
"0.0166750596": 250,
|
||||
"0.024893339400000002": 59,
|
||||
"0.033111619200000005": 1,
|
||||
"0.041329899": 0,
|
||||
"0.04954817880000001": 0,
|
||||
"0.05776645860000001": 0,
|
||||
"0.0659847384": 0,
|
||||
"0.07420301820000001": 0,
|
||||
"0.082421298": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0002821,
|
||||
"p25": 0.0002909,
|
||||
"p50": 0.0003,
|
||||
"p75": 0.0003113,
|
||||
"p90": 0.0003385,
|
||||
"p95": 0.0004117,
|
||||
"p99": 0.009029699,
|
||||
"p99.9": 0.017197,
|
||||
"p99.99": 0.0236532
|
||||
},
|
||||
"rps": {
|
||||
"mean": 2124.484265564842,
|
||||
"stddev": 1347.8575502140113,
|
||||
"max": 3645.643456057386,
|
||||
"min": 12.074684629160716,
|
||||
"percentiles": {
|
||||
"p10": 70.81350555177794,
|
||||
"p25": 608.951588348692,
|
||||
"p50": 3104.999048468054,
|
||||
"p75": 3249.918752029405,
|
||||
"p90": 3328.933019572346,
|
||||
"p95": 3383.0288607359867,
|
||||
"p99": 3489.0965732087448,
|
||||
"p99.9": 3600.884788833553,
|
||||
"p99.99": 3645.643456057386
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.081536798,
|
||||
"fastest": 0.081536798,
|
||||
"slowest": 0.081536798
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.0000458,
|
||||
"fastest": 0.0000458,
|
||||
"slowest": 0.0000458
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0005321862014396212,
|
||||
"fastest": 0.0002385,
|
||||
"slowest": 0.082421298
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 27924
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.03402794,
|
||||
"slowest": 0.130961199,
|
||||
"fastest": 0.0001862,
|
||||
"average": 0.004149040110114824,
|
||||
"requestsPerSec": 3843.347919173815,
|
||||
"totalData": 173301,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 11527.250095026762
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 3843.347919173815,
|
||||
"latency_ms": {
|
||||
"min": 0.186,
|
||||
"mean": 4.149,
|
||||
"p50": 1.855,
|
||||
"p95": 18.713,
|
||||
"p99": 28.766,
|
||||
"max": 130.961
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001862": 1,
|
||||
"0.0132636999": 52977,
|
||||
"0.026341199800000003": 3490,
|
||||
"0.039418699700000004": 1217,
|
||||
"0.0524961996": 57,
|
||||
"0.0655736995": 3,
|
||||
"0.07865119940000001": 6,
|
||||
"0.09172869930000001": 4,
|
||||
"0.1048061992": 5,
|
||||
"0.1178836991": 6,
|
||||
"0.130961199": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0009131,
|
||||
"p25": 0.0011822,
|
||||
"p50": 0.0018548,
|
||||
"p75": 0.0026308,
|
||||
"p90": 0.0112775,
|
||||
"p95": 0.018713299,
|
||||
"p99": 0.028765999,
|
||||
"p99.9": 0.0428159,
|
||||
"p99.99": 0.1050984
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001859": 1,
|
||||
"0.0132634099": 52977,
|
||||
"0.0263409198": 3490,
|
||||
"0.03941842970000001": 1217,
|
||||
"0.052495939600000006": 57,
|
||||
"0.0655734495": 3,
|
||||
"0.07865095940000001": 6,
|
||||
"0.0917284693": 4,
|
||||
"0.10480597920000001": 5,
|
||||
"0.11788348910000002": 6,
|
||||
"0.130960999": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0009128,
|
||||
"p25": 0.0011819,
|
||||
"p50": 0.0018545,
|
||||
"p75": 0.0026305,
|
||||
"p90": 0.0112772,
|
||||
"p95": 0.018712999,
|
||||
"p99": 0.028765699,
|
||||
"p99.9": 0.0428156,
|
||||
"p99.99": 0.1050981
|
||||
},
|
||||
"rps": {
|
||||
"mean": 4687.215272300966,
|
||||
"stddev": 4249.667886126964,
|
||||
"max": 18300.837615252258,
|
||||
"min": 9.473159696631534,
|
||||
"percentiles": {
|
||||
"p10": 76.57612815780362,
|
||||
"p25": 607.0723933828876,
|
||||
"p50": 4152.361275686176,
|
||||
"p75": 7117.139747132983,
|
||||
"p90": 11249.415614773832,
|
||||
"p95": 13226.58543672865,
|
||||
"p99": 14836.795252224973,
|
||||
"p99.9": 17690.76542045258,
|
||||
"p99.99": 18300.837615252258
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.0998782625,
|
||||
"fastest": 0.086856,
|
||||
"slowest": 0.1134017
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000027018750000000006,
|
||||
"fastest": 5.8e-6,
|
||||
"slowest": 0.0000528
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.004148775954108705,
|
||||
"fastest": 0.0001859,
|
||||
"slowest": 0.130960999
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 57767
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 14
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.02036436,
|
||||
"slowest": 0.307769899,
|
||||
"fastest": 0.0007085,
|
||||
"average": 0.057897151761926315,
|
||||
"requestsPerSec": 4421.463981050856,
|
||||
"totalData": 198468,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 13213.261359260396
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 4421.463981050856,
|
||||
"latency_ms": {
|
||||
"min": 0.709,
|
||||
"mean": 57.897,
|
||||
"p50": 52.26,
|
||||
"p95": 114.007,
|
||||
"p99": 155.594,
|
||||
"max": 307.77
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0007085": 1,
|
||||
"0.0314146399": 13286,
|
||||
"0.062120779800000005": 27831,
|
||||
"0.09282691970000001": 16633,
|
||||
"0.12353305960000001": 6055,
|
||||
"0.1542391995": 1668,
|
||||
"0.18494533940000002": 359,
|
||||
"0.2156514793": 87,
|
||||
"0.24635761920000002": 47,
|
||||
"0.27706375910000003": 44,
|
||||
"0.307769899": 145
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0227912,
|
||||
"p25": 0.0346661,
|
||||
"p50": 0.0522601,
|
||||
"p75": 0.074456899,
|
||||
"p90": 0.098357199,
|
||||
"p95": 0.1140067,
|
||||
"p99": 0.1555942,
|
||||
"p99.9": 0.288823099,
|
||||
"p99.99": 0.305920899
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0007083": 1,
|
||||
"0.0314144299": 13286,
|
||||
"0.0621205598": 27831,
|
||||
"0.09282668969999999": 16633,
|
||||
"0.1235328196": 6055,
|
||||
"0.1542389495": 1668,
|
||||
"0.1849450794": 359,
|
||||
"0.2156512093": 87,
|
||||
"0.2463573392": 47,
|
||||
"0.2770634691": 44,
|
||||
"0.307769599": 145
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0227909,
|
||||
"p25": 0.034666,
|
||||
"p50": 0.05226,
|
||||
"p75": 0.074456599,
|
||||
"p90": 0.098356899,
|
||||
"p95": 0.1140066,
|
||||
"p99": 0.155594,
|
||||
"p99.9": 0.288822999,
|
||||
"p99.99": 0.305920699
|
||||
},
|
||||
"rps": {
|
||||
"mean": 5496.792005988151,
|
||||
"stddev": 9329.201442555335,
|
||||
"max": 281250.00000069453,
|
||||
"min": 6.819621688306462,
|
||||
"percentiles": {
|
||||
"p10": 83.23483877412131,
|
||||
"p25": 802.8662324498608,
|
||||
"p50": 4426.336703384787,
|
||||
"p75": 8480.209025692833,
|
||||
"p90": 11862.787095923737,
|
||||
"p95": 14050.864128143876,
|
||||
"p99": 18224.633971543284,
|
||||
"p99.9": 172413.7930951901,
|
||||
"p99.99": 281250.00000069453
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.15998890273046876,
|
||||
"fastest": 0.1231775,
|
||||
"slowest": 0.241296799
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 6.783203125000001e-6,
|
||||
"fastest": 2.2e-6,
|
||||
"slowest": 0.0000495
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.057896894489721726,
|
||||
"fastest": 0.0007083,
|
||||
"slowest": 0.307769599
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 66156
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 256
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.036446055,
|
||||
"slowest": 0.1376657,
|
||||
"fastest": 0.0001935,
|
||||
"average": 0.009662872524779646,
|
||||
"requestsPerSec": 6595.707498782364,
|
||||
"totalData": 297342,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 19774.752552058417
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 6595.707498782364,
|
||||
"latency_ms": {
|
||||
"min": 0.193,
|
||||
"mean": 9.663,
|
||||
"p50": 4.938,
|
||||
"p95": 33.788,
|
||||
"p99": 50.88,
|
||||
"max": 137.666
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001935": 1,
|
||||
"0.013940719999999998": 79769,
|
||||
"0.027687939999999998": 9875,
|
||||
"0.04143516": 7034,
|
||||
"0.055182379999999996": 1704,
|
||||
"0.0689296": 569,
|
||||
"0.08267682": 94,
|
||||
"0.09642403999999999": 22,
|
||||
"0.11017126": 27,
|
||||
"0.12391848": 9,
|
||||
"0.1376657": 10
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0031773,
|
||||
"p25": 0.0039024,
|
||||
"p50": 0.004938,
|
||||
"p75": 0.0083745,
|
||||
"p90": 0.0271535,
|
||||
"p95": 0.033787599,
|
||||
"p99": 0.050880099,
|
||||
"p99.9": 0.0751186,
|
||||
"p99.99": 0.1239474
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001934": 1,
|
||||
"0.013940599999999997": 79769,
|
||||
"0.027687799999999995": 9875,
|
||||
"0.04143499999999999": 7034,
|
||||
"0.055182199999999994": 1704,
|
||||
"0.06892939999999999": 569,
|
||||
"0.08267659999999998": 94,
|
||||
"0.09642379999999998": 22,
|
||||
"0.11017099999999998": 27,
|
||||
"0.12391819999999998": 9,
|
||||
"0.1376654": 10
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0031771,
|
||||
"p25": 0.0039023,
|
||||
"p50": 0.0049379,
|
||||
"p75": 0.0083743,
|
||||
"p90": 0.0271533,
|
||||
"p95": 0.033787299,
|
||||
"p99": 0.050879899,
|
||||
"p99.9": 0.0751182,
|
||||
"p99.99": 0.1239473
|
||||
},
|
||||
"rps": {
|
||||
"mean": 7151.913612124201,
|
||||
"stddev": 5949.056372473474,
|
||||
"max": 20847.81097993122,
|
||||
"min": 12.05063193513868,
|
||||
"percentiles": {
|
||||
"p10": 81.88197532077213,
|
||||
"p25": 789.3033608537072,
|
||||
"p50": 6479.2817253406865,
|
||||
"p75": 13466.930645307371,
|
||||
"p90": 15285.906796194184,
|
||||
"p95": 15963.695143624791,
|
||||
"p99": 17204.301075273863,
|
||||
"p99.9": 20505.809979503636,
|
||||
"p99.99": 20847.81097993122
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.071270578125,
|
||||
"fastest": 0.01819,
|
||||
"slowest": 0.1329798
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.0000122875,
|
||||
"fastest": 2.5e-6,
|
||||
"slowest": 0.0000632
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.00966263009082475,
|
||||
"fastest": 0.0001934,
|
||||
"slowest": 0.1376654
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 99114
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 62
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.000988698,
|
||||
"slowest": 0.122994999,
|
||||
"fastest": 0.0007963,
|
||||
"average": 0.01313843324213699,
|
||||
"requestsPerSec": 1217.6530739227412,
|
||||
"totalData": 54750,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 3649.759432676562
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 1217.6530739227412,
|
||||
"latency_ms": {
|
||||
"min": 0.796,
|
||||
"mean": 13.138,
|
||||
"p50": 8.574,
|
||||
"p95": 36.093,
|
||||
"p99": 50.643,
|
||||
"max": 122.995
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0007963": 1,
|
||||
"0.0130161699": 11248,
|
||||
"0.0252360398": 4128,
|
||||
"0.0374559097": 2124,
|
||||
"0.0496757796": 551,
|
||||
"0.0618956495": 130,
|
||||
"0.0741155194": 35,
|
||||
"0.0863353893": 13,
|
||||
"0.0985552592": 2,
|
||||
"0.1107751291": 16,
|
||||
"0.122994999": 2
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0033333,
|
||||
"p25": 0.0045663,
|
||||
"p50": 0.008574199,
|
||||
"p75": 0.0173364,
|
||||
"p90": 0.0302762,
|
||||
"p95": 0.0360932,
|
||||
"p99": 0.050642799,
|
||||
"p99.9": 0.0964043,
|
||||
"p99.99": 0.111215699
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0007962": 1,
|
||||
"0.0130160099": 11248,
|
||||
"0.0252358198": 4128,
|
||||
"0.03745562969999999": 2124,
|
||||
"0.049675439599999996": 551,
|
||||
"0.0618952495": 130,
|
||||
"0.07411505939999999": 35,
|
||||
"0.08633486929999999": 13,
|
||||
"0.0985546792": 2,
|
||||
"0.1107744891": 16,
|
||||
"0.122994299": 2
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0033331,
|
||||
"p25": 0.004566,
|
||||
"p50": 0.008573899,
|
||||
"p75": 0.0173361,
|
||||
"p90": 0.0302759,
|
||||
"p95": 0.0360926,
|
||||
"p99": 0.050642499,
|
||||
"p99.9": 0.0964039,
|
||||
"p99.99": 0.111215399
|
||||
},
|
||||
"rps": {
|
||||
"mean": 1623.8342116429112,
|
||||
"stddev": 1490.9497185280286,
|
||||
"max": 13242.10990949649,
|
||||
"min": 9.110795555670109,
|
||||
"percentiles": {
|
||||
"p10": 66.88023755860222,
|
||||
"p25": 214.64757176177963,
|
||||
"p50": 1448.4656610177435,
|
||||
"p75": 2599.16374731618,
|
||||
"p90": 3559.0355013795183,
|
||||
"p95": 4058.4827362291403,
|
||||
"p99": 6388.755789809181,
|
||||
"p99.9": 9176.416609327147,
|
||||
"p99.99": 13242.10990949649
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.004792804314465752,
|
||||
"fastest": 0.00035,
|
||||
"slowest": 0.107325499
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 8.753638301369792e-6,
|
||||
"fastest": 2.8e-6,
|
||||
"slowest": 0.0054627
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.013138131625698619,
|
||||
"fastest": 0.0007962,
|
||||
"slowest": 0.122994299
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 18250
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.00111823,
|
||||
"slowest": 0.033558699,
|
||||
"fastest": 0.0003061,
|
||||
"average": 0.0004550638255813963,
|
||||
"requestsPerSec": 2172.8380178228886,
|
||||
"totalData": 97782,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 6518.314068377288
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 2172.8380178228886,
|
||||
"latency_ms": {
|
||||
"min": 0.306,
|
||||
"mean": 0.455,
|
||||
"p50": 0.37,
|
||||
"p95": 0.433,
|
||||
"p99": 0.765,
|
||||
"max": 33.559
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0003061": 1,
|
||||
"0.0036313599": 32442,
|
||||
"0.0069566198": 22,
|
||||
"0.0102818797": 20,
|
||||
"0.0136071396": 14,
|
||||
"0.0169323995": 35,
|
||||
"0.0202576594": 20,
|
||||
"0.0235829193": 4,
|
||||
"0.0269081792": 11,
|
||||
"0.0302334391": 8,
|
||||
"0.033558699": 17
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0003497,
|
||||
"p25": 0.0003597,
|
||||
"p50": 0.0003701,
|
||||
"p75": 0.0003828,
|
||||
"p90": 0.0004061,
|
||||
"p95": 0.0004327,
|
||||
"p99": 0.0007653,
|
||||
"p99.9": 0.024875799,
|
||||
"p99.99": 0.033113799
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0003057": 1,
|
||||
"0.0036309399": 32442,
|
||||
"0.0069561798": 22,
|
||||
"0.0102814197": 20,
|
||||
"0.013606659600000001": 14,
|
||||
"0.0169318995": 35,
|
||||
"0.0202571394": 20,
|
||||
"0.0235823793": 4,
|
||||
"0.0269076192": 11,
|
||||
"0.0302328591": 8,
|
||||
"0.033558099": 17
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0003494,
|
||||
"p25": 0.0003594,
|
||||
"p50": 0.0003697,
|
||||
"p75": 0.0003824,
|
||||
"p90": 0.0004058,
|
||||
"p95": 0.0004323,
|
||||
"p99": 0.0007649,
|
||||
"p99.9": 0.024874999,
|
||||
"p99.99": 0.033112799
|
||||
},
|
||||
"rps": {
|
||||
"mean": 2363.0034978010385,
|
||||
"stddev": 739.063364589429,
|
||||
"max": 2852.2823352042915,
|
||||
"min": 17.942111571226594,
|
||||
"percentiles": {
|
||||
"p10": 1634.6546791989604,
|
||||
"p25": 2532.697119817031,
|
||||
"p50": 2617.397998460656,
|
||||
"p75": 2671.7363892240896,
|
||||
"p90": 2716.2704600553375,
|
||||
"p95": 2742.397464805496,
|
||||
"p99": 2800.1008036289745,
|
||||
"p99.9": 2838.537318417298,
|
||||
"p99.99": 2852.2823352042915
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.054373,
|
||||
"fastest": 0.054373,
|
||||
"slowest": 0.054373
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.0000668,
|
||||
"fastest": 0.0000668,
|
||||
"slowest": 0.0000668
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.0004546897905135944,
|
||||
"fastest": 0.0003057,
|
||||
"slowest": 0.033558099
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 32594
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.002048744,
|
||||
"slowest": 0.080674,
|
||||
"fastest": 0.000205,
|
||||
"average": 0.003360361990725557,
|
||||
"requestsPerSec": 4723.0882400871105,
|
||||
"totalData": 212520,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 14166.06515726703
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 4723.0882400871105,
|
||||
"latency_ms": {
|
||||
"min": 0.205,
|
||||
"mean": 3.36,
|
||||
"p50": 1.513,
|
||||
"p95": 15.622,
|
||||
"p99": 27.496,
|
||||
"max": 80.674
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.000205": 1,
|
||||
"0.0082519": 62919,
|
||||
"0.0162988": 4568,
|
||||
"0.024345699999999998": 2029,
|
||||
"0.032392599999999994": 1005,
|
||||
"0.04043949999999999": 217,
|
||||
"0.04848639999999999": 71,
|
||||
"0.056533299999999995": 13,
|
||||
"0.06458019999999999": 2,
|
||||
"0.07262709999999999": 5,
|
||||
"0.08067399999999998": 10
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.000851,
|
||||
"p25": 0.0010722,
|
||||
"p50": 0.0015126,
|
||||
"p75": 0.0023282,
|
||||
"p90": 0.0095442,
|
||||
"p95": 0.0156224,
|
||||
"p99": 0.0274955,
|
||||
"p99.9": 0.0425913,
|
||||
"p99.99": 0.0791286
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0002047": 1,
|
||||
"0.0082516": 62919,
|
||||
"0.016298499999999997": 4568,
|
||||
"0.024345399999999996": 2029,
|
||||
"0.0323923": 1005,
|
||||
"0.040439199999999995": 217,
|
||||
"0.0484861": 71,
|
||||
"0.056533": 13,
|
||||
"0.0645799": 2,
|
||||
"0.07262679999999999": 5,
|
||||
"0.08067369999999999": 10
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0008507,
|
||||
"p25": 0.0010719,
|
||||
"p50": 0.0015122,
|
||||
"p75": 0.0023278,
|
||||
"p90": 0.0095439,
|
||||
"p95": 0.0156221,
|
||||
"p99": 0.0274951,
|
||||
"p99.9": 0.042591,
|
||||
"p99.99": 0.0791282
|
||||
},
|
||||
"rps": {
|
||||
"mean": 5553.686301294755,
|
||||
"stddev": 4636.220124623151,
|
||||
"max": 29126.213592180335,
|
||||
"min": 12.970858540737687,
|
||||
"percentiles": {
|
||||
"p10": 79.97888557421057,
|
||||
"p25": 1107.4754593506525,
|
||||
"p50": 5025.814410380619,
|
||||
"p75": 8877.840909090803,
|
||||
"p90": 12490.479817212197,
|
||||
"p95": 13917.306274213552,
|
||||
"p99": 15435.53231727701,
|
||||
"p99.9": 20818.87578071068,
|
||||
"p99.99": 29126.213592180335
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.06953728589864486,
|
||||
"fastest": 0.066216799,
|
||||
"slowest": 0.077152799
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.00003968661349520042,
|
||||
"fastest": 5e-6,
|
||||
"slowest": 0.0001012
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.003359983626806897,
|
||||
"fastest": 0.0002047,
|
||||
"slowest": 0.0806737
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 70840
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.004394475,
|
||||
"slowest": 0.233813599,
|
||||
"fastest": 0.0019897,
|
||||
"average": 0.06393254985710015,
|
||||
"requestsPerSec": 3981.3669321700504,
|
||||
"totalData": 178446,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 11892.91579192502
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 3981.3669321700504,
|
||||
"latency_ms": {
|
||||
"min": 1.99,
|
||||
"mean": 63.933,
|
||||
"p50": 60.979,
|
||||
"p95": 117.167,
|
||||
"p99": 146.548,
|
||||
"max": 233.814
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0019897": 1,
|
||||
"0.0251720899": 4428,
|
||||
"0.048354479799999996": 15291,
|
||||
"0.07153686969999999": 18566,
|
||||
"0.0947192596": 12529,
|
||||
"0.1179016495": 5779,
|
||||
"0.1410840394": 2008,
|
||||
"0.16426642930000002": 616,
|
||||
"0.1874488192": 126,
|
||||
"0.2106312091": 72,
|
||||
"0.233813599": 66
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0285981,
|
||||
"p25": 0.0421162,
|
||||
"p50": 0.0609785,
|
||||
"p75": 0.0817872,
|
||||
"p90": 0.1013445,
|
||||
"p95": 0.1171666,
|
||||
"p99": 0.1465478,
|
||||
"p99.9": 0.213014699,
|
||||
"p99.99": 0.233074499
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0019894": 1,
|
||||
"0.0251717999": 4428,
|
||||
"0.048354199800000004": 15291,
|
||||
"0.07153659970000001": 18566,
|
||||
"0.0947189996": 12529,
|
||||
"0.1179013995": 5779,
|
||||
"0.14108379940000002": 2008,
|
||||
"0.1642661993": 616,
|
||||
"0.1874485992": 126,
|
||||
"0.21063099910000002": 72,
|
||||
"0.233813399": 66
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0285978,
|
||||
"p25": 0.0421158,
|
||||
"p50": 0.0609782,
|
||||
"p75": 0.0817868,
|
||||
"p90": 0.1013442,
|
||||
"p95": 0.1171662,
|
||||
"p99": 0.1465475,
|
||||
"p99.9": 0.213014499,
|
||||
"p99.99": 0.233074299
|
||||
},
|
||||
"rps": {
|
||||
"mean": 5779.471101779443,
|
||||
"stddev": 6601.574808634353,
|
||||
"max": 44899.130720031004,
|
||||
"min": 8.940433467976261,
|
||||
"percentiles": {
|
||||
"p10": 67.35095234246428,
|
||||
"p25": 227.93581327497992,
|
||||
"p50": 3688.8634484510167,
|
||||
"p75": 9008.893064439195,
|
||||
"p90": 14666.464370605858,
|
||||
"p95": 18280.82958919514,
|
||||
"p99": 28451.882845186923,
|
||||
"p99.9": 43534.53347450577,
|
||||
"p99.99": 44899.130720031004
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.10169912107360363,
|
||||
"fastest": 0.0848183,
|
||||
"slowest": 0.1330386
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 6.6574106452371976e-6,
|
||||
"fastest": 2.1e-6,
|
||||
"slowest": 0.000086
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.06393220326148973,
|
||||
"fastest": 0.0019894,
|
||||
"slowest": 0.233813399
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 59482
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 256
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 15.023609532,
|
||||
"slowest": 0.0658201,
|
||||
"fastest": 0.0004612,
|
||||
"average": 0.005405248224763808,
|
||||
"requestsPerSec": 11726.276539919329,
|
||||
"totalData": 528408,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 35171.84062022519
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 11726.276539919329,
|
||||
"latency_ms": {
|
||||
"min": 0.461,
|
||||
"mean": 5.405,
|
||||
"p50": 4.545,
|
||||
"p95": 10.65,
|
||||
"p99": 23.208,
|
||||
"max": 65.82
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0004612": 1,
|
||||
"0.006997090000000001": 151799,
|
||||
"0.013532980000000002": 18947,
|
||||
"0.02006887": 2842,
|
||||
"0.02660476": 1483,
|
||||
"0.03314065000000001": 574,
|
||||
"0.03967654": 219,
|
||||
"0.046212430000000006": 163,
|
||||
"0.05274832000000001": 80,
|
||||
"0.05928421000000001": 22,
|
||||
"0.0658201": 6
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0030629,
|
||||
"p25": 0.0037292,
|
||||
"p50": 0.0045451,
|
||||
"p75": 0.005699,
|
||||
"p90": 0.0079279,
|
||||
"p95": 0.0106502,
|
||||
"p99": 0.0232082,
|
||||
"p99.9": 0.0425018,
|
||||
"p99.99": 0.053907799
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0004608": 1,
|
||||
"0.00699669": 151800,
|
||||
"0.01353258": 18946,
|
||||
"0.02006847": 2842,
|
||||
"0.02660436": 1483,
|
||||
"0.033140249999999996": 574,
|
||||
"0.03967614": 219,
|
||||
"0.046212029999999994": 163,
|
||||
"0.05274792": 80,
|
||||
"0.05928381": 22,
|
||||
"0.0658197": 6
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0030626,
|
||||
"p25": 0.0037288,
|
||||
"p50": 0.0045446,
|
||||
"p75": 0.0056987,
|
||||
"p90": 0.0079275,
|
||||
"p95": 0.0106498,
|
||||
"p99": 0.0232078,
|
||||
"p99.9": 0.0425014,
|
||||
"p99.99": 0.053907399
|
||||
},
|
||||
"rps": {
|
||||
"mean": 11895.442419086467,
|
||||
"stddev": 4680.144007737889,
|
||||
"max": 49428.483163434095,
|
||||
"min": 7.767708299001681,
|
||||
"percentiles": {
|
||||
"p10": 5033.421921559103,
|
||||
"p25": 9573.484748448464,
|
||||
"p50": 13033.295998370142,
|
||||
"p75": 15115.087697941077,
|
||||
"p90": 16694.490818031227,
|
||||
"p95": 17559.747316341523,
|
||||
"p99": 19370.0621015941,
|
||||
"p99.9": 27827.79505647037,
|
||||
"p99.99": 49428.483163434095
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.10946267101026484,
|
||||
"fastest": 0.105613999,
|
||||
"slowest": 0.117580599
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.000017014461552436865,
|
||||
"fastest": 2.7e-6,
|
||||
"slowest": 0.0001871
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.005404881319645097,
|
||||
"fastest": 0.0004608,
|
||||
"slowest": 0.0658197
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 176136
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 35
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"summary": {
|
||||
"successRate": 1.0,
|
||||
"total": 300.040740639,
|
||||
"slowest": 0.134277698,
|
||||
"fastest": 0.0001588,
|
||||
"average": 0.005118276956612962,
|
||||
"requestsPerSec": 6244.6486300816005,
|
||||
"totalData": 5620866,
|
||||
"sizePerRequest": 3,
|
||||
"sizePerSec": 18733.6759269064
|
||||
},
|
||||
"metrics": {
|
||||
"success_rate": 1.0,
|
||||
"requests_per_sec": 6244.6486300816005,
|
||||
"latency_ms": {
|
||||
"min": 0.159,
|
||||
"mean": 5.118,
|
||||
"p50": 3.231,
|
||||
"p95": 18.637,
|
||||
"p99": 31.29,
|
||||
"max": 134.278
|
||||
}
|
||||
},
|
||||
"responseTimeHistogram": {
|
||||
"0.0001588": 1,
|
||||
"0.013570689800000002": 1735548,
|
||||
"0.026982579600000004": 101468,
|
||||
"0.04039446940000001": 32269,
|
||||
"0.05380635920000001": 3626,
|
||||
"0.06721824900000001": 577,
|
||||
"0.08063013880000001": 96,
|
||||
"0.09404202860000001": 24,
|
||||
"0.10745391840000001": 10,
|
||||
"0.12086580820000002": 2,
|
||||
"0.134277698": 1
|
||||
},
|
||||
"latencyPercentiles": {
|
||||
"p10": 0.0018471,
|
||||
"p25": 0.0023739,
|
||||
"p50": 0.003231,
|
||||
"p75": 0.0048148,
|
||||
"p90": 0.0103185,
|
||||
"p95": 0.0186373,
|
||||
"p99": 0.031289601,
|
||||
"p99.9": 0.045978201,
|
||||
"p99.99": 0.064620198
|
||||
},
|
||||
"firstByteHistogram": {
|
||||
"0.0001585": 1,
|
||||
"0.013570399799999999": 1735552,
|
||||
"0.026982299599999995": 101464,
|
||||
"0.04039419939999999": 32269,
|
||||
"0.05380609919999999": 3626,
|
||||
"0.067217999": 577,
|
||||
"0.08062989879999999": 96,
|
||||
"0.09404179859999999": 24,
|
||||
"0.10745369839999999": 10,
|
||||
"0.1208655982": 2,
|
||||
"0.134277498": 1
|
||||
},
|
||||
"firstBytePercentiles": {
|
||||
"p10": 0.0018469,
|
||||
"p25": 0.0023736,
|
||||
"p50": 0.003230698,
|
||||
"p75": 0.0048145,
|
||||
"p90": 0.0103182,
|
||||
"p95": 0.018636705,
|
||||
"p99": 0.031289501,
|
||||
"p99.9": 0.045978001,
|
||||
"p99.99": 0.064619898
|
||||
},
|
||||
"rps": {
|
||||
"mean": 6831.9380563046725,
|
||||
"stddev": 56287.82989499296,
|
||||
"max": 9999997.751511324,
|
||||
"min": 16.082057605351388,
|
||||
"percentiles": {
|
||||
"p10": 153.79173523161913,
|
||||
"p25": 2417.210539039103,
|
||||
"p50": 6983.156145760573,
|
||||
"p75": 10011.91417787061,
|
||||
"p90": 12038.644047401345,
|
||||
"p95": 12949.051635822501,
|
||||
"p99": 14395.393473988073,
|
||||
"p99.9": 16346.58941450963,
|
||||
"p99.99": 33698.39932558305
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"DNSDialup": {
|
||||
"average": 0.05800439587499999,
|
||||
"fastest": 0.056025299,
|
||||
"slowest": 0.060235399
|
||||
},
|
||||
"DNSLookup": {
|
||||
"average": 0.00001675,
|
||||
"fastest": 2.8e-6,
|
||||
"slowest": 0.000091
|
||||
},
|
||||
"firstByte": {
|
||||
"average": 0.005117947834417036,
|
||||
"fastest": 0.0001585,
|
||||
"slowest": 0.134277498
|
||||
}
|
||||
},
|
||||
"statusCodeDistribution": {
|
||||
"200": 1873622
|
||||
},
|
||||
"errorDistribution": {
|
||||
"aborted due to deadline": 27
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
label: wsl2-ubuntu
|
||||
date: 2026-11-18T17:08:35Z
|
||||
kernel: Linux 6.18.58.1-microsoft-standard-WSL2
|
||||
cpu: AMD Ryzen 7 5800X3D 8-Core Processor
|
||||
cpus: 16
|
||||
memory: 32827248 kB
|
||||
virtualisation: WSL2
|
||||
build: release; edge worker threads: 2
|
||||
caddy: unknown
|
||||
oha: oha 1.17.0
|
||||
duration: 15s per run; soak: 300s
|
||||
@@ -345,6 +345,10 @@ pub(crate) fn host_allowed(ctl: &Control, headers: &HeaderMap) -> bool {
|
||||
.any(|a| a.eq_ignore_ascii_case(host))
|
||||
}
|
||||
|
||||
/// Marks a request that came in on control's UI socket (`[ui] socket`).
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ViaUiSocket;
|
||||
|
||||
enum UiIdentity {
|
||||
/// No sign-in headers: an API-token request.
|
||||
None,
|
||||
@@ -356,7 +360,7 @@ enum UiIdentity {
|
||||
User(String, String),
|
||||
}
|
||||
|
||||
fn ui_identity(ctl: &Control, headers: &HeaderMap) -> UiIdentity {
|
||||
fn ui_identity(ctl: &Control, headers: &HeaderMap, via_socket: bool) -> UiIdentity {
|
||||
let names_user = headers.keys().any(|k| k.as_str().starts_with("remote-"));
|
||||
let proof = headers.get("x-ianitor-proof");
|
||||
if !names_user && proof.is_none() {
|
||||
@@ -366,7 +370,11 @@ fn ui_identity(ctl: &Control, headers: &HeaderMap) -> UiIdentity {
|
||||
(Some(p), Some(want)) => crate::util::ct_eq(p.as_bytes(), want),
|
||||
_ => false,
|
||||
};
|
||||
if !ok {
|
||||
// With a UI socket (G14 option b) the proof counts only there: the loopback port is open
|
||||
// to every local process, and one that learned the proof (say, by taking control's port
|
||||
// while it restarted and reading what edge sent) must not be able to use it.
|
||||
let socket_only = ctl.cfg.ui.as_ref().is_some_and(|u| u.socket.is_some());
|
||||
if !ok || (socket_only && !via_socket) {
|
||||
return UiIdentity::Forged;
|
||||
}
|
||||
let users: Vec<&HeaderValue> = headers.get_all("remote-user").iter().collect();
|
||||
@@ -428,7 +436,8 @@ async fn guard(State(st): State<Arc<AppState>>, mut req: Request, next: Next) ->
|
||||
// The web UI, through edge on the admin host (docs/api.md, "Sign-in"): only a request
|
||||
// with the per-boot proof edge adds is identified by its Remote-User. Any other
|
||||
// request that names a user is refused, so a local process cannot claim to be one.
|
||||
match ui_identity(&st.ctl, req.headers()) {
|
||||
let via_socket = req.extensions().get::<ViaUiSocket>().is_some();
|
||||
match ui_identity(&st.ctl, req.headers(), via_socket) {
|
||||
UiIdentity::None => {}
|
||||
UiIdentity::Forged => {
|
||||
return Err(ApiError::new(
|
||||
|
||||
@@ -315,6 +315,21 @@ pub async fn probe_upstream(
|
||||
"GET {path} HTTP/1.1\r\nHost: {host_header}\r\nUser-Agent: ianitor-health\r\nConnection: close\r\n\r\n"
|
||||
);
|
||||
let run = async {
|
||||
if let Some(path) = u.unix_path() {
|
||||
// A socket upstream (the admin host on control's own UI socket): plain HTTP.
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let s = tokio::net::UnixStream::connect(path)
|
||||
.await
|
||||
.map_err(|e| io_kind(&e))?;
|
||||
return ask(s, req.as_bytes()).await.map_err(|e| io_kind(&e));
|
||||
}
|
||||
#[cfg(not(unix))]
|
||||
{
|
||||
let _ = path;
|
||||
return Err("refused");
|
||||
}
|
||||
}
|
||||
let tcp = match tokio::net::TcpStream::connect(u.authority()).await {
|
||||
Ok(t) => t,
|
||||
Err(e) => return Err(io_kind(&e)),
|
||||
|
||||
@@ -116,6 +116,10 @@ pub struct Compile {
|
||||
/// Proxies in front whose X-Forwarded-For is believed (e.g. ["127.0.0.1"] beside Caddy).
|
||||
#[serde(default)]
|
||||
pub trusted_proxies: Vec<std::net::IpAddr>,
|
||||
/// The front proxy's Unix socket (beside Caddy): both engines serve the HTTPS hosts on it
|
||||
/// and believe its X-Forwarded-For.
|
||||
#[serde(default)]
|
||||
pub proxy_socket: Option<String>,
|
||||
}
|
||||
|
||||
impl Compile {
|
||||
@@ -130,6 +134,7 @@ impl Compile {
|
||||
caddy_admin: self.caddy_admin,
|
||||
caddy_admin_socket: self.caddy_admin_socket.clone(),
|
||||
trusted_proxies: self.trusted_proxies.clone(),
|
||||
proxy_socket: self.proxy_socket.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,6 +195,13 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn check(&self) -> Result<(), ConfigError> {
|
||||
if let Some(s) = self.ui.as_ref().and_then(|u| u.socket.as_ref())
|
||||
&& (!s.is_absolute() || s.as_os_str().len() > 100)
|
||||
{
|
||||
return Err(ConfigError::Invalid(
|
||||
"ui.socket must be an absolute path of at most 100 characters".into(),
|
||||
));
|
||||
}
|
||||
if !self.listen.ip().is_loopback() {
|
||||
return Err(ConfigError::Invalid(format!(
|
||||
"listen = {} is not a loopback address; ianitor-control only listens on 127.0.0.1 or ::1",
|
||||
@@ -341,6 +353,13 @@ pub struct UiConfig {
|
||||
pub proof_credential: Option<String>,
|
||||
/// The built web UI (served at `/`).
|
||||
pub static_dir: Option<PathBuf>,
|
||||
/// A Unix socket (mode 0660; its directory only for the ianitor group) on which control
|
||||
/// also serves the API for the admin host (G14 option b). With it, the proof signs in only
|
||||
/// on this socket; over the loopback port, which any local process can reach (or take while
|
||||
/// control restarts), only API tokens work. The admin host's upstream is then
|
||||
/// `unix:<this path>`.
|
||||
#[serde(default)]
|
||||
pub socket: Option<PathBuf>,
|
||||
/// Authelia's logout address (e.g. `https://auth.example/logout`), shown as "Sign out".
|
||||
#[serde(default)]
|
||||
pub logout_url: Option<String>,
|
||||
|
||||
@@ -150,6 +150,7 @@ pub async fn run(args: &[String]) -> Result<(), String> {
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
},
|
||||
compile_caddy: None,
|
||||
pki: Some(ianitor_control::config::PkiConfig {
|
||||
@@ -168,6 +169,7 @@ pub async fn run(args: &[String]) -> Result<(), String> {
|
||||
proof_credential: None,
|
||||
static_dir: Some(PathBuf::from(d)),
|
||||
logout_url: None,
|
||||
socket: None,
|
||||
}),
|
||||
engine: None,
|
||||
};
|
||||
|
||||
@@ -680,6 +680,41 @@ impl Control {
|
||||
})?;
|
||||
// The UI proof belongs to the [ui] host only (core already demands forward-auth for it).
|
||||
let ui_host = self.cfg.ui.as_ref().and_then(|u| u.hostname.as_deref());
|
||||
// A socket upstream likewise: only the [ui] host, and only control's own UI socket (a
|
||||
// route file must not point edge at any other socket on the machine).
|
||||
let ui_socket = self
|
||||
.cfg
|
||||
.ui
|
||||
.as_ref()
|
||||
.and_then(|u| u.socket.as_deref())
|
||||
.and_then(|p| p.to_str());
|
||||
for h in model.hosts() {
|
||||
for (i, u) in h.upstreams.iter().enumerate() {
|
||||
let Some(path) = u.unix_path() else { continue };
|
||||
if ui_host == Some(h.hostname.as_str()) && ui_socket == Some(path) {
|
||||
continue;
|
||||
}
|
||||
let p = messages::params([
|
||||
("hostname", h.hostname.to_string()),
|
||||
("url", u.to_string()),
|
||||
]);
|
||||
let fe = FieldError {
|
||||
code: "host.upstream.unix_socket".into(),
|
||||
message: message("host.upstream.unix_socket", &p),
|
||||
field: Some(format!("upstreams[{i}]")),
|
||||
params: p.clone(),
|
||||
detail: None,
|
||||
};
|
||||
return Err(Fail {
|
||||
status: 422,
|
||||
reason: reason(
|
||||
"apply.failed.validation",
|
||||
messages::params([("first_error", fe.message.clone())]),
|
||||
),
|
||||
errors: vec![fe],
|
||||
});
|
||||
}
|
||||
}
|
||||
for h in model.hosts() {
|
||||
let proof = h.request_headers.iter().any(|r| {
|
||||
matches!(r, ianitor_core::HeaderRule::Set { value: ianitor_core::HeaderValue::Secret(s), .. } if s.as_str() == ianitor_core::UI_PROOF_SECRET)
|
||||
|
||||
@@ -123,7 +123,10 @@ impl Control {
|
||||
async fn probe_host(hostname: &str, r: &Rule) -> Vec<(String, caddy_link::UpstreamProbe)> {
|
||||
let mut out = Vec::new();
|
||||
for u in &r.upstreams {
|
||||
let host_header = if r.has_check {
|
||||
let host_header = if r.has_check && u.is_unix() {
|
||||
// As edge: a socket has no authority to name.
|
||||
"localhost".to_owned()
|
||||
} else if r.has_check {
|
||||
u.authority()
|
||||
} else {
|
||||
hostname.to_owned()
|
||||
|
||||
@@ -37,6 +37,7 @@ pub async fn serve(
|
||||
) -> Result<(), String> {
|
||||
cfg.check().map_err(|e| e.to_string())?;
|
||||
let listen = cfg.listen;
|
||||
let ui_socket = cfg.ui.as_ref().and_then(|u| u.socket.clone());
|
||||
let ctl = Control::open(cfg).await?;
|
||||
tokio::spawn(ctl.clone().worker());
|
||||
tokio::spawn(ctl.clone().health_poller());
|
||||
@@ -50,14 +51,88 @@ pub async fn serve(
|
||||
.await
|
||||
.map_err(|e| format!("cannot listen on {listen}: {e}"))?;
|
||||
log::info!(target: "ianitor::control", "API on http://{listen}/api/v1");
|
||||
axum::serve(listener, app)
|
||||
.with_graceful_shutdown(shutdown)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
// One shutdown for both listeners.
|
||||
let (stop_tx, stop_rx) = tokio::sync::watch::channel(false);
|
||||
tokio::spawn(async move {
|
||||
shutdown.await;
|
||||
let _ = stop_tx.send(true);
|
||||
});
|
||||
let stopped = |mut rx: tokio::sync::watch::Receiver<bool>| async move {
|
||||
let _ = rx.wait_for(|s| *s).await;
|
||||
};
|
||||
let tcp = axum::serve(listener, app.clone()).with_graceful_shutdown(stopped(stop_rx.clone()));
|
||||
match ui_socket {
|
||||
None => tcp.await.map_err(|e| e.to_string())?,
|
||||
Some(path) => {
|
||||
let ui = ui_listener(&path)?;
|
||||
log::info!(target: "ianitor::control", "UI API on unix:{}", path.display());
|
||||
let ui_app = app.layer(axum::Extension(api::ViaUiSocket));
|
||||
let ui = serve_ui(ui, ui_app, stopped(stop_rx));
|
||||
let (a, b) = tokio::join!(std::future::IntoFuture::into_future(tcp), ui);
|
||||
a.map_err(|e| e.to_string())?;
|
||||
b?;
|
||||
}
|
||||
}
|
||||
drop(ctl);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Control's UI socket: a stale socket file from an earlier run is replaced; the new one is
|
||||
/// 0660 (owner and group: edge and Caddy are in the ianitor group). Its directory is the
|
||||
/// real fence: only the ianitor group may enter it, so no other user can connect or put a
|
||||
/// socket of their own in its place.
|
||||
#[cfg(unix)]
|
||||
fn ui_listener(path: &std::path::Path) -> Result<tokio::net::UnixListener, String> {
|
||||
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
|
||||
if let Ok(m) = std::fs::symlink_metadata(path) {
|
||||
if !m.file_type().is_socket() {
|
||||
return Err(format!(
|
||||
"{} exists and is not a socket; not replacing it",
|
||||
path.display()
|
||||
));
|
||||
}
|
||||
std::fs::remove_file(path).map_err(|e| format!("cannot remove {}: {e}", path.display()))?;
|
||||
}
|
||||
let l = tokio::net::UnixListener::bind(path)
|
||||
.map_err(|e| format!("cannot listen on {}: {e}", path.display()))?;
|
||||
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o660))
|
||||
.map_err(|e| format!("cannot set the mode of {}: {e}", path.display()))?;
|
||||
Ok(l)
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn serve_ui(
|
||||
l: tokio::net::UnixListener,
|
||||
app: axum::Router,
|
||||
stop: impl std::future::Future<Output = ()> + Send + 'static,
|
||||
) -> Result<(), String> {
|
||||
axum::serve(l, app)
|
||||
.with_graceful_shutdown(stop)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
struct NoUnixListener;
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn ui_listener(path: &std::path::Path) -> Result<NoUnixListener, String> {
|
||||
Err(format!(
|
||||
"ui.socket {}: a Unix socket needs a Unix system",
|
||||
path.display()
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
async fn serve_ui(
|
||||
_l: NoUnixListener,
|
||||
_app: axum::Router,
|
||||
_stop: impl std::future::Future<Output = ()> + Send + 'static,
|
||||
) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Wait for Ctrl-C or SIGTERM.
|
||||
pub async fn stop_signal() {
|
||||
#[cfg(unix)]
|
||||
|
||||
@@ -37,6 +37,12 @@ fn template(code: &str) -> &'static str {
|
||||
}
|
||||
"host.upstream.not_url" => "Write it as a full address, like http://10.0.0.23:3000.",
|
||||
"host.upstream.scheme" => "Start the address with http:// or https://.",
|
||||
"host.upstream.unix_path" => {
|
||||
"Write a socket as unix:/absolute/path.sock, with letters, digits, dots, dashes and underscores only."
|
||||
}
|
||||
"host.upstream.unix_socket" => {
|
||||
"Only the web UI's admin host can use a socket, and only control's own ([ui] socket in control.toml)."
|
||||
}
|
||||
"host.upstream.no_host" => "Add the server's name or IP address after http://.",
|
||||
"host.upstream.host_name" => {
|
||||
"The server name is not usable. Use letters a–z, digits, dots and dashes, or an IP address."
|
||||
|
||||
@@ -12,14 +12,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux (edge admin socket); run it in WSL2",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux (edge admin socket): run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux (edge admin socket); run it in WSL2",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux (edge admin socket): run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -116,6 +116,7 @@ impl Env {
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
};
|
||||
// Edge starts from an empty config; control brings it in line on its first start.
|
||||
let empty = load(
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux; run it in WSL2",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux: run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux; run it in WSL2",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux: run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux; run it in WSL2",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux: run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
@@ -240,6 +238,153 @@ mod unix {
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- G14 option b (phase 4)
|
||||
|
||||
/// Control with `[ui] socket`: the UI comes in on a Unix socket in a directory only the
|
||||
/// ianitor group can use; the loopback port stays for API tokens (scripts, the CLI).
|
||||
async fn socket_env(site: String, ui_host: &str) -> (Env, std::path::PathBuf) {
|
||||
let mut env = Env::new(EnvSpec {
|
||||
site,
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
std::fs::write(
|
||||
env.dir.join("creds/ui-proof"),
|
||||
format!(
|
||||
"{PROOF}
|
||||
"
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
let sock = env.dir.join("ui.sock");
|
||||
let text = std::fs::read_to_string(env.config_path()).unwrap()
|
||||
+ &format!(
|
||||
"
|
||||
[ui]
|
||||
hostname = \"{ui_host}\"
|
||||
proof_credential = \"ui-proof\"
|
||||
socket = \"{}\"
|
||||
",
|
||||
sock.display()
|
||||
);
|
||||
std::fs::write(env.config_path(), text).unwrap();
|
||||
env.start_control(None);
|
||||
for _ in 0..100 {
|
||||
if sock.exists() {
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
|
||||
}
|
||||
assert!(
|
||||
sock.exists(),
|
||||
"no UI socket:
|
||||
{}",
|
||||
env.control_log()
|
||||
);
|
||||
(env, sock)
|
||||
}
|
||||
|
||||
async fn over_socket(sock: &std::path::Path, headers: &[(&str, &str)]) -> (u16, String) {
|
||||
let mut req = Req::get("ui.test", "/api/v1/overview");
|
||||
for (n, v) in headers {
|
||||
req = req.header(n, v);
|
||||
}
|
||||
let r = client::unix(sock, &req).await.unwrap();
|
||||
(r.status, r.text())
|
||||
}
|
||||
|
||||
/// The per-boot proof alone no longer signs anyone in: off the socket it is refused even
|
||||
/// when it is right, so a local process that learned it (say, by listening on control's
|
||||
/// port while control restarted) gets nothing; on the socket, which only edge and Caddy
|
||||
/// (group ianitor) can open, it works as before.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn with_a_ui_socket_the_proof_counts_only_on_the_socket() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let (env, sock) = socket_env(String::new(), "ui.test").await;
|
||||
let mode = std::fs::metadata(&sock).unwrap().permissions().mode() & 0o777;
|
||||
assert_eq!(mode, 0o660, "owner and group only");
|
||||
|
||||
let signed = [("Remote-User", "mark"), ("X-Ianitor-Proof", PROOF)];
|
||||
let r = env
|
||||
.call_with("GET", "/api/v1/overview", &signed, None)
|
||||
.await;
|
||||
assert_eq!(r.status, 401, "the right proof over TCP: {}", r.text);
|
||||
assert_eq!(r.json["error"]["code"], "ui.no_proof", "{}", r.text);
|
||||
assert!(!env.control_log().contains("by mark"));
|
||||
|
||||
let (status, text) = over_socket(&sock, &signed).await;
|
||||
assert_eq!(status, 200, "{text}");
|
||||
// The socket does not replace the proof: without it, a Remote-User is still refused.
|
||||
let (status, text) = over_socket(&sock, &[("Remote-User", "mark")]).await;
|
||||
assert_eq!(status, 401, "{text}");
|
||||
let (status, text) = over_socket(
|
||||
&sock,
|
||||
&[("Remote-User", "mark"), ("X-Ianitor-Proof", "guess")],
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, 401, "{text}");
|
||||
|
||||
// API tokens keep working on the loopback port.
|
||||
let r = env.call("GET", "/api/v1/overview", None).await;
|
||||
assert_eq!(r.status, 200, "{}", r.text);
|
||||
}
|
||||
|
||||
/// A route file may name a socket only for the admin host, and only control's own.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn a_socket_upstream_is_only_for_the_admin_host_and_controls_own_socket() {
|
||||
let auth = MockAuthelia::start().await;
|
||||
let site = format!(
|
||||
"secrets = [\"ui-proof\"]
|
||||
[forward_auth]
|
||||
url = \"{}\"
|
||||
",
|
||||
auth.url()
|
||||
);
|
||||
let (env, sock) = socket_env(site, "a.test").await;
|
||||
for (hostname, upstream) in [
|
||||
("b.test", format!("unix:{}", sock.display())),
|
||||
("a.test", "unix:/run/docker.sock".to_owned()),
|
||||
] {
|
||||
let host = json!({"host": {
|
||||
"hostname": hostname, "upstreams": [upstream],
|
||||
"tls": "domi", "auth": "forward-auth",
|
||||
}});
|
||||
let r = env.call("POST", "/api/v1/hosts", Some(host)).await;
|
||||
assert_eq!(r.status, 422, "{hostname} {upstream}: {}", r.text);
|
||||
assert_eq!(
|
||||
r.json["errors"][0]["code"], "host.upstream.unix_socket",
|
||||
"{}",
|
||||
r.text
|
||||
);
|
||||
}
|
||||
|
||||
// The admin host on control's socket: through edge, Authelia decides, the UI gets in.
|
||||
let host = json!({"host": {
|
||||
"hostname": "a.test", "upstreams": [format!("unix:{}", sock.display())],
|
||||
"tls": "domi", "auth": "forward-auth",
|
||||
"request_headers": [{"action": "set", "name": "X-Ianitor-Proof", "secret": "ui-proof"}]
|
||||
}});
|
||||
let rec = env.apply("POST", "/api/v1/hosts", Some(host)).await;
|
||||
assert_eq!(
|
||||
rec["state"],
|
||||
"kept",
|
||||
"{rec}
|
||||
{}",
|
||||
env.control_log()
|
||||
);
|
||||
let edge = env.edge.as_ref().unwrap();
|
||||
let r = client::https(
|
||||
edge.https,
|
||||
"a.test",
|
||||
env.ca.roots(),
|
||||
&Req::get("a.test", "/api/v1/overview").header("cookie", "authelia_session=good"),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(r.status, 200, "{}", r.text());
|
||||
assert!(r.text().contains("\"hosts\""), "{}", r.text());
|
||||
}
|
||||
|
||||
/// QC: signed in at Authelia (alice) but the client also sends a proof guess: edge must
|
||||
/// replace, not append, the proof; and Remote-User must be Authelia's.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
|
||||
@@ -16,9 +16,7 @@ url.workspace = true
|
||||
ring.workspace = true
|
||||
base64.workspace = true
|
||||
unicode-normalization = "0.1.24"
|
||||
rcgen = { workspace = true, features = ["x509-parser"] }
|
||||
x509-parser = { version = "0.18", features = ["verify"] }
|
||||
time = { version = "0.3", default-features = false }
|
||||
domi-pki.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
rustls-pki-types.workspace = true
|
||||
|
||||
@@ -19,6 +19,7 @@ use crate::{
|
||||
const ACCESS_LOGGER: &str = "ianitor_access";
|
||||
const HTTPS_SERVER: &str = "ianitor_https";
|
||||
const HTTP_SERVER: &str = "ianitor_http";
|
||||
const PROXY_SERVER: &str = "ianitor_proxy";
|
||||
|
||||
pub(super) fn compile(model: &Model, o: &CompileOptions) -> Value {
|
||||
let hosts = model.hosts();
|
||||
@@ -77,6 +78,23 @@ pub(super) fn compile(model: &Model, o: &CompileOptions) -> Value {
|
||||
.collect();
|
||||
policies.push(json!({}));
|
||||
|
||||
// ---- The front proxy's socket: the same routes in plain HTTP, its peer trusted (edge:
|
||||
// `client_ip` on the socket). No TLS here, so no certificates are managed for it.
|
||||
let mut proxy = o.proxy_socket.as_ref().map(|sock| {
|
||||
let mut p = Map::new();
|
||||
p.insert(
|
||||
"listen".into(),
|
||||
json!([format!("unix//{}|0660", sock.trim_start_matches('/'))]),
|
||||
);
|
||||
p.insert("routes".into(), Value::Array(routes.clone()));
|
||||
p.insert("automatic_https".into(), json!({ "disable": true }));
|
||||
p.insert("protocols".into(), json!(["h1"]));
|
||||
p.insert("trusted_proxies_unix".into(), json!(true));
|
||||
p.insert("client_ip_headers".into(), json!(["X-Forwarded-For"]));
|
||||
p.insert("trusted_proxies_strict".into(), json!(1));
|
||||
p
|
||||
});
|
||||
|
||||
let mut https = Map::new();
|
||||
https.insert("listen".into(), json!([o.https_listen.to_string()]));
|
||||
https.insert("routes".into(), Value::Array(routes));
|
||||
@@ -106,10 +124,11 @@ pub(super) fn compile(model: &Model, o: &CompileOptions) -> Value {
|
||||
.iter()
|
||||
.map(|h| (h.hostname.to_string(), json!([ACCESS_LOGGER])))
|
||||
.collect();
|
||||
https.insert(
|
||||
"logs".into(),
|
||||
json!({ "logger_names": names, "skip_unmapped_hosts": true }),
|
||||
);
|
||||
let logs = json!({ "logger_names": names, "skip_unmapped_hosts": true });
|
||||
if let Some(p) = proxy.as_mut() {
|
||||
p.insert("logs".into(), logs.clone());
|
||||
}
|
||||
https.insert("logs".into(), logs);
|
||||
}
|
||||
|
||||
// ---- HTTP server: redirect known hosts to HTTPS (ACME HTTP-01 is answered by Caddy itself).
|
||||
@@ -142,6 +161,9 @@ pub(super) fn compile(model: &Model, o: &CompileOptions) -> Value {
|
||||
let mut servers = Map::new();
|
||||
servers.insert(HTTPS_SERVER.into(), Value::Object(https));
|
||||
servers.insert(HTTP_SERVER.into(), http);
|
||||
if let Some(p) = proxy {
|
||||
servers.insert(PROXY_SERVER.into(), Value::Object(p));
|
||||
}
|
||||
|
||||
let mut tls = Map::new();
|
||||
if !domi.is_empty() {
|
||||
@@ -259,7 +281,11 @@ fn host_route(h: &Host, fa: Option<&ForwardAuth>, o: &CompileOptions) -> Value {
|
||||
fn upstreams(list: &[&Upstream]) -> Value {
|
||||
Value::Array(
|
||||
list.iter()
|
||||
.map(|u| json!({ "dial": u.authority() }))
|
||||
.map(|u| match u.unix_path() {
|
||||
// Caddy's network address: `unix/` then the absolute path.
|
||||
Some(p) => json!({ "dial": format!("unix/{p}") }),
|
||||
None => json!({ "dial": u.authority() }),
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ pub(super) fn compile(model: &Model, o: &CompileOptions) -> EdgeConfig {
|
||||
allow: join(&o.cert_dir, DEVICE_ALLOW_FILE),
|
||||
}),
|
||||
trusted_proxies: o.trusted_proxies.iter().map(ToString::to_string).collect(),
|
||||
proxy_socket: o.proxy_socket.clone(),
|
||||
forward_auth: site.forward_auth.as_ref().map(|fa| EdgeForwardAuth {
|
||||
upstream: upstream(&fa.upstream),
|
||||
path_and_query: fa.path_and_query.clone(),
|
||||
|
||||
@@ -48,6 +48,10 @@ pub struct CompileOptions {
|
||||
/// Ianitor on loopback): the share-link throttle and the access log then see the real
|
||||
/// client. Empty (the default): only the connection's own address counts.
|
||||
pub trusted_proxies: Vec<std::net::IpAddr>,
|
||||
/// A Unix socket (mode 0660) on which the engine also serves the HTTPS hosts, in plain HTTP,
|
||||
/// to a front proxy that terminated TLS (Caddy beside Ianitor). Only the socket's owner and
|
||||
/// group can connect, so its peer is trusted and its `X-Forwarded-For` names the client.
|
||||
pub proxy_socket: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
@@ -80,6 +84,19 @@ pub fn caddy(model: &Model, options: &CompileOptions) -> Result<String, CompileE
|
||||
}
|
||||
|
||||
fn check_options(o: &CompileOptions) -> Result<(), CompileError> {
|
||||
if let Some(s) = &o.proxy_socket {
|
||||
check_path(s).map_err(|reason| CompileError::BadOption {
|
||||
option: "proxy_socket",
|
||||
reason,
|
||||
})?;
|
||||
// sun_path holds 108 bytes on Linux, the terminating NUL included.
|
||||
if s.len() > 100 {
|
||||
return Err(CompileError::BadOption {
|
||||
option: "proxy_socket",
|
||||
reason: "a socket path is at most 100 characters",
|
||||
});
|
||||
}
|
||||
}
|
||||
if let Some(s) = &o.caddy_admin_socket {
|
||||
check_path(s).map_err(|reason| CompileError::BadOption {
|
||||
option: "caddy_admin_socket",
|
||||
|
||||
@@ -34,6 +34,10 @@ pub struct EdgeConfig {
|
||||
/// Peers whose `X-Forwarded-For` is believed (IP addresses); empty: none.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub trusted_proxies: Vec<String>,
|
||||
/// A Unix socket (mode 0660) serving the HTTPS hosts in plain HTTP to a front proxy that
|
||||
/// terminated TLS; its peer is trusted (`X-Forwarded-For` names the client).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub proxy_socket: Option<String>,
|
||||
/// Sorted by hostname.
|
||||
pub hosts: Vec<EdgeHost>,
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ pub(crate) mod reason {
|
||||
pub const URL_CREDENTIALS: &str = "credentials in the URL are not allowed";
|
||||
pub const URL_FRAGMENT: &str = "a #fragment is not allowed";
|
||||
pub const URL_NO_HOST: &str = "it has no host";
|
||||
pub const URL_UNIX_PATH: &str = "a socket upstream is unix:/absolute/path: letters, digits, '.', '_', '-' and single '/' only, no '.' or '..' parts, at most 100 characters";
|
||||
pub const URL_HOST_NAME: &str = "the host name is not valid";
|
||||
pub const URL_NO_PORT: &str = "it has no port";
|
||||
pub const URL_PORT_ZERO: &str = "port 0 is not usable";
|
||||
@@ -275,6 +276,7 @@ impl ValidationError {
|
||||
x if x == r::URL_PATH => "host.upstream.path",
|
||||
x if x == r::URL_QUERY => "host.upstream.query",
|
||||
x if x == r::URL_MIXED => "host.upstream.mixed_schemes",
|
||||
x if x == r::URL_UNIX_PATH => "host.upstream.unix_path",
|
||||
_ => "host.upstream.not_url",
|
||||
},
|
||||
E::DuplicateUpstream { .. } => "host.upstream.duplicate",
|
||||
|
||||
@@ -64,11 +64,13 @@ impl Scheme {
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the upstream host is: a DNS name or an IP literal (IPv6 without brackets).
|
||||
/// Where the upstream host is: a DNS name, an IP literal (IPv6 without brackets), or a Unix
|
||||
/// socket path (`unix:/abs/path`, plain HTTP; which socket a host may use is control's call).
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum UpstreamHost {
|
||||
Name(String),
|
||||
Ip(std::net::IpAddr),
|
||||
Unix(String),
|
||||
}
|
||||
|
||||
/// A validated upstream: scheme, host and explicit port. No path, query, fragment or userinfo.
|
||||
@@ -81,26 +83,44 @@ pub struct Upstream {
|
||||
}
|
||||
|
||||
impl Upstream {
|
||||
/// `host:port` as used for dialing, with IPv6 in brackets.
|
||||
/// `host:port` as used for dialing, with IPv6 in brackets; `unix:<path>` for a socket.
|
||||
pub fn authority(&self) -> String {
|
||||
match &self.host {
|
||||
UpstreamHost::Name(n) => format!("{n}:{}", self.port),
|
||||
UpstreamHost::Ip(std::net::IpAddr::V6(ip)) => format!("[{ip}]:{}", self.port),
|
||||
UpstreamHost::Ip(ip) => format!("{ip}:{}", self.port),
|
||||
UpstreamHost::Unix(p) => format!("unix:{p}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// The host part for TLS SNI and certificate verification.
|
||||
/// The host part for TLS SNI and certificate verification (empty for a socket, which is
|
||||
/// always plain HTTP).
|
||||
pub fn host_str(&self) -> String {
|
||||
match &self.host {
|
||||
UpstreamHost::Name(n) => n.clone(),
|
||||
UpstreamHost::Ip(ip) => ip.to_string(),
|
||||
UpstreamHost::Unix(_) => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// The socket path of a `unix:` upstream.
|
||||
pub fn unix_path(&self) -> Option<&str> {
|
||||
match &self.host {
|
||||
UpstreamHost::Unix(p) => Some(p),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_unix(&self) -> bool {
|
||||
self.unix_path().is_some()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Upstream {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if self.is_unix() {
|
||||
return f.write_str(&self.authority());
|
||||
}
|
||||
write!(f, "{}://{}", self.scheme.as_str(), self.authority())
|
||||
}
|
||||
}
|
||||
|
||||
+67
-554
@@ -2,8 +2,10 @@
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//! The Domi CA (ROADMAP §1.1, §1.2, §1.8, §3): a small CA on rcgen. Pure: the caller passes
|
||||
//! the time in and does every file read and write. Keys are ECDSA P-256 everywhere.
|
||||
//! The Domi CA (ROADMAP §1.1, §1.2, §1.8, §3), as Ianitor uses it. The CA itself lives in the
|
||||
//! shared crate `domi-pki` (Fabrica `docs/32_coherence.md`, T3a); this module is Ianitor's view of
|
||||
//! it with Ianitor's names and messages, plus Ianitor's encrypted-key format. Pure: the caller
|
||||
//! passes the time in and does every file read and write. Keys are ECDSA P-256 everywhere.
|
||||
//!
|
||||
//! ```text
|
||||
//! Domi PKI Root 10 years, pathLen 1 created offline, never on the server
|
||||
@@ -22,41 +24,22 @@
|
||||
//! - No certificate is ever issued past its issuer's `notAfter`.
|
||||
//!
|
||||
//! The intermediate is never made from what a CSR asks for: only its public key and its
|
||||
//! subject CN are taken; every extension comes from the profile here.
|
||||
|
||||
use std::fmt;
|
||||
//! subject CN are taken; every extension comes from the profile in `domi-pki`.
|
||||
|
||||
use base64::Engine as _;
|
||||
use base64::engine::general_purpose::STANDARD;
|
||||
use rcgen::{
|
||||
BasicConstraints, CertificateParams, CertificateSigningRequestParams, DistinguishedName,
|
||||
DnType, ExtendedKeyUsagePurpose, IsCa, Issuer, KeyUsagePurpose, PKCS_ECDSA_P256_SHA256,
|
||||
SerialNumber,
|
||||
};
|
||||
use ring::rand::{SecureRandom, SystemRandom};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
/// Root: about 10 years.
|
||||
pub const ROOT_DAYS: u32 = 3653;
|
||||
/// Intermediate: about 1 year.
|
||||
pub const INTERMEDIATE_DAYS: u32 = 365;
|
||||
/// Server (tls = "domi") certificates.
|
||||
pub const SERVER_DAYS: u32 = 90;
|
||||
/// Renew a server certificate when fewer than this many days are left.
|
||||
pub const SERVER_RENEW_DAYS: u32 = 30;
|
||||
/// Device (mTLS client) certificates.
|
||||
pub const DEVICE_DAYS: u32 = 365;
|
||||
/// Subject CN of the root.
|
||||
pub const ROOT_CN: &str = "Domi PKI Root";
|
||||
pub use domi_pki::{
|
||||
CertInfo, DEVICE_DAYS, EkuInfo, INTERMEDIATE_DAYS, INTERMEDIATE_OPENSSL_EXT, KeyPair,
|
||||
KeyUsageInfo, ORG, ROOT_CN, ROOT_DAYS, SERVER_DAYS, SERVER_RENEW_DAYS, der_to_pem, match_code,
|
||||
openssl_sign_command, sha256_hex,
|
||||
};
|
||||
|
||||
/// Subject CN of the intermediate. Signers refuse a CSR whose CN does not start with this.
|
||||
pub const INTERMEDIATE_CN: &str = "Ianitor Domi Intermediate";
|
||||
/// Organisation on every certificate.
|
||||
pub const ORG: &str = "Fabrica Domi";
|
||||
pub const INTERMEDIATE_CN: &str = domi_pki::IANITOR_INTERMEDIATE_CN;
|
||||
/// PBKDF2-HMAC-SHA256 iterations for encrypted keys (OWASP 2023 figure).
|
||||
pub const KEY_KDF_ITERATIONS: u32 = 600_000;
|
||||
/// Backdating of `notBefore`, for clocks that run a little late.
|
||||
const BACKDATE_SECS: i64 = 300;
|
||||
const DAY: i64 = 86_400;
|
||||
// Split so that this file does not match the pre-commit hook itself.
|
||||
const ARMOR_BEGIN: &str = concat!("-----BEGIN IANITOR ENCRYPTED ", "PRIVATE KEY-----");
|
||||
const ARMOR_END: &str = concat!("-----END IANITOR ENCRYPTED ", "PRIVATE KEY-----");
|
||||
@@ -91,52 +74,27 @@ pub enum PkiError {
|
||||
Build(String),
|
||||
}
|
||||
|
||||
fn build(e: rcgen::Error) -> PkiError {
|
||||
PkiError::Build(e.to_string())
|
||||
}
|
||||
|
||||
/// An ECDSA P-256 key pair. Never printed.
|
||||
pub struct KeyPair(rcgen::KeyPair);
|
||||
|
||||
impl fmt::Debug for KeyPair {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str("KeyPair(…)")
|
||||
}
|
||||
}
|
||||
|
||||
impl KeyPair {
|
||||
/// PKCS#8 PEM. Callers write it only to files with mode 0600 (or encrypt it).
|
||||
pub fn serialize_pem(&self) -> String {
|
||||
self.0.serialize_pem()
|
||||
}
|
||||
|
||||
pub fn serialize_der(&self) -> Vec<u8> {
|
||||
self.0.serialize_der()
|
||||
}
|
||||
|
||||
pub fn from_pem(pem: &str) -> Result<KeyPair, PkiError> {
|
||||
rcgen::KeyPair::from_pem(pem)
|
||||
.map(KeyPair)
|
||||
.map_err(|_| PkiError::BadKey)
|
||||
}
|
||||
|
||||
pub fn from_der(der: &[u8]) -> Result<KeyPair, PkiError> {
|
||||
rcgen::KeyPair::try_from(der)
|
||||
.map(KeyPair)
|
||||
.map_err(|_| PkiError::BadKey)
|
||||
}
|
||||
|
||||
/// SubjectPublicKeyInfo DER.
|
||||
pub fn public_key_der(&self) -> Vec<u8> {
|
||||
use rcgen::PublicKeyData as _;
|
||||
self.0.subject_public_key_info()
|
||||
impl From<domi_pki::PkiError> for PkiError {
|
||||
fn from(e: domi_pki::PkiError) -> PkiError {
|
||||
use domi_pki::PkiError as D;
|
||||
match e {
|
||||
D::BadCertificate(s) => PkiError::BadCertificate(s),
|
||||
D::BadCsr => PkiError::BadCsr,
|
||||
D::CsrSubject => PkiError::CsrSubject,
|
||||
D::BadKey | D::UnsupportedKey => PkiError::BadKey,
|
||||
D::NotCa => PkiError::NotCa,
|
||||
D::KeyMismatch => PkiError::KeyMismatch,
|
||||
D::IssuerExpired => PkiError::IssuerExpired,
|
||||
D::BadName(s) => PkiError::BadName(s),
|
||||
D::Random => PkiError::Random,
|
||||
D::Build(s) | D::Signer(s) => PkiError::Build(s),
|
||||
other => PkiError::Build(other.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn generate_key() -> Result<KeyPair, PkiError> {
|
||||
rcgen::KeyPair::generate_for(&PKCS_ECDSA_P256_SHA256)
|
||||
.map(KeyPair)
|
||||
.map_err(build)
|
||||
Ok(domi_pki::generate_key()?)
|
||||
}
|
||||
|
||||
fn random<const N: usize>() -> Result<[u8; N], PkiError> {
|
||||
@@ -147,50 +105,12 @@ fn random<const N: usize>() -> Result<[u8; N], PkiError> {
|
||||
Ok(b)
|
||||
}
|
||||
|
||||
fn serial() -> Result<SerialNumber, PkiError> {
|
||||
let mut b = random::<16>()?;
|
||||
// Positive and never shortened by DER (leading byte 0x01..=0x7f).
|
||||
b[0] = (b[0] & 0x7f) | 0x01;
|
||||
Ok(SerialNumber::from_slice(&b))
|
||||
}
|
||||
|
||||
fn time(unix: i64) -> Result<OffsetDateTime, PkiError> {
|
||||
OffsetDateTime::from_unix_timestamp(unix).map_err(|e| PkiError::Build(e.to_string()))
|
||||
}
|
||||
|
||||
fn dn(cn: &str) -> DistinguishedName {
|
||||
let mut d = DistinguishedName::new();
|
||||
d.push(DnType::CommonName, cn);
|
||||
d.push(DnType::OrganizationName, ORG);
|
||||
d
|
||||
}
|
||||
|
||||
/// A certificate name a person typed: 1 to 64 printable characters, no control characters.
|
||||
fn check_display_name(name: &str) -> Result<(), PkiError> {
|
||||
let n = name.chars().count();
|
||||
if n == 0 || n > 64 || name.chars().any(char::is_control) || name.trim() != name {
|
||||
return Err(PkiError::BadName(
|
||||
"use 1 to 64 visible characters, no leading or trailing spaces".into(),
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ root (offline)
|
||||
|
||||
/// Create the root: a self-signed CA, `pathLenConstraint 1`, about 10 years. For the offline
|
||||
/// machine only (`ianitor-control ca init`); control never calls this on the server.
|
||||
pub fn create_root(now: i64) -> Result<(String, KeyPair), PkiError> {
|
||||
let key = generate_key()?;
|
||||
let mut p = CertificateParams::default();
|
||||
p.distinguished_name = dn(ROOT_CN);
|
||||
p.is_ca = IsCa::Ca(BasicConstraints::Constrained(1));
|
||||
p.key_usages = vec![KeyUsagePurpose::KeyCertSign, KeyUsagePurpose::CrlSign];
|
||||
p.not_before = time(now - BACKDATE_SECS)?;
|
||||
p.not_after = time(now + i64::from(ROOT_DAYS) * DAY)?;
|
||||
p.serial_number = Some(serial()?);
|
||||
let cert = p.self_signed(&key.0).map_err(build)?;
|
||||
Ok((cert.pem(), key))
|
||||
Ok(domi_pki::create_root_local(now)?)
|
||||
}
|
||||
|
||||
/// Common name of [`no_device_placeholder`].
|
||||
@@ -198,46 +118,15 @@ pub const NO_DEVICE_CN: &str = "Ianitor placeholder: no device is allowed";
|
||||
|
||||
/// The allow list's only entry while no device is enrolled. Caddy refuses to load an empty
|
||||
/// leaf list (and with it the whole config), so the list is never empty: this self-signed
|
||||
/// certificate's key is dropped right here, so no client can ever present it, and it is not
|
||||
/// certificate's key is dropped right away, so no client can ever present it, and it is not
|
||||
/// issued by the Domi intermediate, so edge refuses it too.
|
||||
pub fn no_device_placeholder(now: i64) -> Result<String, PkiError> {
|
||||
let key = generate_key()?;
|
||||
let mut p = CertificateParams::default();
|
||||
p.distinguished_name = dn(NO_DEVICE_CN);
|
||||
p.is_ca = IsCa::ExplicitNoCa;
|
||||
p.key_usages = vec![KeyUsagePurpose::DigitalSignature];
|
||||
p.not_before = time(now - BACKDATE_SECS)?;
|
||||
p.not_after = time(now + 100 * 365 * DAY)?;
|
||||
p.serial_number = Some(serial()?);
|
||||
let cert = p.self_signed(&key.0).map_err(build)?;
|
||||
drop(key);
|
||||
Ok(cert.pem())
|
||||
Ok(domi_pki::placeholder_leaf(NO_DEVICE_CN, now)?)
|
||||
}
|
||||
|
||||
/// A CSR for a new intermediate key (made by control on the server).
|
||||
pub fn intermediate_csr(key: &KeyPair, cn: &str) -> Result<String, PkiError> {
|
||||
let mut p = CertificateParams::default();
|
||||
p.distinguished_name = dn(cn);
|
||||
p.serialize_request(&key.0)
|
||||
.map_err(build)?
|
||||
.pem()
|
||||
.map_err(build)
|
||||
}
|
||||
|
||||
/// The extensions for signing an intermediate with openssl on the offline machine (the
|
||||
/// accepted manual step until Custos can sign, docs/pki.md): the same profile as
|
||||
/// [`sign_intermediate`]. Use with `openssl x509 -req … -days 365 -extfile <this file>`.
|
||||
pub const INTERMEDIATE_OPENSSL_EXT: &str = "basicConstraints = critical, CA:TRUE, pathlen:0\n\
|
||||
keyUsage = critical, keyCertSign, cRLSign, digitalSignature\n\
|
||||
subjectKeyIdentifier = hash\n\
|
||||
authorityKeyIdentifier = keyid:always\n";
|
||||
|
||||
/// The openssl command that signs a renewal on the offline machine (files named after the
|
||||
/// request). OpenSSL 3 picks a random serial.
|
||||
pub fn openssl_sign_command(base: &str) -> String {
|
||||
format!(
|
||||
"openssl x509 -req -in {base}.csr -CA domi-root.crt -CAkey domi-root.key -days {INTERMEDIATE_DAYS} -sha256 -extfile {base}.ext -out {base}.crt"
|
||||
)
|
||||
Ok(domi_pki::intermediate_csr(key, cn)?)
|
||||
}
|
||||
|
||||
/// Sign an intermediate CSR with the root (offline, or in Custos once it can). Only the CSR's
|
||||
@@ -248,349 +137,81 @@ pub fn sign_intermediate(
|
||||
csr_pem: &str,
|
||||
now: i64,
|
||||
) -> Result<String, PkiError> {
|
||||
let root = inspect(root_cert_pem)?;
|
||||
if !root.is_ca {
|
||||
return Err(PkiError::NotCa);
|
||||
}
|
||||
if public_key_der(root_cert_pem)? != root_key.public_key_der() {
|
||||
return Err(PkiError::KeyMismatch);
|
||||
}
|
||||
if now < root.not_before || now >= root.not_after {
|
||||
return Err(PkiError::IssuerExpired);
|
||||
}
|
||||
let csr = CertificateSigningRequestParams::from_pem(csr_pem).map_err(|_| PkiError::BadCsr)?;
|
||||
let cn = csr
|
||||
.params
|
||||
.distinguished_name
|
||||
.get(&DnType::CommonName)
|
||||
.and_then(dn_text)
|
||||
.ok_or(PkiError::CsrSubject)?;
|
||||
if !cn.starts_with(INTERMEDIATE_CN)
|
||||
|| cn.chars().count() > 64
|
||||
|| cn.chars().any(char::is_control)
|
||||
{
|
||||
return Err(PkiError::CsrSubject);
|
||||
}
|
||||
let mut p = CertificateParams::default();
|
||||
p.distinguished_name = dn(&cn);
|
||||
p.is_ca = IsCa::Ca(BasicConstraints::Constrained(0));
|
||||
p.key_usages = vec![
|
||||
KeyUsagePurpose::KeyCertSign,
|
||||
KeyUsagePurpose::CrlSign,
|
||||
KeyUsagePurpose::DigitalSignature,
|
||||
];
|
||||
p.not_before = time(now - BACKDATE_SECS)?;
|
||||
p.not_after = time((now + i64::from(INTERMEDIATE_DAYS) * DAY).min(root.not_after))?;
|
||||
p.serial_number = Some(serial()?);
|
||||
p.use_authority_key_identifier_extension = true;
|
||||
let fresh = CertificateSigningRequestParams {
|
||||
params: p,
|
||||
public_key: csr.public_key,
|
||||
};
|
||||
let issuer = Issuer::from_ca_cert_pem(root_cert_pem, &root_key.0).map_err(build)?;
|
||||
Ok(fresh.signed_by(&issuer).map_err(build)?.pem())
|
||||
}
|
||||
|
||||
fn dn_text(v: &rcgen::DnValue) -> Option<String> {
|
||||
match v {
|
||||
rcgen::DnValue::Utf8String(s) => Some(s.clone()),
|
||||
rcgen::DnValue::PrintableString(s) => Some(s.as_str().to_owned()),
|
||||
_ => None,
|
||||
}
|
||||
Ok(domi_pki::sign_intermediate(
|
||||
root_cert_pem,
|
||||
root_key,
|
||||
csr_pem,
|
||||
INTERMEDIATE_CN,
|
||||
now,
|
||||
)?)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ the intermediate
|
||||
|
||||
/// The intermediate as control holds it: its certificate and its key, checked to belong
|
||||
/// together and to be a CA.
|
||||
pub struct Intermediate {
|
||||
cert_pem: String,
|
||||
key: KeyPair,
|
||||
info: CertInfo,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Intermediate {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Intermediate")
|
||||
.field("subject", &self.info.subject_cn)
|
||||
.field("not_after", &self.info.not_after)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub struct Intermediate(domi_pki::Intermediate);
|
||||
|
||||
impl Intermediate {
|
||||
pub fn new(cert_pem: &str, key: KeyPair) -> Result<Intermediate, PkiError> {
|
||||
let first = first_pem(cert_pem)?;
|
||||
let info = inspect(&first)?;
|
||||
if !info.is_ca {
|
||||
return Err(PkiError::NotCa);
|
||||
}
|
||||
if public_key_der(&first)? != key.public_key_der() {
|
||||
return Err(PkiError::KeyMismatch);
|
||||
}
|
||||
Ok(Intermediate {
|
||||
cert_pem: first,
|
||||
key,
|
||||
info,
|
||||
})
|
||||
Ok(Intermediate(domi_pki::Intermediate::new(cert_pem, key)?))
|
||||
}
|
||||
|
||||
pub fn cert_pem(&self) -> &str {
|
||||
&self.cert_pem
|
||||
self.0.cert_pem()
|
||||
}
|
||||
|
||||
pub fn not_after(&self) -> i64 {
|
||||
self.info.not_after
|
||||
self.0.not_after()
|
||||
}
|
||||
|
||||
pub fn info(&self) -> &CertInfo {
|
||||
&self.info
|
||||
self.0.info()
|
||||
}
|
||||
|
||||
pub fn key(&self) -> &KeyPair {
|
||||
&self.key
|
||||
self.0.key()
|
||||
}
|
||||
|
||||
fn issue(&self, mut p: CertificateParams, days: u32, now: i64) -> Result<Issued, PkiError> {
|
||||
if now < self.info.not_before || now >= self.info.not_after {
|
||||
return Err(PkiError::IssuerExpired);
|
||||
}
|
||||
let key = generate_key()?;
|
||||
p.is_ca = IsCa::ExplicitNoCa;
|
||||
p.not_before = time(now - BACKDATE_SECS)?;
|
||||
p.not_after = time((now + i64::from(days) * DAY).min(self.info.not_after))?;
|
||||
p.serial_number = Some(serial()?);
|
||||
p.use_authority_key_identifier_extension = true;
|
||||
let issuer = Issuer::from_ca_cert_pem(&self.cert_pem, &self.key.0).map_err(build)?;
|
||||
let cert = p.signed_by(&key.0, &issuer).map_err(build)?;
|
||||
let cert_pem = cert.pem();
|
||||
let info = inspect(&cert_pem)?;
|
||||
Ok(Issued {
|
||||
chain_pem: format!("{cert_pem}{}", self.cert_pem),
|
||||
key_pem: key.serialize_pem(),
|
||||
key,
|
||||
serial_hex: info.serial_hex.clone(),
|
||||
sha256_hex: info.sha256_hex.clone(),
|
||||
not_before: info.not_before,
|
||||
not_after: info.not_after,
|
||||
cert_pem,
|
||||
})
|
||||
/// The shared crate's intermediate.
|
||||
pub fn inner(&self) -> &domi_pki::Intermediate {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A freshly issued leaf.
|
||||
pub struct Issued {
|
||||
/// The leaf alone.
|
||||
pub cert_pem: String,
|
||||
/// Leaf, then the intermediate (what a server or a device presents).
|
||||
pub chain_pem: String,
|
||||
/// PKCS#8 PEM of the leaf's key.
|
||||
pub key_pem: String,
|
||||
pub key: KeyPair,
|
||||
pub serial_hex: String,
|
||||
/// SHA-256 of the leaf's DER, lowercase hex.
|
||||
pub sha256_hex: String,
|
||||
pub not_before: i64,
|
||||
pub not_after: i64,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Issued {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Issued")
|
||||
.field("serial", &self.serial_hex)
|
||||
.field("not_after", &self.not_after)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
pub use domi_pki::Issued;
|
||||
|
||||
/// A server certificate for one hostname (`tls = "domi"`). The hostname must already be
|
||||
/// validated by the schema; it is checked again here.
|
||||
pub fn issue_server(int: &Intermediate, hostname: &str, now: i64) -> Result<Issued, PkiError> {
|
||||
let mut p = CertificateParams::new(vec![hostname.to_owned()])
|
||||
.map_err(|e| PkiError::BadName(e.to_string()))?;
|
||||
p.distinguished_name = dn(hostname);
|
||||
p.key_usages = vec![KeyUsagePurpose::DigitalSignature];
|
||||
p.extended_key_usages = vec![ExtendedKeyUsagePurpose::ServerAuth];
|
||||
int.issue(p, SERVER_DAYS, now)
|
||||
Ok(domi_pki::issue_server(&int.0, hostname, now)?)
|
||||
}
|
||||
|
||||
/// A device certificate (mTLS client) for a named device.
|
||||
pub fn issue_device(int: &Intermediate, name: &str, now: i64) -> Result<Issued, PkiError> {
|
||||
check_display_name(name)?;
|
||||
let mut p = CertificateParams::default();
|
||||
let mut d = DistinguishedName::new();
|
||||
d.push(DnType::CommonName, name);
|
||||
d.push(DnType::OrganizationName, ORG);
|
||||
d.push(DnType::OrganizationalUnitName, "Domi devices");
|
||||
p.distinguished_name = d;
|
||||
p.key_usages = vec![KeyUsagePurpose::DigitalSignature];
|
||||
p.extended_key_usages = vec![ExtendedKeyUsagePurpose::ClientAuth];
|
||||
int.issue(p, DEVICE_DAYS, now)
|
||||
Ok(domi_pki::issue_device(&int.0, name, now)?)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ reading certificates
|
||||
|
||||
/// What Ianitor needs to know about a certificate.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct CertInfo {
|
||||
pub subject_cn: String,
|
||||
pub issuer_cn: String,
|
||||
pub not_before: i64,
|
||||
pub not_after: i64,
|
||||
pub is_ca: bool,
|
||||
pub path_len: Option<u32>,
|
||||
pub dns_names: Vec<String>,
|
||||
pub serial_hex: String,
|
||||
pub sha256_hex: String,
|
||||
/// keyUsage: `None` when the extension is absent.
|
||||
pub key_usage: Option<KeyUsageInfo>,
|
||||
/// extendedKeyUsage: `None` when the extension is absent (any use).
|
||||
pub eku: Option<EkuInfo>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct KeyUsageInfo {
|
||||
pub key_cert_sign: bool,
|
||||
pub crl_sign: bool,
|
||||
pub digital_signature: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct EkuInfo {
|
||||
pub any: bool,
|
||||
pub server_auth: bool,
|
||||
pub client_auth: bool,
|
||||
}
|
||||
|
||||
fn ders(pem: &str) -> Result<Vec<Vec<u8>>, PkiError> {
|
||||
let mut out = Vec::new();
|
||||
for p in x509_parser::pem::Pem::iter_from_buffer(pem.as_bytes()) {
|
||||
let p = p.map_err(|e| PkiError::BadCertificate(e.to_string()))?;
|
||||
if p.label != "CERTIFICATE" {
|
||||
return Err(PkiError::BadCertificate(format!(
|
||||
"unexpected PEM block {}",
|
||||
p.label
|
||||
)));
|
||||
}
|
||||
out.push(p.contents);
|
||||
}
|
||||
if out.is_empty() {
|
||||
return Err(PkiError::BadCertificate("no certificate in it".into()));
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// The DER of every certificate in a PEM chain, in order.
|
||||
pub fn chain_der(pem: &str) -> Result<Vec<Vec<u8>>, PkiError> {
|
||||
ders(pem)
|
||||
Ok(domi_pki::chain_der(pem)?)
|
||||
}
|
||||
|
||||
/// The first certificate of a PEM chain, as PEM.
|
||||
pub fn first_pem(pem: &str) -> Result<String, PkiError> {
|
||||
let first = ders(pem)?
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or_else(|| PkiError::BadCertificate("no certificate in it".into()))?;
|
||||
Ok(der_to_pem(&first))
|
||||
}
|
||||
|
||||
pub fn der_to_pem(der: &[u8]) -> String {
|
||||
let b = STANDARD.encode(der);
|
||||
let mut s = String::from("-----BEGIN CERTIFICATE-----\n");
|
||||
for chunk in b.as_bytes().chunks(64) {
|
||||
s.push_str(&String::from_utf8_lossy(chunk));
|
||||
s.push('\n');
|
||||
}
|
||||
s.push_str("-----END CERTIFICATE-----\n");
|
||||
s
|
||||
}
|
||||
|
||||
fn parse(der: &[u8]) -> Result<x509_parser::certificate::X509Certificate<'_>, PkiError> {
|
||||
let (rest, c) = x509_parser::parse_x509_certificate(der)
|
||||
.map_err(|e| PkiError::BadCertificate(e.to_string()))?;
|
||||
if !rest.is_empty() {
|
||||
return Err(PkiError::BadCertificate("trailing bytes".into()));
|
||||
}
|
||||
Ok(c)
|
||||
}
|
||||
|
||||
fn cn_of(name: &x509_parser::x509::X509Name<'_>) -> String {
|
||||
name.iter_common_name()
|
||||
.next()
|
||||
.and_then(|c| c.as_str().ok())
|
||||
.unwrap_or_default()
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
fn hex(b: &[u8]) -> String {
|
||||
b.iter().map(|x| format!("{x:02x}")).collect()
|
||||
}
|
||||
|
||||
/// SHA-256 of a DER blob, lowercase hex.
|
||||
pub fn sha256_hex(der: &[u8]) -> String {
|
||||
hex(ring::digest::digest(&ring::digest::SHA256, der).as_ref())
|
||||
Ok(domi_pki::first_pem(pem)?)
|
||||
}
|
||||
|
||||
/// Read the first certificate of a PEM chain.
|
||||
pub fn inspect(pem: &str) -> Result<CertInfo, PkiError> {
|
||||
let der = ders(pem)?
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or_else(|| PkiError::BadCertificate("no certificate in it".into()))?;
|
||||
inspect_der(&der)
|
||||
Ok(domi_pki::inspect(pem)?)
|
||||
}
|
||||
|
||||
pub fn inspect_der(der: &[u8]) -> Result<CertInfo, PkiError> {
|
||||
let c = parse(der)?;
|
||||
let bc = c
|
||||
.basic_constraints()
|
||||
.map_err(|e| PkiError::BadCertificate(e.to_string()))?;
|
||||
let (is_ca, path_len) = match bc {
|
||||
Some(b) => (b.value.ca, b.value.path_len_constraint),
|
||||
None => (false, None),
|
||||
};
|
||||
let dns_names = match c
|
||||
.subject_alternative_name()
|
||||
.map_err(|e| PkiError::BadCertificate(e.to_string()))?
|
||||
{
|
||||
Some(san) => san
|
||||
.value
|
||||
.general_names
|
||||
.iter()
|
||||
.filter_map(|g| match g {
|
||||
x509_parser::extensions::GeneralName::DNSName(n) => Some((*n).to_owned()),
|
||||
_ => None,
|
||||
})
|
||||
.collect(),
|
||||
None => Vec::new(),
|
||||
};
|
||||
Ok(CertInfo {
|
||||
subject_cn: cn_of(c.subject()),
|
||||
issuer_cn: cn_of(c.issuer()),
|
||||
not_before: c.validity().not_before.timestamp(),
|
||||
not_after: c.validity().not_after.timestamp(),
|
||||
is_ca,
|
||||
path_len,
|
||||
dns_names,
|
||||
serial_hex: hex(c.raw_serial()),
|
||||
sha256_hex: sha256_hex(der),
|
||||
key_usage: c
|
||||
.key_usage()
|
||||
.map_err(|e| PkiError::BadCertificate(e.to_string()))?
|
||||
.map(|k| KeyUsageInfo {
|
||||
key_cert_sign: k.value.key_cert_sign(),
|
||||
crl_sign: k.value.crl_sign(),
|
||||
digital_signature: k.value.digital_signature(),
|
||||
}),
|
||||
eku: c
|
||||
.extended_key_usage()
|
||||
.map_err(|e| PkiError::BadCertificate(e.to_string()))?
|
||||
.map(|e| EkuInfo {
|
||||
any: e.value.any,
|
||||
server_auth: e.value.server_auth,
|
||||
client_auth: e.value.client_auth,
|
||||
}),
|
||||
})
|
||||
Ok(domi_pki::inspect_der(der)?)
|
||||
}
|
||||
|
||||
/// Why a signed certificate cannot be the Domi intermediate, or `None` when it can. It must
|
||||
@@ -598,102 +219,28 @@ pub fn inspect_der(der: &[u8]) -> Result<CertInfo, PkiError> {
|
||||
/// allowed to issue both server and device certificates (no extendedKeyUsage, or one that
|
||||
/// allows both), valid now, and no longer than the root.
|
||||
pub fn intermediate_problem(cert_pem: &str, root_pem: &str, now: i64) -> Option<&'static str> {
|
||||
let Ok(info) = inspect(cert_pem) else {
|
||||
return Some("not_certificate");
|
||||
};
|
||||
let Ok(root) = inspect(root_pem) else {
|
||||
return Some("not_root");
|
||||
};
|
||||
if !issued_by(cert_pem, root_pem).unwrap_or(false) {
|
||||
return Some("not_root");
|
||||
}
|
||||
if !info.is_ca || info.path_len != Some(0) || !info.subject_cn.starts_with(INTERMEDIATE_CN) {
|
||||
return Some("not_ca");
|
||||
}
|
||||
if !info
|
||||
.key_usage
|
||||
.is_some_and(|k| k.key_cert_sign && k.crl_sign)
|
||||
{
|
||||
return Some("not_ca");
|
||||
}
|
||||
if info
|
||||
.eku
|
||||
.is_some_and(|e| !e.any && !(e.server_auth && e.client_auth))
|
||||
{
|
||||
return Some("eku");
|
||||
}
|
||||
if info.not_before > now + 300
|
||||
|| info.not_after <= now
|
||||
|| info.not_after > root.not_after
|
||||
|| info.not_before < root.not_before - 300
|
||||
{
|
||||
return Some("dates");
|
||||
}
|
||||
None
|
||||
domi_pki::intermediate_problem(cert_pem, root_pem, INTERMEDIATE_CN, now)
|
||||
}
|
||||
|
||||
/// SubjectPublicKeyInfo DER of the first certificate.
|
||||
pub fn public_key_der(pem: &str) -> Result<Vec<u8>, PkiError> {
|
||||
let der = ders(pem)?
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or_else(|| PkiError::BadCertificate("no certificate in it".into()))?;
|
||||
let c = parse(&der)?;
|
||||
Ok(c.public_key().raw.to_vec())
|
||||
Ok(domi_pki::public_key_der(pem)?)
|
||||
}
|
||||
|
||||
/// Is `child` (first certificate) signed by the key of `issuer` (first certificate), and
|
||||
/// does its issuer name match? A CA flag on the issuer is required.
|
||||
pub fn issued_by(child_pem: &str, issuer_pem: &str) -> Result<bool, PkiError> {
|
||||
let cd = ders(child_pem)?
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or(PkiError::BadCertificate(String::new()))?;
|
||||
let id = ders(issuer_pem)?
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or(PkiError::BadCertificate(String::new()))?;
|
||||
let child = parse(&cd)?;
|
||||
let issuer = parse(&id)?;
|
||||
let ca = matches!(issuer.basic_constraints(), Ok(Some(b)) if b.value.ca);
|
||||
Ok(ca
|
||||
&& child.issuer() == issuer.subject()
|
||||
&& child.verify_signature(Some(issuer.public_key())).is_ok())
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ match codes
|
||||
|
||||
/// The code both screens show for one request: SHA-256 of the request, first three bytes,
|
||||
/// each mod 100, as `47 19 83` (see docs/custos-ticket.md).
|
||||
pub fn match_code(request: &[u8]) -> String {
|
||||
let d = ring::digest::digest(&ring::digest::SHA256, request);
|
||||
let b = d.as_ref();
|
||||
format!(
|
||||
"{:02} {:02} {:02}",
|
||||
b.first().copied().unwrap_or(0) % 100,
|
||||
b.get(1).copied().unwrap_or(0) % 100,
|
||||
b.get(2).copied().unwrap_or(0) % 100
|
||||
)
|
||||
Ok(domi_pki::issued_by(child_pem, issuer_pem)?)
|
||||
}
|
||||
|
||||
/// SubjectPublicKeyInfo DER of a CSR (to match a signed certificate to its request).
|
||||
pub fn csr_public_key_der(csr_pem: &str) -> Result<Vec<u8>, PkiError> {
|
||||
use x509_parser::prelude::FromDer;
|
||||
let der = csr_der(csr_pem)?;
|
||||
let (_, csr) = x509_parser::certification_request::X509CertificationRequest::from_der(&der)
|
||||
.map_err(|_| PkiError::BadCsr)?;
|
||||
Ok(csr.certification_request_info.subject_pki.raw.to_vec())
|
||||
Ok(domi_pki::csr_public_key_der(csr_pem)?)
|
||||
}
|
||||
|
||||
/// DER of the first PEM block of a CSR (for the match code).
|
||||
pub fn csr_der(csr_pem: &str) -> Result<Vec<u8>, PkiError> {
|
||||
for p in x509_parser::pem::Pem::iter_from_buffer(csr_pem.as_bytes()) {
|
||||
let p = p.map_err(|_| PkiError::BadCsr)?;
|
||||
if p.label == "CERTIFICATE REQUEST" {
|
||||
return Ok(p.contents);
|
||||
}
|
||||
}
|
||||
Err(PkiError::BadCsr)
|
||||
Ok(domi_pki::csr_der(csr_pem)?)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ encrypted keys
|
||||
@@ -781,7 +328,7 @@ pub fn decrypt_key(sealed: &str, password: &[u8]) -> Result<KeyPair, PkiError> {
|
||||
&mut data,
|
||||
)
|
||||
.map_err(|_| PkiError::WrongPassword)?;
|
||||
KeyPair::from_der(plain)
|
||||
Ok(KeyPair::from_der(plain)?)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ for tests
|
||||
@@ -799,55 +346,21 @@ pub mod testing {
|
||||
name: &str,
|
||||
now: i64,
|
||||
) -> Result<String, PkiError> {
|
||||
let leaf_key = generate_key()?;
|
||||
let mut p = CertificateParams::new(vec![name.to_owned()]).map_err(build)?;
|
||||
p.distinguished_name = dn(name);
|
||||
p.extended_key_usages = vec![ExtendedKeyUsagePurpose::ServerAuth];
|
||||
p.not_before = time(now - BACKDATE_SECS)?;
|
||||
p.not_after = time(now + 30 * DAY)?;
|
||||
let issuer = Issuer::from_ca_cert_pem(&first_pem(issuer_pem)?, key.0).map_err(build)?;
|
||||
Ok(p.signed_by(&leaf_key.0, &issuer).map_err(build)?.pem())
|
||||
Ok(domi_pki::testing::sign_as(issuer_pem, key, name, now)?)
|
||||
}
|
||||
|
||||
/// A CA below the intermediate (which pathLen 0 forbids).
|
||||
pub fn sub_ca(int: &Intermediate, key: &KeyPair, now: i64) -> Result<String, PkiError> {
|
||||
let mut p = CertificateParams::default();
|
||||
p.distinguished_name = dn("Sub CA");
|
||||
p.is_ca = IsCa::Ca(BasicConstraints::Unconstrained);
|
||||
p.key_usages = vec![KeyUsagePurpose::KeyCertSign];
|
||||
p.not_before = time(now - BACKDATE_SECS)?;
|
||||
p.not_after = time(now + 30 * DAY)?;
|
||||
let issuer = Issuer::from_ca_cert_pem(int.cert_pem(), &int.key.0).map_err(build)?;
|
||||
Ok(p.signed_by(&key.0, &issuer).map_err(build)?.pem())
|
||||
Ok(domi_pki::testing::sub_ca(int.inner(), key, now)?)
|
||||
}
|
||||
|
||||
/// A CSR that asks for far too much.
|
||||
pub fn greedy_csr(key: &KeyPair, cn: &str) -> Result<String, PkiError> {
|
||||
let mut p = CertificateParams::new(vec!["www.example.com".to_owned()]).map_err(build)?;
|
||||
p.distinguished_name = dn(cn);
|
||||
p.is_ca = IsCa::Ca(BasicConstraints::Unconstrained);
|
||||
p.not_after = time(4_000_000_000)?;
|
||||
p.serialize_request(&key.0)
|
||||
.map_err(build)?
|
||||
.pem()
|
||||
.map_err(build)
|
||||
Ok(domi_pki::testing::greedy_csr(key, cn)?)
|
||||
}
|
||||
|
||||
/// Flip one byte inside the CSR's signed part.
|
||||
pub fn tamper_csr(csr_pem: &str) -> String {
|
||||
let Ok(mut der) = csr_der(csr_pem) else {
|
||||
return csr_pem.to_owned();
|
||||
};
|
||||
if let Some(b) = der.get_mut(40) {
|
||||
*b ^= 0x01;
|
||||
}
|
||||
let b = STANDARD.encode(der);
|
||||
let mut s = String::from("-----BEGIN CERTIFICATE REQUEST-----\n");
|
||||
for chunk in b.as_bytes().chunks(64) {
|
||||
s.push_str(&String::from_utf8_lossy(chunk));
|
||||
s.push('\n');
|
||||
}
|
||||
s.push_str("-----END CERTIFICATE REQUEST-----\n");
|
||||
s
|
||||
domi_pki::testing::tamper_csr(csr_pem)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,7 +401,11 @@ fn check_host(file: &str, raw: RawHost, site: Option<&Site>, errors: &mut Vec<E>
|
||||
let mut upstreams: Vec<Upstream> = Vec::new();
|
||||
let mut seen_upstreams = BTreeSet::new();
|
||||
for (index, u) in raw.upstreams.iter().take(MAX_UPSTREAMS).enumerate() {
|
||||
match parse_url(u, false) {
|
||||
let parsed = match u.strip_prefix("unix:") {
|
||||
Some(path) => parse_unix(path).map(|up| (up, String::new())),
|
||||
None => parse_url(u, false),
|
||||
};
|
||||
match parsed {
|
||||
Ok((up, _)) => {
|
||||
if seen_upstreams.insert(up.clone()) {
|
||||
upstreams.push(up);
|
||||
@@ -786,6 +790,31 @@ fn parse_url(raw: &str, allow_path: bool) -> Result<(Upstream, String), &'static
|
||||
Ok((Upstream { scheme, host, port }, path))
|
||||
}
|
||||
|
||||
/// The path of a `unix:` upstream. It ends up in JSON strings and in Caddy's dial address
|
||||
/// (where `{...}` would be a placeholder), so it is plain: absolute, `[A-Za-z0-9._-]` parts
|
||||
/// joined by single `/`, no `.` or `..` part, at most 100 bytes (sun_path is 108 on Linux).
|
||||
fn parse_unix(path: &str) -> Result<Upstream, &'static str> {
|
||||
let ok = path.len() <= 100
|
||||
&& path.len() > 1
|
||||
&& path.starts_with('/')
|
||||
&& path[1..].split('/').all(|part| {
|
||||
!part.is_empty()
|
||||
&& part != "."
|
||||
&& part != ".."
|
||||
&& part
|
||||
.bytes()
|
||||
.all(|c| c.is_ascii_alphanumeric() || matches!(c, b'.' | b'_' | b'-'))
|
||||
});
|
||||
if !ok {
|
||||
return Err(r::URL_UNIX_PATH);
|
||||
}
|
||||
Ok(Upstream {
|
||||
scheme: Scheme::Http,
|
||||
host: UpstreamHost::Unix(path.to_owned()),
|
||||
port: 0,
|
||||
})
|
||||
}
|
||||
|
||||
/// A URL as an error may show it: everything before the last `@` (after the scheme) is
|
||||
/// replaced by `…`, so a user name or password, even one containing `/`, `?` or `#`, never
|
||||
/// reaches a message, a log or the API. A URL with no `@` is shown as it is.
|
||||
|
||||
@@ -74,6 +74,7 @@ fn options() -> CompileOptions {
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +175,44 @@ fn trusted_proxies_reach_both_engines_only_when_set() {
|
||||
assert_eq!(https["trusted_proxies_strict"], serde_json::json!(1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_proxy_socket_reaches_both_engines_only_when_set() {
|
||||
let edge = compile::edge(&model(false), &options()).unwrap();
|
||||
let caddy = compile::caddy(&model(false), &options()).unwrap();
|
||||
assert!(!edge.contains("proxy_socket") && !caddy.contains("ianitor_proxy"));
|
||||
let mut o = options();
|
||||
o.proxy_socket = Some("/run/ianitor-proxy/edge.sock".into());
|
||||
let cfg: EdgeConfig = serde_json::from_str(&compile::edge(&model(false), &o).unwrap()).unwrap();
|
||||
assert_eq!(
|
||||
cfg.proxy_socket.as_deref(),
|
||||
Some("/run/ianitor-proxy/edge.sock")
|
||||
);
|
||||
let v: serde_json::Value =
|
||||
serde_json::from_str(&compile::caddy(&model(false), &o).unwrap()).unwrap();
|
||||
let servers = &v["apps"]["http"]["servers"];
|
||||
let proxy = &servers["ianitor_proxy"];
|
||||
assert_eq!(
|
||||
proxy["listen"],
|
||||
serde_json::json!(["unix//run/ianitor-proxy/edge.sock|0660"])
|
||||
);
|
||||
// The same routes as the HTTPS server, no TLS, the socket's peer trusted.
|
||||
assert_eq!(proxy["routes"], servers["ianitor_https"]["routes"]);
|
||||
assert_eq!(
|
||||
proxy["automatic_https"],
|
||||
serde_json::json!({"disable": true})
|
||||
);
|
||||
assert_eq!(proxy["trusted_proxies_unix"], serde_json::json!(true));
|
||||
assert!(proxy.get("tls_connection_policies").is_none());
|
||||
|
||||
let long = format!("/{}", "a".repeat(120));
|
||||
for bad in ["relative.sock", "/run/{env.HOME}.sock", long.as_str()] {
|
||||
let mut o = options();
|
||||
o.proxy_socket = Some(bad.to_owned());
|
||||
assert!(compile::edge(&model(false), &o).is_err(), "{bad}");
|
||||
assert!(compile::caddy(&model(false), &o).is_err(), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outputs_reference_secrets_by_name_only() {
|
||||
let edge = compile::edge(&model(false), &options()).unwrap();
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//! Unix-socket upstreams (G14 option b, tests first): the admin host reaches control on a
|
||||
//! Unix socket in a directory only the ianitor group can use, so no local process can take
|
||||
//! control's place while it restarts. Route files are hostile input: the path is strict, and
|
||||
//! which socket a host may use is control's decision (its `[ui] socket`), not core's.
|
||||
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
|
||||
use ianitor_core::compile::{self, CompileOptions};
|
||||
use ianitor_core::edge_config::EdgeConfig;
|
||||
use ianitor_core::{Model, SourceFile, ValidationError, load};
|
||||
|
||||
const SOCKET: &str = "/run/ianitor-control/ui.sock";
|
||||
|
||||
fn load_host(upstreams: &str) -> Result<Model, Vec<ValidationError>> {
|
||||
let body = format!("hostname = \"ui.test\"\ntls = \"domi\"\nupstreams = [{upstreams}]\n");
|
||||
load(
|
||||
&SourceFile {
|
||||
name: "ianitor.toml",
|
||||
contents: "",
|
||||
},
|
||||
&[SourceFile {
|
||||
name: "hosts/ui.test.toml",
|
||||
contents: &body,
|
||||
}],
|
||||
)
|
||||
.map_err(ianitor_core::ValidationErrors::into_errors)
|
||||
}
|
||||
|
||||
fn options() -> CompileOptions {
|
||||
CompileOptions {
|
||||
http_listen: "0.0.0.0:80".parse().unwrap(),
|
||||
https_listen: "0.0.0.0:443".parse().unwrap(),
|
||||
cert_dir: "/var/lib/ianitor/certs".into(),
|
||||
state_dir: "/var/lib/ianitor".into(),
|
||||
access_log: "/var/log/ianitor/access.log".into(),
|
||||
caddy_credentials_dir: "/run/credentials/caddy-fallback.service".into(),
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_unix_socket_upstream_reaches_both_engines() {
|
||||
let model = load_host(&format!("\"unix:{SOCKET}\"")).unwrap();
|
||||
let up = &model.hosts()[0].upstreams[0];
|
||||
assert!(up.is_unix());
|
||||
assert_eq!(up.to_string(), format!("unix:{SOCKET}"));
|
||||
|
||||
let edge: EdgeConfig =
|
||||
serde_json::from_str(&compile::edge(&model, &options()).unwrap()).unwrap();
|
||||
let u = &edge.hosts[0].upstreams[0];
|
||||
assert_eq!(u.address, format!("unix:{SOCKET}"));
|
||||
assert!(!u.tls);
|
||||
|
||||
let caddy: serde_json::Value =
|
||||
serde_json::from_str(&compile::caddy(&model, &options()).unwrap()).unwrap();
|
||||
let text = caddy.to_string();
|
||||
assert!(
|
||||
text.contains("\"dial\":\"unix//run/ianitor-control/ui.sock\""),
|
||||
"{text}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_unix_socket_path_is_strict() {
|
||||
let long = format!("unix:/run/{}.sock", "a".repeat(100));
|
||||
for bad in [
|
||||
"unix:relative.sock",
|
||||
"unix:",
|
||||
"unix:/",
|
||||
"unix:/run/",
|
||||
"unix://run/x.sock",
|
||||
"unix:/run//x.sock",
|
||||
"unix:/run/../etc/x.sock",
|
||||
"unix:/run/./x.sock",
|
||||
"unix:/run/x y.sock",
|
||||
"unix:/run/{env.HOME}.sock",
|
||||
"unix:/run/x.sock?q=1",
|
||||
"unix:/run/x\\y.sock",
|
||||
"unix:/run/ü.sock",
|
||||
long.as_str(),
|
||||
] {
|
||||
let errs = load_host(&format!("{:?}", bad))
|
||||
.err()
|
||||
.unwrap_or_else(|| panic!("{bad} was accepted"));
|
||||
assert!(
|
||||
errs.iter().any(|e| e.code() == "host.upstream.unix_path"),
|
||||
"{bad}: {errs:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn forward_auth_never_goes_to_a_socket() {
|
||||
let errs = load(
|
||||
&SourceFile {
|
||||
name: "ianitor.toml",
|
||||
contents: "[forward_auth]\nurl = \"unix:/run/authelia.sock\"\n",
|
||||
},
|
||||
&[],
|
||||
)
|
||||
.unwrap_err();
|
||||
assert!(!errs.errors().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_unix_upstream_and_a_tcp_one_are_both_kept() {
|
||||
let model = load_host(&format!("\"unix:{SOCKET}\", \"http://127.0.0.1:7878\"")).unwrap();
|
||||
assert_eq!(model.hosts()[0].upstreams.len(), 2);
|
||||
let dup = load_host(&format!("\"unix:{SOCKET}\", \"unix:{SOCKET}\"")).unwrap_err();
|
||||
assert!(dup.iter().any(|e| e.code() == "host.upstream.duplicate"));
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//! An overall deadline for reading a request header (slowloris).
|
||||
//!
|
||||
//! Pingora times out each *read* of a request header (60 s), not the header as a whole, so a
|
||||
//! client that sends one byte every 59 s holds a connection open for as long as it likes.
|
||||
//! Caddy (Go's `ReadHeaderTimeout`, 1 minute by default in Caddy 2) closes such a connection
|
||||
//! after a minute. [`HeaderDeadline`] wraps an HTTP app and does the same: a request whose
|
||||
//! header is not complete within the deadline has its connection closed, without an answer
|
||||
//! (Go does not answer either).
|
||||
//!
|
||||
//! The app under it says "the header is in" by calling [`header_read`] (edge's proxy does it in
|
||||
//! its first filter, the plain-HTTP listener right after parsing), which reaches this
|
||||
//! request's deadline through a task-local. A request whose header is in is never cut by it,
|
||||
//! however long its body or its upstream takes.
|
||||
//!
|
||||
//! On a reused keep-alive connection the deadline starts when the previous answer was sent, so
|
||||
//! it also covers the idle wait (Pingora's keep-alive timeout, 60 s): such a request gets the
|
||||
//! keep-alive timeout plus the header deadline. The first request on a connection is told
|
||||
//! apart by the reuse budget the wrapper sets (`keepalive_request_limit`, effectively
|
||||
//! unlimited): only the first request sees it whole.
|
||||
|
||||
use std::future::pending;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::time::Duration;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use pingora::apps::{HttpServerApp, HttpServerOptions, ReusedHttpStream};
|
||||
use pingora::protocols::http::ServerSession;
|
||||
use pingora::server::ShutdownWatch;
|
||||
|
||||
/// Caddy's default `read_header` timeout.
|
||||
pub const HEADER_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
|
||||
/// Pingora's keep-alive timeout between requests on one connection (`process_new` sets 60 s).
|
||||
pub const KEEPALIVE_IDLE: Duration = Duration::from_secs(60);
|
||||
|
||||
/// The reuse budget that marks a connection's first request (Pingora counts it down by one on
|
||||
/// every reuse; four billion requests on one connection is not a limit anyone meets).
|
||||
const FIRST_REQUEST_BUDGET: u32 = u32::MAX;
|
||||
|
||||
tokio::task_local! {
|
||||
static HEADER_IN: Arc<AtomicBool>;
|
||||
}
|
||||
|
||||
/// The request header has been read: the deadline no longer applies to this request.
|
||||
/// Outside a [`HeaderDeadline`] it does nothing.
|
||||
pub fn header_read() {
|
||||
let _ = HEADER_IN.try_with(|f| f.store(true, Ordering::Release));
|
||||
}
|
||||
|
||||
/// Wraps an HTTP app (edge's proxy, the plain-HTTP listener) with the header deadline.
|
||||
pub struct HeaderDeadline<A> {
|
||||
inner: Arc<A>,
|
||||
timeout: Duration,
|
||||
options: HttpServerOptions,
|
||||
}
|
||||
|
||||
impl<A> HeaderDeadline<A> {
|
||||
pub fn new(inner: A, timeout: Duration) -> Self {
|
||||
let mut options = HttpServerOptions::default();
|
||||
options.keepalive_request_limit = Some(FIRST_REQUEST_BUDGET);
|
||||
HeaderDeadline {
|
||||
inner: Arc::new(inner),
|
||||
timeout,
|
||||
options,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn inner(&self) -> &Arc<A> {
|
||||
&self.inner
|
||||
}
|
||||
|
||||
/// The deadline for this session: the header timeout, plus the keep-alive idle time on a
|
||||
/// reused connection. HTTP/2 streams arrive with their header already read.
|
||||
fn deadline_for(&self, session: &ServerSession) -> Duration {
|
||||
let first = session.is_http2()
|
||||
|| session.get_keepalive_reuses_remaining() == Some(FIRST_REQUEST_BUDGET);
|
||||
if first {
|
||||
self.timeout
|
||||
} else {
|
||||
self.timeout + KEEPALIVE_IDLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<A> HttpServerApp for HeaderDeadline<A>
|
||||
where
|
||||
A: HttpServerApp + Send + Sync + 'static,
|
||||
{
|
||||
async fn process_new_http(
|
||||
self: &Arc<Self>,
|
||||
session: ServerSession,
|
||||
shutdown: &ShutdownWatch,
|
||||
) -> Option<ReusedHttpStream> {
|
||||
let deadline = self.deadline_for(&session);
|
||||
let flag = Arc::new(AtomicBool::new(false));
|
||||
let watch = flag.clone();
|
||||
let inner = self.inner.clone();
|
||||
HEADER_IN
|
||||
.scope(flag, async move {
|
||||
tokio::select! {
|
||||
r = inner.process_new_http(session, shutdown) => r,
|
||||
() = async {
|
||||
tokio::time::sleep(deadline).await;
|
||||
if watch.load(Ordering::Acquire) {
|
||||
pending::<()>().await;
|
||||
}
|
||||
} => {
|
||||
log::debug!(target: "ianitor::http", "request header not complete after {deadline:?}; connection closed");
|
||||
None
|
||||
}
|
||||
}
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
fn h2_options(&self) -> Option<pingora::protocols::http::v2::server::H2Options> {
|
||||
self.inner.h2_options()
|
||||
}
|
||||
|
||||
fn server_options(&self) -> Option<&HttpServerOptions> {
|
||||
Some(&self.options)
|
||||
}
|
||||
|
||||
async fn http_cleanup(&self) {
|
||||
self.inner.http_cleanup().await;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
use super::*;
|
||||
use pingora::apps::ServerApp;
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
||||
/// Reads the header, says so, then answers 204 after `work` (a slow upstream).
|
||||
struct App {
|
||||
work: Duration,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl HttpServerApp for App {
|
||||
async fn process_new_http(
|
||||
self: &Arc<Self>,
|
||||
mut http: ServerSession,
|
||||
_shutdown: &ShutdownWatch,
|
||||
) -> Option<ReusedHttpStream> {
|
||||
if !matches!(http.read_request().await, Ok(true)) {
|
||||
return None;
|
||||
}
|
||||
header_read();
|
||||
tokio::time::sleep(self.work).await;
|
||||
let mut resp = pingora::http::ResponseHeader::build(204, None).unwrap();
|
||||
resp.insert_header("content-length", "0").unwrap();
|
||||
http.write_response_header(Box::new(resp)).await.ok()?;
|
||||
let settings = pingora::apps::HttpPersistentSettings::for_session(&http);
|
||||
http.finish()
|
||||
.await
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|s| ReusedHttpStream::from_reusable_stream(s, settings))
|
||||
}
|
||||
}
|
||||
|
||||
fn shutdown() -> ShutdownWatch {
|
||||
let (tx, rx) = tokio::sync::watch::channel(false);
|
||||
std::mem::forget(tx);
|
||||
rx
|
||||
}
|
||||
|
||||
/// Serve one connection (the in-memory pipe) with the deadline; returns the client end.
|
||||
fn serve(work: Duration, timeout: Duration) -> tokio::io::DuplexStream {
|
||||
let (client, server) = tokio::io::duplex(64 * 1024);
|
||||
let app = Arc::new(HeaderDeadline::new(App { work }, timeout));
|
||||
tokio::spawn(async move {
|
||||
let sd = shutdown();
|
||||
let _ = app.process_new(Box::new(server), &sd).await;
|
||||
});
|
||||
client
|
||||
}
|
||||
|
||||
/// Read until the server closes the pipe or `limit` passes; what was read, and whether the
|
||||
/// pipe closed.
|
||||
async fn read_all(c: &mut tokio::io::DuplexStream, limit: Duration) -> (String, bool) {
|
||||
let mut out = Vec::new();
|
||||
let mut buf = [0u8; 1024];
|
||||
let end = tokio::time::Instant::now() + limit;
|
||||
loop {
|
||||
match tokio::time::timeout_at(end, c.read(&mut buf)).await {
|
||||
Ok(Ok(0)) | Ok(Err(_)) => return (String::from_utf8_lossy(&out).into(), true),
|
||||
Ok(Ok(n)) => out.extend_from_slice(&buf[..n]),
|
||||
Err(_) => return (String::from_utf8_lossy(&out).into(), false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn a_header_trickled_past_the_deadline_is_cut() {
|
||||
let mut c = serve(Duration::ZERO, HEADER_TIMEOUT);
|
||||
let start = tokio::time::Instant::now();
|
||||
// One byte every 30 s: each read is well inside Pingora's own 60 s read timeout.
|
||||
let header = b"GET / HTTP/1.1\r\nHost: a.test\r\nX-Slow: 1\r\n";
|
||||
let mut closed_at = None;
|
||||
for b in header {
|
||||
if c.write_all(&[*b]).await.is_err() {
|
||||
closed_at = Some(start.elapsed());
|
||||
break;
|
||||
}
|
||||
let (got, closed) = read_all(&mut c, Duration::from_secs(30)).await;
|
||||
assert!(got.is_empty(), "no answer to a half header: {got}");
|
||||
if closed {
|
||||
closed_at = Some(start.elapsed());
|
||||
break;
|
||||
}
|
||||
}
|
||||
let at = closed_at.expect("the connection was closed");
|
||||
assert!(
|
||||
at >= HEADER_TIMEOUT && at <= HEADER_TIMEOUT + Duration::from_secs(30),
|
||||
"closed after {at:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn a_slow_answer_after_a_complete_header_is_not_cut() {
|
||||
let mut c = serve(Duration::from_secs(300), HEADER_TIMEOUT);
|
||||
c.write_all(b"GET / HTTP/1.1\r\nHost: a.test\r\n\r\n")
|
||||
.await
|
||||
.unwrap();
|
||||
let (got, _) = read_all(&mut c, Duration::from_secs(400)).await;
|
||||
assert!(got.starts_with("HTTP/1.1 204"), "{got}");
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn a_reused_connection_gets_the_idle_time_on_top() {
|
||||
let mut c = serve(Duration::ZERO, HEADER_TIMEOUT);
|
||||
c.write_all(b"GET / HTTP/1.1\r\nHost: a.test\r\n\r\n")
|
||||
.await
|
||||
.unwrap();
|
||||
let (got, closed) = read_all(&mut c, Duration::from_secs(1)).await;
|
||||
assert!(got.starts_with("HTTP/1.1 204") && !closed, "{got}");
|
||||
// Idle for 50 s, then a header that takes another 50 s: 100 s in all, inside the
|
||||
// keep-alive idle time plus the deadline.
|
||||
tokio::time::sleep(Duration::from_secs(50)).await;
|
||||
c.write_all(b"GET /2 HTTP/1.1\r\n").await.unwrap();
|
||||
tokio::time::sleep(Duration::from_secs(50)).await;
|
||||
c.write_all(b"Host: a.test\r\n\r\n").await.unwrap();
|
||||
let (got, _) = read_all(&mut c, Duration::from_secs(1)).await;
|
||||
assert!(got.starts_with("HTTP/1.1 204"), "second answer: {got}");
|
||||
// A third request that never completes is cut at idle + deadline.
|
||||
let start = tokio::time::Instant::now();
|
||||
c.write_all(b"GET /3 HTTP/1.1\r\n").await.unwrap();
|
||||
let mut closed = false;
|
||||
while start.elapsed() < Duration::from_secs(200) {
|
||||
let _ = c.write_all(b"X").await;
|
||||
let (_, cl) = read_all(&mut c, Duration::from_secs(20)).await;
|
||||
if cl {
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert!(closed, "the third request was cut");
|
||||
assert!(
|
||||
start.elapsed() <= HEADER_TIMEOUT + KEEPALIVE_IDLE + Duration::from_secs(20),
|
||||
"{:?}",
|
||||
start.elapsed()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,36 @@ pub fn peer(addr: SocketAddr, u: &UpstreamRt) -> HttpPeer {
|
||||
p
|
||||
}
|
||||
|
||||
/// The peer of a `unix:` upstream (plain HTTP over the socket).
|
||||
#[cfg(unix)]
|
||||
pub fn unix_peer(path: &str) -> Result<HttpPeer> {
|
||||
let mut p = HttpPeer::new_uds(path, false, String::new())?;
|
||||
p.options.connection_timeout = Some(DIAL_TIMEOUT);
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
pub fn unix_peer(path: &str) -> Result<HttpPeer> {
|
||||
Error::e_explain(
|
||||
ErrorType::SocketError,
|
||||
format!("{path}: Unix sockets need a Unix system"),
|
||||
)
|
||||
}
|
||||
|
||||
/// Every peer to try for `u`, in order: its socket, or each address its name resolves to.
|
||||
pub async fn peers(u: &UpstreamRt) -> Result<Vec<HttpPeer>> {
|
||||
if let Some(path) = &u.unix {
|
||||
return Ok(vec![unix_peer(path)?]);
|
||||
}
|
||||
let addrs = u.resolve().await.map_err(|e| {
|
||||
Error::explain(
|
||||
ErrorType::ConnectNoRoute,
|
||||
format!("cannot resolve {}: {e}", u.authority),
|
||||
)
|
||||
})?;
|
||||
Ok(addrs.into_iter().map(|a| peer(a, u)).collect())
|
||||
}
|
||||
|
||||
/// Send `req` without a body; read the whole response, at most `max_body` bytes of body,
|
||||
/// all within `timeout`.
|
||||
pub async fn fetch(
|
||||
@@ -64,16 +94,9 @@ async fn exchange(
|
||||
max_body: usize,
|
||||
timeout: Duration,
|
||||
) -> Result<Fetched> {
|
||||
let addrs = u.resolve().await.map_err(|e| {
|
||||
Error::explain(
|
||||
ErrorType::ConnectNoRoute,
|
||||
format!("cannot resolve {}: {e}", u.authority),
|
||||
)
|
||||
})?;
|
||||
let mut last = None;
|
||||
let mut session = None;
|
||||
for addr in addrs {
|
||||
let mut p = peer(addr, u);
|
||||
for mut p in peers(u).await? {
|
||||
p.options.total_connection_timeout = Some(timeout);
|
||||
match connector.get_http_session(&p).await {
|
||||
Ok((s, _reused)) => {
|
||||
|
||||
@@ -122,6 +122,9 @@ async fn round(host: &Arc<HostRt>, path: &str, connector: &Arc<Connector>, watch
|
||||
let (h, p, c) = (host.clone(), path.to_owned(), connector.clone());
|
||||
let probe_host = if watch {
|
||||
host.cfg.hostname.clone()
|
||||
} else if host.upstreams[i].unix.is_some() {
|
||||
// A socket has no authority to name; the probe asks as a local client would.
|
||||
"localhost".to_owned()
|
||||
} else {
|
||||
host.upstreams[i].authority.clone()
|
||||
};
|
||||
|
||||
+100
-1
@@ -44,8 +44,11 @@ impl HttpServerApp for HttpApp {
|
||||
mut http: ServerSession,
|
||||
shutdown: &ShutdownWatch,
|
||||
) -> Option<ReusedHttpStream> {
|
||||
// Pipelined requests are answered in order, as Caddy does (RFC 9112 §9.3.2); without
|
||||
// this Pingora answers the first and closes the connection.
|
||||
http.set_pipelining_enabled(true);
|
||||
match http.read_request().await {
|
||||
Ok(true) => {}
|
||||
Ok(true) => crate::deadline::header_read(),
|
||||
Ok(false) => return None,
|
||||
Err(e) => {
|
||||
if matches!(e.etype(), ErrorType::InvalidHTTPHeader) {
|
||||
@@ -129,3 +132,99 @@ impl HttpApp {
|
||||
r
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
use super::*;
|
||||
use pingora::apps::ServerApp;
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
||||
/// An edge runtime with one Let's Encrypt host (nothing to read from disk).
|
||||
fn shared() -> Arc<Shared> {
|
||||
let dir = std::env::temp_dir().join(format!("ianitor-http-app-{}", std::process::id()));
|
||||
let d = dir.to_string_lossy().replace('\\', "/");
|
||||
let d = if d.starts_with('/') {
|
||||
d
|
||||
} else {
|
||||
format!("/{d}")
|
||||
};
|
||||
let model = ianitor_core::load(
|
||||
&ianitor_core::SourceFile {
|
||||
name: "ianitor.toml",
|
||||
contents: "",
|
||||
},
|
||||
&[ianitor_core::SourceFile {
|
||||
name: "hosts/app.test.toml",
|
||||
contents: "hostname = \"app.test\"\nupstreams = [\"http://127.0.0.1:9\"]\n",
|
||||
}],
|
||||
)
|
||||
.unwrap();
|
||||
let opts = ianitor_core::compile::CompileOptions {
|
||||
http_listen: "127.0.0.1:18080".parse().unwrap(),
|
||||
https_listen: "127.0.0.1:18443".parse().unwrap(),
|
||||
cert_dir: format!("{d}/certs"),
|
||||
state_dir: format!("{d}/state"),
|
||||
access_log: format!("{d}/access.log"),
|
||||
caddy_credentials_dir: format!("{d}/creds"),
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
};
|
||||
let cfg =
|
||||
serde_json::from_str(&ianitor_core::compile::edge(&model, &opts).unwrap()).unwrap();
|
||||
let rt = crate::runtime::build(cfg, None).unwrap();
|
||||
crate::shared_for(rt, &crate::Options::default())
|
||||
}
|
||||
|
||||
/// Pipelined requests on the plain-HTTP listener are each answered, in order (phase 4; the
|
||||
/// listener used to answer the first and close).
|
||||
#[tokio::test]
|
||||
async fn pipelined_requests_are_answered_in_order() {
|
||||
let app = Arc::new(crate::deadline::HeaderDeadline::new(
|
||||
HttpApp {
|
||||
shared: shared(),
|
||||
challenges: Arc::new(Challenges::default()),
|
||||
},
|
||||
crate::deadline::HEADER_TIMEOUT,
|
||||
));
|
||||
let (mut client, server) = tokio::io::duplex(64 * 1024);
|
||||
tokio::spawn(async move {
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let _ = app.process_new(Box::new(server), &rx).await;
|
||||
});
|
||||
client
|
||||
.write_all(
|
||||
b"GET /one HTTP/1.1\r\nHost: app.test\r\n\r\n\
|
||||
GET / HTTP/1.1\r\nHost: nobody.test\r\n\r\n\
|
||||
GET /three?x=1 HTTP/1.1\r\nHost: app.test\r\n\r\n",
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let mut got = Vec::new();
|
||||
let mut buf = [0u8; 4096];
|
||||
let end = tokio::time::Instant::now() + std::time::Duration::from_secs(5);
|
||||
while got
|
||||
.windows(12)
|
||||
.filter(|w| w.starts_with(b"HTTP/1.1 "))
|
||||
.count()
|
||||
< 3
|
||||
{
|
||||
match tokio::time::timeout_at(end, client.read(&mut buf)).await {
|
||||
Ok(Ok(n)) if n > 0 => got.extend_from_slice(&buf[..n]),
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
let text = String::from_utf8_lossy(&got);
|
||||
let statuses: Vec<&str> = text
|
||||
.match_indices("HTTP/1.1 ")
|
||||
.map(|(i, _)| &text[i + 9..i + 12])
|
||||
.collect();
|
||||
assert_eq!(statuses, vec!["308", "404", "308"], "{text}");
|
||||
assert!(
|
||||
text.contains("location: https://app.test:18443/three?x=1"),
|
||||
"{text}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+48
-11
@@ -13,6 +13,7 @@
|
||||
pub mod acme;
|
||||
#[cfg(unix)]
|
||||
pub mod admin;
|
||||
pub mod deadline;
|
||||
pub mod error;
|
||||
pub mod fetch;
|
||||
pub mod forward_auth;
|
||||
@@ -21,6 +22,7 @@ pub mod http_app;
|
||||
pub mod logging;
|
||||
pub mod pages;
|
||||
pub mod proxy;
|
||||
pub mod resolver;
|
||||
pub mod runtime;
|
||||
pub mod secrets;
|
||||
pub mod share;
|
||||
@@ -32,7 +34,7 @@ use std::sync::Arc;
|
||||
|
||||
use pingora::connectors::http::Connector;
|
||||
use pingora::listeners::tls::TlsSettings;
|
||||
use pingora::proxy::http_proxy_service;
|
||||
use pingora::proxy::http_proxy;
|
||||
use pingora::server::Server;
|
||||
use pingora::server::configuration::ServerConf;
|
||||
use pingora::services::background::background_service;
|
||||
@@ -56,6 +58,8 @@ pub struct Options {
|
||||
pub acme_root: Option<PathBuf>,
|
||||
/// Overrides `$CREDENTIALS_DIRECTORY` (tests running several edges in one process).
|
||||
pub credentials_dir: Option<PathBuf>,
|
||||
/// The overall deadline for a request header; default [`deadline::HEADER_TIMEOUT`].
|
||||
pub header_timeout: Option<std::time::Duration>,
|
||||
}
|
||||
|
||||
impl Options {
|
||||
@@ -114,12 +118,19 @@ pub fn server(shared: Arc<Shared>, opts: &Options) -> Result<Server, EdgeError>
|
||||
let challenges = Arc::new(acme::Challenges::default());
|
||||
let rt = shared.current();
|
||||
|
||||
let mut https = http_proxy_service(
|
||||
&server.configuration,
|
||||
proxy::EdgeProxy {
|
||||
shared: shared.clone(),
|
||||
connector: Connector::new(None),
|
||||
},
|
||||
let header_timeout = opts.header_timeout.unwrap_or(deadline::HEADER_TIMEOUT);
|
||||
let mut https = Service::new(
|
||||
"ianitor https".to_owned(),
|
||||
deadline::HeaderDeadline::new(
|
||||
http_proxy(
|
||||
&server.configuration,
|
||||
proxy::EdgeProxy {
|
||||
shared: shared.clone(),
|
||||
connector: Connector::new(None),
|
||||
},
|
||||
),
|
||||
header_timeout,
|
||||
),
|
||||
);
|
||||
let mut tls =
|
||||
TlsSettings::with_callbacks(Box::new(tls::SniRecorder)).map_err(|e| EdgeError::Listen {
|
||||
@@ -133,13 +144,19 @@ pub fn server(shared: Arc<Shared>, opts: &Options) -> Result<Server, EdgeError>
|
||||
https
|
||||
.endpoints()
|
||||
.set_pre_tls_callback(Arc::new(tls::HandshakeStart));
|
||||
if let Some(path) = &rt.cfg.proxy_socket {
|
||||
add_proxy_socket(&mut https, Path::new(path))?;
|
||||
}
|
||||
|
||||
let mut http = Service::new(
|
||||
"ianitor http".to_owned(),
|
||||
http_app::HttpApp {
|
||||
shared: shared.clone(),
|
||||
challenges: challenges.clone(),
|
||||
},
|
||||
deadline::HeaderDeadline::new(
|
||||
http_app::HttpApp {
|
||||
shared: shared.clone(),
|
||||
challenges: challenges.clone(),
|
||||
},
|
||||
header_timeout,
|
||||
),
|
||||
);
|
||||
http.add_tcp(&rt.cfg.http_listen);
|
||||
|
||||
@@ -180,6 +197,26 @@ pub fn server(shared: Arc<Shared>, opts: &Options) -> Result<Server, EdgeError>
|
||||
Ok(server)
|
||||
}
|
||||
|
||||
/// The front proxy's socket on the HTTPS service: plain HTTP, mode 0660.
|
||||
#[cfg(unix)]
|
||||
fn add_proxy_socket<A>(svc: &mut Service<A>, path: &Path) -> Result<(), EdgeError> {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let p = path.to_str().ok_or_else(|| EdgeError::Listen {
|
||||
address: path.display().to_string(),
|
||||
reason: "the proxy socket path is not UTF-8".into(),
|
||||
})?;
|
||||
svc.add_uds(p, Some(std::fs::Permissions::from_mode(0o660)));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn add_proxy_socket<A>(_svc: &mut Service<A>, path: &Path) -> Result<(), EdgeError> {
|
||||
Err(EdgeError::Listen {
|
||||
address: path.display().to_string(),
|
||||
reason: "a proxy socket needs a Unix system".into(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Run until `stop` resolves (or is dropped). For running edge inside a test process.
|
||||
#[cfg(unix)]
|
||||
pub fn run_until(server: Server, stop: tokio::sync::oneshot::Receiver<()>) {
|
||||
|
||||
+13
-2
@@ -3,7 +3,7 @@
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//! `ianitor-edge --config <edge.json> [--check] [--admin-socket <path>] [--trial-config <path>]
|
||||
//! [--share-revocations <path>] [--acme-root <ca.pem>]`
|
||||
//! [--share-revocations <path>] [--acme-root <ca.pem>] [--header-timeout <secs>]`
|
||||
//!
|
||||
//! Secrets come from `$CREDENTIALS_DIRECTORY`; the log level from `$IANITOR_LOG`
|
||||
//! (error, warn, info, debug, trace; libraries are capped at info).
|
||||
@@ -25,11 +25,22 @@ fn parse_args() -> Result<(Options, bool), EdgeError> {
|
||||
Some("--admin-socket") => opts.admin_socket = args.next().map(PathBuf::from),
|
||||
Some("--trial-config") => opts.trial_config = args.next().map(PathBuf::from),
|
||||
Some("--share-revocations") => opts.share_revocations = args.next().map(PathBuf::from),
|
||||
Some("--header-timeout") => {
|
||||
let secs = args
|
||||
.next()
|
||||
.and_then(|s| s.to_str().and_then(|s| s.parse::<u64>().ok()))
|
||||
.filter(|s| (1..=3600).contains(s))
|
||||
.ok_or_else(|| {
|
||||
EdgeError::Usage("--header-timeout takes 1 to 3600 seconds".into())
|
||||
})?;
|
||||
opts.header_timeout = Some(std::time::Duration::from_secs(secs));
|
||||
}
|
||||
Some("--check") => check = true,
|
||||
Some("--help" | "-h") => {
|
||||
println!(
|
||||
"usage: ianitor-edge --config <edge.json> [--check] [--admin-socket <path>] \
|
||||
[--trial-config <path>] [--share-revocations <path>] [--acme-root <ca.pem>]"
|
||||
[--trial-config <path>] [--share-revocations <path>] [--acme-root <ca.pem>] \
|
||||
[--header-timeout <secs>]"
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
+36
-15
@@ -75,9 +75,6 @@ pub fn hostname(host_header: &str) -> String {
|
||||
name.to_ascii_lowercase()
|
||||
}
|
||||
|
||||
/// The client's address: the peer, or, when the peer is a trusted proxy, the rightmost
|
||||
/// `X-Forwarded-For` entry that is not itself trusted (the same right-to-left rule as Caddy's
|
||||
/// `trusted_proxies_strict`). Anything a client could forge to the left is ignored.
|
||||
/// An IPv4 address carried as IPv6 (`::ffff:127.0.0.1`) is the IPv4 address.
|
||||
fn canonical(ip: IpAddr) -> IpAddr {
|
||||
match ip {
|
||||
@@ -86,16 +83,26 @@ fn canonical(ip: IpAddr) -> IpAddr {
|
||||
}
|
||||
}
|
||||
|
||||
/// The client's address: the peer, or, when the peer is a trusted proxy, the rightmost
|
||||
/// `X-Forwarded-For` entry that is not itself trusted (the same right-to-left rule as Caddy's
|
||||
/// `trusted_proxies_strict`). Anything a client could forge to the left is ignored.
|
||||
///
|
||||
/// A request on the proxy socket (`--proxy-socket`) comes from the front proxy by
|
||||
/// construction: only the socket's owner and group can connect to it, so its peer is trusted
|
||||
/// and its `X-Forwarded-For` names the client. With no usable entry there is no address.
|
||||
pub fn client_ip(session: &Session, trusted: &[IpAddr]) -> Option<IpAddr> {
|
||||
let peer = canonical(
|
||||
session
|
||||
.client_addr()
|
||||
.and_then(|a| a.as_inet())
|
||||
.map(|a| a.ip())?,
|
||||
);
|
||||
// A Unix-socket peer is unnamed, so Pingora has no client address for it; the listening
|
||||
// side (the proxy socket's path) is what tells the two apart.
|
||||
let peer = match session.client_addr().and_then(|a| a.as_inet()) {
|
||||
Some(a) => Some(canonical(a.ip())),
|
||||
None if session.server_addr().is_some_and(|a| a.as_inet().is_none()) => None,
|
||||
None => return None,
|
||||
};
|
||||
let trusted_ip = |ip: &IpAddr| trusted.iter().any(|t| canonical(*t) == *ip);
|
||||
if !trusted_ip(&peer) {
|
||||
return Some(peer);
|
||||
if let Some(p) = peer
|
||||
&& !trusted_ip(&p)
|
||||
{
|
||||
return Some(p);
|
||||
}
|
||||
let mut last = peer;
|
||||
for v in session
|
||||
@@ -105,16 +112,16 @@ pub fn client_ip(session: &Session, trusted: &[IpAddr]) -> Option<IpAddr> {
|
||||
.iter()
|
||||
.rev()
|
||||
{
|
||||
let Ok(s) = v.to_str() else { return Some(last) };
|
||||
let Ok(s) = v.to_str() else { return last };
|
||||
for part in s.rsplit(',') {
|
||||
match part.trim().parse::<IpAddr>().map(canonical) {
|
||||
Ok(ip) if trusted_ip(&ip) => last = ip,
|
||||
Ok(ip) if trusted_ip(&ip) => last = Some(ip),
|
||||
Ok(ip) => return Some(ip),
|
||||
Err(_) => return Some(last),
|
||||
Err(_) => return last,
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(last)
|
||||
last
|
||||
}
|
||||
|
||||
/// A response with an empty body, like Caddy's `static_response` and error responses.
|
||||
@@ -162,6 +169,15 @@ impl ProxyHttp for EdgeProxy {
|
||||
}
|
||||
}
|
||||
|
||||
async fn early_request_filter(&self, session: &mut Session, _ctx: &mut Ctx) -> Result<()> {
|
||||
// The header is in: the header deadline (slowloris) no longer applies.
|
||||
crate::deadline::header_read();
|
||||
// Pipelined requests are answered in order, as Caddy does (RFC 9112 §9.3.2); without
|
||||
// this Pingora answers the first and closes the connection.
|
||||
session.downstream_session.set_pipelining_enabled(true);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn request_filter(&self, session: &mut Session, ctx: &mut Ctx) -> Result<bool> {
|
||||
let rt = self.shared.current();
|
||||
ctx.rt = Some(rt.clone());
|
||||
@@ -295,6 +311,11 @@ impl ProxyHttp for EdgeProxy {
|
||||
Error::explain(ErrorType::HTTPStatus(503), "no healthy upstream")
|
||||
})?;
|
||||
let up = &host.upstreams[i];
|
||||
if let Some(path) = &up.unix {
|
||||
// A socket: one peer, nothing to resolve and no other address to try.
|
||||
log::debug!(target: "ianitor::proxy", "{}: upstream {}", host.cfg.hostname, up.authority);
|
||||
return Ok(Box::new(fetch::unix_peer(path)?));
|
||||
}
|
||||
ctx.addrs = match up.resolve().await {
|
||||
Ok(a) => a,
|
||||
Err(e) => {
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//! Upstream name lookups with a bounded cost.
|
||||
//!
|
||||
//! The system resolver (`getaddrinfo`, which honours nsswitch and /etc/hosts like every other
|
||||
//! program on the machine) blocks a thread, and a lookup cannot be cancelled: when a request
|
||||
//! gives up after [`crate::runtime::RESOLVE_TIMEOUT`], the thread stays busy until glibc gives
|
||||
//! up (by default 5 s × 2 attempts × each name server). Through tokio's blocking pool, a dead
|
||||
//! name server and enough requests would pin every thread of that pool, which the rest of edge
|
||||
//! shares (file reads, the admin socket).
|
||||
//!
|
||||
//! So lookups run on their own threads, at most [`MAX_LOOKUP_THREADS`] at a time, never on
|
||||
//! tokio's pool; concurrent requests for one name share one lookup; and a request that would
|
||||
//! need a thread past the limit fails at once (a 502, like a lookup that timed out) instead of
|
||||
//! queueing. Nothing is cached: like Caddy, every connect resolves again.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::io;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use std::time::Duration;
|
||||
|
||||
use tokio::sync::{OwnedSemaphorePermit, Semaphore, watch};
|
||||
|
||||
/// How many lookups may hold a thread at once.
|
||||
pub const MAX_LOOKUP_THREADS: usize = 8;
|
||||
|
||||
type Lookup = dyn Fn(&str, u16) -> io::Result<Vec<SocketAddr>> + Send + Sync;
|
||||
type Answer = Result<Arc<Vec<SocketAddr>>, (io::ErrorKind, String)>;
|
||||
type Waiters = HashMap<(String, u16), watch::Receiver<Option<Answer>>>;
|
||||
type Inflight = Mutex<Waiters>;
|
||||
|
||||
pub struct Resolver {
|
||||
permits: Arc<Semaphore>,
|
||||
inflight: Arc<Inflight>,
|
||||
lookup: Arc<Lookup>,
|
||||
}
|
||||
|
||||
fn lock(m: &Inflight) -> MutexGuard<'_, Waiters> {
|
||||
m.lock().unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
}
|
||||
|
||||
/// The process-wide resolver over the system's `getaddrinfo`.
|
||||
pub fn system() -> &'static Resolver {
|
||||
static SYSTEM: std::sync::LazyLock<Resolver> = std::sync::LazyLock::new(|| {
|
||||
Resolver::new(MAX_LOOKUP_THREADS, |host, port| {
|
||||
use std::net::ToSocketAddrs;
|
||||
(host, port).to_socket_addrs().map(Iterator::collect)
|
||||
})
|
||||
});
|
||||
&SYSTEM
|
||||
}
|
||||
|
||||
impl Resolver {
|
||||
pub fn new(
|
||||
threads: usize,
|
||||
lookup: impl Fn(&str, u16) -> io::Result<Vec<SocketAddr>> + Send + Sync + 'static,
|
||||
) -> Resolver {
|
||||
Resolver {
|
||||
permits: Arc::new(Semaphore::new(threads)),
|
||||
inflight: Arc::default(),
|
||||
lookup: Arc::new(lookup),
|
||||
}
|
||||
}
|
||||
|
||||
/// Addresses for `host:port` in resolver order, within `deadline`. IP literals are not
|
||||
/// looked up. Errors: `TimedOut` (the lookup may go on in the background, holding its
|
||||
/// thread), `ResourceBusy` (every lookup thread is taken), `NotFound` (no address), or the
|
||||
/// resolver's own error.
|
||||
pub async fn resolve(
|
||||
&self,
|
||||
host: &str,
|
||||
port: u16,
|
||||
deadline: Duration,
|
||||
) -> io::Result<Vec<SocketAddr>> {
|
||||
if let Ok(ip) = host.parse::<std::net::IpAddr>() {
|
||||
return Ok(vec![SocketAddr::new(ip, port)]);
|
||||
}
|
||||
let mut rx = self.start_or_join(host, port)?;
|
||||
let answer = match tokio::time::timeout(deadline, rx.wait_for(Option::is_some)).await {
|
||||
Ok(Ok(v)) => v.clone(),
|
||||
Ok(Err(_)) => {
|
||||
return Err(io::Error::other(
|
||||
"the name lookup thread ended without an answer",
|
||||
));
|
||||
}
|
||||
Err(_) => {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::TimedOut,
|
||||
format!("name lookup took longer than {deadline:?}"),
|
||||
));
|
||||
}
|
||||
};
|
||||
match answer {
|
||||
Some(Ok(addrs)) if addrs.is_empty() => Err(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
"name resolves to no address",
|
||||
)),
|
||||
Some(Ok(addrs)) => Ok(addrs.as_ref().clone()),
|
||||
Some(Err((kind, msg))) => Err(io::Error::new(kind, msg)),
|
||||
None => Err(io::Error::other("no answer")),
|
||||
}
|
||||
}
|
||||
|
||||
/// The lookup in flight for this name, or a new one on its own thread.
|
||||
fn start_or_join(&self, host: &str, port: u16) -> io::Result<watch::Receiver<Option<Answer>>> {
|
||||
let key = (host.to_ascii_lowercase(), port);
|
||||
let mut map = lock(&self.inflight);
|
||||
if let Some(rx) = map.get(&key) {
|
||||
return Ok(rx.clone());
|
||||
}
|
||||
let permit: OwnedSemaphorePermit =
|
||||
self.permits.clone().try_acquire_owned().map_err(|_| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::ResourceBusy,
|
||||
format!(
|
||||
"{MAX_LOOKUP_THREADS} name lookups are already waiting on the resolver"
|
||||
),
|
||||
)
|
||||
})?;
|
||||
let (tx, rx) = watch::channel(None);
|
||||
map.insert(key.clone(), rx.clone());
|
||||
drop(map);
|
||||
let lookup = self.lookup.clone();
|
||||
let inflight = self.inflight.clone();
|
||||
let spawned = std::thread::Builder::new()
|
||||
.name("ianitor-dns".into())
|
||||
.spawn({
|
||||
let key = key.clone();
|
||||
move || {
|
||||
let answer = lookup(&key.0, key.1)
|
||||
.map(Arc::new)
|
||||
.map_err(|e| (e.kind(), e.to_string()));
|
||||
let _ = tx.send(Some(answer));
|
||||
lock(&inflight).remove(&key);
|
||||
drop(permit);
|
||||
}
|
||||
});
|
||||
if let Err(e) = spawned {
|
||||
lock(&self.inflight).remove(&key);
|
||||
return Err(io::Error::other(format!(
|
||||
"cannot start a name lookup thread: {e}"
|
||||
)));
|
||||
}
|
||||
Ok(rx)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
use super::*;
|
||||
use std::sync::Condvar;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::time::Instant;
|
||||
|
||||
/// A resolver whose lookups hang until the gate opens; counts the lookups started.
|
||||
struct Hung {
|
||||
started: Arc<AtomicUsize>,
|
||||
gate: Arc<(Mutex<bool>, Condvar)>,
|
||||
}
|
||||
|
||||
impl Hung {
|
||||
fn resolver(threads: usize) -> (Resolver, Hung) {
|
||||
let started = Arc::new(AtomicUsize::new(0));
|
||||
let gate = Arc::new((Mutex::new(false), Condvar::new()));
|
||||
let (s, g) = (started.clone(), gate.clone());
|
||||
let r = Resolver::new(threads, move |_, port| {
|
||||
s.fetch_add(1, Ordering::SeqCst);
|
||||
let (m, cv) = &*g;
|
||||
let mut open = m.lock().unwrap();
|
||||
while !*open {
|
||||
open = cv.wait(open).unwrap();
|
||||
}
|
||||
Ok(vec![SocketAddr::from(([127, 0, 0, 1], port))])
|
||||
});
|
||||
(r, Hung { started, gate })
|
||||
}
|
||||
|
||||
fn open(&self) {
|
||||
let (m, cv) = &*self.gate;
|
||||
*m.lock().unwrap_or_else(std::sync::PoisonError::into_inner) = true;
|
||||
cv.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
/// A failed assertion must not leave lookups hung (the runtime waits for them on drop).
|
||||
impl Drop for Hung {
|
||||
fn drop(&mut self) {
|
||||
self.open();
|
||||
}
|
||||
}
|
||||
|
||||
const SHORT: Duration = Duration::from_millis(100);
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn hung_lookups_pin_at_most_the_limit_and_the_rest_fail_at_once() {
|
||||
let (r, hung) = Hung::resolver(2);
|
||||
for name in ["a.test", "b.test"] {
|
||||
let e = r.resolve(name, 80, SHORT).await.unwrap_err();
|
||||
assert_eq!(e.kind(), io::ErrorKind::TimedOut, "{e}");
|
||||
}
|
||||
// Both threads are still stuck in the resolver: a third name fails without waiting.
|
||||
let t = Instant::now();
|
||||
let e = r
|
||||
.resolve("c.test", 80, Duration::from_secs(5))
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(e.kind(), io::ErrorKind::ResourceBusy, "{e}");
|
||||
assert!(t.elapsed() < Duration::from_secs(1), "{:?}", t.elapsed());
|
||||
// A name already being looked up joins that lookup instead of taking a thread.
|
||||
let e = r.resolve("A.test", 80, SHORT).await.unwrap_err();
|
||||
assert_eq!(e.kind(), io::ErrorKind::TimedOut);
|
||||
assert_eq!(hung.started.load(Ordering::SeqCst), 2);
|
||||
|
||||
// Once the resolver answers, the threads come back.
|
||||
hung.open();
|
||||
let mut ok = None;
|
||||
for _ in 0..100 {
|
||||
match r.resolve("c.test", 81, SHORT).await {
|
||||
Ok(a) => {
|
||||
ok = Some(a);
|
||||
break;
|
||||
}
|
||||
Err(e) if e.kind() == io::ErrorKind::ResourceBusy => {
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
}
|
||||
Err(e) => panic!("{e}"),
|
||||
}
|
||||
}
|
||||
assert_eq!(ok.unwrap(), vec![SocketAddr::from(([127, 0, 0, 1], 81))]);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn concurrent_requests_for_one_name_share_one_lookup() {
|
||||
let started = Arc::new(AtomicUsize::new(0));
|
||||
let s = started.clone();
|
||||
let r = Arc::new(Resolver::new(2, move |_, port| {
|
||||
s.fetch_add(1, Ordering::SeqCst);
|
||||
std::thread::sleep(Duration::from_millis(200));
|
||||
Ok(vec![SocketAddr::from(([192, 0, 2, 1], port))])
|
||||
}));
|
||||
let mut tasks = Vec::new();
|
||||
for _ in 0..20 {
|
||||
let r = r.clone();
|
||||
tasks.push(tokio::spawn(async move {
|
||||
r.resolve("shared.test", 443, Duration::from_secs(5)).await
|
||||
}));
|
||||
}
|
||||
for t in tasks {
|
||||
assert_eq!(
|
||||
t.await.unwrap().unwrap(),
|
||||
vec![SocketAddr::from(([192, 0, 2, 1], 443))]
|
||||
);
|
||||
}
|
||||
assert_eq!(started.load(Ordering::SeqCst), 1);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn literals_empty_answers_and_errors() {
|
||||
let r = Resolver::new(1, |host, _| match host {
|
||||
"empty.test" => Ok(vec![]),
|
||||
_ => Err(io::Error::new(io::ErrorKind::NotFound, "no such host")),
|
||||
});
|
||||
assert_eq!(
|
||||
r.resolve("::1", 8080, SHORT).await.unwrap(),
|
||||
vec!["[::1]:8080".parse().unwrap()]
|
||||
);
|
||||
assert_eq!(
|
||||
r.resolve("empty.test", 80, SHORT).await.unwrap_err().kind(),
|
||||
io::ErrorKind::NotFound
|
||||
);
|
||||
let e = r.resolve("gone.test", 80, SHORT).await.unwrap_err();
|
||||
assert_eq!(e.kind(), io::ErrorKind::NotFound);
|
||||
assert!(e.to_string().contains("no such host"));
|
||||
}
|
||||
}
|
||||
+24
-81
@@ -85,6 +85,8 @@ pub struct UpstreamRt {
|
||||
pub authority: String,
|
||||
pub tls: bool,
|
||||
pub sni: String,
|
||||
/// A `unix:` upstream's socket path (plain HTTP); `host` and `port` are then unused.
|
||||
pub unix: Option<String>,
|
||||
pub healthy: AtomicBool,
|
||||
pub health: HealthRecord,
|
||||
}
|
||||
@@ -205,6 +207,21 @@ fn upstream(u: &EdgeUpstream) -> Result<UpstreamRt, EdgeError> {
|
||||
address: u.address.clone(),
|
||||
reason: reason.to_owned(),
|
||||
};
|
||||
if let Some(path) = u.address.strip_prefix("unix:") {
|
||||
if !path.starts_with('/') || u.tls {
|
||||
return Err(err("expected unix:/absolute/path, plain HTTP"));
|
||||
}
|
||||
return Ok(UpstreamRt {
|
||||
host: String::new(),
|
||||
port: 0,
|
||||
authority: u.address.clone(),
|
||||
tls: false,
|
||||
sni: String::new(),
|
||||
unix: Some(path.to_owned()),
|
||||
healthy: AtomicBool::new(true),
|
||||
health: HealthRecord::default(),
|
||||
});
|
||||
}
|
||||
let (host, port) = u
|
||||
.address
|
||||
.rsplit_once(':')
|
||||
@@ -223,6 +240,7 @@ fn upstream(u: &EdgeUpstream) -> Result<UpstreamRt, EdgeError> {
|
||||
authority: u.address.clone(),
|
||||
tls: u.tls,
|
||||
sni: u.sni.clone(),
|
||||
unix: None,
|
||||
healthy: AtomicBool::new(true),
|
||||
health: HealthRecord::default(),
|
||||
})
|
||||
@@ -235,54 +253,15 @@ pub const RESOLVE_TIMEOUT: Duration = Duration::from_secs(3);
|
||||
impl UpstreamRt {
|
||||
/// Addresses to try, in resolver order. Names are resolved at connect time (like Caddy's
|
||||
/// dialer), so DNS changes and unresolvable names only affect requests, not startup.
|
||||
/// A lookup that takes longer than [`RESOLVE_TIMEOUT`] is an error.
|
||||
/// A lookup that takes longer than [`RESOLVE_TIMEOUT`] is an error; lookups run on their
|
||||
/// own bounded threads ([`crate::resolver`]).
|
||||
pub async fn resolve(&self) -> std::io::Result<Vec<SocketAddr>> {
|
||||
resolve_with(
|
||||
&self.host,
|
||||
self.port,
|
||||
RESOLVE_TIMEOUT,
|
||||
|host, port| async move {
|
||||
tokio::net::lookup_host((host.as_str(), port))
|
||||
.await
|
||||
.map(Iterator::collect)
|
||||
},
|
||||
)
|
||||
.await
|
||||
crate::resolver::system()
|
||||
.resolve(&self.host, self.port, RESOLVE_TIMEOUT)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
/// [`UpstreamRt::resolve`] with the lookup passed in, so the deadline can be tested.
|
||||
pub async fn resolve_with<F, Fut>(
|
||||
host: &str,
|
||||
port: u16,
|
||||
deadline: Duration,
|
||||
lookup: F,
|
||||
) -> std::io::Result<Vec<SocketAddr>>
|
||||
where
|
||||
F: FnOnce(String, u16) -> Fut,
|
||||
Fut: Future<Output = std::io::Result<Vec<SocketAddr>>>,
|
||||
{
|
||||
if let Ok(ip) = host.parse::<std::net::IpAddr>() {
|
||||
return Ok(vec![SocketAddr::new(ip, port)]);
|
||||
}
|
||||
let addrs = match tokio::time::timeout(deadline, lookup(host.to_owned(), port)).await {
|
||||
Ok(r) => r?,
|
||||
Err(_) => {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::TimedOut,
|
||||
format!("name lookup took longer than {deadline:?}"),
|
||||
));
|
||||
}
|
||||
};
|
||||
if addrs.is_empty() {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::NotFound,
|
||||
"name resolves to no address",
|
||||
));
|
||||
}
|
||||
Ok(addrs)
|
||||
}
|
||||
|
||||
fn header_name(name: &str) -> Result<HeaderName, EdgeError> {
|
||||
HeaderName::from_bytes(name.as_bytes()).map_err(|_| EdgeError::Header {
|
||||
name: name.to_owned(),
|
||||
@@ -498,46 +477,10 @@ pub fn build(cfg: EdgeConfig, credentials_dir: Option<&Path>) -> Result<Runtime,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod resolve_tests {
|
||||
mod health_tests {
|
||||
#![allow(clippy::unwrap_used)]
|
||||
use super::*;
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn a_slow_resolver_times_out() {
|
||||
let t = tokio::time::Instant::now();
|
||||
let err = resolve_with("slow.test", 80, RESOLVE_TIMEOUT, |_, _| async {
|
||||
tokio::time::sleep(Duration::from_secs(10)).await;
|
||||
Ok(vec!["127.0.0.1:80".parse().unwrap()])
|
||||
})
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(err.kind(), std::io::ErrorKind::TimedOut);
|
||||
assert_eq!(t.elapsed(), RESOLVE_TIMEOUT);
|
||||
}
|
||||
|
||||
#[tokio::test(start_paused = true)]
|
||||
async fn a_prompt_resolver_and_ip_literals_pass() {
|
||||
let a: SocketAddr = "127.0.0.1:80".parse().unwrap();
|
||||
let got = resolve_with(
|
||||
"ok.test",
|
||||
80,
|
||||
RESOLVE_TIMEOUT,
|
||||
|_, _| async move { Ok(vec![a]) },
|
||||
)
|
||||
.await;
|
||||
assert_eq!(got.unwrap(), vec![a]);
|
||||
let got = resolve_with("::1", 8080, RESOLVE_TIMEOUT, |_, _| async {
|
||||
unreachable!("IP literals are not looked up")
|
||||
})
|
||||
.await;
|
||||
assert_eq!(got.unwrap(), vec!["[::1]:8080".parse().unwrap()]);
|
||||
let got = resolve_with("empty.test", 80, RESOLVE_TIMEOUT, |_, _| async {
|
||||
Ok(vec![])
|
||||
})
|
||||
.await;
|
||||
assert_eq!(got.unwrap_err().kind(), std::io::ErrorKind::NotFound);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn health_records_keep_the_last_five() {
|
||||
let r = HealthRecord::default();
|
||||
|
||||
@@ -119,7 +119,10 @@ pub struct Shared {
|
||||
}
|
||||
|
||||
fn same_listeners(a: &Runtime, b: &Runtime) -> Result<(), EdgeError> {
|
||||
if a.cfg.http_listen != b.cfg.http_listen || a.cfg.https_listen != b.cfg.https_listen {
|
||||
if a.cfg.http_listen != b.cfg.http_listen
|
||||
|| a.cfg.https_listen != b.cfg.https_listen
|
||||
|| a.cfg.proxy_socket != b.cfg.proxy_socket
|
||||
{
|
||||
return Err(EdgeError::Config {
|
||||
path: PathBuf::from("<new config>"),
|
||||
message: "the listen addresses can only change with a restart".into(),
|
||||
|
||||
@@ -15,14 +15,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux (Pingora runner, Caddy, Pebble): run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -112,6 +112,8 @@ pub struct EdgeSpec<'a> {
|
||||
pub files: Vec<(String, Vec<u8>)>,
|
||||
/// Peers whose X-Forwarded-For edge believes.
|
||||
pub trusted_proxies: Vec<std::net::IpAddr>,
|
||||
/// The front proxy's Unix socket.
|
||||
pub proxy_socket: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for EdgeSpec<'_> {
|
||||
@@ -125,6 +127,7 @@ impl Default for EdgeSpec<'_> {
|
||||
http_port: None,
|
||||
files: Vec::new(),
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,6 +198,7 @@ pub fn spawn(spec: EdgeSpec<'_>) -> Edge {
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: spec.trusted_proxies.clone(),
|
||||
proxy_socket: spec.proxy_socket.clone(),
|
||||
};
|
||||
let config_text = compile_with(&dir, &ca, &opts, spec.site, &spec.hosts);
|
||||
std::fs::write(dir.join("edge.json"), &config_text).unwrap();
|
||||
|
||||
@@ -12,14 +12,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux (Pingora runner); run it in WSL2, see CLAUDE.md",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux (Pingora runner): run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
fn skipped_on_windows() {
|
||||
eprintln!(
|
||||
"SKIPPED on Windows: {} needs Linux (Pingora runner, Caddy, Pebble); run it in WSL2, see CLAUDE.md",
|
||||
file!()
|
||||
);
|
||||
}
|
||||
#[ignore = "needs Linux (Pingora runner, Caddy, Pebble): run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
|
||||
@@ -0,0 +1,553 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
//! Listener hardening (phase 4, tests first): an overall deadline for a request header
|
||||
//! (slowloris), pipelined requests answered in order on both listeners, and the proxy socket a
|
||||
//! front proxy (Caddy beside Ianitor) reaches edge through, whose X-Forwarded-For is believed
|
||||
//! because only that proxy can connect to it.
|
||||
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
|
||||
#[cfg(unix)]
|
||||
mod common;
|
||||
|
||||
// On Windows this target has nothing to run: it shows as one *ignored* test, never as a
|
||||
// pass (ROADMAP §8.3; run it in WSL2, see CLAUDE.md).
|
||||
#[cfg(not(unix))]
|
||||
#[test]
|
||||
#[ignore = "needs Linux (Pingora runner): run it in WSL2, see CLAUDE.md"]
|
||||
fn needs_linux() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use crate::common::{Edge, EdgeSpec, host_file, start};
|
||||
use ianitor_testkit::client::{self, Req};
|
||||
use ianitor_testkit::upstream::Echo;
|
||||
use rustls_pki_types::ServerName;
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
|
||||
/// Trickle a header that never ends, one byte every 300 ms; how long until edge closes the
|
||||
/// connection, and whatever it sent.
|
||||
async fn trickle<S: AsyncRead + AsyncWrite + Unpin>(mut s: S) -> (Duration, Vec<u8>) {
|
||||
let start = Instant::now();
|
||||
let header = b"GET / HTTP/1.1\r\nHost: app.test\r\nX-Slow: ";
|
||||
let mut got = Vec::new();
|
||||
let mut i = 0usize;
|
||||
while start.elapsed() < Duration::from_secs(20) {
|
||||
let b = header.get(i).copied().unwrap_or(b'a');
|
||||
i += 1;
|
||||
if s.write_all(&[b]).await.is_err() || s.flush().await.is_err() {
|
||||
return (start.elapsed(), got);
|
||||
}
|
||||
let mut buf = [0u8; 512];
|
||||
match tokio::time::timeout(Duration::from_millis(300), s.read(&mut buf)).await {
|
||||
Ok(Ok(0)) | Ok(Err(_)) => return (start.elapsed(), got),
|
||||
Ok(Ok(n)) => got.extend_from_slice(&buf[..n]),
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
panic!("edge kept a trickling header open for 20 s");
|
||||
}
|
||||
|
||||
fn app_edge(echo: &Echo, extra: Vec<String>) -> Edge {
|
||||
start(EdgeSpec {
|
||||
hosts: vec![host_file(
|
||||
"app.test",
|
||||
&format!("upstreams = [\"{}\"]\n", echo.url()),
|
||||
)],
|
||||
extra_args: extra,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn a_trickled_header_is_cut_at_the_deadline_on_both_listeners() {
|
||||
let echo = Echo::start("app").await;
|
||||
let edge = app_edge(&echo, vec!["--header-timeout".into(), "2".into()]);
|
||||
|
||||
let tcp = tokio::net::TcpStream::connect(edge.http).await.unwrap();
|
||||
let (took, got) = trickle(tcp).await;
|
||||
assert!(
|
||||
took >= Duration::from_millis(1800) && took < Duration::from_secs(6),
|
||||
"plain HTTP closed after {took:?}"
|
||||
);
|
||||
assert!(got.is_empty(), "no answer to half a header: {got:?}");
|
||||
|
||||
let tcp = tokio::net::TcpStream::connect(edge.https).await.unwrap();
|
||||
let name = ServerName::try_from("app.test").unwrap();
|
||||
let tls = client::tls_connector(edge.roots())
|
||||
.connect(name, tcp)
|
||||
.await
|
||||
.unwrap();
|
||||
let (took, got) = trickle(tls).await;
|
||||
assert!(
|
||||
took >= Duration::from_millis(1800) && took < Duration::from_secs(6),
|
||||
"HTTPS closed after {took:?}"
|
||||
);
|
||||
assert!(got.is_empty(), "no answer to half a header: {got:?}");
|
||||
assert!(echo.proxied().is_empty());
|
||||
|
||||
// A complete header still gets through.
|
||||
let r = client::https(
|
||||
edge.https,
|
||||
"app.test",
|
||||
edge.roots(),
|
||||
&Req::get("app.test", "/"),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(r.status, 200, "{}", edge.stderr());
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn pipelined_requests_are_answered_in_order_on_both_listeners() {
|
||||
let echo = Echo::start("app").await;
|
||||
let edge = app_edge(&echo, vec![]);
|
||||
|
||||
// Plain HTTP: a redirect, a 404 for an unknown host, a redirect.
|
||||
let got = client::http_pipelined(
|
||||
edge.http,
|
||||
&[
|
||||
Req::get("app.test", "/one"),
|
||||
Req::get("nobody.test", "/"),
|
||||
Req::get("app.test", "/three"),
|
||||
],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let statuses: Vec<u16> = got.iter().map(|r| r.status).collect();
|
||||
assert_eq!(statuses, vec![308, 404, 308], "{}", edge.stderr());
|
||||
assert!(got[2].header("location").unwrap().ends_with("/three"));
|
||||
|
||||
// HTTPS: three requests, one with a body, each proxied in order.
|
||||
let got = client::https_pipelined(
|
||||
edge.https,
|
||||
"app.test",
|
||||
edge.roots(),
|
||||
&[
|
||||
Req::get("app.test", "/a"),
|
||||
Req::new("POST", "app.test", "/b").body(b"hello"),
|
||||
Req::get("app.test", "/c"),
|
||||
],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let statuses: Vec<u16> = got.iter().map(|r| r.status).collect();
|
||||
assert_eq!(statuses, vec![200, 200, 200], "{}", edge.stderr());
|
||||
let paths: Vec<String> = echo.proxied().iter().map(|r| r.path.clone()).collect();
|
||||
assert_eq!(paths, vec!["/a", "/b", "/c"]);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn the_proxy_socket_believes_its_forwarded_for_and_tcp_does_not() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let echo = Echo::start("app").await;
|
||||
let dir = ianitor_testkit::proc::TempDir::new("proxy-sock");
|
||||
let sock = dir.join("proxy.sock");
|
||||
let edge = start(EdgeSpec {
|
||||
hosts: vec![host_file(
|
||||
"app.test",
|
||||
&format!("upstreams = [\"{}\"]\n", echo.url()),
|
||||
)],
|
||||
proxy_socket: Some(sock.to_string_lossy().into()),
|
||||
..Default::default()
|
||||
});
|
||||
for _ in 0..100 {
|
||||
if sock.exists() {
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
}
|
||||
let mode = std::fs::metadata(&sock).unwrap().permissions().mode() & 0o777;
|
||||
assert_eq!(mode, 0o660, "only the socket's owner and group may connect");
|
||||
|
||||
// Through the socket (Caddy appends the visitor it saw to X-Forwarded-For).
|
||||
let r = client::unix(
|
||||
&sock,
|
||||
&Req::get("app.test", "/via-socket")
|
||||
.header("x-forwarded-for", "198.51.100.9, 203.0.113.7"),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(r.status, 200, "{}", edge.stderr());
|
||||
// Over loopback TCP with the same claim: not believed.
|
||||
let r = client::https(
|
||||
edge.https,
|
||||
"app.test",
|
||||
edge.roots(),
|
||||
&Req::get("app.test", "/via-tcp").header("x-forwarded-for", "203.0.113.7"),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(r.status, 200);
|
||||
|
||||
let seen = echo.proxied();
|
||||
let header = |path: &str, name: &str| {
|
||||
let r = seen.iter().find(|r| r.path == path).unwrap();
|
||||
String::from_utf8(r.header(name).unwrap().to_vec()).unwrap()
|
||||
};
|
||||
assert_eq!(
|
||||
header("/via-socket", "x-forwarded-for"),
|
||||
"203.0.113.7",
|
||||
"the rightmost entry: the visitor the front proxy saw"
|
||||
);
|
||||
assert_eq!(header("/via-tcp", "x-forwarded-for"), "127.0.0.1");
|
||||
assert_eq!(
|
||||
header("/via-socket", "x-forwarded-proto"),
|
||||
"https",
|
||||
"the front proxy terminated TLS"
|
||||
);
|
||||
}
|
||||
|
||||
/// A device-certificate host asks for the certificate in the TLS handshake; the socket has
|
||||
/// none, so the host is refused there (403), never served without one.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn a_device_host_is_refused_through_the_proxy_socket() {
|
||||
let echo = Echo::start("dev").await;
|
||||
let dir = ianitor_testkit::proc::TempDir::new("proxy-sock-dev");
|
||||
let sock = dir.join("proxy.sock");
|
||||
let devices_ca = ianitor_testkit::tls::TestCa::new("Devices Test CA");
|
||||
let edge = start(EdgeSpec {
|
||||
hosts: vec![host_file(
|
||||
"device.test",
|
||||
&format!("upstreams = [\"{}\"]\ndevice_certs = true\n", echo.url()),
|
||||
)],
|
||||
files: vec![
|
||||
(
|
||||
"certs/domi-devices-ca.pem".into(),
|
||||
devices_ca.cert_pem.clone().into_bytes(),
|
||||
),
|
||||
(
|
||||
"certs/domi-devices.pem".into(),
|
||||
devices_ca.issue(&["a-device"]).cert_pem.into_bytes(),
|
||||
),
|
||||
],
|
||||
proxy_socket: Some(sock.to_string_lossy().into()),
|
||||
..Default::default()
|
||||
});
|
||||
for _ in 0..100 {
|
||||
if sock.exists() {
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
}
|
||||
let r = client::unix(&sock, &Req::get("device.test", "/"))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(r.status, 403, "{}", edge.stderr());
|
||||
assert!(echo.proxied().is_empty());
|
||||
}
|
||||
|
||||
/// A `unix:` upstream (G14 option b: the admin host reaches control on its socket):
|
||||
/// requests and health checks go over the socket, in plain HTTP.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn a_unix_socket_upstream_is_proxied_and_health_checked() {
|
||||
use http_body_util::Full;
|
||||
use hyper::server::conn::http1;
|
||||
use hyper::service::service_fn;
|
||||
use hyper_util::rt::TokioIo;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
let dir = ianitor_testkit::proc::TempDir::new("unix-upstream");
|
||||
let sock = dir.join("app.sock");
|
||||
let listener = tokio::net::UnixListener::bind(&sock).unwrap();
|
||||
let seen: Arc<Mutex<Vec<(String, String)>>> = Arc::default();
|
||||
let s = seen.clone();
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
let Ok((stream, _)) = listener.accept().await else {
|
||||
continue;
|
||||
};
|
||||
let s = s.clone();
|
||||
tokio::spawn(async move {
|
||||
let svc = service_fn(move |req: hyper::Request<hyper::body::Incoming>| {
|
||||
let host = req
|
||||
.headers()
|
||||
.get("host")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("")
|
||||
.to_owned();
|
||||
s.lock().unwrap().push((req.uri().path().to_owned(), host));
|
||||
async move {
|
||||
Ok::<_, std::convert::Infallible>(hyper::Response::new(Full::new(
|
||||
bytes::Bytes::from_static(b"via the socket"),
|
||||
)))
|
||||
}
|
||||
});
|
||||
let _ = http1::Builder::new()
|
||||
.serve_connection(TokioIo::new(stream), svc)
|
||||
.await;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let edge = start(EdgeSpec {
|
||||
hosts: vec![host_file(
|
||||
"ui.test",
|
||||
&format!(
|
||||
"upstreams = [\"unix:{}\"]
|
||||
[health_check]
|
||||
path = \"/healthz\"
|
||||
interval_secs = 1
|
||||
",
|
||||
sock.display()
|
||||
),
|
||||
)],
|
||||
..Default::default()
|
||||
});
|
||||
let r = client::https(
|
||||
edge.https,
|
||||
"ui.test",
|
||||
edge.roots(),
|
||||
&Req::get("ui.test", "/x"),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
(r.status, r.text().as_str()),
|
||||
(200, "via the socket"),
|
||||
"{}",
|
||||
edge.stderr()
|
||||
);
|
||||
for _ in 0..50 {
|
||||
if seen.lock().unwrap().iter().any(|(p, _)| p == "/healthz") {
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
}
|
||||
let seen = seen.lock().unwrap().clone();
|
||||
assert!(
|
||||
seen.contains(&("/x".to_owned(), "ui.test".to_owned())),
|
||||
"{seen:?}"
|
||||
);
|
||||
assert!(
|
||||
seen.iter()
|
||||
.any(|(p, h)| p == "/healthz" && h == "localhost"),
|
||||
"{seen:?}"
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ QC phase 4
|
||||
// Adopted as regression tests from QC's probes (fix round 1). The two slow-client tests need
|
||||
// python3 (tests/support/probes/).
|
||||
|
||||
async fn qc_raw(edge: &Edge, sni: &str, bytes: &[u8]) -> String {
|
||||
let tcp = tokio::net::TcpStream::connect(edge.https).await.unwrap();
|
||||
let mut tls = client::tls_connector(edge.roots())
|
||||
.connect(ServerName::try_from(sni.to_owned()).unwrap(), tcp)
|
||||
.await
|
||||
.unwrap();
|
||||
tls.write_all(bytes).await.unwrap();
|
||||
let mut out = Vec::new();
|
||||
let mut buf = [0u8; 8192];
|
||||
loop {
|
||||
match tokio::time::timeout(Duration::from_secs(3), tls.read(&mut buf)).await {
|
||||
Ok(Ok(n)) if n > 0 => out.extend_from_slice(&buf[..n]),
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
String::from_utf8_lossy(&out).into_owned()
|
||||
}
|
||||
|
||||
/// QC p4: desync / smuggling with pipelining on the HTTPS listener. The smuggled request
|
||||
/// names the forward-auth host and has no session, so if the upstream ever sees
|
||||
/// /SMUGGLED, it bypassed edge's routing and sign-in.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn qc_smuggling_cases_on_the_https_listener() {
|
||||
let authelia = ianitor_testkit::authelia::MockAuthelia::start().await;
|
||||
let echo = Echo::start("app").await;
|
||||
let site = format!("[forward_auth]\nurl = \"{}\"\n", authelia.url());
|
||||
let edge = start(EdgeSpec {
|
||||
site: &site,
|
||||
hosts: vec![
|
||||
host_file("app.test", &format!("upstreams = [\"{}\"]\n", echo.url())),
|
||||
host_file(
|
||||
"auth.test",
|
||||
&format!(
|
||||
"upstreams = [\"{}\"]\nauth = \"forward-auth\"\n",
|
||||
echo.url()
|
||||
),
|
||||
),
|
||||
],
|
||||
..Default::default()
|
||||
});
|
||||
let statuses = |t: &str| {
|
||||
t.match_indices("HTTP/1.1 ")
|
||||
.map(|(i, _)| t[i + 9..i + 12].to_owned())
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let sm = "GET /SMUGGLED HTTP/1.1\r\nHost: auth.test\r\n\r\n";
|
||||
let n = sm.len();
|
||||
let cases: Vec<(&str, &str, String)> = vec![
|
||||
(
|
||||
"forward-auth 401 with an unread body",
|
||||
"auth.test",
|
||||
format!(
|
||||
"POST /x HTTP/1.1\r\nHost: auth.test\r\nContent-Length: {n}\r\n\r\n{sm}GET /after HTTP/1.1\r\nHost: app.test\r\n\r\n"
|
||||
),
|
||||
),
|
||||
(
|
||||
"forward-auth 302 (GET with a body)",
|
||||
"auth.test",
|
||||
format!(
|
||||
"GET /x HTTP/1.1\r\nHost: auth.test\r\nContent-Length: {n}\r\n\r\n{sm}GET /after HTTP/1.1\r\nHost: app.test\r\n\r\n"
|
||||
),
|
||||
),
|
||||
(
|
||||
"404 host with an unread body",
|
||||
"app.test",
|
||||
format!(
|
||||
"POST /x HTTP/1.1\r\nHost: nobody.test\r\nContent-Length: {n}\r\n\r\n{sm}GET /after HTTP/1.1\r\nHost: app.test\r\n\r\n"
|
||||
),
|
||||
),
|
||||
(
|
||||
"421 SNI/Host mismatch with a body",
|
||||
"app.test",
|
||||
format!("POST /x HTTP/1.1\r\nHost: auth.test\r\nContent-Length: {n}\r\n\r\n{sm}"),
|
||||
),
|
||||
(
|
||||
"Expect: 100-continue, denied",
|
||||
"auth.test",
|
||||
format!(
|
||||
"POST /x HTTP/1.1\r\nHost: auth.test\r\nExpect: 100-continue\r\nContent-Length: {n}\r\n\r\n{sm}"
|
||||
),
|
||||
),
|
||||
(
|
||||
"CL + TE",
|
||||
"app.test",
|
||||
format!(
|
||||
"POST /clte HTTP/1.1\r\nHost: app.test\r\nContent-Length: {}\r\nTransfer-Encoding: chunked\r\n\r\n0\r\n\r\n{sm}",
|
||||
5 + n
|
||||
),
|
||||
),
|
||||
(
|
||||
"TE + CL (reversed)",
|
||||
"app.test",
|
||||
format!(
|
||||
"POST /tecl HTTP/1.1\r\nHost: app.test\r\nTransfer-Encoding: chunked\r\nContent-Length: 3\r\n\r\n0\r\n\r\n{sm}"
|
||||
),
|
||||
),
|
||||
(
|
||||
"two different CL",
|
||||
"app.test",
|
||||
format!(
|
||||
"POST /cl2 HTTP/1.1\r\nHost: app.test\r\nContent-Length: 0\r\nContent-Length: {n}\r\n\r\n{sm}"
|
||||
),
|
||||
),
|
||||
(
|
||||
"TE chunked, identity",
|
||||
"app.test",
|
||||
format!(
|
||||
"POST /teobf HTTP/1.1\r\nHost: app.test\r\nTransfer-Encoding: chunked, identity\r\nContent-Length: {n}\r\n\r\n{sm}"
|
||||
),
|
||||
),
|
||||
(
|
||||
"TE with a space before the colon",
|
||||
"app.test",
|
||||
format!(
|
||||
"POST /tesp HTTP/1.1\r\nHost: app.test\r\nTransfer-Encoding : chunked\r\nContent-Length: {n}\r\n\r\n{sm}"
|
||||
),
|
||||
),
|
||||
(
|
||||
"upgrade the upstream refuses, then a request",
|
||||
"app.test",
|
||||
format!(
|
||||
"GET /up HTTP/1.1\r\nHost: app.test\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n{sm}"
|
||||
),
|
||||
),
|
||||
];
|
||||
let mut bad = Vec::new();
|
||||
for (name, sni, req) in cases {
|
||||
echo.clear();
|
||||
let got = qc_raw(&edge, sni, req.as_bytes()).await;
|
||||
let reqs = echo.requests();
|
||||
let paths: Vec<String> = reqs.iter().map(|r| r.path.clone()).collect();
|
||||
let framing: Vec<String> = reqs
|
||||
.iter()
|
||||
.map(|r| {
|
||||
r.headers
|
||||
.iter()
|
||||
.filter(|(h, _)| {
|
||||
h.eq_ignore_ascii_case("transfer-encoding")
|
||||
|| h.eq_ignore_ascii_case("content-length")
|
||||
})
|
||||
.map(|(h, v)| format!("{h}={}", String::from_utf8_lossy(v)))
|
||||
.collect::<Vec<_>>()
|
||||
.join(",")
|
||||
})
|
||||
.collect();
|
||||
eprintln!(
|
||||
"QC {name}: statuses {:?}; upstream saw {paths:?} {framing:?}",
|
||||
statuses(&got)
|
||||
);
|
||||
if paths.iter().any(|p| p.contains("SMUGGLED")) {
|
||||
bad.push(name);
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
bad.is_empty(),
|
||||
"the smuggled request reached the upstream: {bad:?}"
|
||||
);
|
||||
}
|
||||
|
||||
/// QC p4: the header deadline wraps only the HTTP app, i.e. after the TLS handshake and,
|
||||
/// for HTTP/2, after a stream's header block. Probes (Python): a TCP connection that never
|
||||
/// sends a ClientHello, and an h2 HEADERS block continued one byte every 0.5 s.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn qc_slow_tls_handshake_and_h2_header_block() {
|
||||
let echo = Echo::start("app").await;
|
||||
let edge = app_edge(&echo, vec![]);
|
||||
let py = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../tests/support/probes/slow.py"
|
||||
);
|
||||
let port = edge.https.port().to_string();
|
||||
let run = |mode: &str| {
|
||||
std::process::Command::new("python3")
|
||||
.args([py, "127.0.0.1", &port, mode, "150", "app.test"])
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap()
|
||||
};
|
||||
let a = run("idle");
|
||||
let b = run("h2");
|
||||
let out = |c: std::process::Child| {
|
||||
String::from_utf8_lossy(&c.wait_with_output().unwrap().stdout).into_owned()
|
||||
};
|
||||
let (oa, ob) = tokio::task::spawn_blocking(move || (out(a), out(b)))
|
||||
.await
|
||||
.unwrap();
|
||||
eprintln!("QC edge {oa}QC edge {ob}");
|
||||
assert!(
|
||||
!oa.contains("STILL OPEN") && !ob.contains("STILL OPEN"),
|
||||
"{oa}{ob}"
|
||||
);
|
||||
}
|
||||
|
||||
/// QC p4: an HTTP/2 header block continued one byte per CONTINUATION frame (valid HPACK).
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn qc_h2_header_block_that_never_ends() {
|
||||
let echo = Echo::start("app").await;
|
||||
let edge = app_edge(&echo, vec!["--header-timeout".into(), "5".into()]);
|
||||
let py = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../tests/support/probes/h2slow.py"
|
||||
);
|
||||
let port = edge.https.port().to_string();
|
||||
let out = tokio::task::spawn_blocking(move || {
|
||||
std::process::Command::new("python3")
|
||||
.args([py, "127.0.0.1", &port, "150", "app.test"])
|
||||
.output()
|
||||
.unwrap()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
let o = String::from_utf8_lossy(&out.stdout).into_owned()
|
||||
+ &String::from_utf8_lossy(&out.stderr);
|
||||
eprintln!("QC edge (header timeout 5 s) {o}");
|
||||
assert!(!o.contains("STILL OPEN"), "{o}");
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user