Files
fips/examples/wireguard-sidecar-macos/fips-off.sh
Alex Xie 83b20b3078 gateway: clarify macOS sidecar naming and startup (#67)
Align the macOS example with the repo's existing fips-gateway binary name and override the test image entrypoint so first-run identity generation succeeds.
2026-04-15 07:01:45 +01:00

36 lines
786 B
Bash
Executable File

#!/bin/bash
# Stop the WireGuard sidecar and restore macOS network settings.
#
# Safe to run multiple times (idempotent).
#
# Usage: ./fips-off.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
HOST_HELPER="$SCRIPT_DIR/fips-host.sh"
run_as_real_user() {
if [ "$(id -u)" -eq 0 ] && [ -n "${SUDO_USER:-}" ]; then
sudo -u "$SUDO_USER" "$@"
else
"$@"
fi
}
run_host_helper() {
if [ "$(id -u)" -eq 0 ]; then
"$HOST_HELPER" "$@"
else
sudo "$HOST_HELPER" "$@"
fi
}
run_host_helper off
echo "Stopping WireGuard sidecar container..."
run_as_real_user docker compose -f "$SCRIPT_DIR/docker-compose.yml" down 2>/dev/null || true
echo " Container stopped"
echo ""
echo "WireGuard sidecar is OFF. macOS network restored."