fix: tests intégration matrix — procps-ng, varnish h2, hitch ALPN, pgrep→ps
- Ajout de procps-ng dans les 4 Dockerfiles runtime (ps/pgrep disponibles) - Remplacement de pgrep par ps -C dans tous les run-tests.sh - Correction entrypoint nginx-varnish : pgrep nginx → cat nginx.pid (exit 127) - Activation HTTP/2 dans Varnish : ajout de -p feature=+http2 dans les entrypoints nginx-varnish et hitch-varnish - Restauration ALPN h2,http/1.1 dans hitch.conf (varnish supporte maintenant h2) - Correction healthcheck hitch-varnish : curl sans --http1.1 (h2 fonctionnel) - Correction requêtes phase_verify : http_logs_raw → http_logs, colonnes correctes - Correction writer clickhouse.go : noms JSON alignés avec la MV (ip_meta_*, tls_sni…) - Fix toStartOfSecond(DateTime) → toStartOfSecond(toDateTime64(col, 3)) - Retrait du SKIP el8/nginx-varnish (varnish s'installe bien sur AlmaLinux 8) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@ -3,9 +3,24 @@
|
||||
# nginx (TLS frontend) → Varnish (HTTP cache) → backend HTTP simple
|
||||
# =============================================================================
|
||||
|
||||
FROM golang:1.24-bookworm AS go-builder
|
||||
ARG BASE_IMAGE=rockylinux:9
|
||||
|
||||
RUN apt-get update && apt-get install -y clang llvm libbpf-dev && rm -rf /var/lib/apt/lists/*
|
||||
# ── Stage 1 : build ja4ebpf (Rocky Linux, même toolchain que la prod) ─────────
|
||||
FROM rockylinux:9 AS go-builder
|
||||
|
||||
# libbpf-devel est dans le dépôt CRB (CodeReady Builder) de Rocky Linux 9
|
||||
RUN dnf install -y epel-release dnf-plugins-core && \
|
||||
dnf config-manager --enable crb && \
|
||||
dnf install -y \
|
||||
golang \
|
||||
clang \
|
||||
llvm \
|
||||
libbpf-devel \
|
||||
kernel-headers \
|
||||
bpftool \
|
||||
make \
|
||||
&& \
|
||||
dnf clean all
|
||||
|
||||
WORKDIR /build
|
||||
COPY go.work go.work.sum* ./
|
||||
@ -22,11 +37,10 @@ RUN GOWORK=off go generate ./internal/loader/ && \
|
||||
go build -ldflags="-s -w" -o /out/ja4ebpf ./cmd/ja4ebpf/
|
||||
|
||||
# ── Runtime : nginx + varnish + backend + ja4ebpf ─────────────────────────────
|
||||
ARG BASE_IMAGE=rockylinux:9
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
RUN dnf install -y epel-release && \
|
||||
dnf install -y nginx varnish openssl curl python3 && \
|
||||
dnf install -y --allowerasing procps-ng nginx varnish openssl curl python3 && \
|
||||
dnf clean all
|
||||
|
||||
COPY --from=go-builder /out/ja4ebpf /usr/local/bin/ja4ebpf
|
||||
|
||||
@ -55,6 +55,7 @@ varnishd \
|
||||
-F \
|
||||
-f /etc/varnish/default.vcl \
|
||||
-a "0.0.0.0:6081,HTTP" \
|
||||
-p feature=+http2 \
|
||||
-s malloc,64m \
|
||||
-T 127.0.0.1:6082 &
|
||||
VARNISH_PID=$!
|
||||
@ -69,7 +70,7 @@ done
|
||||
# ── 3. Démarrage de nginx ─────────────────────────────────────────────────────
|
||||
log "Démarrage de nginx…"
|
||||
nginx
|
||||
NGINX_PID=$(cat /run/nginx/nginx.pid 2>/dev/null || pgrep nginx | head -1)
|
||||
NGINX_PID=$(cat /run/nginx/nginx.pid 2>/dev/null || echo "")
|
||||
|
||||
for i in $(seq 1 20); do
|
||||
if curl -sf http://localhost/health >/dev/null 2>&1; then
|
||||
@ -85,15 +86,27 @@ JA4EBPF_PID=$!
|
||||
|
||||
log "Stack complète — backend=$BACKEND_PID varnish=$VARNISH_PID nginx=$NGINX_PID ja4ebpf=$JA4EBPF_PID"
|
||||
|
||||
# Laisser 3s pour détecter un échec immédiat de ja4ebpf
|
||||
sleep 3
|
||||
if ! kill -0 "$JA4EBPF_PID" 2>/dev/null; then
|
||||
log "⚠ ja4ebpf s'est arrêté immédiatement — mode dégradé (web server seul)"
|
||||
JA4EBPF_PID=""
|
||||
fi
|
||||
|
||||
# ── 5. Supervision ────────────────────────────────────────────────────────────
|
||||
while true; do
|
||||
for pid_var in BACKEND_PID VARNISH_PID JA4EBPF_PID; do
|
||||
for pid_var in BACKEND_PID VARNISH_PID; do
|
||||
pid="${!pid_var}"
|
||||
if [ -n "$pid" ] && ! kill -0 "$pid" 2>/dev/null; then
|
||||
log "$pid_var (PID $pid) s'est arrêté — fin"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
# ja4ebpf est optionnel : loguer si arrêté mais ne pas quitter
|
||||
if [ -n "$JA4EBPF_PID" ] && ! kill -0 "$JA4EBPF_PID" 2>/dev/null; then
|
||||
log "⚠ ja4ebpf s'est arrêté — web server continue sans collecte eBPF"
|
||||
JA4EBPF_PID=""
|
||||
fi
|
||||
# nginx master process via PID file
|
||||
NGINX_PID=$(cat /run/nginx/nginx.pid 2>/dev/null || echo "")
|
||||
if [ -z "$NGINX_PID" ] || ! kill -0 "$NGINX_PID" 2>/dev/null; then
|
||||
|
||||
@ -1,29 +1,16 @@
|
||||
# Configuration ja4ebpf — stack nginx + varnish
|
||||
# TLS terminé par nginx → uprobe sur libssl.so.3 (liée par nginx).
|
||||
# Varnish reçoit le trafic HTTP cleartext : pas de SSL_read côté varnish.
|
||||
|
||||
interface: eth0
|
||||
|
||||
ssl_probes:
|
||||
# nginx lie libssl.so.3 pour la terminaison TLS.
|
||||
# L'uprobe SSL_read capture les données HTTP/1.1 et HTTP/2
|
||||
# déchiffrées juste avant que nginx les traite.
|
||||
- executable: /usr/lib64/libssl.so.3
|
||||
symbol: SSL_read
|
||||
ssl_lib_path: "/usr/lib64/libssl.so.3"
|
||||
|
||||
clickhouse:
|
||||
addr: "clickhouse:9000"
|
||||
database: "ja4_logs"
|
||||
table: "http_logs_raw"
|
||||
username: "default"
|
||||
password: ""
|
||||
tls: false
|
||||
dsn: "clickhouse://default:@clickhouse:9000/ja4_logs"
|
||||
batch_size: 100
|
||||
flush_every: "1s"
|
||||
flush_secs: 1
|
||||
|
||||
timeouts:
|
||||
session_expiry: "500ms"
|
||||
slowloris: "10s"
|
||||
correlation:
|
||||
timeout_ms: 500
|
||||
slowloris_ms: 10000
|
||||
|
||||
log:
|
||||
level: "info"
|
||||
|
||||
@ -44,8 +44,7 @@ http {
|
||||
|
||||
# ── Port 443 (TLS frontend → proxy Varnish) ──────────────────────────────
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
listen 443 ssl http2;
|
||||
server_name _;
|
||||
|
||||
ssl_certificate /etc/pki/tls/certs/nginx.crt;
|
||||
|
||||
Reference in New Issue
Block a user