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:
Josh Hawkins
2026-11-18 10:04:53 -06:00
parent d04ed58d8f
commit 00dc8f2567
3 changed files with 23 additions and 28 deletions
+9 -16
View File
@@ -2,9 +2,8 @@
set -euxo pipefail
NGINX_VERSION="1.27.4"
VOD_MODULE_VERSION="1.31"
SECURE_TOKEN_MODULE_VERSION="1.5"
NGINX_VERSION="1.30.7"
VOD_MODULE_VERSION="v1.9.1"
SET_MISC_MODULE_VERSION="v0.33"
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
rm nginx-${NGINX_VERSION}.tar.gz
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
rm ${VOD_MODULE_VERSION}.tar.gz
# 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
patch -d /tmp/nginx-vod-module/ -p1 << 'EOF'
--- a/vod/avc_hevc_parser.c 2022-06-27 11:38:10.000000000 +0000
+++ b/vod/avc_hevc_parser.c 2023-01-16 11:25:10.900521298 +0000
@@ -3,6 +3,9 @@
--- a/vod/avc_hevc_parser.c
+++ b/vod/avc_hevc_parser.c
@@ -2,6 +2,9 @@
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
+ return TRUE;
+
uint32_t one_bit;
if (reader->stream.eof_reached)
if (reader->stream.eof_reached) {
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
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
@@ -80,7 +74,6 @@ cd /tmp/nginx
--add-module=../ngx_devel_kit \
--add-module=../nginx-set-misc-module \
--add-module=../nginx-vod-module \
--add-module=../nginx-secure-token-module \
--with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
make CC="ccache gcc" -j$(nproc) && make install
@@ -114,21 +114,23 @@ http {
# Smaller segments, faster generation, better browser compatibility
vod_hls_container_format fmp4;
secure_token $args;
secure_token_types application/vnd.apple.mpegurl;
# fMP4 playlists use EXT-X-MAP, which requires HLS protocol
# 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";
expires off;
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/ {
@@ -32,8 +32,8 @@ export function GenericVideoPlayer({
const checkSourceExists = async (url: string) => {
try {
const response = await fetch(url, { method: "HEAD" });
// nginx vod module returns 502 for non existent media
// https://github.com/kaltura/nginx-vod-module/issues/468
// missing media is a 404; 502 still covers a failed or
// unreachable mapping request, which is equally unplayable
setSourceExists(response.status !== 502 && response.status !== 404);
} catch (error) {
setSourceExists(false);