#!/bin/bash # Generate fixtures for the firewall integration test. # # Two FIPS nodes (a, b). node-b mounts the production fips.nft baseline # plus a single drop-in (.nft) under /etc/fips/fips.d/ that allows TCP # port 22 inbound — the test asserts this is honored. node-a is a # probe-only node with no firewall. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # Scoped by the per-run suffix because this directory is wiped and rewritten # below: two runs sharing one output directory would delete each other's # fixtures out from under running containers. Unset (a bare hand run, or the # GitHub-hosted path) it collapses to the historical "generated-configs". GENERATED_DIR="$SCRIPT_DIR/generated-configs${FIPS_CI_NAME_SUFFIX:-}" # Deterministic test identities (mirrors the acl-allowlist style). NPUB_A="npub1sjlh2c3x9w7kjsqg2ay080n2lff2uvt325vpan33ke34rn8l5jcqawh57m" KEY_A="0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20" NPUB_B="npub1tdwa4vjrjl33pcjdpf2t4p027nl86xrx24g4d3avg4vwvayr3g8qhd84le" KEY_B="b102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1fb0" write_file() { local path="$1" mkdir -p "$(dirname "$path")" cat > "$path" } write_hosts_file() { local node="$1" write_file "$GENERATED_DIR/$node/hosts" <