Forum Discussion
Eric_Brander_27
Nimbostratus
Apr 08, 2008SSL Encryption Level
Thanks for clicking.
I've been notified via our auditors that our BIGIP LTM is allowing weak encryption. Yet I cannot for the life of me find where I can tell the LTM to only allow Medium o...
Hello Al,
finclass does a hardcoded wildcard match of the string against each line of the datagroup. I don't think there is a way around this. Perhaps you could make a feature request through F5 Support to provide an option for glob or specific matching against just the first "field" of the datagroup. In the meantime, you could use a for loop and getfield to perform an exact match against the class:
when RULE_INIT {
Create a test class (actually a list in this case). This could also be defined as a class/datagroup.
set ::test_class [list {field1 value1} {field1* value1} {field2 value2} {field11 value11}]
Loop through the datagroup line by line.
foreach element $::test_class {
Log the current line.
log local0. "Current \$element: $element"
Compare the element against the string.
If the datagroup entry has a wildcard, it should be listed first in the string compare statement.
if {[string match -nocase [getfield $element " " 1] "field11"]}{
Found a match, so log it and break out of the foreach loop.
log local0. "Matched \$element: $element. Value: [getfield $element " " 2]. Exiting loop."
break
}
}
}
Log output:
Rule : Current $element: field1 value1
Rule : Current $element: field1* value1
Rule : Matched $element: field1* value1. Value: value1. Exiting loop.
If you don't want wildcard matching, you can test with this version which doesn't have a wildcard in the datagroup:
when RULE_INIT {
Create a test class (actually a list in this case). This could also be defined as a class/datagroup.
set ::test_class [list {field1 value1} {field2 value2} {field11 value11}]
Loop through the datagroup line by line.
foreach element $::test_class {
Log the current line.
log local0. "Current \$element: $element"
Compare the element against the string.
If the datagroup entry has a wildcard, it should be listed first in the string compare statement.
if {[string match -nocase [getfield $element " " 1] "field11"]}{
Found a match, so log it and break out of the foreach loop.
log local0. "Matched \$element: $element. Value: [getfield $element " " 2]. Exiting loop."
break
}
}
}
Rule : Current $element: field1 value1
Rule : Current $element: field2 value2
Rule : Current $element: field11 value11
Rule : Matched $element: field11 value11. Value: value11. Exiting loop.
Aaron
- Michael_YatesMay 11, 2010
Nimbostratus
Hi FraFra,when HTTP_REQUEST { if { [HTTP::host] equals "www.aaa.com" and [HTTP::uri] contains "/xxx" } { HTTP::redirect "http://bbb.com/yyy/file.html" } }
when HTTP_REQUEST { if {[string tolower [HTTP::host]] contains "www.aaa.com"}{ set host [string map -nocase {www.aaa.com www.bbb.com} [HTTP::host]] HTTP::redirect "http://$host[HTTP::uri]" } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects