Skip to content

Commit e724649

Browse files
committed
Images: Fix ModSecurity-nginx configuration.
1 parent 9bb6ae0 commit e724649

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

images/nginx/rootfs/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,21 @@ Include /etc/nginx/owasp-modsecurity-crs/rules/RESPONSE-980-CORRELATION.conf
414414
Include /etc/nginx/owasp-modsecurity-crs/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf
415415
" > /etc/nginx/owasp-modsecurity-crs/nginx-modsecurity.conf
416416

417+
# NGINX compiles a small test program to check if an added module works as expected.
418+
#
419+
# ModSecurity-nginx provides 'printf("hello");' as a test, but newer versions of GCC,
420+
# as included in Alpine 3.21, do not allow implicit declaration of function 'printf':
421+
#
422+
# objs/autotest.c:7:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
423+
#
424+
# For this reason we replace 'printf("hello");' by 'msc_init();', which is always available.
425+
#
426+
# This fix is taken from a PR, that has been proposed to the ModSecurity-nginx project:
427+
#
428+
# https://github.com/owasp-modsecurity/ModSecurity-nginx/pull/275
429+
#
430+
sed -i "s/ngx_feature_test='printf(\"hello\");'/ngx_feature_test='msc_init();'/" $BUILD_PATH/ModSecurity-nginx/config
431+
417432
# build nginx
418433
cd "$BUILD_PATH/nginx-$NGINX_VERSION"
419434

0 commit comments

Comments
 (0)