fix(ja4ebpf): split bpf2go generate into Ja4Tc + Ja4Ssl, fix RPM systemd-rpm-macros
- Use two separate //go:generate directives (Ja4Tc for tc_capture.c, Ja4Ssl
for uprobe_ssl.c) to avoid duplicate LICENSE symbol and multi-file clang issue
- Update loader.go to hold tcObjs/sslObjs separately with correct field names:
UprobeSslSetFd, UprobeSslReadEntry, UretprobeSslReadExit,
KprobeAccept4Entry, KretprobeAccept4Exit
- Add systemd-rpm-macros to all three RPM build stages (el8/el9/el10)
so that %{_unitdir} macro resolves correctly
- RPMs now build successfully for el8, el9, el10
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
60
tests/integration/nginx/platform/entrypoint.sh
Executable file
60
tests/integration/nginx/platform/entrypoint.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# Entrypoint — stack nginx + ja4ebpf
|
||||
# Ordre : nginx → ja4ebpf (uprobes sur nginx/libssl)
|
||||
# =============================================================================
|
||||
set -eo pipefail
|
||||
|
||||
log() { echo "[entrypoint:nginx] $(date +%H:%M:%S) $*"; }
|
||||
|
||||
NGINX_PID=""
|
||||
JA4EBPF_PID=""
|
||||
|
||||
cleanup() {
|
||||
log "Arrêt des processus…"
|
||||
[ -n "$JA4EBPF_PID" ] && kill "$JA4EBPF_PID" 2>/dev/null || true
|
||||
[ -n "$NGINX_PID" ] && kill "$NGINX_PID" 2>/dev/null || true
|
||||
wait 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT SIGTERM SIGINT
|
||||
|
||||
# ── 1. Démarrage de nginx ─────────────────────────────────────────────────
|
||||
log "Démarrage de nginx…"
|
||||
nginx
|
||||
NGINX_PID=$(cat /run/nginx/nginx.pid 2>/dev/null || pgrep nginx | head -1)
|
||||
|
||||
# Attendre que nginx soit opérationnel
|
||||
for i in $(seq 1 20); do
|
||||
if curl -sf http://localhost/health >/dev/null 2>&1; then
|
||||
log "nginx opérationnel (PID $NGINX_PID)"
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
# ── 2. Démarrage de ja4ebpf ───────────────────────────────────────────────
|
||||
log "Démarrage de ja4ebpf (attache uprobes sur libssl)…"
|
||||
ja4ebpf -config /etc/ja4ebpf/config.yml &
|
||||
JA4EBPF_PID=$!
|
||||
|
||||
log "Stack démarrée — nginx PID=$NGINX_PID ja4ebpf PID=$JA4EBPF_PID"
|
||||
|
||||
# ── 3. Supervision ────────────────────────────────────────────────────────
|
||||
# nginx fonctionne en daemon : surveiller le process master via le PID file.
|
||||
# ja4ebpf tourne en foreground.
|
||||
while true; do
|
||||
# Vérifier que nginx est toujours en vie
|
||||
if ! kill -0 "$NGINX_PID" 2>/dev/null; then
|
||||
NGINX_PID=$(cat /run/nginx/nginx.pid 2>/dev/null || echo "")
|
||||
if [ -z "$NGINX_PID" ] || ! kill -0 "$NGINX_PID" 2>/dev/null; then
|
||||
log "nginx s'est arrêté — fin de l'entrypoint"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
# Vérifier que ja4ebpf est toujours en vie
|
||||
if ! kill -0 "$JA4EBPF_PID" 2>/dev/null; then
|
||||
log "ja4ebpf s'est arrêté (code: $?) — fin de l'entrypoint"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
Reference in New Issue
Block a user