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

Commita45fe95

Browse files
author
Felipe Zimmerle
committed
FuzzyHash: if disable giving an run time error instead of config
FuzzyHash operator is optional and only installed if the headers for libfuzzywas found in the system. Otherwise, the FuzzyHash operator is disable duringthe compilation. After this commit, if some rules tries to use it, ModSecuritywill produce an runtime error not a config time error, allowing the web serverto procede normal with its operations.
1 parentfa0c97e commita45fe95

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

‎apache2/re_operators.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,12 +3789,9 @@ static int msre_op_fuzzy_hash_init(msre_rule *rule, char **error_msg)
37893789

37903790
rule->op_param_data=param_data;
37913791
#else
3792-
*error_msg=apr_psprintf(rule->ruleset->mp,"ModSecurity was not " \
3793-
"compiled with ssdeep support.");
3794-
37953792
rule->op_param_data=NULL;
37963793

3797-
return-1;
3794+
return1;
37983795
#endif
37993796
return1;
38003797

@@ -3852,6 +3849,12 @@ static int msre_op_fuzzy_hash_execute(modsec_rec *msr, msre_rule *rule,
38523849
}
38533850

38543851
fclose(fp);
3852+
#else
3853+
*error_msg=apr_psprintf(rule->ruleset->mp,"ModSecurity was not " \
3854+
"compiled with ssdeep support.");
3855+
3856+
return-1;
3857+
38553858
#endif
38563859

38573860
/* No match. */

‎tests/regression/misc/30-fuzzyHash.t‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
SecRule REQUEST_BODY"\@fuzzyHash$ENV{CONF_DIR}/ssdeep.txt 1""id:192372,log,deny"
1313
),
1414
match_log=> {
15-
error=> [ qr/ModSecurity: Access deniedwith code403 \(phase2\)\. Fuzzy hashof REQUEST_BODY matchedwith96:MbQ1L0LDX8GPI8ov3D2D9zd6.*"modsecurity.conf-recommended"/,1],
16-
debug=> [ qr/Access deniedwith code403 \(phase2\)\. Fuzzy hashof REQUEST_BODY matchedwith96:MbQ1L0LDX8GPI8ov3D2D9zd6.*"modsecurity.conf-recommended"/,1],
15+
error=> [ qr/ModSecurity: Access deniedwith code403 \(phase2\)\. Fuzzy hashof REQUEST_BODY matchedwith96:MbQ1L0LDX8GPI8ov3D2D9zd6.*"modsecurity.conf-recommended"|ModSecurity wasnot compiledwith ssdeep support./,1],
16+
debug=> [ qr/Access deniedwith code403 \(phase2\)\. Fuzzy hashof REQUEST_BODY matchedwith96:MbQ1L0LDX8GPI8ov3D2D9zd6.*"modsecurity.conf-recommended"|ModSecurity wasnot compiledwith ssdeep support./,1],
1717
},
1818
match_response=> {
19-
status=> qr/^403$/,
19+
status=> qr/^403|200$/,
2020
},
2121
request=>new HTTP::Request(
2222
POST=>"http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/index.html",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp