Forum Discussion
Faintly_Lucky
Nimbostratus
Apr 24, 2010Second set of eyes, please
Hello all:
I wrote this iRule with people who don't have many public addresses or have found the need to conserve them in mind. I just started a new job, so I don't have access to any F5s to check my syntax. I'm also not an application or systems person, so I was hoping some of you gurus will take pity on the poor network guy and let me know if I have any of my commands out of order. I don't have much experience with TCL, but I do have program design, so I'm pretty sure that I have all of my brackets in the right place and that there aren't any flaws in my modules, but those are famous last words, so please speak up if you see something. The purpose of this rule is to take a list of sites that do SSL off-loading and switch pool and SSL client profile based on HTTP::host. I'd like feedback about my syntax, command order, and efficiency if that wouldn't be too much trouble.
Thanks in advance,
Lucky
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
pool $default_pool
array set hostpool {
yoursite.yourdomain.com yoursite.yourdomain.com_pool
yoursite.yourdomain.com yoursite.yourdomain.com_pool
yoursite.yourdomain.com yoursite.yourdomain.com_pool
yoursite.yourdomain.com yoursite.yourdomain.com_pool
}
array set client_ssl_select {
yoursite.yourdomain.com client_ssl_yoursite.yourdomain.com
yoursite.yourdomain.com client_ssl_yoursite.yourdomain.com
yoursite.yourdomain.com client_ssl_yoursite.yourdomain.com
yoursite.yourdomain.com client_ssl_yoursite.yourdomain.com
}
foreach { site pool } [ array get hostpool ] {
switch [string tolower [HTTP::host]] {
$site { pool $pool {
foreach { name profile } [ array get client_ssl_select ] {
switch [string tolower [HTTP::host]] {
$name { SSL::profile $profile SSL::renegotiate
}
}
}
}
}
}
}
- hoolio
Cirrostratus
Do you have a single SSL cert which is valid for all of the hostnames a client could be requesting for this virtual server? If so, you probably don't need the iRule as you can use that single cert. If you don't have such a cert, then the iRule won't work. Clients who make a request to a hostname which isn't listed in the SSL cert will get a mismatched cert warning from their browser. This will happen during the initial SSL handshake and before you have a chance to renegotiate the SSL handshake again from the HTTP_REQUEST event. - Faintly_Lucky
Nimbostratus
Aaron: - hoolio
Cirrostratus
Hi Lucky,class host_pool_map_class { "host1 pool1" "host_other some_pool" }
when HTTP_REQUEST { Check if there is a host header value if {[HTTP::host] ne "" { Check if the requested Host is in the host_pool_map_class datagroup set my_pool [findclass [string tolower [HTTP::host]] $::host_pool_map_class " "] if { $my_pool ne "" } { pool $my_pool } } }
- Faintly_Lucky
Nimbostratus
Aaron: - Faintly_Lucky
Nimbostratus
Aaron or anyone else who can answer this: - hoolio
Cirrostratus
Hi Lucky,
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