Forum Discussion
haxzorian_35595
Nimbostratus
Apr 01, 2017Blocking admin uri via IP address and keyword?
Hello All,
Is there a proper way to block access to admin URIs using a a keyword and IP address? Such as, if the request comes from 192.168.0.0/16 space and contains /platform/* allow the connecti...
Kai_Wilke
MVP
Apr 04, 2017Hi haxzorian,
to make your black-list more robust and to include the required IP exemptions, you may take a look to the iRule samples below.
Example1: Using a matching condition which isn't prone to escaping sequences
when HTTP_REQUEST {
if { ( [string tolower [HTTP::path]] stats_with "/platform" )
and not ( [class match [IP::client_addr] equals allowed-host] ) } then {
Reject the request
reject
} else {
Allow the request
}
}
Example2: Utilizing a
command to unescape possible URI escape sequences.[URI::decode]
when HTTP_REQUEST {
if { ( [URI::decode [string tolower [HTTP::path]]] stats_with "/platform/" )
and not ( [class match [IP::client_addr] equals DG_Allowed_IPs] ) } then {
Reject the request
reject
} else {
Allow the request
}
}
Note: Both examples should work stable even if a bad guy requests a URL like https://www.yoursite.de/platform
somefolder/somepage.php%2F
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
