Forum Discussion
RobS
Altostratus
Jun 11, 2008ACL for sub-website?
I'm pretty weak with iRules so I was wondering if anyone has an idea on how to accomplish the following:
I need an iRule that checks for users destined for a subsite on our URL and then filtering through an ACL. I think this would be accomplished by first using:
when HTTP_REQUEST {
switch -regexp [string tolower [HTTP::uri] ] {
^/xxx
After determining users are destined to this subsite I need to apply the ACL and only allow those I specified in a Data Group List. I saw the sample for the ACL, but I having difficulty figuring out how I would tie the whole thing together. Any help greatly appreciated.
Thanks!
- The_Bhattman
Nimbostratus
I haven't tested this but I think it might the logic you are looking for.class subsite { "/foo" "/foobar" "/feefifoo" } class allow { "192.168.1.1" "192.168.1.3" "192.168.1.4" } when HTTP_REQUEST { if { not ([matchclass [IP::client_addr] equals $::allow] && [matchclass [string tolower [HTTP::uri]] starts_with $::subsite]) } { } else { reject } }
class allow { "192.168.1.1" "192.168.1.3" "192.168.1.4" } when HTTP_REQUEST { switch -regex [HTTP::uri] { "^XXX" { if { not ([matchclass [IP::client_addr] equals $::allow]) } } else { reject } } }
- Deb_Allen_18Historic F5 Accountyou'd want to be sure the class you create is of type "Address" for the IP::addr comparison to work as expected.
class myIPs { host 10.10.1.1 network 192.168.1.1 255.255.255.0 }
- Deb_Allen_18Historic F5 Accountoh, and cmbhatt's first example for the additional URI comparison is preferred -- avoid regex wherever possible.
- RobS
Altostratus
CB & Deb, - hoolio
Cirrostratus
As Deb suggested before, you'd actually want to define the class as a type of 'address' to avoid doing a string comparison against the client IP address. This also allows you to define networks instead of individual hosts.class myIPs { host 10.10.1.1 network 192.168.1.1 255.255.255.0 }
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