mod security fehler

chewy

New Member
ich hab mir mod security installiert auf meinem Strato Rootie mit suse 9.3

ich hab mir eine security.conf in /etc/apache2/conf.d angelegt mit folgendem Inhalt :

Code:
LoadModule security2_module   /usr/lib/apache2-prefork/mod_security2.so

<IfModule mod_security2.c>

# Only inspect dynamic requests
# (YOU MUST TEST TO MAKE SURE IT WORKS AS EXPECTED)
#SecFilterEngine DynamicOnly

SecFilterEngine On

# Reject requests with status 500
SecFilterDefaultAction "deny,log,status:500"

# Some sane defaults
SecFilterScanPOST On
SecFilterCheckURLEncoding On
SecFilterCheckCookieFormat On
SecFilterCheckUnicodeEncoding Off
SecFilterNormalizeCookies On
# enable version 1 (RFC 2965) cookies
SecFilterCookieFormat 1

SecServerResponseToken Off

#If you want to scan the output, uncomment these
#SecFilterScanOutput On
#SecFilterOutputMimeTypes "(null) text/html text/plain"

# Accept almost all byte values
SecFilterForceByteRange 1 255

# Server masking is optional
#fake server banner - NOYB used - no one needs to know what we are using
SecServerSignature "NOYB"

#SecUploadDir /tmp
#SecUploadKeepFiles Off

# Only record the interesting stuff
SecAuditEngine RelevantOnly
SecAuditLog /var/log/apache2/security/audit_log

# You normally won't need debug logging
SecFilterDebugLevel 0
SecFilterDebugLog /var/log/apache2/security/modsec_debug_log

#And now, the rules
#Remove any of these Include lines you do not use or have rules for.

#First, add in your exclusion rules:
#These MUST come first!
Include /etc/modsecurity/exclude.conf

#Application protection rules
Include /etc/modsecurity/rules.conf

#Comment spam rules
Include /etc/modsecurity/blacklist.conf

#Bad hosts, bad proxies and other bad players
Include /etc/modsecurity/blacklist2.conf

#Bad clients, known bogus useragents and other signs of malware
Include /etc/modsecurity/useragents.conf

#Known bad software, rootkits and other malware
Include /etc/modsecurity/rootkits.conf

#Signatures to prevent proxying through your server 
#only rule these rules if your server is NOT a proxy
Include /etc/modsecurity/proxy.conf

#Additional rules for Apache 2.x ONLY!  Do not add this line if you use Apache 1.x
Include /etc/modsecurity/apache2-rules.conf
</IfModule>

beim starten des Apache passiert nun folgendes :

Code:
Konnte Apache nicht starten : 
Starting httpd2 (prefork) Syntax error on line 1 of /etc/apache2/conf.d/mod_security.conf:
Cannot load /usr/lib/apache2-prefork/mod_security2.so into server: /usr/lib/apache2-prefork/mod_security2.so: undefined symbol: msr_log

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

[1A..failed


wo könnte mein dummer Fehler liegen ? Das Modul ist in etc/apache2/httpd2-prefork.conf eingetragen

Da mauschel ich schon 2 Tage dran rum und kriegs nicht gebacken :-(
 
Last edited by a moderator:
so wie das aussieht kann er entweder das Mudul "mod_security2.so" nicht laden, weil es nicht richtig compiliert worden ist oder das Modul ist an der "vermuteten" Stelle nicht auffindbar
 
ich habe es entgegen der Anleitung mit apxs2 kompiliert

/usr/sbin/apxs2-prefork -cia mod_security2.c

weil das in der Faq beschriebene "Make" zu einer richtig langen Fehlerliste führte. Mit apxs2 klappte das dann reibungslos und ohne Fehlermeldung.

Das Modul befindet sich in /user/lib/apache2-prefork/mod_security.so

also alles da wo es hin soll.

Mich macht das hier stutzig :
Code:
 Cannot load /usr/lib/apache2-prefork/mod_security2.so into server: /usr/lib/apache2-prefork/mod_security2.so: undefined symbol: msr_log

undefinded code : msr_log , da hab ich mal nach gegoogelt und es scheint so als ob das öfter passiert , eine Lösung hab ich nicht gefunden :-(

Obs wirklich daran liegt das ich das mit apxs2 kompiliert hab ? kann ich mir nicht vorstellen
 
ich hab jetzt mal die 2er Module gelöscht und die version 1.9.4 hochgeladen und installiert

und siehe da , es läuft :-)


kann ja nicht sein das man die neueste Version nur mit "make" installieren kann ? gibts ja nicht

Ist wahrscheinlich auch nur ein Suse spezifisches Problem könnt ich mir vorstellen


hab mir dann auch noch den Regelsatz von gotroot implementiert und auf einmal wurde der Server quälend langsam.

maßnahme : badip , blacklist 1+ 2 auskommentiert und nun ists erträglich
 
Last edited by a moderator:
Hallo

Hat das jemand geschaft? kan jemand den mod_security.so zum

bei mir lauft auch nuch 1.9.4, den 2.1.1 kompiliert nicht

Suse 10

makeFile
Code:
top_dir      = /usr/share/apache2

top_srcdir   = ${top_dir}
top_builddir = ${top_dir}

include ${top_builddir}/build/special.mk

APXS      = apxs2
APACHECTL = apache2ctl

INCLUDES = -I /usr/include/libxml2/libxml
DEFS = -DWITH_LIBXML2
#LIBS = -Lmy/lib/dir -lmylib

CFLAGS = -O2 -g -Wuninitialized -Wall -Wmissing-prototypes -Wshadow -Wunused-variable -Wunused-value -Wchar-subscripts -Wsign-compare

all: local-shared-build

clean:
    -rm -f *.o *.lo *.slo *.la *~ .libs

# make

/bin/sh /usr/share/apache2/build/libtool --silent --mode=compile gcc -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread -O2 -g -Wuninitialized -Wall -Wmissing-prototypes -Wshadow -Wunused-variable -Wunused-value -Wchar-subscripts -Wsign-compare -DWITH_LIBXML2 -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_DEBUG -DAP_HAVE_DESIGNATED_INITIALIZER -DSSL_EXPERIMENTAL_ENGINE -DMAX_SERVER_LIMIT=200000 -DDYNAMIC_MODULE_LIMIT=80 -I /usr/include/libxml2/libxml -I. -I/usr/share/apache2/os/unix -I/usr/share/apache2/server/mpm/prefork -I/usr/share/apache2/modules/http -I/usr/share/apache2/modules/filters -I/usr/share/apache2/modules/proxy -I/usr/share/apache2/include -I/usr/share/apache2/modules/generators -I/usr/share/apache2/server -I/usr/include/openssl -I/usr/share/apache2/modules/dav/main -DAP_FNAME=\"apache2_config.c\" -prefer-pic -c apache2_config.c && touch apache2_config.slo

hat als ergbniss

apache2_config.c:1201: error: initializer element is not constant
apache2_config.c:1201: error: (near initialization for ‘module_directives[18]’)
apache2_config.c:1209: error: initializer element is not constant
apache2_config.c:1209: error: (near initialization for ‘module_directives[19]’)
apache2_config.c:1211: warning: implicit declaration of function ‘AP_INIT_ITERATE’
apache2_config.c:1217: error: initializer element is not constant
apache2_config.c:1217: error: (near initialization for ‘module_directives[20]’)
apache2_config.c:1219: warning: implicit declaration of function ‘AP_INIT_NO_ARGS’
apache2_config.c:1225: error: initializer element is not constant
apache2_config.c:1225: error: (near initialization for ‘module_directives[21]’)
apache2_config.c:1227: warning: implicit declaration of function ‘AP_INIT_TAKE23’
apache2_config.c:1233: error: initializer element is not constant
apache2_config.c:1233: error: (near initialization for ‘module_directives[22]’)
apache2_config.c:1241: error: initializer element is not constant
apache2_config.c:1241: error: (near initialization for ‘module_directives[23]’)
apache2_config.c:1261: warning: implicit declaration of function ‘AP_INIT_FLAG’
apache2_config.c:1267: error: initializer element is not constant
apache2_config.c:1267: error: (near initialization for ‘module_directives[24]’)
apache2_config.c:1275: error: initializer element is not constant
apache2_config.c:1275: error: (near initialization for ‘module_directives[25]’)
apache2_config.c:1283: error: initializer element is not constant
apache2_config.c:1283: error: (near initialization for ‘module_directives[26]’)
apache2_config.c:1291: error: initializer element is not constant
apache2_config.c:1291: error: (near initialization for ‘module_directives[27]’)
apache2_config.c:1299: error: initializer element is not constant
apache2_config.c:1299: error: (near initialization for ‘module_directives[28]’)
apache2_config.c:1307: error: initializer element is not constant
apache2_config.c:1307: error: (near initialization for ‘module_directives[29]’)
apache2_config.c:1315: error: initializer element is not constant
apache2_config.c:1315: error: (near initialization for ‘module_directives[30]’)
apache2_config.c:1323: error: initializer element is not constant
apache2_config.c:1323: error: (near initialization for ‘module_directives[31]’)
apache2_config.c:1325: warning: braces around scalar initializer
apache2_config.c:1325: warning: (near initialization for ‘module_directives[32]’)
apache2_config.c:1325: warning: initialization makes integer from pointer without a cast
apache2_config.c:1326: warning: data definition has no type or storage class
make: *** [apache2_config.slo] Error 1
 
Bei mir funktioniert mod_security nicht weil ein mod_unique fehlt, wo kriegt man das denn / wo hast du das denn her ??
 
Hallo!
Das Modul heist mod_unique_id. Ich glaube HornOx hatte schon einmal darauf hingewisen.

mfG
Thorsten
 
Back
Top