BIG-IP : irule class match with wildcards
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi Can [class match] be used to match its arg against a list of strings containing wildcards ? [class match [string tolower [HTTP::path]] contains whitelist] whitelist data-group "/default.html" "/desert-dwellers/camel.html" "/amphibians/*" "/kids-favorites-*" "/smelly/goat-*-juvenile" So all of the following paths would match positive against whitelist : `"default.html" "/desert-dwellers/camel.html" "/amphibians/platypus.html" "/kids-favorites-1.html" "/kids-favorites-2.html" "/smelly/goat-billy-juvenile" "/smelly/goat-nanny-juvenile" If [class match] data-group does not support wildcards is there another syntax possible - such as partial-matching ( left-to-right ) of any entry in the data-group ?1.9KViews0likes9Commentsdata-group format for irule match against simple list
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi My iRule needs to match a variable against a simple list of values : set found_match [class match $lookup_key eq data_group_simple_list] For simplicity, I'd like to structure my data-group like this : "key_1", "key_2", "key_3", "key_4", "key_5", But because the [class match] command apparently was designed for the primary use-case of matching against key-value-pairs ( match key , return value ), I must structure my data-group like this : "key_1" := "key_1", "key_2" := "key_2", "key_3" := "key_3", "key_4" := "key_4", "key_5" := "key_5", Am I understanding this correctly ? Or is there an alternate mechanism that would allow me to format my list in the simple manner ? Admin browser > System > File Management > Data Group File List > Import... File Contents = string For "Key / Value Pair Separator" , if I enter a blank value , I receive error : 0107169a:3: The data group external file (/config/filestore/.stage_d/5955941_d/Common_d/data_group_d/:Common:data-group-test_87302_1) has an invalid format, line: 2.1.2KViews0likes15CommentsDatagroup audit through VIP
Long and short is that we have an external address datagroup that we interrogate from a VIP for auditing. Datagroup: host x.x.x.x := "blah", network y.y.y.0/20 := "blah blah,", host z.z.z.z := "blah blah blah", Rule: when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/auditurl" { HTTP::respond 200 content "[string map { " " "\n" } [class names penaltybox-dg]]" Cache-Control "no-cache,no-store" Content-Type "text/plain" } This does a good job of dumping out all of the records in the datagroup, but is not an easy thing to filter OUT the host entries. It's a pretty easy to apply a filter to "class name" to include something, but have had a hard time figuring out a way to EXCLUDE something. x.x.x.x/32 y.y.y.0/20 z.z.z.z/32 Is there a way to filter out all of the host entries, so no more "/32"s in the listing? Any help would be appreciated. Thanks all. CameronSolved873Views0likes5Commentsirule class match each query param separately
Data Group dg1 param1=p11¶m2=p21 := host1 param1=p12¶m2=p22 := host2 The problem is that some request urls might list their query params in reverse order param2=p21¶m1=p11 Therefore I need to match query params individually. So I have two problems to solve : extract from [HTTP::query] the param segments for param1 and param2 determine if both param1_segment and param2_segment are found together in some key in dg1 So something like : set param1 "param1" set param2 "param2" set param1_segment = [[HTTP:query] $param1] set param2_segment = [[HTTP:query] $param2] if { (class match $param1_segment&$param2_segment equals dg1) or (class match $param2_segment&$param1_segment equals dg1) } { NOTE: I know the above is wrong in terms of both language elements and syntax. I'm just providing to better describe the problem I need to solve. Because my use-case might extend to 3 query params ( in any order ) it might be better to AND together class match for each query param segment.398Views0likes2Comments