|
Packit Service |
384592 |
### Test for SecRuleScript
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
# Lua
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
type => "rule",
|
|
Packit Service |
384592 |
comment => "SecRuleScript (lua absolute nomatch)",
|
|
Packit Service |
384592 |
conf => qq(
|
|
Packit Service |
384592 |
SecRuleEngine On
|
|
Packit Service |
384592 |
SecDebugLog $ENV{DEBUG_LOG}
|
|
Packit Service |
384592 |
SecDebugLogLevel 1
|
|
Packit Service |
384592 |
SecRuleScript "$ENV{CONF_DIR}/test.lua" "phase:2,deny"
|
|
Packit Service |
384592 |
),
|
|
Packit Service |
384592 |
match_log => {
|
|
Packit Service |
384592 |
-error => [ qr/Lua script matched\./, 1 ],
|
|
Packit Service |
384592 |
debug => [ qr/Test message\./, 1 ],
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
match_response => {
|
|
Packit Service |
384592 |
status => qr/^200$/,
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
request => new HTTP::Request(
|
|
Packit Service |
384592 |
GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
|
Packit Service |
384592 |
),
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
type => "rule",
|
|
Packit Service |
384592 |
comment => "SecRuleScript (lua relative nomatch)",
|
|
Packit Service |
384592 |
conf => qq(
|
|
Packit Service |
384592 |
SecRuleEngine On
|
|
Packit Service |
384592 |
SecDebugLog $ENV{DEBUG_LOG}
|
|
Packit Service |
384592 |
SecDebugLogLevel 1
|
|
Packit Service |
384592 |
SecRuleScript "test.lua" "phase:2,deny"
|
|
Packit Service |
384592 |
),
|
|
Packit Service |
384592 |
match_log => {
|
|
Packit Service |
384592 |
-error => [ qr/Lua script matched\./, 1 ],
|
|
Packit Service |
384592 |
debug => [ qr/Test message\./, 1 ],
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
match_response => {
|
|
Packit Service |
384592 |
status => qr/^200$/,
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
request => new HTTP::Request(
|
|
Packit Service |
384592 |
GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
|
Packit Service |
384592 |
),
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
{
|
|
Packit Service |
384592 |
type => "rule",
|
|
Packit Service |
384592 |
comment => "SecRuleScript (lua relative match)",
|
|
Packit Service |
384592 |
conf => qq(
|
|
Packit Service |
384592 |
SecRuleEngine On
|
|
Packit Service |
384592 |
SecDebugLog $ENV{DEBUG_LOG}
|
|
Packit Service |
384592 |
SecDebugLogLevel 1
|
|
Packit Service |
384592 |
SecRuleScript "match.lua" "phase:2,deny"
|
|
Packit Service |
384592 |
),
|
|
Packit Service |
384592 |
match_log => {
|
|
Packit Service |
384592 |
error => [ qr/ModSecurity: Access denied with code 403 \(phase 2\)\. Lua script matched\./, 1 ],
|
|
Packit Service |
384592 |
debug => [ qr/Test message\./, 1 ],
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
match_response => {
|
|
Packit Service |
384592 |
status => qr/^403$/,
|
|
Packit Service |
384592 |
},
|
|
Packit Service |
384592 |
request => new HTTP::Request(
|
|
Packit Service |
384592 |
GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
|
|
Packit Service |
384592 |
),
|
|
Packit Service |
384592 |
},
|