For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

aliasgar215's avatar
aliasgar215
Icon for Nimbostratus rankNimbostratus
Dec 20, 2024

Switch ssl profile based on weak cipher detection via IRULE

Hi Team,

I am looking to create an IRULE to switch ssl profile, if weak cipher detected on tls1.2connection

 

I have created below script but it not accepting on f5 and giving error. Please help me correct below IRULE.

 

IRULE:-

when CLIENTSSL_HANDSHAKE {

    set hsl [HSL::open -proto UDP -pool POOL-SPLUNK-SYSLOG]

   

    # List of ciphers to log

    set log_ciphers {

        "AES256-GCM-SHA384"

        "AES128-GCM-SHA256"

        "ECDHE-RSA-AES256-CBC-SHA"

        "ECDHE-RSA-AES128-SHA256"

        "AES256-SHA"

        "AES128-SHA"

        "AES128-SHA256"

        "ECDHE-RSA-AES256-SHA384"

    }

   

    # Get the negotiated cipher

    set negotiated_cipher [SSL::cipher name]

   

    # Apply profile based on TLSv2

    if { [string match "*TLS1.2*" $negotiated_cipher] } {

        SSL::profile weak_cipher_profile

    } else {

        SSL::profile strong_cipher_profile

    }

   

    # Log details for specific ciphers

    if { [lsearch -exact $log_ciphers $negotiated_cipher] != -1 } {

        HSL::send $hsl "<190>, Cipher Matched: $negotiated_cipher, ClientIP:[IP::client_addr], F5 Vip:[IP::local_addr], Destination Port:[TCP::local_port]"

    }

}

5 Replies

  • I get below error when i try to apply this IRULE

    command is not valid in current event context (CLIENTSSL_HANDSHAKE)][SSL::profile

  • you might not need irules.
    the cipher that will be used is selected by tls server and based on order f5 client side ssl profile.
    so you just need to 1 cipher list with strong ciphers for new clients and weak ciphers for old clients and properly arrange them from strongest to weakest.

    • aliasgar215's avatar
      aliasgar215
      Icon for Nimbostratus rankNimbostratus

      I agree that keeping strong and weak cipher together will get us the same result. But i dont want to disturb the main SSL client profile. So i am looking for a IRULE solution, which can be removed without disturbing any main configuration.