security(shared-httpd): remove cgid/lua/include/actions/dav/userdir + exec-surface build gate #59

Open
jknapp wants to merge 5 commits from sec/shared-httpd-exec-surface-2026-11-22 into trunk
pull from: sec/shared-httpd-exec-surface-2026-11-22
5 Commits
Author SHA1 Message Date
shadowdaoandClaude Sonnet 5.5 0ad6b430ce ci: exec-surface gate test comment names the full removed set and its non-blocking role
The comment still described only the first commit's modules (cgid/lua/include/
actions/dav/userdir). It now lists status/info, the unused proxy_* family and
suexec/dbd/cache too, and says plainly that Shell-Checks does not gate the image
jobs: the Dockerfile `gate check` is what blocks a bad image. Comment only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-22 23:01:15 -08:00
claude 990b3792bc security(shared-httpd): also remove status, info and every unused proxy/suexec/dbd/cache module
A tenant `RewriteRule ^ - [H=server-status|server-info]` binds the handler
after any config section could pin it, and `RewriteRule ... http://x [P]`
proxies to internal addresses (SSRF). Config cannot close those; removing
the modules does. WHP renders only SetHandler proxy:fcgi, <Proxy balancer://>
+ BalancerMember fcgi:// + ProxySet lbmethod=byrequests and
ProxyFCGISetEnvIf, so only proxy, proxy_fcgi, proxy_balancer,
lbmethod_byrequests and slotmem_shm stay.

Removed in addition to the earlier set: status, info, proxy_http, proxy_ajp,
proxy_ftp, proxy_connect, proxy_scgi, proxy_uwsgi, proxy_wstunnel,
proxy_fdpass, proxy_express, proxy_hcheck, lbmethod_bybusyness,
lbmethod_bytraffic, lbmethod_heartbeat (+ mod_heartbeat/heartmonitor .so),
suexec, dbd, authn_dbd, authz_dbd, cache, cache_disk, cache_socache,
socache_dbm, socache_memcache, socache_redis. socache_shmcb stays (SSL).

The gate derives its banned-module regex from one list. Tests: 26 gate
cases (banned status/info/proxy_*/cache back, leftover .so, required
lbmethod_byrequests/balancer missing) and a new live probe script
(scripts/tests/httpd-exec-surface-probes.test.sh) that renders the real WHP
template + drop-in and tries [H=lua-script|server-status|server-info],
nested <If> CGI and [P] http/ws/ajp/ftp/scgi/uwsgi.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-22 22:46:19 -08:00
shadowdaoandClaude Opus 5.5 0f8407c239 httpd-exec-surface-gate test: stop the mod_lua case masking every later case; assert each failure reason
The first regression case runs `dnf install -y mod_lua`, and restore() only
copied back /etc/httpd and /usr/lib64/httpd, not the RPM database. Every
later case therefore failed on "RPM mod_lua is installed" and passed whether
or not the check it targets worked: with the LoadModule scan, the leftover-.so
check, the RPM check, or the loaded-module check disabled in the gate, all 15
cases still passed (measured by mutating the gate).

restore() now uninstalls mod_lua, and expect_fail asserts the gate's own
failure message for each case. The include case puts the real .so back so the
module actually loads; a new case uses the stock prefork-guarded `LoadModule
cgi_module` shape (never loaded under event MPM), which only the LoadModule
scan can see; a new positive-control case removes proxy_balancer. Re-run:
17 passed; disabling the LoadModule scan, the .so check, the config grep or
the required-module check now each fail the suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-22 22:09:09 -08:00
shadowdaoandClaude Opus 5.5 2a6e2d554e httpd-exec-surface-gate: positive control covers the multi-FPM balancer path and brotli
A WHP site with more than one FPM backend is rendered as <Proxy balancer://>
+ BalancerMember + `ProxySet lbmethod=byrequests` (panel/internal/vhost/
httpdtpl/render.go buildProxyBlock), which needs proxy_balancer,
lbmethod_byrequests and slotmem_shm. None of the three was in the required
list, so a future image change dropping them would pass this gate and take
every multi-backend site down. brotli_module was named in the comment but not
in the list. The comment's "status for /ping-style probes" was wrong (/ping is
a mod_rewrite R=204 in the default vhost) and is gone. Also documents that a
later `dnf update` of httpd-core restores the deleted .so / %config files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-22 22:09:09 -08:00
shadowdaoandClaude Sonnet 5.5 8fbbd6d160 security(shared-httpd): remove cgid/lua/include/actions/dav/userdir + exec-surface build gate
One Apache serves every tenant in shared-httpd and everything it executes runs as
the shared `apache` user. mod_lua cannot be closed from the WHP vhost side
(RewriteRule [H=lua-script] binds the handler after any config pin), so the
modules are removed from the image: scripts/httpd-exec-surface-gate.sh
remove|check, run as the last package step of Dockerfile.shared-httpd. check
fails the build if a banned module is loadable/loaded, the global INCLUDES filter
or a cgi-bin ScriptAlias is configured, httpd -t fails, or a module the platform
needs (rewrite, proxy_fcgi, ssl, headers, ...) is not loaded. Test + CI wiring.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-22 21:48:51 -08:00