mod_security will nicht...

faxi

Registered User
hi!,

ich habe mir Heute den Apache2.2.2 kompiliert und es es funktioniert auch alles außer mod_security...

mod_security wurde mit:

Code:
/usr/local/apache2.2.2/bin/apxs -cia mod_security.c
kompiliert, ist als modul vorhanden und in der "httpd.conf" geladen.

Die "modsecurity.conf" habe ich in: "/usr/local/apache2.2.2/conf/extra" abgespeichert.

error_log in: "/usr/local/apache2.2.2/logs", gibt folgendes aus:
Code:
faxi1:/usr/local/apache2.2.2/logs# tail error_log
[Wed May 24 15:50:05 2006] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise
[Wed May 24 15:50:05 2006] [crit] (70023)This function has not been implemented on this platform: DBD: driver for  not available
[Wed May 24 15:50:05 2006] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise
[Wed May 24 15:50:05 2006] [notice] Apache/2.2.2 (Unix) mod_ssl/2.2.2 OpenSSL/0.9.8a DAV/2 configured -- resuming normal operations
[Wed May 24 15:50:13 2006] [error] [client 193.160.59.50] File does not exist: /usr/local/apache2.2.2/htdocs/usr
[Wed May 24 15:50:14 2006] [crit] (70023)This function has not been implemented on this platform: DBD: driver for  not available
[Wed May 24 15:50:14 2006] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise
[Wed May 24 15:50:15 2006] [error] [client 193.160.59.50] File does not exist: /usr/local/apache2.2.2/htdocs/usr
[Wed May 24 15:50:18 2006] [error] [client 193.160.59.50] File does not exist: /usr/local/apache2.2.2/htdocs/usr
[Wed May 24 15:52:07 2006] [error] [client 193.160.59.50] File does not exist: /usr/local/apache2.2.2/htdocs/usr

Ich verwende die Rules von gotroot.
Zum Schluss, meine modsecurity.conf:

Code:
<IfModule mod_security.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 On
SecFilterNormalizeCookies On
# enable version 1 (RFC 2965) cookies
SecFilterCookieFormat 1

SecServerResponseToken On

#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 On

# Only record the interesting stuff
SecAuditEngine RelevantOnly
SecAuditLog /usr/local/apache2.2.2/logs/modsec_audit.log

# You normally won't need debug logging
SecFilterDebugLevel 0
SecFilterDebugLog /usr/local/apache2.2.2/logs/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

Include /etc/modsecurity/recons.conf
Include /etc/modsecurity/badips.conf
Include /etc/modsecurity/jitp.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>
Danke!,
faxi
 
Last edited by a moderator:
faxi said:
[crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise
Ich denke dieser Fehler kommt nicht von mod_security sondern von einem anderen Modul. Z.B. mod_authn_dbd oder mod_authn_dbm. Das solltest Du mit einem entsprechenden perl-dbd-Paket beheben können.

huschi.
 
verstehe, aber ich kann immer noch nicht nachvolziehen, warum mod_securty keine meldungen in /usr/local/apache2.2.2/logs/modsec_audit.log" macht, wenn ich in meinem Browser "http://eigene_domain/usr/X11R6/bin/xterm" eingebe, kommt auch kein Fehler 500...

Danke,
faxi
 
Last edited by a moderator:
faxi said:
"http://eigene_domain/usr/X11R6/bin/xterm" eingebe, kommt auch kein Fehler 500...
Was kommt statt dessen? (404)

Da ich keinen Bock habe den ganzen Regelsatz von gotroot zu ziehen:
Welche Regel soll denn Deiner Meinung nach greifen?

huschi.
 
hi!,

ja es kommt "404" --es müsste: "500" (internal server error) kommen und eine entsprechende meldung in "/usr/local/apache2.2.2/logs/modsec_audit.log" erfolgen. ("modsec_audit.log" wurde noch nicht ein mal von mod_security angelegt...)

So war das schon immer bei mir-- ich installiere es nicht zum ersten mal, aber zum ersten mal unter Apache2.2.2...

Danke,
faxi

P.S.: "mod_authn_dbd" oder "mod_authn_dbm" finde ich leider nicht mit: "apt-cache search ..."
 
Last edited by a moderator:
hmmm,

error.log sagt:

Code:
[Thu May 25 17:08:02 2006] [notice] mod_security/1.9.4 configured
 
Huschi said:
Welche Regel soll denn Deiner Meinung nach greifen?
huschi.

Wie Huschi schon schrieb, musst du mal nachgucken, ob es fuer dein Beispiel eine Regel gibt.
 
OK, verstehe:

Code:
# Reject requests with status 500
SecFilterDefaultAction "deny,log,status:500"
 
faxi said:
"mod_authn_dbd" oder "mod_authn_dbm" finde ich leider nicht mit: "apt-cache search ..."
Das sind vom Apache mitgelieferte Module. Evtl. einfach mal sehen, ob die eingebunden sind.

PS: Das war nicht die gesuchte Regel.

huschi.
 
@Huschi: Ja, diese Apache2-Module: "mod_authn_dbd" und "mod_authn_dbm" werden geladen...
Welche Regel soll ich Dir posten?-- ich habe doch oben meine ganze modsecurity.conf gepostet...

Ich sehe da inzwischen neue Angrife, die von modsecurity nicht ein mal bemerkt werden (nichts in den modsecurity-Logs):mad:

error.log:
Code:
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/drupal
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/community
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/blogs
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/blogs
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/blog
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/blogtest
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/b2
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/b2evo
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/wordpress
[Thu May 25 23:41:13 2006] [error] [client 213.202.214.127] File does not exist: /usr/local/apache2.2.2/htdocs/phpgroupware

Grüße,
faxi
 
Last edited by a moderator:
faxi said:
@Huschi: Ja, diese Apache2-Module: "mod_authn_dbd" und "mod_authn_dbm" werden geladen...
Falls Du sie nicht brauchst, solltest Du sie ausladen.

Welche Regel soll ich Dir posten?-- ich habe doch oben meine ganze modsecurity.conf gepostet...
Ja, aber darin sind ja keine Regeln sondern nur die grundsätzliche Konfig drin.
Die Regeln stehen in den Includes.
Und bevor Du auf die Idee kommts uns alle ~10 Dateien hier einzustellen, mußt Du schon selber nachschauen, ob die Regeln überhaupt zu deinem Test passen.

huschi.
 
Hi!,

das Problem hat sich gelöst, in dem ich den standard-Apache installiert habe.

danke,
faxi
 
Back
Top