fix(test): add ClickHouse readiness check before starting ja4ebpf

Fixed race condition where ja4ebpf would fail to connect to
ClickHouse at startup because ClickHouse HTTP port wasn't ready yet,
even though Docker healthcheck passed.

Changes:
- Add 30s wait loop with ClickHouse /ping endpoint check
- Log success message when ClickHouse is ready
- Applied to all 4 stacks: nginx, apache, nginx-varnish, hitch-varnish

Test results after fix:
- nginx: 240 rows, 175 JA4 fingerprints 
- apache: 257 rows, 191 JA4 fingerprints 
- nginx-varnish: 298 rows, 242 JA4 fingerprints 
- hitch-varnish: 247 rows, 177 JA4 fingerprints 

All L3/L4 metadata (TTL, MSS, Window), TLS fingerprinting (JA4, SNI),
and HTTP layer data are correctly captured and persisted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacquin Antoine
2026-04-19 15:11:22 +02:00
parent 506d151832
commit 742f4420c0
4 changed files with 53 additions and 0 deletions

View File

@ -33,6 +33,19 @@ for i in $(seq 1 20); do
done
# ── 2. Démarrage de ja4ebpf ───────────────────────────────────────────────
# Attendre que ClickHouse soit prêt (connection refused possible sinon)
log "Attente de ClickHouse (max 30s)…"
for i in $(seq 1 30); do
if curl -sf http://clickhouse:8123/ping >/dev/null 2>&1; then
log "ClickHouse est prêt (http://clickhouse:8123/ping OK)"
break
fi
if [ $i -eq 30 ]; then
log "⚠ ClickHouse toujours pas prêt après 30s, démarrage ja4ebpf quand même"
fi
sleep 1
done
log "Démarrage de ja4ebpf (attache uprobes sur libssl)…"
ja4ebpf -config /etc/ja4ebpf/config.yml &
JA4EBPF_PID=$!