Forum Discussion
Ryan_Rowe_79249
Nimbostratus
Dec 23, 2009Ip Restrict then client cert check
BigIP 8.3.3 and 8.4.1 (hopefully there is no difference)
So here is what I want to do. If an IP is in a datagroup then passthrough but if not then authenticate with an SSL cert.
I think it would look something like this:
when HTTP_REQUEST {
if {[matchclass [IP::client_addr] equals $::IPdatagroup]{
} elseif {
} elseif {
HTTP::respond 403 content "403 - Forbidden"
}
}
Anyone know the best way to do this I want to basically do Cert Authentication to people not in the IP group.
- Ryan_Rowe_79249
Nimbostratus
Here I found this:when RULE_INIT { set ::debug 1 } when CLIENTSSL_CLIENTCERT { Example Subject DN: /C=AU/ST=NSW/L=Syd/O=Your Organisation/OU=Your OU/CN=John Smith set subject_dn [X509::subject [SSL::cert 0]] if { $subject_dn != "" }{ if { $debug }{ log "Client Certificate received: $subject_dn"} } } when HTTP_REQUEST { if {[matchclass [IP::client_addr] equals $::IPdatagroup]{ } elseif {($subject_dn contains "CN=Company A") } { } } elseif { HTTP::respond 403 content "403 - Forbidden" } } }
- Ryan_Rowe_79249
Nimbostratus
So this is what I did and it seems not to work...both profiles work but not the Irule.when CLIENT_ACCEPTED { if { [matchclass [IP::client_addr] equals $::Test_IPs]} { SSL::profile NoBrowserCert } else { SSL::profile BrowserCert } } when HTTP_REQUEST { SSL::renegotiate }
- hoolio
Cirrostratus
Can you remove the HTTP_REQUEST event and retest? Also, you only need one set of square braces around matchclass. It shouldn't matter which client SSL profile you specify in the VIP config as the iRule will set it based on the client IP address check.when CLIENT_ACCEPTED { if { [matchclass [IP::client_addr] equals $::Test_IPs]} { SSL::profile NoBrowserCert } else { SSL::profile BrowserCert } }
- Ryan_Rowe_79249
Nimbostratus
So if I am not in the Test_ip class it will ask for a cert but then will continue to pass me if I don't have one and if I am in the class then it will just pass me through without asking for a cert. I need it to block me if I don't have a browser cert and am not in the Test_ip class. - hoolio
Cirrostratus
If you want to use this simple iRule and two client SSL profiles, you'll need to set one profile to require a client cert in order to prevent a client without a client cert from accessing the pool. I'd suggest testing the client cert profile further without the iRule. Once you get that working, then you can test the iRule and both profiles. - Ryan_Rowe_79249
Nimbostratus
I opened a ticket with F5 about the SSL profile and they said that they need to switch the client authorization from require to request and that made it work. They said this Try changing the "peer cert mode require" to "peer cert mode request"profile clientssl BrowserCert { defaults from clientssl key "Encrypt-Cert.key" cert "Encrypt-Cert.crt" ca file "Encrypt-CA.crt" peer cert mode require authenticate once }
profile clientssl NoBrowserCert { defaults from clientssl key "Encrypt-Cert.key" cert "Encrypt-Cert.crt" chain "Encrypt-CA.crt" }
profile clientssl clientssl { mode enable key "default.key" cert "default.crt" chain none ca file none crl file none client cert ca none ciphers "DEFAULT" modssl methods disable cache size 20000 cache timeout 3600 renegotiate period indefinite renegotiate size indefinite renegotiate max record delay 10 handshake timeout 60 alert timeout 60 peer cert mode ignore authenticate once authenticate depth 9 unclean shutdown enable strict resume disable }
- hoolio
Cirrostratus
Setting the client cert mode to request is only useful if the iRule or the web application validates the client cert. If you want LTM to do this using the client SSL profile it must be set to require. If you have a case open with F5 Support, you could ask them to help you capture a tcpdump and use ssldump to troubleshoot the failure. You might also be able to get some relevant info from the /var/log/ltm log file (somewhat doubtful on this though).
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