Forum Discussion
jondyke_46152
Nimbostratus
Dec 16, 2008Irule for restriciting URL paths unsecure
I currenlty use an irule that I use to restrict traffic to certain paths:-
when HTTP_REQUEST {
if {([matchclass [HTTP::uri] starts_with $::securePaths]) and not ([matchclass [IP::client_addr] equals $::trustedAddresses])}{
log local0. "Untrusted IP ([IP::client_addr]) attempting to access secure path ([HTTP::uri])"
discard
} else {
log local0. "Allowing connection from [IP::client_addr] to [HTTP::uri]"
}
}
However I have just discovered that the paths I have in the data group appear to be case sensitive so \test\ as a restricted path can be circumvented by using \Test\. How do I get around this? I don't wish to add every possible path upper and lower case to the datagroup - I will be here until next Christmas!
- hoolio
Cirrostratus
If you add the datagroup items in lower case, you can set the request to lower case before using matchclass to test the URI. Also, it would be more efficient to use HTTP::path versus HTTP::uri assuming you're not looking for the query string in the URI.when HTTP_REQUEST { if {[matchclass [string tolower [HTTP::path]]...
- jondyke_46152
Nimbostratus
Thanks for that - jondyke_46152
Nimbostratus
What about if in the securepaths datagroup I just put the name of the service.... - jondyke_46152
Nimbostratus
Does anybody know if there is any way you can use wild cards with datagroup paths? - hoolio
Cirrostratus
Using a white would be a better method. - jondyke_46152
Nimbostratus
Thats looks an option but does not look like a particularly stright forward one to put together. - hoolio
Cirrostratus
You could use regsub to handle multiple slashes (regsub -all /+ [HTTP::uri] result), but there are quite a few other techniques attackers could use to obfuscate the URI to bypass any blacklist. - jondyke_46152
Nimbostratus
Aplogies for sounding a bit dim here but what do you class as a whitelist? - jondyke_46152
Nimbostratus
I think I tried a whitelist version of this rule before but it did not work. I think it looked something like this. - jondyke_46152
Nimbostratus
I am now told by one of our developers that the way to write this would be :-
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