Forum Discussion
Justin_48142
Nimbostratus
Apr 10, 2008Block URI with /dev60cgi from external client_addr
Hello,
I'm new to F5/iRules and I have a requirement to block external ip's from invoking any /dev60cgi/f60cgi URI call that doesn't include the string 'DRECSINHIST' or 'DRECSFFEDBF'. The iRule should do the following:
1) detect if IP::client_addr is external by reading from a data class ($::approved_clients)
2) if IP::client_addr is internal, then it will LB to the pool associated with the virtual
3) if IP::client_addr is external, then it will check for /dev60cgi/f60cgi in the URI
4) if 3 = true, then the iRule will look for 'DRECSINHIST' or 'DRECSFFEDBF' in the URI string
5) if URI strings contains 'DRECSINHIST' or 'DRECSFFEDBF' then LB to the pool associated with the virtual, else display an HTTP response that says "no forms access allowed to external client ip's"
Here's what I've come up with to address these requirements. Everthing seems to work except the part where the HTTP::respond streams HTML back to the requesting client. The iRule effectively determines if the IP::client_addr is external/internal and blocks invocations to any forms that aren't in our approved forms list, but it fails to display any type of response...the broswer just hangs indefinitely.
when HTTP_REQUEST {
if { not [matchclass [IP::client_addr] equals $::approved_clients] } {
if {[HTTP::uri] contains "/dev60cgi/f60cgi"} {
if { not [matchclass [HTTP::uri] contains $::approved_forms] } {
log local0. "URI requested by [IP::client_addr] blocked"
log local0. "URI requested = [HTTP::uri]"
HTTP::respond 200 content "ErrorError No Access to forms via external address"
}
}
}
}
Any thoughts?
iRule newbie...
- Justin_48142
Nimbostratus
FYI...here's what the LTM log shows when someone accesses an unauthorized form from an external ip address - The_Bhattman
Nimbostratus
Did you try to switch browsers like say I.E. vs Firefox? Just a simple test to rule out the browser. - Justin_48142
Nimbostratus
I figured it out. I'm using the same logic as before, but now I'm searching for a different string (had to uses wireshark on a non-ssl server to figure this out)
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