limit go2rtc exec and echo to frigate's ffmpeg and disable ngrok

go2rtc merges its config files, and the HomeKit file and anything saved through go2rtc's unauthenticated config API load before Frigate's generated config. A planted exec: or echo: source, or an ngrok.command, ran whatever program it named, and as root under FRIGATE_ROOT_SERVICES=go2rtc. Unless GO2RTC_ALLOW_ARBITRARY_EXEC is set, the generated config now sets exec.allow_paths and echo.allow_paths to Frigate's ffmpeg and sets an empty ngrok.command, which override earlier files, and the config-save API rejects new exec and echo keys. The non-root docs note that a root go2rtc still isn't separated from the frigate user, since ffmpeg with arbitrary arguments can overwrite files as root.
This commit is contained in:
Josh Hawkins
2026-11-15 11:53:17 -06:00
parent 7fd81171f0
commit 7f846df0bd
4 changed files with 40 additions and 13 deletions
+2
View File
@@ -36,6 +36,8 @@ There are two reasons to use it:
Try the device grants and `EXTRA_GROUPS` first. The `frigate` service runs the API and every ffmpeg process that decodes your camera streams, so listing it puts those back on root as well, not just your detectors.
Listing `go2rtc` without `frigate` doesn't separate the two. go2rtc's API accepts unauthenticated config changes from inside the container, so the unprivileged `frigate` service can make a root go2rtc run ffmpeg with any arguments, which can overwrite any file as root.
A listed service also stops honoring a [custom ffmpeg or go2rtc build](/configuration/advanced/system#custom-dependencies) kept in `/config`, since that directory stays owned by the unprivileged user and a binary there would run as root. `FRIGATE_RUN_AS_ROOT=true` has no such restriction.
Recordings and exports are owned by `PUID`/`PGID` as soon as they're written, even by a root service. Snapshots, thumbnails, and other files under `clips/` are corrected on each restart, so they can show as root-owned from the host until then. A listed service also keeps root's home directory, so library caches go to the container layer instead of `/config`. The same applies to the [detector runtimes](/frigate/network_requirements#detector-runtimes) Frigate installs at first start (Hailo, MemryX, AXEngine): a root `frigate` service installs them into `/root/.local`, which is lost when the container is recreated, and never loads a copy left behind in `/config/.local`.
+1 -1
View File
@@ -223,7 +223,7 @@ For security reasons, the `echo:`, `expr:`, and `exec:` stream sources are disab
go2rtc's `${VAR:default}` variable syntax is also disabled by default in stream sources, since its default can name one of those sources. Use Frigate's [`{FRIGATE_*}` substitution](./config.md#environment-variable-substitution) instead.
If you attempt to use these sources in your configuration, the streams will be removed and an error message will be printed in the logs.
If you attempt to use these sources in your configuration, the streams will be removed and an error message will be printed in the logs. go2rtc also refuses to run anything but Frigate's ffmpeg from `exec:` and `echo:` sources added through its API or `/config/go2rtc_homekit.yml`.
To enable these sources, you must set the environment variable `GO2RTC_ALLOW_ARBITRARY_EXEC=true`. This can be done in your Docker Compose file or container environment, or for Home Assistant App users with the `go2rtc_allow_arbitrary_exec` option in the App's configuration. The `environment_vars` section of the Frigate config can't enable it: