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]"
}
}
- 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: - winifred_corbet
Nimbostratus
We are not on V10 yet, still on v9.4.8 - 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. - 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.
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