]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl/sample: adds ssl_bc_is_resumed fetch keyword.
authorEmeric Brun <ebrun@haproxy.com>
Mon, 19 Feb 2018 15:14:12 +0000 (16:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Feb 2018 15:50:20 +0000 (16:50 +0100)
Returns true when the back connection was made over an SSL/TLS transport
layer and the newly created SSL session was resumed using a cached
session or a TLS ticket.

doc/configuration.txt
src/ssl_sock.c

index 14d7063c9fa00e7b4c43780f3dbdbba94294ba35..b770b5cbb4ec852602cb1abb45f4913b624ac39e 100644 (file)
@@ -14412,6 +14412,11 @@ ssl_bc_cipher : string
   Returns the name of the used cipher when the outgoing connection was made
   over an SSL/TLS transport layer.
 
+ssl_bc_is_resumed : boolean
+  Returns true when the back connection was made over an SSL/TLS transport
+  layer and the newly created SSL session was resumed using a cached
+  session or a TLS ticket.
+
 ssl_bc_protocol : string
   Returns the name of the used protocol when the outgoing connection was made
   over an SSL/TLS transport layer.
index 6f1c113c5644c0d1dec15352d91aed011643fb80..fc1ead17647d6fca41b53d47cfa39cd3ec6fc908 100644 (file)
@@ -6603,11 +6603,16 @@ 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 */
+/* boolean, returns true if client session has been resumed.
+ * This function is also usable on backend conn if the fetch keyword 5th
+ * char is 'b'.
+ */
 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);
+       struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
+                                           smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+
 
        smp->data.type = SMP_T_BOOL;
        smp->data.u.sint = (conn && conn->xprt == &ssl_sock) &&
@@ -8519,6 +8524,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
        { "ssl_bc",                 smp_fetch_ssl_fc,             0,                   NULL,    SMP_T_BOOL, SMP_USE_L5SRV },
        { "ssl_bc_alg_keysize",     smp_fetch_ssl_fc_alg_keysize, 0,                   NULL,    SMP_T_SINT, SMP_USE_L5SRV },
        { "ssl_bc_cipher",          smp_fetch_ssl_fc_cipher,      0,                   NULL,    SMP_T_STR,  SMP_USE_L5SRV },
+       { "ssl_bc_is_resumed",      smp_fetch_ssl_fc_is_resumed,  0,                   NULL,    SMP_T_BOOL, SMP_USE_L5SRV },
        { "ssl_bc_protocol",        smp_fetch_ssl_fc_protocol,    0,                   NULL,    SMP_T_STR,  SMP_USE_L5SRV },
        { "ssl_bc_unique_id",       smp_fetch_ssl_fc_unique_id,   0,                   NULL,    SMP_T_BIN,  SMP_USE_L5SRV },
        { "ssl_bc_use_keysize",     smp_fetch_ssl_fc_use_keysize, 0,                   NULL,    SMP_T_SINT, SMP_USE_L5SRV },