Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc54bb74

Browse files
author
Felipe Zimmerle
committed
Adds SecRemoteRules as an build option
SecRemoteRules adds a new dependency to libcurl. Before only mlogc wasdepending on libcurl. SecRemoteRules also depends on the apr-tools withcrypto support, which (as reported by our buildbots) is not default insome environments such as: MacOS X. This commit disable SecRemoteRulessupport if apr-tools was not compiled with crypto support.
1 parent38b9924 commitc54bb74

File tree

5 files changed

+38
-12
lines changed

5 files changed

+38
-12
lines changed

‎apache2/apache2_config.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ static const char *cmd_remote_rules_fail(cmd_parms *cmd, void *_dcfg, const char
22172217
{
22182218
directory_config*dcfg= (directory_config*)_dcfg;
22192219
if (dcfg==NULL)returnNULL;
2220-
2220+
#ifdefWITH_REMOTE_RULES_SUPPORT
22212221
if (strncasecmp(p1,"warn",4)==0)
22222222
{
22232223
remote_rules_fail_action=REMOTE_RULES_WARN_ON_FAIL;
@@ -2231,6 +2231,10 @@ static const char *cmd_remote_rules_fail(cmd_parms *cmd, void *_dcfg, const char
22312231
returnapr_psprintf(cmd->pool,"ModSecurity: Invalid value for " \
22322232
"SecRemoteRulesFailAction, expected: Abort or Warn.");
22332233
}
2234+
#else
2235+
returnapr_psprintf(cmd->pool,"ModSecurity: " \
2236+
"SecRemoteRules: ModSecurity was not compiled with such functionality.");
2237+
#endif
22342238

22352239
returnNULL;
22362240
}
@@ -2242,6 +2246,7 @@ static const char *cmd_remote_rules(cmd_parms *cmd, void *_dcfg, const char *p1,
22422246
directory_config*dcfg= (directory_config*)_dcfg;
22432247
if (dcfg==NULL)returnNULL;
22442248

2249+
#ifdefWITH_REMOTE_RULES_SUPPORT
22452250
// FIXME: make it https only.
22462251
// if (strncasecmp(p1, "https", 5) != 0) {
22472252
if (strncasecmp(p2,"http",4)!=0) {
@@ -2274,6 +2279,10 @@ static const char *cmd_remote_rules(cmd_parms *cmd, void *_dcfg, const char *p1,
22742279
{
22752280
returnerror_msg;
22762281
}
2282+
#else
2283+
returnapr_psprintf(cmd->pool,"ModSecurity: " \
2284+
"SecRemoteRules: ModSecurity was not compiled with such functionality.");
2285+
#endif
22772286

22782287
returnNULL;
22792288
}

‎apache2/mod_security2.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ unsigned long int DSOLOCAL msc_pcre_match_limit = 0;
6868

6969
unsigned longintDSOLOCALmsc_pcre_match_limit_recursion=0;
7070

71+
#ifdefWITH_REMOTE_RULES_SUPPORT
7172
msc_remote_rules_serverDSOLOCAL*remote_rules_server=NULL;
7273
intDSOLOCALremote_rules_fail_action=REMOTE_RULES_ABORT_ON_FAIL;
74+
#endif
7375

7476
intDSOLOCALstatus_engine_state=STATUS_ENGINE_DISABLED;
7577

@@ -759,6 +761,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
759761
}
760762
#endif
761763

764+
#ifdefWITH_REMOTE_RULES_SUPPORT
762765
if (remote_rules_server!=NULL)
763766
{
764767
if (remote_rules_server->amount_of_rules==1)
@@ -776,6 +779,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
776779
remote_rules_server->uri);
777780
}
778781
}
782+
#endif
779783
}
780784

781785
srand((unsignedint)(time(NULL)*getpid()));

‎apache2/modsecurity.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ typedef struct msc_arg msc_arg;
3333
typedefstructmsc_stringmsc_string;
3434
typedefstructmsc_parmmsc_parm;
3535

36-
#include"msc_remote_rules.h"
3736
#include"msc_release.h"
3837
#include"msc_logging.h"
3938
#include"msc_multipart.h"
@@ -47,11 +46,13 @@ typedef struct msc_parm msc_parm;
4746
#include"msc_unicode.h"
4847
#include"re.h"
4948
#include"msc_crypt.h"
49+
#include"msc_remote_rules.h"
5050

5151
#include"ap_config.h"
5252
#include"apr_md5.h"
5353
#include"apr_strings.h"
5454
#include"apr_hash.h"
55+
#include"apr_crypto.h"
5556
#include"httpd.h"
5657
#include"http_config.h"
5758
#include"http_log.h"
@@ -145,8 +146,10 @@ extern DSOLOCAL unsigned long int msc_pcre_match_limit;
145146

146147
externDSOLOCAL unsigned longintmsc_pcre_match_limit_recursion;
147148

149+
#ifdefWITH_REMOTE_RULES_SUPPORT
148150
externDSOLOCALmsc_remote_rules_server*remote_rules_server;
149151
externDSOLOCALintremote_rules_fail_action;
152+
#endif
150153

151154
externDSOLOCALintstatus_engine_state;
152155

‎apache2/msc_remote_rules.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
#defineAP_MAX_ARGC 64
2727
#endif
2828

29-
#ifndefAPU_HAVE_CRYPTO
30-
#error Missing apu crypto module
31-
#endif
29+
#ifdefWITH_REMOTE_RULES_SUPPORT
3230

3331
/**
3432
* @brief Insert a new SecRule to be processed by ModSecurity
@@ -716,3 +714,4 @@ int msc_remote_clean_chunk(struct msc_curl_memory_buffer_t *chunk)
716714
return0;
717715
}
718716

717+
#endif

‎apache2/msc_remote_rules.h‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,32 @@
1212
* directly using the email address security@modsecurity.org.
1313
*/
1414

15+
#ifAPU_HAVE_CRYPTO
16+
#defineWITH_REMOTE_RULES_SUPPORT
17+
#endif
18+
19+
#ifdefWITH_REMOTE_RULES_SUPPORT
20+
1521
#ifndefMSC_REMOTE_RULES_H
1622
#defineMSC_REMOTE_RULES_H
1723

24+
/* forward declarations */
25+
typedefstructmsc_remote_rules_servermsc_remote_rules_server;
26+
structmsc_curl_memory_buffer_t;
27+
28+
#include"modsecurity.h"
29+
1830
#include<apr_general.h>
1931
#include<apr_optional.h>
2032
#include<apr_thread_pool.h>
21-
#include<curl/curl.h>
22-
2333
#include<apr_sha1.h>
24-
#include<apr_crypto.h>
34+
2535
#include"http_core.h"
36+
#include"http_config.h"
2637

27-
typedefstructmsc_remote_rules_servermsc_remote_rules_server;
28-
structmsc_curl_memory_buffer_t;
38+
#include<curl/curl.h>
2939

30-
#include"modsecurity.h"
40+
#include<apr_crypto.h>
3141

3242
structmsc_remote_rules_server {
3343
directory_config*context;
@@ -38,7 +48,7 @@ struct msc_remote_rules_server {
3848
};
3949

4050
constchar*msc_remote_invoke_cmd(constcommand_rec*cmd,cmd_parms*parms,
41-
void*mconfig,constchar*args);
51+
void*mconfig,constchar*args);
4252

4353
intmsc_remote_grab_content(apr_pool_t*mp,constchar*uri,constchar*key,
4454
structmsc_curl_memory_buffer_t*chunk,char**error_msg);
@@ -64,4 +74,5 @@ int msc_remote_add_rules_from_uri(cmd_parms *orig_parms,
6474
intmsc_remote_clean_chunk(structmsc_curl_memory_buffer_t*chunk);
6575

6676
#endif
77+
#endif
6778

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp