From 351b9cc357d439e30ebd61d89a9e38ecf55c6827 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 12 Dec 2013 05:25:14 -0800 Subject: [PATCH] nginx: generates config file using configure input. The nginx config file was looking for depedencies by its own, by doing that it was ignoring the options that were passed to configure script. This commit deletes this config file and adds a meta-config which is populated by configure whenever the standalone-module is enabled. --- configure.ac | 1 + nginx/modsecurity/config | 87 ------------------------------------- nginx/modsecurity/config.in | 44 +++++++++++++++++++ 3 files changed, 45 insertions(+), 87 deletions(-) delete mode 100644 nginx/modsecurity/config create mode 100644 nginx/modsecurity/config.in diff --git a/configure.ac b/configure.ac index 59b40ceb..ced68a12 100644 --- a/configure.ac +++ b/configure.ac @@ -707,6 +707,7 @@ AC_CONFIG_FILES([apache2/Makefile]) fi if test "$build_standalone_module" -ne 0; then AC_CONFIG_FILES([standalone/Makefile]) +AC_CONFIG_FILES([nginx/modsecurity/config]) fi if test "$build_extentions" -ne 0; then AC_CONFIG_FILES([ext/Makefile]) diff --git a/nginx/modsecurity/config b/nginx/modsecurity/config deleted file mode 100644 index 144c0e2e..00000000 --- a/nginx/modsecurity/config +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -dependencies='apr-1 apr-util-1 libxml-2.0 lua5.1' - -if [ ! -e "$ngx_addon_dir/../../standalone/.libs/standalone.a" ] -then - echo "Aborting. ModSecurity must be compiled with \ ---enable-standalone-module option prior to the Nginx compilation." - exit 1 -fi - -echo -n "Checking for Apache headers using apxs2... " -apache_include_dir=`apxs2 -q INCLUDEDIR 2> /dev/null` -RETVAL=$? -if [ $RETVAL -eq 0 ] -then - CORE_INCS="$CORE_INCS $apache_include_dir" - echo "Ok" -else - echo -n "Checking for Apache headers using apxs... " - apache_include_dir=`apxs -q INCLUDEDIR 2> /dev/null` - RETVAL=$? - if [ $RETVAL -eq 0 ] - then - CORE_INCS="$CORE_INCS $apache_include_dir" - echo "Ok" - else - echo "Aborting. Apache apxs2/apxs is not installed or fails to point\ -Apache headers." - exit 1; - fi -fi - -missing="" -for element in $dependencies; -do - echo -n "Checking for $element... "; - - cflags=`pkg-config --cflags-only-I $element 2> /dev/null | sed -s 's/-I//'` - libs=`pkg-config --libs $element 2> /dev/null` - RETVAL=$? - - if [ $RETVAL -eq 0 ] - then - CORE_INCS="$CORE_INCS $cflags" - CORE_LIBS="$CORE_LIBS $libs" - echo "Ok" - else - echo "FAIL" - missing="$missing $element" - fi -done - -if [ ! -z $missing ] -then - echo "Aborting. Following dependencies are missing: $missing" - exit 1 -fi - -if [ $USE_PCRE = DISABLED ] -then - echo "Aborting. PCRE support must be enabled on Nginx compilation" - exit 1 -fi - -ngx_addon_name=ngx_http_modsecurity - -CORE_MODULES="$CORE_MODULES ngx_pool_context_module" - -HTTP_AUX_FILTER_MODULES="ngx_http_modsecurity $HTTP_AUX_FILTER_MODULES" - -NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ - $ngx_addon_dir/ngx_http_modsecurity.c \ - $ngx_addon_dir/apr_bucket_nginx.c \ - $ngx_addon_dir/ngx_pool_context.c" - -NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ - $ngx_addon_dir/apr_bucket_nginx.h \ - $ngx_addon_dir/ngx_pool_context.h" - -CORE_LIBS="$ngx_addon_dir/../../standalone/.libs/standalone.a $CORE_LIBS" - -CORE_INCS="$CORE_INCS \ - $ngx_addon_dir \ - $ngx_addon_dir/../../standalone \ - $ngx_addon_dir/../../apache2" - diff --git a/nginx/modsecurity/config.in b/nginx/modsecurity/config.in new file mode 100644 index 00000000..4918224c --- /dev/null +++ b/nginx/modsecurity/config.in @@ -0,0 +1,44 @@ +#!/bin/sh + +CFLAGS="$CFLAGS \ + @APR_CFLAGS@ \ + @APU_CFLAGS@ \ + @APXS_CFLAGS@ \ + @LIBXML2_CFLAGS@ \ + @LUA_CFLAGS@ \ + @MODSEC_EXTRA_CFLAGS@ \ + @PCRE_CFLAGS@" + + +CORE_LIBS="$CORE_LIBS \ + @APR_LINKLD@ \ + @APU_LINKLD@ \ + @APXS_CFLAGS@ \ + @CURL_LDADD@ \ + @LIBXML2_LDADD@ \ + @LUA_LDADD@ \ + @PCRE_LDADD@ \ + @APXS_LIBS@" + +ngx_addon_name=ngx_http_modsecurity + +CORE_MODULES="$CORE_MODULES ngx_pool_context_module" + +HTTP_AUX_FILTER_MODULES="ngx_http_modsecurity $HTTP_AUX_FILTER_MODULES" + +NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ + $ngx_addon_dir/ngx_http_modsecurity.c \ + $ngx_addon_dir/apr_bucket_nginx.c \ + $ngx_addon_dir/ngx_pool_context.c" + +NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ + $ngx_addon_dir/apr_bucket_nginx.h \ + $ngx_addon_dir/ngx_pool_context.h" + +CORE_LIBS="$ngx_addon_dir/../../standalone/.libs/standalone.a $CORE_LIBS" + +CORE_INCS="$CORE_INCS \ + $ngx_addon_dir \ + $ngx_addon_dir/../../standalone \ + $ngx_addon_dir/../../apache2" +