mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-25 23:07:07 +03:00
Boot ownership and device grant fixes (#25085)
* fix boot sentinel and usb device grant edge cases - Exclude /config/.permissions_version from every fix-ownership sweep. The granular root per-boot /config sweep ran without --sentinel and chowned the root-owned sentinel to PUID, so safe-sentinel rejected it on the next boot and /config and /media/frigate were fully re-swept on every boot - Only grant real directories and char devices under /dev/bus/usb, and pass -P when setting the default ACLs, so a symlink in a host-backed usb tree is never followed by root - Open the sentinel with O_NONBLOCK on read so a FIFO at that path fails the regular-file check instead of hanging the boot - Assert in CI that the sentinel stays root-owned across a granular restart and that a symlink under /dev/bus/usb is not followed * tweak ci
This commit is contained in:
@@ -105,12 +105,14 @@ done
|
||||
# node), so the directories also get a default ACL new nodes inherit. The
|
||||
# inherited grant is clamped by the creating mode's group bits, which is rw on
|
||||
# udev hosts (0664) and nothing on raw devtmpfs (0600); hardware-verified.
|
||||
# The tree may be a host devtmpfs bind mount the runtime users can write, so
|
||||
# only real directories and device nodes are granted and links are never followed
|
||||
if [[ -d /dev/bus/usb ]]; then
|
||||
while IFS= read -r -d '' node; do
|
||||
grant "$node"
|
||||
done < <(find /dev/bus/usb -mindepth 1 -print0)
|
||||
done < <(find /dev/bus/usb -mindepth 1 \( -type c -o -type d \) -print0)
|
||||
while IFS= read -r -d '' dir; do
|
||||
setfacl -d -m "u:frigate:rw,u:go2rtc:rw" "$dir" 2>/dev/null || \
|
||||
setfacl -P -d -m "u:frigate:rw,u:go2rtc:rw" "$dir" 2>/dev/null || \
|
||||
echo "[WARN] could not set a default ACL on ${dir}; a re-enumerating USB device may lose access"
|
||||
done < <(find /dev/bus/usb -type d -print0)
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user