[bench] Conformance: the slow-client probes (a TLS handshake that never starts, an HTTP/2 header block that never ends) against both engines, and Caddy's real version from the binary's build info
This commit is contained in:
+13
-1
@@ -18,7 +18,7 @@ set -euo pipefail
|
|||||||
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||||
out="$root/bench/conformance"
|
out="$root/bench/conformance"
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
for tool in caddy h2spec jq; do
|
for tool in caddy h2spec jq; do # and python3 for the slow-client probes, when present
|
||||||
command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; }
|
command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; }
|
||||||
done
|
done
|
||||||
testssl=$(command -v testssl.sh || command -v testssl || true)
|
testssl=$(command -v testssl.sh || command -v testssl || true)
|
||||||
@@ -60,6 +60,18 @@ for engine in ianitor caddy; do
|
|||||||
grade=$(jq -r '[.[] | select(.id=="overall_grade")][0].finding // "n/a"' "$out/$engine-testssl.json" 2>/dev/null || echo n/a)
|
grade=$(jq -r '[.[] | select(.id=="overall_grade")][0].finding // "n/a"' "$out/$engine-testssl.json" 2>/dev/null || echo n/a)
|
||||||
bad=$(jq -r '[.[] | select(.severity=="HIGH" or .severity=="CRITICAL")] | length' "$out/$engine-testssl.json" 2>/dev/null || echo "?")
|
bad=$(jq -r '[.[] | select(.severity=="HIGH" or .severity=="CRITICAL")] | length' "$out/$engine-testssl.json" 2>/dev/null || echo "?")
|
||||||
printf '%-10s %-8s %s\n' "$engine" testssl "grade $grade, $bad findings HIGH or CRITICAL"
|
printf '%-10s %-8s %s\n' "$engine" testssl "grade $grade, $bad findings HIGH or CRITICAL"
|
||||||
|
|
||||||
|
# Slow clients (QC phase 4, tests/support/probes): a TLS handshake that never starts, and an
|
||||||
|
# HTTP/2 header block that never ends; how long each engine keeps them open (75 s at most).
|
||||||
|
if command -v python3 >/dev/null; then
|
||||||
|
probes="$root/tests/support/probes"
|
||||||
|
python3 "$probes/slow.py" 127.0.0.1 "$p" idle 75 localhost >"$out/$engine-slow-idle.txt" 2>&1 &
|
||||||
|
a=$!
|
||||||
|
python3 "$probes/h2slow.py" 127.0.0.1 "$p" 75 localhost >"$out/$engine-slow-h2.txt" 2>&1 &
|
||||||
|
b=$!
|
||||||
|
wait $a $b || true
|
||||||
|
printf '%-10s %-8s %s\n' "$engine" slow "$(cut -d';' -f1 "$out/$engine-slow-idle.txt" | head -1); $(cut -d';' -f1 "$out/$engine-slow-h2.txt" | head -1)"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# A case Caddy passes and Ianitor fails is a regression against the fallback.
|
# A case Caddy passes and Ianitor fails is a regression against the fallback.
|
||||||
|
|||||||
@@ -95,6 +95,34 @@ mod unix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `caddy version`, or, for a `go install`ed Caddy that says "unknown", its module version
|
||||||
|
/// from the binary's build info (`go version -m`).
|
||||||
|
fn caddy_version(caddy: &std::path::Path) -> String {
|
||||||
|
let out = |cmd: &mut std::process::Command| {
|
||||||
|
cmd.output()
|
||||||
|
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
|
||||||
|
.unwrap_or_default()
|
||||||
|
};
|
||||||
|
let v = out(std::process::Command::new(caddy).arg("version"));
|
||||||
|
if !v.is_empty() && v != "unknown" {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
let info = out(std::process::Command::new("go")
|
||||||
|
.args(["version", "-m"])
|
||||||
|
.arg(caddy));
|
||||||
|
info.lines()
|
||||||
|
.map(|l| l.split_whitespace().collect::<Vec<_>>())
|
||||||
|
.find(|f| f.len() >= 3 && f[0] == "mod" && f[1] == "github.com/caddyserver/caddy/v2")
|
||||||
|
.map(|f| {
|
||||||
|
format!(
|
||||||
|
"{} (go install; {})",
|
||||||
|
f[2],
|
||||||
|
info.lines().next().unwrap_or("").trim()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.unwrap_or(v)
|
||||||
|
}
|
||||||
|
|
||||||
fn addrs(t: &Target) -> serde_json::Value {
|
fn addrs(t: &Target) -> serde_json::Value {
|
||||||
json!({ "http": t.http.to_string(), "https": t.https.to_string() })
|
json!({ "http": t.http.to_string(), "https": t.https.to_string() })
|
||||||
}
|
}
|
||||||
@@ -158,11 +186,7 @@ mod unix {
|
|||||||
&caddy2_cfg,
|
&caddy2_cfg,
|
||||||
&[("GOMAXPROCS", "2")],
|
&[("GOMAXPROCS", "2")],
|
||||||
);
|
);
|
||||||
let caddy_version = std::process::Command::new(&caddy)
|
let caddy_version = caddy_version(&caddy);
|
||||||
.arg("version")
|
|
||||||
.output()
|
|
||||||
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
|
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
|
|||||||
Reference in New Issue
Block a user