Files
ja4-platform/tests/vm/Vagrantfile
Jacquin Antoine f88b739992 feat(e2e): add distributed E2E test framework with parametric traffic generation
Add run-e2e-test.sh with CLI parameters (--hits, --http-ratio, --dns, --tls,
--src-ips, --keep-analysis, --up) for configurable traffic generation. Traffic
runs from VM endpoints with multiple source IPs (alias IPs on eth0) to produce
distinct sessions for the ML pipeline. Fix curl TLS flags (--tlsv1.2 instead
of --tls-v1-2), skip redundant local verification in distributed mode, and
fix dashboard is_available() cache that never retried after ClickHouse recovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 00:09:32 +02:00

122 lines
6.2 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
# =============================================================================
# Vagrantfile — VMs de test ja4ebpf multi-distro
#
# 3 VMs pour les tests unitaires eBPF sur kernel réel :
# - centos8 : CentOS 8 (el8)
# - rocky9 : Rocky Linux 9 (el9)
# - rocky10 : Rocky Linux 10 (el10)
#
# Fournit un environnement kernel complet pour les tests eBPF :
# - tracefs / debugfs montés
# - perf_kprobe PMU disponible
# - uprobes fonctionnels avec accept4 tracepoints
#
# Prérequis (host Ubuntu) :
# sudo apt-get install -y libvirt-daemon-system libvirt-clients qemu-kvm libvirt-dev ruby-dev
# vagrant plugin install vagrant-libvirt
# sudo usermod -aG libvirt,kvm $USER # puis se reconnecter
#
# Utilisation :
# vagrant up # créer + provisionner toutes les VMs
# vagrant up rocky9 # créer une seule VM
# vagrant ssh rocky9 # connexion SSH
# make test-vm-nginx # test nginx sur Rocky 9 (défaut)
# make test-vm-all # tous les tests sur Rocky 9
# ./tests/vm/run-all-vms.sh # tests sur les 3 VMs
# vagrant destroy -f # détruire toutes les VMs
# =============================================================================
Vagrant.configure("2") do |config|
# ── Désactiver synced_folder par défaut ─────────────────────────────────────
config.vm.synced_folder ".", "/vagrant", disabled: true
# ── Provider libvirt commun ─────────────────────────────────────────────────
config.vm.provider :libvirt do |v|
v.cpus = 4
v.memory = 4096
v.nested = false
v.cpu_mode = "host-passthrough"
v.driver = "kvm"
v.disk_bus = "virtio"
v.nic_model_type = "virtio"
end
# ── Synchronisation du projet via rsync ─────────────────────────────────────
config.vm.synced_folder "../..", "/ja4-platform",
type: "rsync",
rsync__exclude: [".git/", "old/", "*.rpm", "dist/"]
# ═══════════════════════════════════════════════════════════════════════════
# VM 1 : CentOS 8 (el8)
# ═══════════════════════════════════════════════════════════════════════════
config.vm.define "centos8", autostart: false do |node|
node.vm.box = "centos/8"
node.vm.network "private_network",
libvirt__network_name: "ja4-e2e",
type: "dhcp"
node.vm.provision "shell", path: "provision-el8.sh"
node.vm.post_up_message = "VM centos8 prête ! Tests : make test-vm-centos8"
end
# ═══════════════════════════════════════════════════════════════════════════
# VM 2 : Rocky Linux 9 (el9) — VM par défaut
# ═══════════════════════════════════════════════════════════════════════════
config.vm.define "rocky9", primary: true do |node|
node.vm.box = "generic/rocky9"
node.vm.network "private_network",
libvirt__network_name: "ja4-e2e",
type: "dhcp"
node.vm.provision "shell", path: "provision.sh"
node.vm.post_up_message = <<~MSG
VM rocky9 prête !
Depuis la racine du projet :
make vm-ssh # connexion interactive
make test-vm-nginx # test nginx complet (L3/L4 + TLS + L7)
make test-vm-all # tous les tests
make vm-rebuild-ja4ebpf # resynchroniser + recompiler après modif
MSG
end
# ═══════════════════════════════════════════════════════════════════════════
# VM 3 : Rocky Linux 10 (el10)
# ═══════════════════════════════════════════════════════════════════════════
config.vm.define "rocky10", autostart: false do |node|
node.vm.box = "almalinux/10"
node.vm.network "private_network",
libvirt__network_name: "ja4-e2e",
type: "dhcp"
node.vm.provision "shell", path: "provision.sh"
node.vm.post_up_message = "VM rocky10 prête ! Tests : make test-vm-rocky10"
end
# ═══════════════════════════════════════════════════════════════════════════
# VM 4 : Analysis Server (ClickHouse + bot-detector + dashboard)
#
# VM centralisée pour le test E2E distribué. Les endpoints EL8/9/10 envoient
# leurs logs ja4ebpf vers le ClickHouse de cette VM (192.168.42.10).
# ═══════════════════════════════════════════════════════════════════════════
config.vm.define "analysis", autostart: false do |node|
node.vm.box = "generic/rocky9"
node.vm.network "private_network", ip: "192.168.42.10",
libvirt__network_name: "ja4-e2e",
libvirt__netmask: "255.255.255.0"
node.vm.provider :libvirt do |v|
v.cpus = 4
v.memory = 12288 # 12 Go — torch + isotree build gourmand en RAM
end
node.vm.provision "shell", path: "provision-analysis.sh"
node.vm.post_up_message = <<~MSG
VM analysis prête !
Depuis la racine du projet :
make test-e2e # test E2E complet (capture + ML + dashboard)
make test-e2e-quick # test rapide avec trafic réduit
MSG
end
end