]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: Add sample fetch which identifies if the SSL session has been resumed
authorNenad Merdanovic <nmerdan@anine.io>
Mon, 18 May 2015 00:28:57 +0000 (02:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 May 2015 05:07:53 +0000 (07:07 +0200)
Signed-off-by: Nenad Merdanovic <nmerdan@anine.io>
doc/configuration.txt
src/ssl_sock.c

index 7af647ff73d40e52a5dd82add7c9910fd63e3759..1688bd7b4bc335a90d02281960b6af11812edde4 100644 (file)
@@ -11962,6 +11962,10 @@ ssl_fc_has_sni : boolean
   that the SSL library is build with support for TLS extensions enabled (check
   haproxy -vv).
 
+ssl_fc_is_resumed: boolean
+  Returns true if the SSL/TLS session has been resumed through the use of
+  SSL session cache or TLS tickets.
+
 ssl_fc_npn : string
   This extracts the Next Protocol Negotiation field from an incoming connection
   made via a TLS transport layer and locally deciphered by haproxy. The result
index 9a47cf14f72bd35f9844231ae3306645bb6f45e8..9302869b92863ac06a937abdd5f982e98a5dc805 100644 (file)
@@ -3716,6 +3716,19 @@ smp_fetch_ssl_fc_has_sni(const struct arg *args, struct sample *smp, const char
 #endif
 }
 
+/* boolean, returns true if client session has been resumed */
+static int
+smp_fetch_ssl_fc_is_resumed(const struct arg *args, struct sample *smp, const char *kw, void *private)
+{
+       struct connection *conn = objt_conn(smp->sess->origin);
+
+       smp->type = SMP_T_BOOL;
+       smp->data.uint = (conn && conn->xprt == &ssl_sock) &&
+               conn->xprt_ctx &&
+               SSL_session_reused(conn->xprt_ctx);
+       return 1;
+}
+
 /* string, returns the used cipher if front conn. transport layer is SSL.
  * This function is also usable on backend conn if the fetch keyword 5th
  * char is 'b'.
@@ -4876,6 +4889,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
        { "ssl_fc_cipher",          smp_fetch_ssl_fc_cipher,      0,                   NULL,    SMP_T_STR,  SMP_USE_L5CLI },
        { "ssl_fc_has_crt",         smp_fetch_ssl_fc_has_crt,     0,                   NULL,    SMP_T_BOOL, SMP_USE_L5CLI },
        { "ssl_fc_has_sni",         smp_fetch_ssl_fc_has_sni,     0,                   NULL,    SMP_T_BOOL, SMP_USE_L5CLI },
+       { "ssl_fc_is_resumed",      smp_fetch_ssl_fc_is_resumed,  0,                   NULL,    SMP_T_BOOL, SMP_USE_L5CLI },
 #ifdef OPENSSL_NPN_NEGOTIATED
        { "ssl_fc_npn",             smp_fetch_ssl_fc_npn,         0,                   NULL,    SMP_T_STR,  SMP_USE_L5CLI },
 #endif