fix(safe-paths): fail closed on planted symlinks before root daemons start

drop_symlink unlinks as root (rm on the final component never follows the
target and the customer cannot deny it) and refuses to start if the path is
still a symlink. user_touch refuses unless it ends up a regular file. New
require_safe_logs runs immediately before httpd / php-fpm start (they open
files under /home/$user/logs as root): logs/, logs/apache, logs/php-fpm must be
real directories and nothing under logs/ may be other than a regular file or
directory, else the entrypoint exits 1 without starting any daemon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-10-20 16:04:21 -07:00
1 parent 94a73ea8ab
commit 02d93f4d1a
3 files changed
+43 -12

No files matched your search

+3
View File
@@ -37,6 +37,9 @@ if [ -f /etc/httpd/conf.d/ssl.conf ]; then
mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.bak
fi
# httpd and php-fpm open their logs under /home/$user/logs as root: last
# fail-closed check immediately before they start (safe-paths.sh).
require_safe_logs /home/$user/logs/apache /home/$user/logs/php-fpm
/usr/sbin/httpd -k start
/usr/sbin/php-fpm -y /etc/php-fpm.conf
# GNU chown -R defaults to -P: symlinks are lchown()ed, never followed.