Forum Discussion
cbarnett_13782
Nimbostratus
Feb 16, 2009Block ssl requests by ip
We need to test out a website befor we roll it out to production. So to test we want to only allow certian IP addresses accessing a virtual server. I have this working nicely for the HTTP virtual server with the following iRule.
when HTTP_REQUEST { if {[IP::client_addr] starts_with "ip address" } { pool WEBPOOL } else { reject } }
I need a simple Irule for our SSL virtual server. I applied the above rule to the ssl virtual server and it does not work. Any help would be appreciated.
- hoolio
Cirrostratus
Because the client IP address will always be the same for the duration of the TCP connection, it would be more efficient to check it once in CLIENT_ACCEPTED (triggered when a client establishes a TCP connection) versus in HTTP_REQUEST (triggered when the HTTP headers in an HTTP request are parsed). This would also allow you to use the same iRule for both VIPs.when CLIENT_ACCEPTED { Check if client IP is part of the subnet we want to allow if {[IP::addr [IP::client_addr] equals 10.0.0.0/8]}{ Specify the pool pool WEBPOOL } else { Reset the TCP connection reject } }
- cbarnett_13782
Nimbostratus
Hoolio, - hoolio
Cirrostratus
I don't think anyone has written a book about iRules (yet?). Here is a page with a lot of good links to start with: - cbarnett_13782
Nimbostratus
Hoolio, - hoolio
Cirrostratus
Possibly. What are the symptoms of the failure? Do you see any errors logged in /var/log/ltm? Can you add debug logging to the iRule to see what's happening?when CLIENT_ACCEPTED { log local0. "[IP::client_addr]:[TCP::client_port]: New TCP connection established." Check if client IP is part of the subnet we want to allow if {[IP::addr [IP::client_addr] equals 10.0.0.0/8]}{ Specify the pool log local0. "[IP::client_addr]:[TCP::client_port]: Legal IP. Connection allowed to pool." pool WEBPOOL } else { Reset the TCP connection log local0. "[IP::client_addr]:[TCP::client_port]: Invalid IP. Resetting TCP connection." reject } }
- cbarnett_13782
Nimbostratus
Aaron, - hoolio
Cirrostratus
Does it work if you remove the iRule and add the WEBPOOL as the default pool on the VIP? If so, I'm not sure what would change with the iRule. Can you post an anonymized copy of the VIP and pool configuration with and without the iRule by running 'b virtual VIP_NAME list' and 'b pool POOL_NAME list'? - cbarnett_13782
Nimbostratus
I have three pools, one for 80, one for 443, and one for 8080. The only one that works with the SSL VIP is the 443 pool. - cbarnett_13782
Nimbostratus
I figured it out, i need a different irule to point ot the different pool. I am a bine head. Thanks for all of your help!
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