Forum Discussion
string tolower and case insensitivity
We wanted to redirect to a particular request when the radius AVP such as User-Name ends with test.com. I implemented irule like the one below. From my understanding, it should be for case insensitive. so, when client request comes in with Test.com or TEST.COM or tEst.com, etc ...work, should still go to test_pool1
rule test_irule {
when CLIENT_DATA {
if { [ string tolower [RADIUS::avp User-Name] ] ends_with "test.com" } {
pool test_pool1
} else {
pool test_pool2
}
}
However, I noticed that when for example clien request has Test.com (e.g., capital T), it would go to test_pool2. The goal is to ensure that any request regardless of its case (upper or lower letter) containing a string such as "test.com" to always go to test_pool1, anything else would go to test_pool2
Any feedback would be really appreciated.
Thanks.
5 Replies
- Kevin_Stewart
Employee
Just out of curiosity, what's the output if you throw in the following log line:when CLIENT_DATA { log local0. "User-Name = [string tolower [RADIUS::avp User-Name]]" if { [ string tolower [RADIUS::avp User-Name] ] ends_with "test.com" } { pool test_pool1 } else { pool test_pool2 } }
- nitass
Employee
it looks fine to me.[root@ve10:Active] config b virtual bar list virtual bar { snat automap destination 172.28.19.79:1812 ip protocol 17 rules myrule profiles { myudp {} radiusLB {} } } [root@ve10:Active] config b profile myudp list profile udp myudp { defaults from udp datagram lb enable } [root@ve10:Active] config b pool test_pool1 list pool test_pool1 { members 200.200.200.101:1812 {} } [root@ve10:Active] config b pool test_pool2 list pool test_pool2 { members 200.200.200.111:1812 {} } [root@ve10:Active] config b rule myrule list rule myrule { when CLIENT_DATA { log local0. "[RADIUS::avp User-Name]" if {[string tolower [RADIUS::avp User-Name]] ends_with "test.com"} { pool test_pool1 } else { pool test_pool2 } } when SERVER_CONNECTED { log local0. "[LB::server pool]" log local0. "[IP::remote_addr]:[UDP::remote_port]" } } [root@ve10:Active] config tail -f /var/log/ltm Oct 11 11:17:20 local/tmm info tmm[7926]: Rule myrule : john@Test.com Oct 11 11:17:20 local/tmm info tmm[7926]: Rule myrule : test_pool1 Oct 11 11:17:20 local/tmm info tmm[7926]: Rule myrule : 200.200.200.101:1812 Oct 11 11:17:27 local/tmm info tmm[7926]: Rule myrule : john@other.com Oct 11 11:17:27 local/tmm info tmm[7926]: Rule myrule : test_pool2 Oct 11 11:17:27 local/tmm info tmm[7926]: Rule myrule : 200.200.200.111:1812
- nitass
Employee
just in case if you have not yet seen this. - MB_58262
Nimbostratus
Thank you for the confirmation! - I am just curious, may I ask what tool have you used to generate the radius request? - nitass
Employee
may I ask what tool have you used to generate the radius request?of course.
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