mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-18 19:43:00 +03:00
update nginx to 1.30.7 and backport nginx module changes from dev
nginx 1.27.4 was vulnerable to CVE-2026-123007 (HTTP/2 flow control heap overflow) and CVE-2026-123633 (HTTP/2 use-after-free), both reachable before auth on the internal and external ports because http2 is on for the whole server block. Kaltura also deleted the nginx-vod-module and nginx-secure-token-module repos, so the build could no longer download either module. - Update nginx to 1.30.7 - Backport the switch to the maintained dio-az nginx-vod-module fork (#24123) - Backport the nginx-secure-token-module removal (#24893)
This commit is contained in:
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
NGINX_VERSION="1.27.4"
|
NGINX_VERSION="1.30.7"
|
||||||
VOD_MODULE_VERSION="1.31"
|
VOD_MODULE_VERSION="v1.9.1"
|
||||||
SECURE_TOKEN_MODULE_VERSION="1.5"
|
|
||||||
SET_MISC_MODULE_VERSION="v0.33"
|
SET_MISC_MODULE_VERSION="v0.33"
|
||||||
NGX_DEVEL_KIT_VERSION="v0.3.3"
|
NGX_DEVEL_KIT_VERSION="v0.3.3"
|
||||||
|
|
||||||
@@ -31,32 +30,27 @@ wget -nv https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
|
|||||||
tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1
|
tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1
|
||||||
rm nginx-${NGINX_VERSION}.tar.gz
|
rm nginx-${NGINX_VERSION}.tar.gz
|
||||||
mkdir /tmp/nginx-vod-module
|
mkdir /tmp/nginx-vod-module
|
||||||
wget -nv https://github.com/kaltura/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz
|
wget -nv https://github.com/dio-az/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz
|
||||||
tar -zxf ${VOD_MODULE_VERSION}.tar.gz -C /tmp/nginx-vod-module --strip-components=1
|
tar -zxf ${VOD_MODULE_VERSION}.tar.gz -C /tmp/nginx-vod-module --strip-components=1
|
||||||
rm ${VOD_MODULE_VERSION}.tar.gz
|
rm ${VOD_MODULE_VERSION}.tar.gz
|
||||||
# Patch MAX_CLIPS to allow more clips to be added than the default 128
|
# Patch MAX_CLIPS to allow more clips to be added than the default 128
|
||||||
sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h
|
sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h
|
||||||
patch -d /tmp/nginx-vod-module/ -p1 << 'EOF'
|
patch -d /tmp/nginx-vod-module/ -p1 << 'EOF'
|
||||||
--- a/vod/avc_hevc_parser.c 2022-06-27 11:38:10.000000000 +0000
|
--- a/vod/avc_hevc_parser.c
|
||||||
+++ b/vod/avc_hevc_parser.c 2023-01-16 11:25:10.900521298 +0000
|
+++ b/vod/avc_hevc_parser.c
|
||||||
@@ -3,6 +3,9 @@
|
@@ -2,6 +2,9 @@
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader)
|
avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader) {
|
||||||
{
|
|
||||||
+ // https://github.com/blakeblackshear/frigate/issues/4572
|
+ // https://github.com/blakeblackshear/frigate/issues/4572
|
||||||
+ return TRUE;
|
+ return TRUE;
|
||||||
+
|
+
|
||||||
uint32_t one_bit;
|
uint32_t one_bit;
|
||||||
|
|
||||||
if (reader->stream.eof_reached)
|
if (reader->stream.eof_reached) {
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
mkdir /tmp/nginx-secure-token-module
|
|
||||||
wget https://github.com/kaltura/nginx-secure-token-module/archive/refs/tags/${SECURE_TOKEN_MODULE_VERSION}.tar.gz
|
|
||||||
tar -zxf ${SECURE_TOKEN_MODULE_VERSION}.tar.gz -C /tmp/nginx-secure-token-module --strip-components=1
|
|
||||||
rm ${SECURE_TOKEN_MODULE_VERSION}.tar.gz
|
|
||||||
|
|
||||||
mkdir /tmp/ngx_devel_kit
|
mkdir /tmp/ngx_devel_kit
|
||||||
wget https://github.com/vision5/ngx_devel_kit/archive/refs/tags/${NGX_DEVEL_KIT_VERSION}.tar.gz
|
wget https://github.com/vision5/ngx_devel_kit/archive/refs/tags/${NGX_DEVEL_KIT_VERSION}.tar.gz
|
||||||
tar -zxf ${NGX_DEVEL_KIT_VERSION}.tar.gz -C /tmp/ngx_devel_kit --strip-components=1
|
tar -zxf ${NGX_DEVEL_KIT_VERSION}.tar.gz -C /tmp/ngx_devel_kit --strip-components=1
|
||||||
@@ -80,7 +74,6 @@ cd /tmp/nginx
|
|||||||
--add-module=../ngx_devel_kit \
|
--add-module=../ngx_devel_kit \
|
||||||
--add-module=../nginx-set-misc-module \
|
--add-module=../nginx-set-misc-module \
|
||||||
--add-module=../nginx-vod-module \
|
--add-module=../nginx-vod-module \
|
||||||
--add-module=../nginx-secure-token-module \
|
|
||||||
--with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
|
--with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
|
||||||
|
|
||||||
make CC="ccache gcc" -j$(nproc) && make install
|
make CC="ccache gcc" -j$(nproc) && make install
|
||||||
|
|||||||
@@ -114,21 +114,23 @@ http {
|
|||||||
# Smaller segments, faster generation, better browser compatibility
|
# Smaller segments, faster generation, better browser compatibility
|
||||||
vod_hls_container_format fmp4;
|
vod_hls_container_format fmp4;
|
||||||
|
|
||||||
secure_token $args;
|
# fMP4 playlists use EXT-X-MAP, which requires HLS protocol
|
||||||
secure_token_types application/vnd.apple.mpegurl;
|
# version 6 (RFC 8216 section 7); the module default is 4
|
||||||
|
vod_hls_version 6;
|
||||||
|
|
||||||
|
# Pass the playlist's query args (e.g. Home Assistant's authSig) on
|
||||||
|
# to every URL in it. These match the only URL endings vod writes
|
||||||
|
# with fmp4 and no subtitles.
|
||||||
|
sub_filter_types application/vnd.apple.mpegurl;
|
||||||
|
sub_filter_once off;
|
||||||
|
sub_filter '.m3u8' '.m3u8$is_args$args';
|
||||||
|
sub_filter '.m4s' '.m4s$is_args$args';
|
||||||
|
sub_filter '.mp4"' '.mp4$is_args$args"';
|
||||||
|
|
||||||
add_header Cache-Control "no-store";
|
add_header Cache-Control "no-store";
|
||||||
expires off;
|
expires off;
|
||||||
|
|
||||||
keepalive_disable safari;
|
keepalive_disable safari;
|
||||||
|
|
||||||
# vod module returns 502 for non-existent media
|
|
||||||
# https://github.com/kaltura/nginx-vod-module/issues/468
|
|
||||||
error_page 502 =404 /vod-not-found;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /vod-not-found {
|
|
||||||
return 404;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location /stream/ {
|
location /stream/ {
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ export function GenericVideoPlayer({
|
|||||||
const checkSourceExists = async (url: string) => {
|
const checkSourceExists = async (url: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, { method: "HEAD" });
|
const response = await fetch(url, { method: "HEAD" });
|
||||||
// nginx vod module returns 502 for non existent media
|
// missing media is a 404; 502 still covers a failed or
|
||||||
// https://github.com/kaltura/nginx-vod-module/issues/468
|
// unreachable mapping request, which is equally unplayable
|
||||||
setSourceExists(response.status !== 502 && response.status !== 404);
|
setSourceExists(response.status !== 502 && response.status !== 404);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setSourceExists(false);
|
setSourceExists(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user