Forum Discussion
I need help with an iRule to restrict inbound connections to certain IPs
Hi,
You can use the following irule to disallow access to specific urls to users :
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] starts_with "/devicemanagement/enroll" or [string tolower [HTTP::path]] starts_with "/deviceservices/enrollment/airwatchenroll.aws" and ![class match [IP::client_addr] equals irdg-mdm-test] } {
log local0. "[IP::client_addr] - Matched default policy: Access Denied"
reject
return
}
}
This irule will allow IP addresses defined in the datagroup named irdg-mdm-test to access specified urls. Other IPs will be rejected.
Maybe, you can also change the
reject command to something more user friendly like
HTTP::respond 403 content "Request Not Allowed"
Note : Pay attention that you don't have other irules, LTM policies or whatever else that bypass this irule processing.
- Yann_Desmarest_Jul 30, 2016
Nacreous
You may also expect something more scalable :
when HTTP_REQUEST { if { [class match [HTTP::path] contains url-mdm-test] and ![class match [IP::client_addr] equals irdg-mdm-test] } { log local0. "[IP::client_addr] - Matched default policy: Access Denied" reject return } } - bmohanak_276891Aug 01, 2016
Cirrus
Yann,
I have changed the iRule to above but connections are still being allowed when I try to access from an machine not from this list.
- Yann_Desmarest_Aug 02, 2016
Nacreous
Hi,
Hi updated the irule above. Can you check that you get the logs from the irule in the /var/log/ltm logfile ?
Do you have some proxy or reverse proxy between F5 and the client ?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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