Forum Discussion
class match with OR - irule not capturing traffic as expected
Guys can someone help with the below – I have a funny feeling I could be heading for a “plant face on desk” moment …
Requirement to selectively block a HSL logging irule from logging to my SIEM by IP or by xff.
Initial irule has
if { not [class match [IP::client_addr] equals ip_external_scan_addresses] } {
Log some stuff }
This works fine with my src IP in “ip_external_scan_addresses” no log. Src IP removed for datagroup = log
(Works also for xff in the same code snippet)
I then moved to add an OR against xff –
if { not ([class match [IP::client_addr] equals ip_external_scan_addresses]) or ([class match [HTTP::header "X-Forwarded-For"] equals ip_external_scan_addresses]) } {
Log some stuff }
Which complies fine and doesn’t break website access BUT now whatever IP I put in the datagroup nothing gets logged – the line does not capture ANY traffic – noting in my test case xff and client_addr are the same IP.
Any ideas – Thanks !!
1 Reply
- JG
Cumulonimbus
when HTTP_REQUEST { if { not ([class match [IP::client_addr] equals ip_external_scan_addresses]) } { log local0. "[IP::client_addr] is not in acl ip_external_scan_addresses" } elseif { [HTTP::header values "X-Forwarded-For"] ne ""} { set found 0 foreach xff_item [split [string map [list " " ""] [HTTP::header "X-Forwarded-For"]] ","] { if { [class match $xff_item equals ip_external_scan_addresses] } { set found 1 break } } if { $found == 0 } { log local0. "[IP::client_addr] is not on acl ip_external_scan_addresses." } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com