From 79583fea8f98a2578409bb8caf630df47ae3f93a Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 2 Sep 2026 22:58:04 -0700 Subject: [PATCH] Add guarded Arcane Caddy port handoff --- .../frontdoor/scripts/patch-arcane-compose.sh | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 servers/bwh-us-dc9/frontdoor/scripts/patch-arcane-compose.sh diff --git a/servers/bwh-us-dc9/frontdoor/scripts/patch-arcane-compose.sh b/servers/bwh-us-dc9/frontdoor/scripts/patch-arcane-compose.sh new file mode 100755 index 0000000..7f00c72 --- /dev/null +++ b/servers/bwh-us-dc9/frontdoor/scripts/patch-arcane-compose.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -eu + +compose_file=/host-arcane/compose.yml +backup_file=/host-arcane/compose.yml.pre-haproxy-20260903 + +test -r "$compose_file" +test -w "$compose_file" + +if [ ! -e "$backup_file" ]; then + cp -p "$compose_file" "$backup_file" +fi + +mapping_pattern="^[[:space:]]*-[[:space:]]*['\"]?((0\\.0\\.0\\.0|::):)?443:443(/tcp)?['\"]?[[:space:]]*$" +mapping_count=$(grep -Ec "$mapping_pattern" "$compose_file" || true) + +if [ "$mapping_count" -eq 1 ]; then + sed -E -i "\#$mapping_pattern#d" "$compose_file" +elif [ "$mapping_count" -ne 0 ]; then + echo "refusing to patch: expected zero or one TCP 443 mapping, found $mapping_count" >&2 + exit 1 +fi + +if grep -Eq "$mapping_pattern" "$compose_file"; then + echo "TCP 443 mapping remains after patch" >&2 + exit 1 +fi + +echo "Arcane Caddy Compose source is backed up and no longer publishes TCP 443"