diff --git a/scripts/httpd-exec-surface-gate.sh b/scripts/httpd-exec-surface-gate.sh index bafb6a5..e5d6a46 100755 --- a/scripts/httpd-exec-surface-gate.sh +++ b/scripts/httpd-exec-surface-gate.sh @@ -128,7 +128,7 @@ cmd_check() { fi # Positive control: nothing the platform uses may have disappeared with them. for m in $REQUIRED_MODULES; do - if ! printf '%s\n' "$mods" | grep -qE "^ ${m} "; then + if ! grep -qE "^ ${m} " <<<"$mods"; then echo "gate FAIL: required module ${m} is NOT loaded" >&2; fail=1 fi done diff --git a/scripts/tests/httpd-exec-surface-probes.test.sh b/scripts/tests/httpd-exec-surface-probes.test.sh index 1a5e1ef..14f2b33 100755 --- a/scripts/tests/httpd-exec-surface-probes.test.sh +++ b/scripts/tests/httpd-exec-surface-probes.test.sh @@ -124,7 +124,12 @@ for p in pa:ajp pf:ftp ps:scgi pu:uwsgi; do # error log, which names the missing scheme handler only when the module is gone. if [ "$EXPECT_OPEN" = 1 ]; then ok "[P] ${p##*:}:// : not asserted on an unhardened image"; continue; fi l=$(docker exec "$N" sh -c "grep -c 'No protocol handler was valid for the URL /${p%%:*}/' /var/log/httpd/a.test-error.log 2>/dev/null || true") + # The server-scope proxy guard now answers 403 BEFORE mod_proxy picks a handler, so the + # request never reaches the scheme lookup and AH01144 is no longer logged. A 403 is the + # secure outcome (the [P] is refused); AH01144 is the older one (module removed). Anything + # else (502/503/500/200, i.e. a proxy attempt or served content) is a failure. if [ "${l:-0}" -ge 1 ]; then ok "[P] ${p##*:}:// has no protocol handler (AH01144 for /${p%%:*}/)" + elif [ "$(printf %s "${r: -5}" | tr -d '\n')" = "[403]" ]; then ok "[P] ${p##*:}:// refused by the proxy guard (403) before any handler lookup" else bad "[P] ${p##*:}://: no 'No protocol handler' for /${p%%:*}/ in the error log -> ${r: -12}"; fi done echo "== surfaces that must stay (reported, not failed)"