mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-05 12:12:58 -05:00
cake_error.log, error.log, cake_debug.log and debug.log in ZM_LOGDIR
were created 0644 under the usual umask of 022, so any local
account could read them. Before the redaction in this series they held
the token, auth hash or password of any API request that failed.
The three FileLog configs now set 'mask' => 0640. Cake applies it only
when it creates a file: on the first write, and after its own 10 MB
rotation. An existing file keeps its mode.
Behaviour change: new files are 0640, owned by the user PHP runs as and
its primary group (www-data:www-data on Debian/Ubuntu, apache:apache on
Red Hat/Fedora), so only that user, members of that group and root can
read them. The Debian packages chown /var/log/zm to www-data:root, which
does not change the group of the files PHP creates in it. Nothing in
ZoneMinder reads these files: the web log view and zmaudit use the Logs
table. The distros' logrotate configs run as root; with the usual
global "create" a rotated file is recreated with the same mode and
owner, otherwise Cake recreates it with the mask.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 48d5fad41d)