51 Commits

Author SHA1 Message Date
David Andrews
dda91f1689 Standalone: independently destroy the connection and request pools
Add independent modsecFinishConnection API that allows you to independently
destroy the connection and request pools. This is to facilitate reuse of a
connection for multiple requests.
2014-03-03 14:17:00 -08:00
Felipe Zimmerle
fe14d9df4d nginx: Considering modsec state before apply any rules
For some reason the state of modsec (enable, disable or detecting only) was not
being checked under certain circumstances. For instance, while reading the
body. This was leading ModSecurity to fail and consequently nginx. This patch
added the to standalone implementation mechanism to verify the state that is now
verified under the nginx module.
2014-01-13 18:44:47 -08:00
Felipe Zimmerle
7ac515ee29 nginx: Adds proper support to SecServerSignature
SecServerSignature was leading nginx to crash. It was trying to write over a
memory area that it was not allowed to. In order to fix that a new function was
created on the standalone api. This function is called
modsecIsServerSignatureAvailale. Whenever it returns data it means that the
function SecServerSignature was used by the user. Nginx module was also patched
to support this new function.
2014-01-08 18:06:32 -08:00
Felipe Zimmerle
2a43589395 nginx: Removes problematic performance improvement
In an attempt to boost the performance the headers were being checked in two
different situations, the first if SecResponseBodyAccess was Off and in a
second situation if SecResponseBodyAccess was set to On. This makes sense
however functionalities such as content injection demands the body even if
SecResponseBodyAccess was not enabled. This patch removes the first scenario,
leaving just the second one. After this modification the following regression
tests started to pass:

from: regression/action/10-append-prepend.t
  1) action - append content: passed
  2) action - prepend content: passed
2014-01-07 19:26:43 -08:00
Felipe Zimmerle
e20c800044 nginx: fix missing headers while SecResponseBodyAccess was On
The problem was caused by the fact that ModSecutiry was telling Nginx that
headers had been sent when, in fact, had not. This modification was added in
the past, along with others, in the following commit: fd2c30fa2311e783eecf3bf02bf3dcfbabc3968a
This patch, just removes the "r->header_sent = 1". After that modification
the following regression tests started to work again:

from: action/00-disruptive-actions.t
   3) action - pass in phase:3
   4) action - pass in phase:4
  11) action - deny in phase:3
  12) action - deny in phase:4
  19) action - redirect in phase:3 (get)
  20) action - redirect in phase:4 (get)
  23) action - proxy in phase:3 (get)
  24) action - proxy in phase:4 (get)
from: config/10-response-directives.t
   2) config - SecResponseBodyAccess On
   6) config - SecResponseBodyLimit (greater)
   7) config - SecResponseBodyLimitAction Reject
2014-01-06 19:10:24 -08:00
ahuango
b788ce2608 Clean the garbage character after the duplicated charset property
Pull request #148 by zimmerle doesn't fix the problem. '\0' in format
string won't be processed by "ngx_vslprintf".
When the garbage character is '\n' or '\r', http response is cracked and
browsers may go crashing.
2013-12-18 16:50:44 -08:00
Felipe Zimmerle
1734221d9d Fix #154, Uses addn instead of apr_table_setn
The headers are represented in the format of an apr_table, which
is able to handle elements with the same key, however the function
apr_table_setn checks if the key exists before add the element, if so
it replaces the old value with the new one. This was making our
implementation to just keep the last added Cookie. The apr_table_addn
function, which is now used, just add a new item without check for
olders one.
2013-10-24 10:55:58 -03:00
Felipe Zimmerle
7f7d00fa2c Revert "Merge pull request #139 from chaizhenhua/remotes/trunk"
This reverts commit 10fd40fb0d06f6c577d870b6f15d2f6e2a3a5b1b, reversing
changes made to 414033aafa94cd50c9b310afd3f164740caccc94.
2013-10-18 11:02:10 -03:00
Felipe Zimmerle
ff19dcd5c5 Bugfix: missing string terminator while mounting the charset (nginx)
The charset in headers is mounted using ngx_snprintf which
does not place the string terminator. This patch adds the
terminator at the end of the string. The size was correctly
allocated, just missing the terminator.

This bug was report at:
- https://www.modsecurity.org/tracker/browse/MODSEC-420
- https://github.com/SpiderLabs/ModSecurity/issues/142

Both reports cames with patch, first by Veli Pekka Jutila and
second by wellumies.
2013-09-30 21:56:57 -03:00
chaizhenhua
e0993fcd7a Fixed fd leackage after reload 2013-08-27 22:10:46 +08:00
Breno Silva
885eeecefb Fix outbound size of salt variable 2013-06-12 09:51:25 -07:00
Breno Silva
a79e818497 Merge pull request #116 from chaizhenhua/remotes/trunk
Nginx: Fixed segfaults on reload
2013-06-12 07:32:53 -07:00
chaizhenhua
4ffdf9bf6d Nginx: Fixed segfaults on reload 2013-06-11 19:44:02 +08:00
chaizhenhua
bad4586277 Nginx: Try to fix eats 100% cpu in ngx_event_pipe_write_to_downstream issue 2013-05-13 21:46:43 +08:00
Breno Silva
400a5f5f55 Nginx: Fix implicit declaration of base64 encode funtion 2013-05-13 03:54:18 -04:00
Breno Silva
35b36b7032 Nginx: Fix UNIQUE_ID 2013-05-13 03:34:47 -04:00
Breno Silva
6126374890 Merge pull request #96 from chaizhenhua/remotes/trunk
Nginx: Try to fix eats 100% cpu in ngx_event_pipe_write_to_downstream issue..
2013-05-13 07:30:27 -07:00
Breno Silva
aa18ec7f45 Updated copyright dates 2013-04-19 03:20:46 -04:00
chaizhenhua
fd2c30fa23 Nginx: minor improve 2013-04-17 11:17:17 +08:00
chaizhenhua
fdf0ba540f Nginx Improved: set filter_need_in_memory flag so that nginx transfer response in memory, we do not need read from file buffer. 2013-04-11 16:02:06 +08:00
chaizhenhua
74278a8e9e Nginx Improved response body filter, issue #56 might be fixed 2013-04-09 10:31:16 +08:00
chaizhenhua
e553761aec Nginx Improved: if "SecResponseBodyAccess off" do not copy response body buffer 2013-04-07 12:32:10 +08:00
chaizhenhua
ddd6bd2a70 Nginx Improved: modsec terminate handling 2013-04-05 02:41:34 +08:00
chaizhenhua
5ce1818a9a Nginx Fixed if "master_process off" is set nginx will crash at exit 2013-04-04 21:42:05 +08:00
chaizhenhua
a951a83eec Nginx: Improved redirect action work for phases except log 2013-03-31 15:26:45 +08:00
chaizhenhua
42e9a5ab24 Nginx: Fixed internal request finalized after rewrite with regex 2013-03-28 12:08:40 +08:00
chaizhenhua
6934acf0e1 Nginx: Fixed memory leakage 2013-03-28 10:20:22 +08:00
chaizhenhua
177b5b9c98 Nginx: Added SecDisableBackendCompression support
Nginx: Added internel redirected request processing
2013-03-22 14:42:56 +08:00
Breno Silva
43162f52cf Fixed: Nginx return 500 when request body is off 2013-03-05 02:38:46 -04:00
Breno Silva
4a8e536b0b Nginx: fixed SecRequestBodyAccess 2013-01-30 16:51:42 -04:00
chaizhenhua
1a89b6b8a6 Fixed deny not work in response phase, Fixed debug log message 2013-01-31 09:09:28 +08:00
chaizhenhua
ed1d3d927a Fixed Action Drop not work 2013-01-27 08:05:46 +08:00
chaizhenhua
972d9e2abf Added Response Phase for Nginx 2013-01-26 22:44:54 +08:00
Greg Wroblewski
c53e743c86 IIS version improvements 2013-01-18 11:39:05 -08:00
chaizhenhua
0566d652c7 Fixed hang up when post multiple request 2013-01-09 11:08:08 +08:00
chaizhenhua
22b8293fdf Fixed content length error 2013-01-07 10:42:15 +08:00
chaizhenhua
275cb28a0e Added 'ngx_modsecurity_write_body_cb' so that NGINX can deal with STREAM_INPUT_BODY 2013-01-06 21:51:36 +08:00
chaizhenhua
604643c4b9 change CRLF to LF 2013-01-06 16:26:10 +08:00
chaizhenhua
d5a6df167c promote modsecurity_handler from CONTENT_PHASE to PREACCESS_PHASE, so that we can process and pass request to backend without internal redirect. 2013-01-06 14:28:10 +08:00
chaizhenhua
86e0455724 Fixed compile error 2013-01-05 08:27:58 +08:00
chaizhenhua
82d44071d4 Fixed 'request body is larger ...' error 2013-01-04 23:50:27 +08:00
chaizhenhua
231921ce25 Revert "Fixed request body is larger"
This reverts commit ee47cccb63588fef6294351abdf07e7b914404d9.
2013-01-04 23:15:54 +08:00
chaizhenhua
ee47cccb63 Fixed request body is larger 2013-01-04 23:10:05 +08:00
chaizhenhua
344ec7dfa0 Added cleanup handler for finalize request 2012-12-25 10:16:51 +08:00
chaizhenhua
5f97bec8d3 read client body in a better manner 2012-12-25 09:34:13 +08:00
chaizhenhua
77ccd0b7b5 Fixed: ngx_http_read_client_request_body returned unexpected buffer type
- after post request is processed
the calling to ngx_http_read_client_request_body will ingore
r->request_body_in_file_only option, which is not expected.
2012-12-24 22:18:13 +08:00
chaizhenhua
6815d17690 Added drop action for nginx 2012-12-20 12:32:58 +08:00
Breno Silva
d7280c61f0 Fixed NGINX compilation issues 2012-11-09 18:35:29 -04:00
brenosilva
060cf0ab3d MODSEC-337 2012-10-08 18:50:10 +00:00
alancsilva
73e87c035a module bugfixes (kyprizel) 2012-09-29 18:10:39 +00:00