Forum Discussion
winifred_corbet
Nimbostratus
Jun 24, 2010Block traffic by IP address and Allow external access by domain name?
Currently we have an irule in place that allows traffic to specific URLs, by allowing the interal IP addresses only.
Now we need to allow very specifc external domains in (we cannot get an IP range), like akamai.net, how would we accomplish that?
This is what we have now:
when HTTP_REQUEST {
if {([matchclass [HTTP::uri] starts_with $::securePaths]) and not ([matchclass [IP::client_addr] equals $::our_internal_ips])}{
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]"
}
}
5 Replies
- hoolio
Cirrostratus
If you wanted to check the domain of the client IP address, you'd need to get the PTR record using NAME::lookup (for pre-10.1) or RESOLV::lookup for 10.1.0+. See the wiki pages for details and examples:
http://devcentral.f5.com/wiki/default.aspx/iRules/NAME__lookup.html
http://devcentral.f5.com/wiki/default.aspx/iRules/RESOLV__lookup.html
Aaron - winifred_corbet
Nimbostratus
We are not on V10 yet, still on v9.4.8
So there is no way to modify this rule to "allow" specific domains? We would need to do a lookup and compare that address to a list? - hoolio
Cirrostratus
If I understand your scenario correctly, yes, you'd need to do a reverse lookup of the client IP to see what domain the IP is part of. There isn't anything within an HTTP request that you can rely on to get the DNS domain of a client. You could add that DNS check to the existing rule.
I could see the DNS call adding latency to the connections through LTM.
Aaron - winifred_corbet
Nimbostratus
So, I can't add a list of allowed domain nam in a "data group" to allow? - hoolio
Cirrostratus
I was suggesting you'd need to do a DNS query to determine what domain the client IP PTR shows. You could check that return value against a datagroup to see if it's allowed.
If that's not what you're thinking of, can you clarify what domain name you want to check (client DNS PTR record, Referer header, Host header, etc).
Aaron
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