Skip to content

Commit de21b1f

Browse files
airweenzimmerle
authored andcommitted
Small modifications in autotool related files:
* detect the installed httpd * check used MPM * check its mode (shared, static) * build custom external config * fix the make test chain * added new SecRule to phase:2 step tests
1 parent e0e268e commit de21b1f

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

Makefile.am

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CLEANFILES = \
1515
t/logs/* \
1616
t/htdocs/index.html \
1717
t/conf/extra.conf \
18+
t/conf/httpd.conf \
1819
t/conf/apache_test_config.pm \
1920
t/conf/httpd.conf \
2021
src/*.lo \
@@ -29,7 +30,9 @@ all:
2930
build/apxs-wrapper
3031

3132
test:
32-
cd t/ && ./TEST
33+
cd t/ && ./TEST -clean
34+
cd t/ && ./TEST -configure
35+
cd t/ && ./TEST -httpd_conf conf/httpd.conf -httpd @APACHE@ -apxs @APXS@
3336

3437

3538
install-exec-hook: $(pkglib_LTLIBRARIES)

configure.ac

+28
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ AC_PATH_PROGS(PERL, [perl perl5], )
1313
AC_SUBST(APXS)
1414
AC_SUBST(V3LIB)
1515
AC_SUBST(V3INCLUDE)
16+
AC_SUBST(APACHE)
1617

1718
# Some directories
1819
MSC_BASE_DIR=`pwd`
@@ -24,6 +25,17 @@ MSC_REGRESSION_CONF_DIR="$MSC_REGRESSION_SERVERROOT_DIR/conf"
2425
MSC_REGRESSION_LOGS_DIR="$MSC_REGRESSION_SERVERROOT_DIR/logs"
2526
MSC_REGRESSION_DOCROOT_DIR="$MSC_REGRESSION_SERVERROOT_DIR/htdocs"
2627

28+
if test -f /etc/apache2/envvars
29+
then
30+
SERVER_MPM=`. /etc/apache2/envvars && $APACHE -V | grep Server\ MPM | awk '{print $3}'`
31+
SERVER_MPM_MODE=`. /etc/apache2/envvars && $APACHE -M | grep mpm_${SERVER_MPM}_module | awk '{print $2}' | sed -e 's/@<:@\@{:@\@:}@@:>@//g'`
32+
SERVER_AUTHZ_MODE=`. /etc/apache2/envvars && $APACHE -M | grep authz_core_module | awk '{print $2}' | sed -e 's/@<:@\@{:@\@:}@@:>@//g'`
33+
else
34+
SERVER_MPM=`$APACHE -V | grep Server\ MPM | awk '{print $3}'`
35+
SERVER_MPM_MODE=`$APACHE -M | grep mpm_${SERVER_MPM}_module | awk '{print $2}' | sed -e 's/@<:@\@{:@\@:}@@:>@//g'`
36+
SERVER_AUTHZ_MODE=`$APACHE -M | grep authz_core_module | awk '{print $2}' | sed -e 's/@<:@\@{:@\@:}@@:>@//g'`
37+
fi
38+
2739
AC_SUBST(MSC_BASE_DIR)
2840
AC_SUBST(MSC_PKGBASE_DIR)
2941
AC_SUBST(MSC_TEST_DIR)
@@ -33,7 +45,11 @@ AC_SUBST(MSC_REGRESSION_CONF_DIR)
3345
AC_SUBST(MSC_REGRESSION_LOGS_DIR)
3446
AC_SUBST(MSC_REGRESSION_DOCROOT_DIR)
3547

48+
AC_SUBST(SERVER_MPM)
49+
AC_SUBST(SERVER_MPM_MODE)
50+
AC_SUBST(SERVER_AUTHZ_MODE)
3651

52+
echo "Found Apache with MPM ${SERVER_MPM}, ${SERVER_MPM_MODE}."
3753

3854
APXS_SBINDIR="`$APXS -q SBINDIR`"
3955
APXS_PROGNAME="`$APXS -q PROGNAME`"
@@ -44,6 +60,18 @@ APXS_LIBEXECDIR="`$APXS -q LIBEXECDIR`"
4460
if test "xx$APXS_LIBEXECDIR" = "xx"; then APXS_LIBEXECDIR="`$APXS -q LIBDIR`/modules"; fi
4561
AC_SUBST(APXS_LIBEXECDIR)
4662

63+
# generating apache depends loadable modules
64+
# authz_core required, if not static
65+
# one mpm required, if not static
66+
echo "" > t/conf/modules.conf
67+
68+
if @<:@ ${SERVER_AUTHZ_MODE} == "shared" @:>@; then
69+
echo "LoadModule authz_core_module ${APXS_LIBEXECDIR}/mod_authz_core.so" >> t/conf/modules.conf
70+
fi
71+
if @<:@ ${SERVER_MPM_MODE} == "shared" @:>@; then
72+
echo "LoadModule mpm_${SERVER_MPM}_module ${APXS_LIBEXECDIR}/mod_mpm_${SERVER_MPM}.so" >> t/conf/modules.conf
73+
fi
74+
echo "" >> t/conf/modules.conf
4775

4876

4977
AC_CONFIG_FILES([\

t/conf/extra.conf.in

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
CoreDumpDirectory /tmp/
44

5+
Include @ServerRoot@/.././t/conf/modules.conf
6+
57
LoadModule security3_module "@ServerRoot@/.././src/.libs/mod_security3.so"
68

79

@@ -26,6 +28,7 @@ modsecurity_rules 'SecDebugLogLevel 9'
2628
</Directory>
2729

2830
<Directory "@ServerRoot@/htdocs/block-evil-4">
31+
modsecurity_rules 'SecResponseBodyAccess On'
2932
modsecurity_rules 'SecRule ARGS "evil" "phase:4,id:114,log,status:403,block,deny"'
3033
</Directory>
3134

@@ -48,6 +51,7 @@ modsecurity_rules 'SecDebugLogLevel 9'
4851
</Location>
4952

5053
<Location "/block-evil-4-loc">
54+
modsecurity_rules 'SecResponseBodyAccess On'
5155
modsecurity_rules 'SecRule ARGS "evil" "phase:4,id:1134,log,status:402,block,deny"'
5256
</Location>
5357

0 commit comments

Comments
 (0)