Forum Discussion
Insert something into header to distiguish public and private IP Addresses
All, I am working with our developers and need some assistance. What they would like to do is insert a custom header based on the client address. If it is RFC1918 addresses (172.18.0.0, 192.168.0.0, 10.0.0.0 addresses) they don't have to validate the user. Any other address is seen as an external user and we would like to have a custom header inserted. If they find this header on any packet, we assume the request is an external user attempting to access an internal resource, so we do validation against that user.
I tried this but I don't think this is what I am looking for, as far as a custom header and it is not passing validation within iRule editor.
when CLIENT_ACCEPTED {
if {[IP::addr[IP::remote_addr] equals 172.18.0.0 255.0.0.0] or [IP::addr[IP::remote_addr] equals 10.0.0.0 255.0.0.0]}{
HTTP::header insert ["internal_user"]
}else {
HTTP::header insert ["external_user"]
}
}
when CLIENT_ACCEPTED {
if {[IP::addr[IP::remote_addr] equals 172.18.0.0 255.0.0.0] or [IP::addr[IP::remote_addr] equals 10.0.0.0 255.0.0.0]}{
HTTP::header insert ["internal_user"]
}else {
HTTP::header insert ["external_user"]
}
}
Any ideas? Hopefully someone has seen this before.
Thanks...
Andy
- hooleylistCirrostratusHi Andy,
when CLIENT_ACCEPTED { if { [IP::addr [IP::remote_addr] equals 172.16.0.0/12] or [IP::addr [IP::remote_addr] equals 10.0.0.0/8]}{ HTTP::header insert "user_type" "internal_user" } else { HTTP::header insert "user_type" "external_user" } }
- Andrew_7467NimbostratusHey Hoolio thanks so much!
- Michael_YatesNimbostratusHi Andrew,
- Andrew_7467NimbostratusAwesome! Michael and Hoolio, thanks a bunch to both of you. I guess I was missing the target but hitting the tree. DevCentral rocks. Moving on the acceptance testing and will let you know how that goes.
- hooleylistCirrostratusPosted By Michael Yates on 09/09/2011 10:51 AM
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