140 Commits

Author SHA1 Message Date
Felipe Zimmerle
dc81e4f852 Informs problems and successfully loaded external resources during reload
Resources load mechanism as the SecRemoteRuels were not showing information
about the loaded rules while Apache was reloaded. This patch add such
information to reload in the same way that it was showing on restart.
2014-12-11 12:42:58 -08:00
Felipe Zimmerle
fe22446bdd Adds missing 'ModSecurity:' prefix to log messages
As reported by Walter Hop, the status call functionality was printing a message
in the console without the expected 'ModSecurity:' prefix. SecServerSignature
was also printing messages without the expected prefix. Both are fixed by this
commit.
2014-12-11 12:42:56 -08:00
Felipe Zimmerle
ce4cf24f6e Refactoring external resources download warn messages
Holding the message to be displayed when Apache is ready to write on the
error_log instead of the default output. Regression tests were added.
2014-12-11 12:42:49 -08:00
Felipe Zimmerle
23823bb2c3 Makes Curl no longer a mandatory depedency for ModSecurity core
As reported by Rainer Jung, Curl may not be mandatory to build
	ModSecurity core. This patch make it optional by:
	- Concentrate all downloads using curl on msc_remote_rules.c
	- Split Curl build definitions checks into: WITH_CURL, WITH_REMOTE_RULES
	and WITH_CRYPTO.
	  - WITH_CURL: Contains Culr headers and binaries during the build time.
	  - WITH_REMOTE_RULES: Currently enabled if Curl is present.
	  - WITH_CRYPTO: Set if apr tool was compiled with crypto support.
	- Renames msc_remote_grab_content to msc_remote_download_content
2014-12-03 08:28:59 -08:00
Felipe Zimmerle
b019f6056f fix typo
- Adds a missing "s" while informing the amount of remote loaded rules.
- Renames text file that was wrongly named as .py
2014-11-17 19:32:43 -08:00
Felipe Zimmerle
9fe72b72de Improves the CA validation
On IIS CA validation was not working as libcurl on windows does not look for a
certificate store, unless it is specified. The resource downloads are now
respecting the SecRemoteRulesFailAction.
2014-11-17 19:32:32 -08:00
Felipe Zimmerle
c54bb746c6 Adds SecRemoteRules as an build option
SecRemoteRules adds a new dependency to libcurl. Before only mlogc was
depending on libcurl. SecRemoteRules also depends on the apr-tools with
crypto support, which (as reported by our buildbots) is not default in
some environments such as: MacOS X. This commit disable SecRemoteRules
support if apr-tools was not compiled with crypto support.
2014-11-14 11:53:40 -08:00
Felipe Zimmerle
38b9924705 Adds the SecRemoteRulesFailAction directive
This directive allows the user to set a default action whenever the
SecRemoteRules failed to download a set of rules. Current the supported
values are: Warn and Abort. By default `Abort' is selected.
2014-11-14 11:53:40 -08:00
Felipe Zimmerle
9b836b652a Initial support to load rules from a remote server
New directive `SecRemoteRules' was added. It allows the user to load a
set of rules from a given HTTP server.
2014-11-14 11:53:40 -08:00
Felipe Zimmerle
59a1746be7 Using real server signature on status call
On Apache platform the server signature can be replaced using the
SecServerSignature directive. Status call was using the signature informed by
this directive instead of using the original one. As reported at #702.
2014-11-14 11:53:39 -08:00
Mauro Faccenda
87df4827dc Print YAJL version on startup. Closing issue: #703 2014-09-30 10:40:03 -03:00
Felipe Zimmerle
48d85c7d6e Places connection filter engine in a separated configuration
Different from the Rules or other options, the connections filters are applied
to entire server, not to a single vhost, or so. In order to keep it clear to
the user this patches adds "SecConnectionEngine" which works in the same way
that SecRuleEngine does.
2014-03-31 16:22:10 -07:00
Felipe Zimmerle
a15f8813e9 Honor the SecRuleEngine while filtering connections
The SecRuleEngine has the capability to Enable, Disable or even to place the
ModSecurity in DetectionOnly mode. The SecReadStateLimit and SecWriteStateLimit
were not honoring such state, due the fact that our configuration belongs to
requests not to connections, the only struct that exists while those filters
are placed. By adding a global variable "conn_limits_filter_state" we are now
able to identify the current state of the ModSecurity, once the configuration
is loaded this variable is set and used by the connections filters.
2014-03-31 16:22:10 -07:00
Felipe Zimmerle
0037a0732a Using RadixTree instead of list to storage IPs
Used by the operator @ipMatch and variants, this structure storage all the IPs
addresses for later comparison. Last version was using RadixTree only if the
set of IPs was specified from files. IPs specified as parameters, was using
a chained list. Chained lists may affect the performance, since lookups in
worst case will be O(n). RadixTrees could provide better results depending
on the amount of elements and its contents.
2014-03-31 16:22:10 -07:00
Felipe Zimmerle
b9fdc4fe3b Adds support to suspicious and whitelist to Read and Write limits
The operators @ipMatch, @ipMatchF and @ipMatchFromFile were
added to the functions: SecReadStateLimit and SecReadStateLimit,
by using them it is possible to declare a suspicious list. When
a suspicious list is given, the {Read|Write}StateLimit will be
applied just to the IPs that belongs to that restricted list.
Note that the negative of those operators (e.g. !@ipMatch) can be
used to place a whitelist. The {Read|Write}StateLimit
restrictions will not be applied to those in the whitelist.
This current version the Sec{Read|Write}StateLimit can be used
varios times to add elements to both lists, however, the
last informed limit will be applied for the entire group. This
feature is experimental, and suggestions on how to improve it
are very welcome. For further discussion use the issue: #353.
2014-03-31 16:22:10 -07:00
Felipe "Zimmerle" Costa
20014c808c Adds modsecStatusEngineCall to standalone API
In ModSecurityIIS the configuration is loaded upon the first request
is received. In other words, SecStatusEngine value can be only
loaded once the first request hit the server, and so, the status
function was moved to proceed just after the configuration got loaded.
This update is IIS only.
2014-03-31 07:14:55 -07:00
Felipe Zimmerle
a6d93441c1 Places StatusEngine to be Off by default
StatusEngine is now marked as Off by default. This patch also adds the
SecStatusEngine directive to our recommend configuration file.
2014-03-31 07:14:55 -07:00
Felipe Zimmerle
f86a71f7a7 Adds SecStatusEngine On/Off switch
Add the possibility to turn the Status Engine On or Off using the
directive SecStatusEngine [On/Off]. By default it is On.
2014-03-31 07:14:55 -07:00
Felipe Zimmerle
0c6a661c69 First version of the status engine implementation
The Status Engine allow the measurements of how many ModSecurity
instances are running around the world, as long as information
on how many times it had been restarted and so on. Everytime that
the server is started it perform a DNS query that is redirected
to our servers, that query constains information about the
ModSecurity version and it dependencies versions. It also sends a
unique indetification generate locally for the server, avoiding
counting the same server twice while generating the statistics.
This id is a sha-1 hash of the machine name + mac address of the
first network adapter. In this commit it is enabled by default,
in the release will be a configuration option to disable this
functionality. It also important to cite that the information
gather by this query will be also available in ModSecurity website
public open via a JSON stateless API. There will be an fancy
heatmap as well.
2014-03-31 07:14:55 -07:00
Felipe Zimmerle
d93ce9ceee Adds REQUEST_FULL and REQUEST_FULL_LENGTH variables
This variable is a combination from REQUEST_LINE, REQUEST_HEADERS and
REQUEST_BODY (if any). Expects for \n\n in between each of those values.
2014-03-31 07:14:55 -07:00
Jiri Kukacka
62a6f228f8 Fixes for Parfait errors - mostly unhandled NULL pointer dereference and data type mismatch 2014-02-28 17:05:41 -08:00
Justin Gerace
498b9b2e7a Don't reject a large request with ProcessPartial set 2014-02-28 12:36:48 -08:00
Felipe Zimmerle
795d6a64d2 nginx: Warn about not workable 'proxy'
Proxy is not yet ready for nginx. Instead of give a generic error, this patch
adds a clean message explains that such functionality is not available on the
nginx port. This patch also modifies the test cases to reflect this changes.
2014-01-09 11:12:28 -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
Chase Venters
0ddd2b4639 Add mod_extract_forwarded.c to run before mod_security2.c
mod_extract_forwarded2.c is already present in this list, but there is a
(seemingly better) alternative for Apache 2.2 which is distributed in
Fedora EPEL that is called mod_extract_forwarded.c.
2013-12-18 18:05:03 -08:00
Breno Silva
aa18ec7f45 Updated copyright dates 2013-04-19 03:20:46 -04:00
Breno Silva
8816254cc8 ModSecurity: fixed compiling with lua 5.2 2013-01-30 22:03:15 -04:00
chaizhenhua
6815d17690 Added drop action for nginx 2012-12-20 12:32:58 +08:00
brenosilva
afea6dbe61 Fixed drop action was disabled by mistake for apache2 2012-10-19 17:05:08 +00:00
brenosilva
0e85d9f753 MODSEC-226 2012-10-08 15:21:57 +00:00
brenosilva
5c5107a860 MODSEC-297 2012-10-08 13:55:11 +00:00
brenosilva
0d2307192c MODSEC-336 2012-10-05 18:03:58 +00:00
gregwroblewski
2dbe4ab4f0 Second part of IIS/nginx merge into M2 trunk. 2012-08-20 20:31:06 +00:00
brenosilva
e8bd4c05f3 Revert pcre message warning mismatch 2012-08-02 22:58:48 +00:00
brenosilva
f4d446574c Fix pcre version mismatch warning 2012-07-03 19:12:51 +00:00
brenosilva
866cb6d6b4 Update trunk for 2.7 2012-05-10 23:18:39 +00:00
brenosilva
2be4d8b02e Fix new apache api 2011-12-19 15:15:55 +00:00
brenosilva
2046a43bf4 Fixed AP_SERVER_MINOR instead of AP_SERVER_MAJOR 2011-12-19 15:09:38 +00:00
brenosilva
2e00ae0f45 Fixed new apache API 2011-12-19 14:20:39 +00:00
brenosilva
7d327e8df8 Update lastest Apache API 2011-12-19 12:40:56 +00:00
brenosilva
6c71b26985 [Reverted] Check POST request for SecWriteStateLimit 2011-07-07 16:48:30 +00:00
brenosilva
644d0b58ff Check POST request for SecWriteStateLimit 2011-07-07 15:24:09 +00:00
brenosilva
3d69126de0 Build and code fixes 2011-06-14 18:16:55 +00:00
brenosilva
f595919107 Implement unicode map 2011-06-02 19:11:04 +00:00
brenosilva
e1025d0f0c Change apr version macro by apache one 2011-05-18 18:33:20 +00:00
brenosilva
5eaa1a7345 Added SecWriteStateLimit for slow post DoS 2011-05-05 17:01:57 +00:00
brenosilva
1aa4cace65 Fix compiler warnings 2011-04-27 21:54:16 +00:00
brenosilva
6b7edc4d47 Fixes, code cleanups, improvements 2011-04-27 15:58:22 +00:00
brenosilva
f64b5544af Move version() to mod_security2 2011-04-11 18:34:47 +00:00
brenosilva
9c5e0a4f98 Improvements in detection only 2011-04-05 17:41:52 +00:00