Forum Discussion
Xavier_Gillmann
Nimbostratus
Sep 09, 2005(Client) SSL profiles config from iRules
Hi all,
First I have to say that this forum is really great: I found so many indications here... thank you everybody!! I hope this topic will contribute to this rich source of information...
I saw quite a lot of topics about control of SSL connections from iRules... one of which giving instructions to do more or less half of what I need to do: change SSL profile upon specific uri.
when HTTP_REQUEST {
if { [HTTP::uri] eq "/manual/" } {
SSL::cert mode require
log LOCAL0.warn "Requiring certificate and Renegotiate..."
log LOCAL0.warn "Set Authenticate always and depth 9..."
SSL::authenticate always
SSL::authenticate depth 9
SSL::renegotiate
} else {
SSL::cert mode ignore
log LOCAL0. "Other Pages"
}
}
My first question is what about CRL file?
With the console, switching from "require" to "ignore" apparently "cleans up" the "crl file" entry in the clientssl profile (i.e. bigip.conf)... is this also the case when switching from iRules?
If not, how to 'start with' "ignore" as cert mode (i.e. for which I cannot set the CRL from the console) ? Is it enough to directly write in the bigip.conf something like:
profile clientssl xxx {
defaults from clientssl
key "xxx.key"
cert "xxx.crt"
ca file "xxx.crt"
crl file "xxx.crl"
peer cert mode ignore
}
My second question is not a 'pure iRules' one... I have 2 valid CA... As the client SSL profile " Trusted Certificate Authorities" is single-valued, I created one SSL Certificate bundle simply appending the 2 CA into one file. And it seems to work fine...
BUT both CA publish (HTTP) their CRL as (DER) files. So I'm planning to do the same as for certificates: converting DER files to PEM files... and append them into one (which would be the xxx.crl file here above).
I guess I need some OS-level scripting to do (and automate) that... and think about something like
!/bin/bash
wget /config/ssl/ssl.crl/firstCA.crl url_to_crl_file
openssl crl -inform DER -in firstCA.crl -outform PEM -out firstCA_PEM.crl
wget /config/ssl/ssl.crl/secondCA.crl url_to_crl_file
openssl crl -inform DER -in secondCA.crl -outform PEM -out secondCA_PEM.crl
cat firstCA_PEM.crl secondCA_PEM.crl > xxx.crl
openssl crl -in xxx.crl -text -noout
This little script would be scheduled (I don't know yet how!) every day.
The problem is: wget is not installed on my BigIP... neither a c compiler (to build wget binaries!).
I know I could install them... but I feel this would introduce security risks on the BigIP... and I feel it gets a bit dirty going deeper in this direction... So my question is: is there any other (simpler?) mean to do what I'm planning to do???
thanks in advance for the help,
Xavier
- JRahm
Admin
From the configuration guide under the writing irules section: - unRuleY_95363Historic F5 AccountGood point. I suppose you will need to do your suggested work around after all but just be careful that using the TMUI afterwards doesn't remove your changes.
- unRuleY_95363Historic F5 AccountOh, BTW - you could try switching down in the CLIENT_ACCEPTED event. That event occurs at the completion of the 3-way TCP handshake before the SSL has even seen any packets.
- Xavier_Gillmann
Nimbostratus
I have to admit that I already tried that one too... but I got the following error message:[command is not valid in current event context (CLIENT_ACCEPTED)] [SSL::cert mode ignore]
- James_Yang_9981
Altostratus
How about the CR going. I also has customer need this function. - James_Yang_9981
Altostratus
Can we using SSL::profile to solve this issue? - Colin_Walker_12Historic F5 AccountThe only issue with that approach is that the SSL::profile command isn't going to work under the HTTP_REQUEST event. The SSL::renegotiate command will, but you'll need to select which profile to use ahead of time.
- James_Yang_9981
Altostratus
At last, I got this rules running:when CLIENT_ACCEPTED { set session_flag 0 } when CLIENTSSL_HANDSHAKE { log LOCAL0.warn "cert count=[SSL::cert count]" if { [SSL::cert count] ==0 } { log LOCAL0.warn "when client handshake,ssl cert count is 0,pass" } else { log LOCAL0.warn "when clent handshake , two way cert founded and the cert count is [SSL::cert count] " HTTP::release } log "Session flag is $session_flag" } when HTTP_REQUEST { if {[HTTP::uri] starts_with "/manual/" } { log "Requiring certificate...and tht request uri is :[HTTP::uri]" if {[SSL::cert count] == 0} { log local0. "when http request,ssl cert count is 0,now http collect" HTTP::collect SSL::authenticate always SSL::authenticate depth 9 SSL::cert mode require log local0. "when http request,now renegotiating" set session_flag 1 SSL::renegotiate } } else { log LOCAL0.warn "No cert needed,to server directly.And the uri is [HTTP::uri]" } log "Session_flag at end of http_request is $session_flag" }
- James_Yang_9981
Altostratus
sure, Code share will save our time on it. and it's unique feature for BIGIP.
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