1+ when RULE_INIT {
2+ # debug logging flag
3+ set debug 0
4+ }
5+
6+ when HTTP_REQUEST {
7+ # get LTM policy matched rule and chosen ASM security policy
8+ set policy [POLICY::names matched]
9+ if { $debug } {
10+ log local0. " Matched policy [ POLICY::names matched] "
11+ log local0. " Matched rule in policy [ POLICY::rules matched] "
12+ log local0. " ASM policy [ ASM::policy] enforcing"
13+ }
14+ }
15+
16+ when ASM_REQUEST_DONE {
17+ # define custom violation conditions
18+ # user-defined violation: VIOLATION_TOO_MANY_VIOLATIONS
19+ set violationName " VIOLATION_TOO_MANY_VIOLATIONS"
20+ if {[ASM::violation count] > 20 and [ASM::severity] eq " Error" } {
21+ ASM::raise $violationName
22+ }
23+ # user-defined violation: X
24+ # debug logging
25+ if { $debug } {
26+ log local0. " SupportID: [ ASM::support_id] ;"
27+ log local0. " Request Status: [ ASM::status] ;"
28+ log local0. " Severity: [ ASM::severity] ;"
29+ log local0. " ClientIP: [ ASM::client_ip] ;"
30+ log local0. " Number Violations: [ ASM::violation count] "
31+ log local0. " Violations Names: [ ASM::violation names] ;"
32+ log local0. " Attack Types: [ ASM::violation attack_types] ;"
33+ log local0. " Violation details: [ ASM::violation details] ;"
34+ }
35+ }
36+
37+ when ASM_REQUEST_VIOLATION {
38+ if { $debug } {
39+ log local0. " SupportID: [ ASM::support_id] ;"
40+ log local0. " Request Status: [ ASM::status] ;"
41+ log local0. " Severity: [ ASM::severity] ;"
42+ log local0. " ClientIP: [ ASM::client_ip] ;"
43+ log local0. " Number Violations: [ ASM::violation count] "
44+ log local0. " Violations Names: [ ASM::violation names] ;"
45+ log local0. " Attack Types: [ ASM::violation attack_types] ;"
46+ log local0. " Violation details: [ ASM::violation details] ;"
47+ }
48+ }
49+
50+ when ASM_RESPONSE_VIOLATION {
51+ if { $debug } {
52+ log local0. " SupportID: [ ASM::support_id] ;"
53+ log local0. " Request Status: [ ASM::status] ;"
54+ log local0. " Severity: [ ASM::severity] ;"
55+ log local0. " ClientIP: [ ASM::client_ip] ;"
56+ log local0. " Number Violations: [ ASM::violation count] "
57+ log local0. " Violations Names: [ ASM::violation names] ;"
58+ log local0. " Attack Types: [ ASM::violation attack_types] ;"
59+ log local0. " Violation details: [ ASM::violation details] ;"
60+ }
61+ }
62+
63+ when ASM_REQUEST_BLOCKING {
64+ if { $debug } {
65+ log local0. " SupportID: [ ASM::support_id] ;"
66+ log local0. " Request Status: [ ASM::status] ;"
67+ log local0. " Severity: [ ASM::severity] ;"
68+ log local0. " ClientIP: [ ASM::client_ip] ;"
69+ log local0. " Number Violations: [ ASM::violation count] "
70+ log local0. " Violations Names: [ ASM::violation names] ;"
71+ log local0. " Attack Types: [ ASM::violation attack_types] ;"
72+ log local0. " Violation details: [ ASM::violation details] ;"
73+ }
74+ }
0 commit comments