DRAFT: shared-httpd mod_whp_proxy_guard (request-time proxy allow list, .htaccess ProxyFCGISetEnvIf refusal, env scrub, handler deny) - DO NOT MERGE #62
Open
jknapp
wants to merge 2 commits from
sec/shared-httpd-proxy-guard into trunk
pull from: sec/shared-httpd-proxy-guard
merge into: cloud-hosting-platform:trunk
cloud-hosting-platform:trunk
cloud-hosting-platform:feat/shared-httpd-symlink-guard
cloud-hosting-platform:fix/local-dev-and-docroot-2026-11-23
cloud-hosting-platform:sec/shared-httpd-exec-surface-2026-11-22
cloud-hosting-platform:fix/arm64-attach-parity-defaults
cloud-hosting-platform:fix/lsphp-dev-qemu-empty-maintscript
cloud-hosting-platform:feat/arm64-attach-ols
cloud-hosting-platform:chore/pin-test2
cloud-hosting-platform:chore/pin-actions
cloud-hosting-platform:fix/attach-testfix
cloud-hosting-platform:fix/attach-parity
cloud-hosting-platform:fix/attach-digest
cloud-hosting-platform:fix/attach-debug
cloud-hosting-platform:fix/attach-plan-after-buildx
cloud-hosting-platform:fix/arm64-policy
cloud-hosting-platform:feat/arm64-attach
cloud-hosting-platform:feat/php86-cac-cac-fpm
cloud-hosting-platform:fix/lsapi-repin-2026-11-19b
cloud-hosting-platform:fix/lsphp-inconsistent-repo-pin
cloud-hosting-platform:fix/lsphp-src-repin-lsapi-8.4
cloud-hosting-platform:fix/lsphp-src-upload-progress-default
cloud-hosting-platform:ci/drop-eol-php
cloud-hosting-platform:feat/pkg-cache-build-arg
cloud-hosting-platform:feat/lsphp-source-emergency
cloud-hosting-platform:fix/remi-origin-https
cloud-hosting-platform:fix/remi-origin
cloud-hosting-platform:fix/ci-no-fail-fast
cloud-hosting-platform:fix/php2shell-ini-mitigation
cloud-hosting-platform:fix/lsphp-upgrade-pipefail
cloud-hosting-platform:feat/lsphp-upgrade-at-build
cloud-hosting-platform:fix/no-recursive-chmod-on-start
cloud-hosting-platform:fix/shared-ols-catchall-421
cloud-hosting-platform:fix/lsphp-enable-user-ini
cloud-hosting-platform:feature/cac-lsphp-image
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5f8597363e |
mod_whp_proxy_guard: fail-closed switches (WHPProxyRequireTLS, WHPProxyRequireVhostList)
Review of WHP #362: the per-site :80 vhost redirected only its PRIMARY name, so an alias host on :80 (reachable from the shared docker network; the edge uses :443 only) was served with the tenant .htaccess and none of the :443 FastCGI pins. Measured on the current image: plain, <If> and nested ProxyFCGISetEnvIf + [P] to another tenant's backend all ran its script there, and with only the inherited fcgi://*:9000 default a [P] still ran the other tenant's index.php. - WHPProxyRequireTLS On (image default): no proxying for a request that did not arrive over TLS (ap_ssl_conn_is_ssl). Closes :80 for vhosts rendered before WHP's unconditional redirect. - WHPProxyRequireVhostList On|Off (image default Off): a vhost without its OWN WHPProxyAllow may not proxy; an inherited list does not count. Off in the image because hosts carry pre-#362 renders; WHP turns it on once every vhost renders its own list. - `WHPProxyAllow None` now resets the list; clearer refusal log lines. - In-repo test: 40 assertions (plain-HTTP refusal, RequireVhostList with and without an own list). DRAFT - DO NOT MERGE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6 |
||
|
|
ba3fb70d3c |
feat(shared-httpd): mod_whp_proxy_guard - request-time proxy allow list
A tenant's NESTED <If> in .htaccess is merged after every section a vhost or the server-scope drop-in can use, so it overrides any config-only SCRIPT_FILENAME / DOCUMENT_ROOT / PHP_VALUE pin. Measured on httpd 2.4.63-13.el10_2.8: `<If "true"><If "true"> ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/home/<victim>/..." </If></If>` plus `RewriteRule ... fcgi://<victim>-01:9000/... [P]` ran the other tenant's script as its uid (also <If><If><If>, <Files><If><If> SetHandler "proxy:fcgi://", a nested <ElseIf>, a nested PATH_TRANSLATED, the victim's IP); [P] to http/ws/ajp reached any host (SSRF); a nested <If> `SetHandler balancer-manager` served the balancer manager. New loadable module (stock Alma httpd, built against httpd-devel like mod_whp_symlink in #60, separate source so the two can merge independently): - mod_proxy scheme_handler hook (APR_HOOK_REALLY_FIRST): after all config merging, mod_rewrite and balancer member selection, the connection target (UDS path or scheme://host:port) must be on the vhost's WHPProxyAllow list, else 403 before a byte is sent. Every proxy scheme is covered. - WHPHtaccessProxyFCGI Deny: ProxyFCGISetEnvIf / ProxyFCGIBackendType in .htaccess (any nesting) is a config error, so the vhost's own rules stay the last word in mod_proxy_fcgi's fix_cgivars. - WHPProxyScrubEnv: tenant-set PHP_VALUE / PHP_ADMIN_VALUE / PATH_TRANSLATED removed before the backend params are built. - WHPDenyHandler: 403 for balancer-manager, server-status, server-info, lua-script, cgi-script (+ their MIME aliases) whatever selected them. Image defaults (configs/whp-proxy-guard.conf): Deny, scrub, default allow list fcgi://*:9000 (every WHP-rendered PHP handler), deny list. WHP renders a per-vhost exact list inside <IfModule whp_proxy_guard_module>. scripts/tests/whp-proxy-guard-module.test.sh: 36 assertions, PASS on the built image, 24 FAIL on the current shared-httpd:latest. DRAFT - DO NOT MERGE (merging publishes the image). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6 |