f-76: nft: règles de pont en nftables, ebtables retiré #76
internal/nft pose les règles d'un port en une transaction, dans une table bridge two par netns de VPC. Subnets, gateway anycast et watchdog l'utilisent, même filtrage qu'avec ebtables. bootstrap_kvm.sh et le lab installent nftables ; helpers e2e, doc et notes 0.3.0 suivent. Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
da6295baf1
commit
d98e42e0a8
27 changed files with 823 additions and 341 deletions
|
|
@ -55,7 +55,7 @@ host_state () {
|
|||
echo "## liens"; ip -o link show | awk -F': ' '{print $2}' | cut -d@ -f1 | sort
|
||||
echo "## adresses"; ip -o -4 addr show | awk '{print $2, $4}' | sort
|
||||
echo "## routes"; ip -4 route show table all | grep -v '^local \|^broadcast ' | sort
|
||||
echo "## ebtables"; ebtables -t filter -L; ebtables -t nat -L
|
||||
echo "## nftables bridge"; nft list ruleset bridge
|
||||
echo "## iptables"; iptables-save | grep -v '^#' | sed 's/ \[[0-9]*:[0-9]*\]$//'
|
||||
echo "## frr"; vtysh -c 'show running-config' | grep -v '^Building\|^Current configuration\|^!'
|
||||
echo "## frr.conf"; sha256sum /etc/frr/frr.conf | cut -d' ' -f1
|
||||
|
|
|
|||
|
|
@ -180,24 +180,37 @@ vm_sniff_start () {
|
|||
sleep 3
|
||||
}
|
||||
|
||||
ebt_mac () {
|
||||
awk -F: 'BEGIN {OFS = ":"} {for (i = 1; i <= NF; i++) sub(/^0/, "", $i); $1 = $1; print tolower($0)}' <<<"${1}"
|
||||
nft_table () {
|
||||
local tables
|
||||
tables=$(ip netns exec "${1}" nft list tables bridge) || return 1
|
||||
grep -qx 'table bridge two' <<<"${tables}" || return 0
|
||||
ip netns exec "${1}" nft list table bridge two
|
||||
}
|
||||
|
||||
ebt_rules () {
|
||||
{ ip netns exec "${1}" ebtables -t nat -L; ip netns exec "${1}" ebtables -t filter -L; } | grep -- "${2}"
|
||||
nft_rules () {
|
||||
local table
|
||||
table=$(nft_table "${1}") || return 1
|
||||
awk -v p="${2}" '$1 == "chain" {c = ($2 == "pre-" p || $2 == "fwd-" p || $2 == "out-" p) ? $2 : ""; next} $1 == "}" {c = ""; next} c != "" && NF {$1 = $1; print c, $0}' <<<"${table}"
|
||||
}
|
||||
|
||||
ebt_confined () {
|
||||
ebt_rules "${1}" "${2}" | grep -ciE -- "-s ($(ebt_mac "${3}")|${3}) .*DROP"
|
||||
nft_count () {
|
||||
nft_rules "${1}" "${2}" | cut -d' ' -f2- | grep -cxF -- "${3}"
|
||||
}
|
||||
|
||||
ebt_arp_drop () {
|
||||
ebt_rules "${1}" "${2}" | grep -i arp | grep -i request | grep -q -- "${3} "
|
||||
nft_confined () {
|
||||
nft_count "${1}" "${2}" "ether saddr $(tr 'A-F' 'a-f' <<<"${3}") drop"
|
||||
}
|
||||
|
||||
ebt_dhcp_drop () {
|
||||
ebt_rules "${1}" "${2}" | grep -i udp | grep -- "${3} " | grep -q "67:68"
|
||||
nft_arp_drop () {
|
||||
[ "$(nft_count "${1}" "${2}" "arp operation request arp daddr ip ${3} drop")" -gt 0 ]
|
||||
}
|
||||
|
||||
nft_dhcp_drop () {
|
||||
[ "$(nft_count "${1}" "${2}" "ip saddr ${3} udp sport 67-68 udp dport 67-68 drop")" -gt 0 ]
|
||||
}
|
||||
|
||||
nft_handle () {
|
||||
ip netns exec "${1}" nft -a list chain bridge two "${2}" | awk -v r="${3}" '{line = $0; sub(/^[ \t]+/, "", line); if (sub(/ # handle [0-9]+$/, "", line) && line == r) print $NF}'
|
||||
}
|
||||
|
||||
vrrp_expected_master () {
|
||||
|
|
|
|||
|
|
@ -552,17 +552,59 @@ test_subnet_create_bridge_sends_mode_iface_type_and_interface_ip () {
|
|||
teardown
|
||||
}
|
||||
|
||||
test_ebt_confined_reads_both_mac_forms () {
|
||||
setup "ebt_confined : MAC avec ou sans zéros de tête (ebtables legacy et nft)"
|
||||
local stub='ebt_rules () { printf "%s\\n" "-s 02:01:00:00:0c:27 -o v-x-i -j DROP" "-s 2:1:0:0:c:27 -i v-x-i -j DROP" "-s 02:01:00:00:0c:28 -o v-x-i -j DROP"; }; '
|
||||
[[ $(node "${stub}ebt_confined ns v-x-i 02:01:00:00:0C:27") == 2 ]] || fail "$(node "${stub}ebt_confined ns v-x-i 02:01:00:00:0C:27")"
|
||||
nft_listing () {
|
||||
printf '%s\n' 'table bridge two {' ' map fwd_ports {' ' type ifname : verdict' ' elements = { "v-x-i" : jump fwd-v-x-i,' ' "v-y-i" : jump fwd-v-y-i }' ' }' '' \
|
||||
' chain forward {' ' type filter hook forward priority filter; policy accept;' ' oifname vmap @fwd_ports' ' }' '' \
|
||||
' chain pre-v-x-i {' ' ether saddr 02:01:00:00:0c:27 drop' ' }' '' \
|
||||
' chain fwd-v-x-i {' ' ether saddr 02:01:00:00:0c:27 drop' ' arp operation request arp daddr ip 10.2.1.254 drop' ' ip saddr 10.2.1.254 udp sport 67-68 udp dport 67-68 drop' ' ip saddr 10.2.1.254 udp dport 53 drop' ' }' '' \
|
||||
' chain fwd-v-x-ix {' ' arp operation request arp daddr ip 10.2.9.254 drop' ' }' '' \
|
||||
' chain fwd-v-y-i {' ' arp operation request arp daddr ip 10.2.2.254 drop' ' }' '}'
|
||||
}
|
||||
|
||||
test_nft_table_reads_the_two_table_only_when_present () {
|
||||
setup "nft_table : table bridge two lue si elle existe, rien sinon, échec si nft échoue"
|
||||
local listing
|
||||
listing=$(mktemp)
|
||||
nft_listing > "${listing}"
|
||||
[[ $(node "ip () { case \"\$*\" in 'netns exec ns nft list tables bridge') echo 'table bridge filter'; echo 'table bridge two' ;; 'netns exec ns nft list table bridge two') cat '${listing}' ;; *) echo \"ip \$*\"; return 1 ;; esac; }; nft_table ns") == "$(cat "${listing}")" ]] || fail "table présente non lue"
|
||||
[[ $(node "ip () { case \"\$*\" in 'netns exec ns nft list tables bridge') echo 'table bridge filter' ;; *) echo \"ip \$*\"; return 1 ;; esac; }; nft_table ns && echo VIDE") == VIDE ]] || fail "table absente : $(node "ip () { echo 'table bridge filter'; }; nft_table ns")"
|
||||
[[ $(node "ip () { return 1; }; nft_table ns || echo ÉCHEC") == ÉCHEC ]] || fail "échec de nft avalé"
|
||||
[[ $(node "nft_table () { return 1; }; nft_rules ns v-x-i || echo ÉCHEC") == ÉCHEC ]] || fail "nft_rules avale l'échec de nft_table"
|
||||
rm -f "${listing}"
|
||||
teardown
|
||||
}
|
||||
|
||||
test_ebt_mac_drops_leading_zeros_like_ebtables () {
|
||||
setup "ebt_mac : octets sans zéro de tête, en minuscules, comme ebtables -L"
|
||||
[[ $(node 'ebt_mac 02:01:00:00:0C:1d') == 2:1:0:0:c:1d ]] || fail "$(node 'ebt_mac 02:01:00:00:0C:1d')"
|
||||
[[ $(node 'ebt_mac aa:10:00:ff:01:00') == aa:10:0:ff:1:0 ]] || fail "$(node 'ebt_mac aa:10:00:ff:01:00')"
|
||||
test_nft_rules_reads_only_the_chains_of_the_port () {
|
||||
setup "nft_rules : règles des chaînes pre-, fwd- et out- du port, préfixées par la chaîne"
|
||||
local stub got want
|
||||
stub="nft_table () { $(declare -f nft_listing | sed 1,2d | sed '$d'); }; "
|
||||
got=$(node "${stub}nft_rules ns v-x-i")
|
||||
want=$(printf '%s\n' 'pre-v-x-i ether saddr 02:01:00:00:0c:27 drop' 'fwd-v-x-i ether saddr 02:01:00:00:0c:27 drop' 'fwd-v-x-i arp operation request arp daddr ip 10.2.1.254 drop' 'fwd-v-x-i ip saddr 10.2.1.254 udp sport 67-68 udp dport 67-68 drop' 'fwd-v-x-i ip saddr 10.2.1.254 udp dport 53 drop')
|
||||
[[ "${got}" == "${want}" ]] || fail "règles lues : ${got}"
|
||||
teardown
|
||||
}
|
||||
|
||||
test_nft_matchers_read_the_rules () {
|
||||
setup "nft_confined / nft_arp_drop / nft_dhcp_drop : règle exacte, MAC en minuscules"
|
||||
local stub
|
||||
stub="nft_table () { $(declare -f nft_listing | sed 1,2d | sed '$d'); }; "
|
||||
[[ $(node "${stub}nft_confined ns v-x-i 02:01:00:00:0C:27") == 2 ]] || fail "confinement : $(node "${stub}nft_confined ns v-x-i 02:01:00:00:0C:27")"
|
||||
[[ $(node "${stub}nft_confined ns v-x-i 02:01:00:00:0c:28") == 0 ]] || fail "autre MAC comptée"
|
||||
[[ $(node "${stub}nft_arp_drop ns v-x-i 10.2.1.254 && echo OUI") == OUI ]] || fail "ARP non lu"
|
||||
[[ $(node "${stub}nft_arp_drop ns v-x-i 10.2.1.25 || echo NON") == NON ]] || fail "10.2.1.25 pris pour 10.2.1.254"
|
||||
[[ $(node "${stub}nft_arp_drop ns v-x-i 10.2.9.254 || echo NON") == NON ]] || fail "chaîne de v-x-ix lue pour v-x-i"
|
||||
[[ $(node "${stub}nft_dhcp_drop ns v-x-i 10.2.1.254 && echo OUI") == OUI ]] || fail "DHCP non lu"
|
||||
[[ $(node "${stub}nft_dhcp_drop ns v-y-i 10.2.1.254 || echo NON") == NON ]] || fail "autre interface acceptée"
|
||||
[[ $(node "nft_rules () { echo 'fwd-v-z-i ip saddr 10.2.1.254 udp dport 53 drop'; }; nft_dhcp_drop ns v-z-i 10.2.1.254 || echo NON") == NON ]] || fail "règle UDP hors DHCP prise pour un blocage DHCP"
|
||||
teardown
|
||||
}
|
||||
|
||||
test_nft_handle_finds_the_exact_rule () {
|
||||
setup "nft_handle : numéro de la règle exacte dans nft -a list chain"
|
||||
local stub
|
||||
stub="ip () { printf '%s\\n' 'table bridge two {' ' chain out-v-x-i { # handle 9' ' arp saddr ip 10.2.1.25 drop # handle 11' ' arp saddr ip 10.2.1.254 drop # handle 12' ' }' '}'; }; "
|
||||
[[ $(node "${stub}nft_handle ns out-v-x-i 'arp saddr ip 10.2.1.254 drop'") == 12 ]] || fail "$(node "${stub}nft_handle ns out-v-x-i 'arp saddr ip 10.2.1.254 drop'")"
|
||||
[[ -z $(node "${stub}nft_handle ns out-v-x-i 'arp saddr ip 10.2.1.2 drop'") ]] || fail "règle absente trouvée"
|
||||
teardown
|
||||
}
|
||||
|
||||
|
|
@ -664,19 +706,6 @@ test_log_gap_measures_the_longest_silence_in_a_window () {
|
|||
teardown
|
||||
}
|
||||
|
||||
test_ebt_matchers_read_the_ebtables_listing () {
|
||||
setup "ebt_confined / ebt_arp_drop / ebt_dhcp_drop : lecture de ebtables -L"
|
||||
local stub='ebt_rules () { printf "%s\n" "-s 2:1:0:0:c:27 -i v-x-i -j DROP" "-s 2:1:0:0:c:27 -o v-x-i -j DROP" "-p ARP -o v-x-i --arp-op Request --arp-ip-dst 10.2.1.254 -j DROP" "-p IPv4 -o v-x-i --ip-src 10.2.1.254 --ip-proto udp --ip-sport 67:68 --ip-dport 67:68 -j DROP" | grep -- "$2"; }; '
|
||||
[[ $(node "${stub}ebt_confined ns v-x-i 02:01:00:00:0c:27") == 2 ]] || fail "confinement : $(node "${stub}ebt_confined ns v-x-i 02:01:00:00:0c:27")"
|
||||
[[ $(node "${stub}ebt_confined ns v-x-i 02:01:00:00:0c:28") == 0 ]] || fail "autre MAC comptée"
|
||||
[[ $(node "${stub}ebt_arp_drop ns v-x-i 10.2.1.254 && echo OUI") == OUI ]] || fail "ARP non lu"
|
||||
[[ $(node "${stub}ebt_arp_drop ns v-x-i 10.2.1.25 || echo NON") == NON ]] || fail "10.2.1.25 pris pour 10.2.1.254"
|
||||
[[ $(node "${stub}ebt_dhcp_drop ns v-x-i 10.2.1.254 && echo OUI") == OUI ]] || fail "DHCP non lu"
|
||||
[[ $(node "${stub}ebt_dhcp_drop ns v-y-i 10.2.1.254 || echo NON") == NON ]] || fail "autre interface acceptée"
|
||||
[[ $(node 'ebt_rules () { echo "-p IPv4 -o v-z-i --ip-src 10.2.1.254 --ip-proto udp --ip-dport 53 -j DROP"; }; ebt_dhcp_drop ns v-z-i 10.2.1.254 || echo NON') == NON ]] || fail "règle UDP hors DHCP prise pour un blocage DHCP"
|
||||
teardown
|
||||
}
|
||||
|
||||
test_wait_bgp_paths_waits_for_the_expected_count () {
|
||||
setup "wait_bgp_paths : nombre de chemins attendu, erreur explicite sinon"
|
||||
[[ $(node 'bgp_paths () { echo 0; }; sleep () { :; }; wait_bgp_paths vp-t53 10.53.1.50/32 0 && echo OUI') == OUI ]] || fail "0 attendu refusé"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# fonctionnalité: hypothèses d'environnement de la suite — firmware UEFI, unités modèles de l'agent, journalctl, format de ebtables -L, br-lan, priorités VRRP lues dans FRR
|
||||
# fonctionnalité: hypothèses d'environnement de la suite — firmware UEFI, unités modèles de l'agent, journalctl, format de nft list table, br-lan, priorités VRRP lues dans FRR
|
||||
# hôtes: hv1 hv2 hv3
|
||||
# tickets: #70
|
||||
|
||||
|
|
@ -17,20 +17,32 @@ check "${HOST} : journalctl accepte --since @<epoch>" journalctl --since "@$(dat
|
|||
for unit in dhcp@.service dnsmasq@.service metadata@.service; do
|
||||
check "${HOST} : unité modèle ${unit} installée" systemctl cat "${unit}"
|
||||
done
|
||||
NS=t02-ebt
|
||||
NS=t02-nft
|
||||
MAC=02:01:00:00:0c:27
|
||||
ip netns add "${NS}"
|
||||
check "${HOST} : ebtables -L, aucune règle avant (témoin)" test "$(ebt_confined "${NS}" v-t02-i "${MAC}")" -eq 0
|
||||
ip netns exec "${NS}" ebtables -t nat -A PREROUTING --in-interface v-t02-i -s "${MAC}" -j DROP
|
||||
ip netns exec "${NS}" ebtables -t filter -A FORWARD --out-interface v-t02-i -s "${MAC}" -j DROP
|
||||
ip netns exec "${NS}" ebtables -t filter -A OUTPUT --out-interface v-t02-i -s "${MAC}" -j DROP
|
||||
ip netns exec "${NS}" ebtables -A FORWARD --out-interface v-t02-i -p arp --arp-op Request --arp-ip-dst 10.2.1.254 -j DROP
|
||||
ip netns exec "${NS}" ebtables -A FORWARD --out-interface v-t02-i -p IPv4 --ip-protocol udp --ip-source-port 67:68 --ip-destination-port 67:68 --ip-source 10.2.1.254 -j DROP
|
||||
check "${HOST} : ebtables -L, confinement de MAC lu par ebt_confined (3 règles)" test "$(ebt_confined "${NS}" v-t02-i "${MAC}")" -eq 3
|
||||
check "${HOST} : ebtables -L, blocage ARP vers la gateway lu par ebt_arp_drop" ebt_arp_drop "${NS}" v-t02-i 10.2.1.254
|
||||
check "${HOST} : ebtables -L, blocage DHCP lu par ebt_dhcp_drop" ebt_dhcp_drop "${NS}" v-t02-i 10.2.1.254
|
||||
other_ip_ignored () { ! ebt_arp_drop "${NS}" v-t02-i 10.2.1.25; }
|
||||
check "${HOST} : ebt_arp_drop ne confond pas une autre adresse (témoin)" other_ip_ignored
|
||||
check "${HOST} : nft installé" command -v nft
|
||||
check "${HOST} : nft list table, aucune règle avant (témoin)" test "$(nft_confined "${NS}" v-t02-i "${MAC}")" -eq 0
|
||||
ip netns exec "${NS}" nft -f - <<NFT
|
||||
add table bridge two
|
||||
add chain bridge two pre-v-t02-i
|
||||
add rule bridge two pre-v-t02-i ether saddr ${MAC} drop
|
||||
add chain bridge two fwd-v-t02-i
|
||||
add rule bridge two fwd-v-t02-i ether saddr ${MAC} drop
|
||||
add rule bridge two fwd-v-t02-i arp operation request arp daddr ip 10.2.1.254 drop
|
||||
add rule bridge two fwd-v-t02-i ip saddr 10.2.1.254 udp sport 67-68 udp dport 67-68 drop
|
||||
add chain bridge two out-v-t02-i
|
||||
add rule bridge two out-v-t02-i ether saddr ${MAC} drop
|
||||
add chain bridge two fwd-v-t02x-i
|
||||
add rule bridge two fwd-v-t02x-i arp operation request arp daddr ip 10.2.9.254 drop
|
||||
NFT
|
||||
check "${HOST} : nft list table, confinement de MAC lu par nft_confined (3 règles)" test "$(nft_confined "${NS}" v-t02-i "${MAC}")" -eq 3
|
||||
check "${HOST} : nft list table, blocage ARP vers la gateway lu par nft_arp_drop" nft_arp_drop "${NS}" v-t02-i 10.2.1.254
|
||||
check "${HOST} : nft list table, blocage DHCP lu par nft_dhcp_drop" nft_dhcp_drop "${NS}" v-t02-i 10.2.1.254
|
||||
other_ip_ignored () { ! nft_arp_drop "${NS}" v-t02-i 10.2.1.25; }
|
||||
check "${HOST} : nft_arp_drop ne confond pas une autre adresse (témoin)" other_ip_ignored
|
||||
other_port_ignored () { ! nft_arp_drop "${NS}" v-t02-i 10.2.9.254; }
|
||||
check "${HOST} : nft_rules ne lit pas la chaîne d'un autre port (témoin)" other_port_ignored
|
||||
check "${HOST} : nft_handle trouve le numéro d'une règle" test -n "$(nft_handle "${NS}" out-v-t02-i "ether saddr ${MAC} drop")"
|
||||
ip netns del "${NS}"
|
||||
case "${HOST}" in
|
||||
hv1) LAN=10.33.0.11 ;;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ check "sn-t31a : route du subnet émise depuis la gateway" sh -c "ip -n vp-t31 -
|
|||
for dev in br-t31a gw-t31a; do
|
||||
check "sn-t31a : ${dev}, arp_ignore=1 et arp_announce=2" sh -c "[ \"\$(ip netns exec vp-t31 sysctl -n net.ipv4.conf.${dev}.arp_ignore) \$(ip netns exec vp-t31 sysctl -n net.ipv4.conf.${dev}.arp_announce)\" = '1 2' ]"
|
||||
done
|
||||
check "sn-t31a : confinement de la MAC anycast sur v-t31a-i (nat PREROUTING, FORWARD, OUTPUT)" test "$(ebt_confined vp-t31 v-t31a-i "${MAC}")" -eq 3
|
||||
check "sn-t31a : confinement de la MAC anycast sur v-t31a-i (prerouting, forward, output)" test "$(nft_confined vp-t31 v-t31a-i "${MAC}")" -eq 3
|
||||
for ip in 10.31.1.254 10.31.1.253; do
|
||||
check "sn-t31a : requêtes ARP vers ${ip} bloquées en sortie de v-t31a-i" ebt_arp_drop vp-t31 v-t31a-i "${ip}"
|
||||
check "sn-t31a : DHCP émis depuis ${ip} bloqué en sortie de v-t31a-i" ebt_dhcp_drop vp-t31 v-t31a-i "${ip}"
|
||||
check "sn-t31a : requêtes ARP vers ${ip} bloquées en sortie de v-t31a-i" nft_arp_drop vp-t31 v-t31a-i "${ip}"
|
||||
check "sn-t31a : DHCP émis depuis ${ip} bloqué en sortie de v-t31a-i" nft_dhcp_drop vp-t31 v-t31a-i "${ip}"
|
||||
done
|
||||
check "VM t31-a" vm_create t31-a sn-t31a 10.31.1.10 "${KEY}"
|
||||
check "VM t31-b" vm_create t31-b sn-t31b 10.31.2.10 "${KEY}"
|
||||
|
|
@ -39,8 +39,8 @@ check "suppression de t31-a" vm_delete t31-a
|
|||
check "suppression de sn-t31a" api_delete subnets/sn-t31a
|
||||
check "sn-t31a supprimé" wait_state subnets/sn-t31a deleted
|
||||
check "sn-t31a : plus de macvlan gw-t31a dans le netns" sh -c "! ip -n vp-t31 link show gw-t31a >/dev/null 2>&1"
|
||||
check "sn-t31a : plus aucune règle ebtables pour v-t31a-i" test -z "$(ebt_rules vp-t31 v-t31a-i)"
|
||||
check "sn-t31b : règles de son propre subnet toujours présentes (témoin)" test -n "$(ebt_rules vp-t31 v-t31b-i)"
|
||||
check "sn-t31a : plus aucune règle nftables pour v-t31a-i" test -z "$(nft_rules vp-t31 v-t31a-i)"
|
||||
check "sn-t31b : règles de son propre subnet toujours présentes (témoin)" test -n "$(nft_rules vp-t31 v-t31b-i)"
|
||||
check "sn-t31a recréé" subnet_create sn-t31a vp-t31 3101 10.31.1.0/24
|
||||
check "VM t31-a2 sur le subnet recréé" vm_create t31-a2 sn-t31a 10.31.1.11 "${KEY}"
|
||||
check "t31-a2 joignable" vm_wait vp-t31 10.31.1.11
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ own_meta () {
|
|||
done
|
||||
[ "${ok}" -eq 5 ] || { echo "${2} : ${ok}/5 réponses avec ses propres métadonnées"; return 1; }
|
||||
}
|
||||
check "hv1 : quatre règles de confinement de 10.33.0.1 sur v-t33a-i" test "$(ebt_rules vp-t33 v-t33a-i | grep -c '10.33.0.1 ')" -eq 4
|
||||
check "hv1 : quatre règles de confinement de 10.33.0.1 sur v-t33a-i" test "$(nft_rules vp-t33 v-t33a-i | grep -c '10.33.0.1 ')" -eq 4
|
||||
RESPONDERS=$(vm_frames vp-t33 10.33.0.21 arp-who ens3 10.33.0.21 10.33.0.1 2)
|
||||
info "MAC qui répondent pour 10.33.0.1 vues de t33-a1 : $(echo ${RESPONDERS})"
|
||||
check "deux hôtes : t33-a1 (hv1) joint t33-b1 (hv2) sur le segment lan" vm_ssh vp-t33 10.33.0.21 'ping -n -c 3 -W 2 10.33.0.23'
|
||||
|
|
@ -74,10 +74,11 @@ check "témoin : l'ARP émis par t33-a1 atteint le segment par v-t33a-e (capture
|
|||
check "aucune trame ARP depuis 10.33.0.1 vers le segment (v-t33a-e)" test "$(cat "${S}/arp")" -eq 0
|
||||
check "aucune trame DHCP depuis 10.33.0.1 vers le segment (v-t33a-e)" test "$(cat "${S}/dhcp")" -eq 0
|
||||
rm -r "${S}"
|
||||
RULE='OUTPUT --out-interface v-t33a-i -p arp --arp-ip-src 10.33.0.1 -j DROP'
|
||||
check "règle ARP OUTPUT retirée à la main" ip netns exec vp-t33 ebtables -D ${RULE}
|
||||
check "watchdog : règle manquante signalée pour sn-t33a" wait_watchdog "ebtables rule missing in netns vp-t33"
|
||||
check "règle ARP OUTPUT reposée" ip netns exec vp-t33 ebtables -A ${RULE}
|
||||
RULE='arp saddr ip 10.33.0.1 drop'
|
||||
HANDLE=$(nft_handle vp-t33 out-v-t33a-i "${RULE}")
|
||||
check "règle ARP output retirée à la main (handle ${HANDLE:-absent})" ip netns exec vp-t33 nft delete rule bridge two out-v-t33a-i handle "${HANDLE}"
|
||||
check "watchdog : règle manquante signalée pour sn-t33a" wait_watchdog "nftables rule missing in netns vp-t33: out-v-t33a-i: ${RULE}"
|
||||
check "règle ARP output reposée" ip netns exec vp-t33 nft add rule bridge two out-v-t33a-i ${RULE}
|
||||
NODE
|
||||
|
||||
on hv2 <<'NODE'
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ sleep 20
|
|||
check "après redémarrage : même processus QEMU pour t61-a (ni arrêtée ni recréée)" test "$(pgrep -f "${VOLUMES}/t61-a.qcow2" | sort | tr '\n' ' ')" = "${QEMU}"
|
||||
check "après redémarrage : même processus QEMU pour t61-d" test "$(pgrep -f "${VOLUMES}/t61-d.qcow2" | sort | tr '\n' ' ')" = "${QEMU_D}"
|
||||
check "après redémarrage : mêmes fichiers sous /run/two, /etc/dnsmasq.d et les volumes (sinon, fichiers en cause)" section_unchanged "${STATE_DIR}/t61.restart" fichiers
|
||||
check "après redémarrage : hôte inchangé (netns, liens, taps, adresses, routes, ebtables, iptables, FRR, frr.conf, fichiers, unités)" same_as "${STATE_DIR}/t61.restart" host_state
|
||||
check "après redémarrage : hôte inchangé (netns, liens, taps, adresses, routes, nftables de pont, iptables, FRR, frr.conf, fichiers, unités)" same_as "${STATE_DIR}/t61.restart" host_state
|
||||
check "après redémarrage : l'API rend les mêmes ressources dans le même état" same_as "${STATE_DIR}/t61.api" api_snapshot
|
||||
for rr in 10.255.255.1 10.255.255.2; do
|
||||
check "après redémarrage : session EVPN vers ${rr} établie, jamais coupée" sh -c "vtysh -c 'show bgp neighbors ${rr}' | grep -q 'BGP state = Established' && [ \"\$(vtysh -c 'show bgp neighbors ${rr}' | grep -o 'dropped [0-9]*')\" = \"\$(cat '${STATE_DIR}/t61.${rr}')\" ]"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ check "${HOST} : aucune unité two-vm-*" none systemctl list-units --all --plain
|
|||
check "${HOST} : aucune instance DHCP (dhcp@, dnsmasq@) ni de métadonnées (metadata@) active" none sh -c "systemctl list-units --plain --no-legend 'dhcp@*' 'dnsmasq@*' 'metadata@*' | grep -w active"
|
||||
check "${HOST} : aucun socket de contrôle DHCP" none sh -c "ls /run/two/dhcp/*.sock 2>/dev/null"
|
||||
check "${HOST} : aucun processus QEMU" none pgrep -a qemu-system
|
||||
check "${HOST} : aucune règle ebtables qui vise une interface de subnet" none sh -c "{ ebtables -t filter -L; ebtables -t nat -L; } | grep -E -- '-(i|o) v-'"
|
||||
check "${HOST} : aucune règle nftables de pont qui vise une interface de subnet" none sh -c "nft list ruleset bridge | grep -E 'v-[a-z0-9]'"
|
||||
check "${HOST} : aucune règle iptables qui vise une interface de subnet ou de VPC" none sh -c "iptables-save | grep -E -- '(v-|vp-|tap)[a-z0-9]'"
|
||||
check "${HOST} : aucun volume de VM de test" none sh -c "ls '${VOLUMES}'/t[0-9][0-9]-* 2>/dev/null"
|
||||
check "${HOST} : FRR garde la base BGP (témoin)" sh -c "vtysh -c 'show running-config' | grep -q 'peer-group fabric'"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ for script in deploy.sh bootstrap_kvm.sh; do
|
|||
done
|
||||
chmod 0755 deploy.sh bootstrap_kvm.sh
|
||||
bash ./deploy.sh --noup_script -i -u "${LAB_UPLINK}" -t "${RELEASE}"
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nftables
|
||||
for binary in "${LAB_FILES}"/bin/*; do
|
||||
[ -f "${binary}" ] || continue
|
||||
name=$(basename "${binary}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue