blob: 710ed4c027ec3437246f08d8e65e2263d9c555c5 [file] [log] [blame]
Willy Tarreaud4c33c82013-01-07 21:59:07 +01001/*
2 * General protocol-agnostic payload-based sample fetches and ACLs
3 *
4 * Copyright 2000-2013 Willy Tarreau <w@1wt.eu>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <stdlib.h>
14#include <string.h>
15
16#include <proto/acl.h>
17#include <proto/arg.h>
18#include <proto/channel.h>
Thierry FOURNIERed66c292013-11-28 11:05:19 +010019#include <proto/pattern.h>
Willy Tarreaud4c33c82013-01-07 21:59:07 +010020#include <proto/payload.h>
21#include <proto/sample.h>
22
23
24/************************************************************************/
25/* All supported sample fetch functions must be declared here */
26/************************************************************************/
27
28/* wait for more data as long as possible, then return TRUE. This should be
29 * used with content inspection.
30 */
31static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +020032smp_fetch_wait_end(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +010033{
Thierry FOURNIER0786d052015-05-11 15:42:45 +020034 if (!(smp->opt & SMP_OPT_FINAL)) {
Willy Tarreaud4c33c82013-01-07 21:59:07 +010035 smp->flags |= SMP_F_MAY_CHANGE;
36 return 0;
37 }
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +020038 smp->data.type = SMP_T_BOOL;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +020039 smp->data.u.sint = 1;
Willy Tarreaud4c33c82013-01-07 21:59:07 +010040 return 1;
41}
42
43/* return the number of bytes in the request buffer */
44static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +020045smp_fetch_len(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +010046{
Willy Tarreau22ec1ea2014-11-27 20:45:39 +010047 struct channel *chn;
48
Thierry FOURNIER0786d052015-05-11 15:42:45 +020049 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
Willy Tarreau22ec1ea2014-11-27 20:45:39 +010050 if (!chn->buf)
Willy Tarreaud4c33c82013-01-07 21:59:07 +010051 return 0;
52
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +020053 smp->data.type = SMP_T_SINT;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +020054 smp->data.u.sint = chn->buf->i;
Willy Tarreaud4c33c82013-01-07 21:59:07 +010055 smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
56 return 1;
57}
58
Pradeep Jindalbb2acf52015-09-29 10:12:57 +053059/* Returns 0 if the client didn't send a SessionTicket Extension
60 * Returns 1 if the client sent SessionTicket Extension
61 * Returns 2 if the client also sent non-zero length SessionTicket
62 * Returns SMP_T_SINT data type
63 */
64static int
65smp_fetch_req_ssl_st_ext(const struct arg *args, struct sample *smp, const char *kw, void *private)
66{
67 int hs_len, ext_len, bleft;
68 struct channel *chn;
69 unsigned char *data;
70
71 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
72 if (!chn->buf)
73 goto not_ssl_hello;
74
75 bleft = chn->buf->i;
76 data = (unsigned char *)chn->buf->p;
77
78 /* Check for SSL/TLS Handshake */
79 if (!bleft)
80 goto too_short;
81 if (*data != 0x16)
82 goto not_ssl_hello;
83
84 /* Check for SSLv3 or later (SSL version >= 3.0) in the record layer*/
85 if (bleft < 3)
86 goto too_short;
87 if (data[1] < 0x03)
88 goto not_ssl_hello;
89
90 if (bleft < 5)
91 goto too_short;
92 hs_len = (data[3] << 8) + data[4];
93 if (hs_len < 1 + 3 + 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
94 goto not_ssl_hello; /* too short to have an extension */
95
96 data += 5; /* enter TLS handshake */
97 bleft -= 5;
98
99 /* Check for a complete client hello starting at <data> */
100 if (bleft < 1)
101 goto too_short;
102 if (data[0] != 0x01) /* msg_type = Client Hello */
103 goto not_ssl_hello;
104
105 /* Check the Hello's length */
106 if (bleft < 4)
107 goto too_short;
108 hs_len = (data[1] << 16) + (data[2] << 8) + data[3];
109 if (hs_len < 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
110 goto not_ssl_hello; /* too short to have an extension */
111
112 /* We want the full handshake here */
113 if (bleft < hs_len)
114 goto too_short;
115
116 data += 4;
117 /* Start of the ClientHello message */
118 if (data[0] < 0x03 || data[1] < 0x01) /* TLSv1 minimum */
119 goto not_ssl_hello;
120
121 ext_len = data[34]; /* session_id_len */
122 if (ext_len > 32 || ext_len > (hs_len - 35)) /* check for correct session_id len */
123 goto not_ssl_hello;
124
125 /* Jump to cipher suite */
126 hs_len -= 35 + ext_len;
127 data += 35 + ext_len;
128
129 if (hs_len < 4 || /* minimum one cipher */
130 (ext_len = (data[0] << 8) + data[1]) < 2 || /* minimum 2 bytes for a cipher */
131 ext_len > hs_len)
132 goto not_ssl_hello;
133
134 /* Jump to the compression methods */
135 hs_len -= 2 + ext_len;
136 data += 2 + ext_len;
137
138 if (hs_len < 2 || /* minimum one compression method */
139 data[0] < 1 || data[0] > hs_len) /* minimum 1 bytes for a method */
140 goto not_ssl_hello;
141
142 /* Jump to the extensions */
143 hs_len -= 1 + data[0];
144 data += 1 + data[0];
145
146 if (hs_len < 2 || /* minimum one extension list length */
147 (ext_len = (data[0] << 8) + data[1]) > hs_len - 2) /* list too long */
148 goto not_ssl_hello;
149
150 hs_len = ext_len; /* limit ourselves to the extension length */
151 data += 2;
152
153 while (hs_len >= 4) {
154 int ext_type, ext_len;
155
156 ext_type = (data[0] << 8) + data[1];
157 ext_len = (data[2] << 8) + data[3];
158
159 if (ext_len > hs_len - 4) /* Extension too long */
160 goto not_ssl_hello;
161
162 /* SesstionTicket extension */
163 if (ext_type == 35) {
164 smp->data.type = SMP_T_SINT;
165 /* SessionTicket also present */
166 if (ext_len > 0)
167 smp->data.u.sint = 2;
168 /* SessionTicket absent */
169 else
170 smp->data.u.sint = 1;
171 smp->flags = SMP_F_VOLATILE;
172 return 1;
173 }
174
175 hs_len -= 4 + ext_len;
176 data += 4 + ext_len;
177 }
178 /* SessionTicket Extension not found */
179 smp->data.type = SMP_T_SINT;
180 smp->data.u.sint = 0;
181 smp->flags = SMP_F_VOLATILE;
182 return 1;
183
184 /* server name not found */
185 goto not_ssl_hello;
186
187 too_short:
188 smp->flags = SMP_F_MAY_CHANGE;
189
190 not_ssl_hello:
191 return 0;
192}
193
Nenad Merdanovic5fc7d7e2015-07-07 22:00:17 +0200194/* Returns TRUE if the client sent Supported Elliptic Curves Extension (0x000a)
195 * Mainly used to detect if client supports ECC cipher suites.
196 */
197static int
198smp_fetch_req_ssl_ec_ext(const struct arg *args, struct sample *smp, const char *kw, void *private)
199{
200 int hs_len, ext_len, bleft;
201 struct channel *chn;
202 unsigned char *data;
203
204 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
205 if (!chn->buf)
206 goto not_ssl_hello;
207
208 bleft = chn->buf->i;
209 data = (unsigned char *)chn->buf->p;
210
211 /* Check for SSL/TLS Handshake */
212 if (!bleft)
213 goto too_short;
214 if (*data != 0x16)
215 goto not_ssl_hello;
216
217 /* Check for SSLv3 or later (SSL version >= 3.0) in the record layer*/
218 if (bleft < 3)
219 goto too_short;
220 if (data[1] < 0x03)
221 goto not_ssl_hello;
222
223 if (bleft < 5)
224 goto too_short;
225 hs_len = (data[3] << 8) + data[4];
226 if (hs_len < 1 + 3 + 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
227 goto not_ssl_hello; /* too short to have an extension */
228
229 data += 5; /* enter TLS handshake */
230 bleft -= 5;
231
232 /* Check for a complete client hello starting at <data> */
233 if (bleft < 1)
234 goto too_short;
235 if (data[0] != 0x01) /* msg_type = Client Hello */
236 goto not_ssl_hello;
237
238 /* Check the Hello's length */
239 if (bleft < 4)
240 goto too_short;
241 hs_len = (data[1] << 16) + (data[2] << 8) + data[3];
242 if (hs_len < 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
243 goto not_ssl_hello; /* too short to have an extension */
244
245 /* We want the full handshake here */
246 if (bleft < hs_len)
247 goto too_short;
248
249 data += 4;
250 /* Start of the ClientHello message */
251 if (data[0] < 0x03 || data[1] < 0x01) /* TLSv1 minimum */
252 goto not_ssl_hello;
253
254 ext_len = data[34]; /* session_id_len */
255 if (ext_len > 32 || ext_len > (hs_len - 35)) /* check for correct session_id len */
256 goto not_ssl_hello;
257
258 /* Jump to cipher suite */
259 hs_len -= 35 + ext_len;
260 data += 35 + ext_len;
261
262 if (hs_len < 4 || /* minimum one cipher */
263 (ext_len = (data[0] << 8) + data[1]) < 2 || /* minimum 2 bytes for a cipher */
264 ext_len > hs_len)
265 goto not_ssl_hello;
266
267 /* Jump to the compression methods */
268 hs_len -= 2 + ext_len;
269 data += 2 + ext_len;
270
271 if (hs_len < 2 || /* minimum one compression method */
272 data[0] < 1 || data[0] > hs_len) /* minimum 1 bytes for a method */
273 goto not_ssl_hello;
274
275 /* Jump to the extensions */
276 hs_len -= 1 + data[0];
277 data += 1 + data[0];
278
279 if (hs_len < 2 || /* minimum one extension list length */
280 (ext_len = (data[0] << 8) + data[1]) > hs_len - 2) /* list too long */
281 goto not_ssl_hello;
282
283 hs_len = ext_len; /* limit ourselves to the extension length */
284 data += 2;
285
286 while (hs_len >= 4) {
287 int ext_type, ext_len;
288
289 ext_type = (data[0] << 8) + data[1];
290 ext_len = (data[2] << 8) + data[3];
291
292 if (ext_len > hs_len - 4) /* Extension too long */
293 goto not_ssl_hello;
294
295 /* Elliptic curves extension */
296 if (ext_type == 10) {
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200297 smp->data.type = SMP_T_BOOL;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200298 smp->data.u.sint = 1;
Nenad Merdanovic8a39a1f2015-07-15 12:51:11 +0200299 smp->flags = SMP_F_VOLATILE;
Nenad Merdanovic5fc7d7e2015-07-07 22:00:17 +0200300 return 1;
301 }
302
303 hs_len -= 4 + ext_len;
304 data += 4 + ext_len;
305 }
306 /* server name not found */
307 goto not_ssl_hello;
308
309 too_short:
310 smp->flags = SMP_F_MAY_CHANGE;
311
312 not_ssl_hello:
313
314 return 0;
315}
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100316/* returns the type of SSL hello message (mainly used to detect an SSL hello) */
317static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200318smp_fetch_ssl_hello_type(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100319{
320 int hs_len;
321 int hs_type, bleft;
322 struct channel *chn;
323 const unsigned char *data;
324
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200325 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
Willy Tarreau22ec1ea2014-11-27 20:45:39 +0100326 if (!chn->buf)
Willy Tarreau83f25922014-11-26 13:24:24 +0100327 goto not_ssl_hello;
328
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100329 bleft = chn->buf->i;
330 data = (const unsigned char *)chn->buf->p;
331
332 if (!bleft)
333 goto too_short;
334
335 if ((*data >= 0x14 && *data <= 0x17) || (*data == 0xFF)) {
336 /* SSLv3 header format */
337 if (bleft < 9)
338 goto too_short;
339
340 /* ssl version 3 */
341 if ((data[1] << 16) + data[2] < 0x00030000)
342 goto not_ssl_hello;
343
344 /* ssl message len must present handshake type and len */
345 if ((data[3] << 8) + data[4] < 4)
346 goto not_ssl_hello;
347
348 /* format introduced with SSLv3 */
349
350 hs_type = (int)data[5];
351 hs_len = ( data[6] << 16 ) + ( data[7] << 8 ) + data[8];
352
353 /* not a full handshake */
354 if (bleft < (9 + hs_len))
355 goto too_short;
356
357 }
358 else {
359 goto not_ssl_hello;
360 }
361
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200362 smp->data.type = SMP_T_SINT;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200363 smp->data.u.sint = hs_type;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100364 smp->flags = SMP_F_VOLATILE;
365
366 return 1;
367
368 too_short:
369 smp->flags = SMP_F_MAY_CHANGE;
370
371 not_ssl_hello:
372
373 return 0;
374}
375
376/* Return the version of the SSL protocol in the request. It supports both
377 * SSLv3 (TLSv1) header format for any message, and SSLv2 header format for
378 * the hello message. The SSLv3 format is described in RFC 2246 p49, and the
379 * SSLv2 format is described here, and completed p67 of RFC 2246 :
380 * http://wp.netscape.com/eng/security/SSL_2.html
381 *
382 * Note: this decoder only works with non-wrapping data.
383 */
384static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200385smp_fetch_req_ssl_ver(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100386{
387 int version, bleft, msg_len;
388 const unsigned char *data;
Thierry FOURNIER0a9a2b82015-05-11 15:20:49 +0200389 struct channel *req = &smp->strm->req;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100390
Thierry FOURNIER0a9a2b82015-05-11 15:20:49 +0200391 if (!req->buf)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100392 return 0;
393
394 msg_len = 0;
Thierry FOURNIER0a9a2b82015-05-11 15:20:49 +0200395 bleft = req->buf->i;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100396 if (!bleft)
397 goto too_short;
398
Thierry FOURNIER0a9a2b82015-05-11 15:20:49 +0200399 data = (const unsigned char *)req->buf->p;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100400 if ((*data >= 0x14 && *data <= 0x17) || (*data == 0xFF)) {
401 /* SSLv3 header format */
Lukas Tribusc93242c2015-11-05 13:59:30 +0100402 if (bleft < 11)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100403 goto too_short;
404
Lukas Tribusc93242c2015-11-05 13:59:30 +0100405 version = (data[1] << 16) + data[2]; /* record layer version: major, minor */
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100406 msg_len = (data[3] << 8) + data[4]; /* record length */
407
408 /* format introduced with SSLv3 */
409 if (version < 0x00030000)
410 goto not_ssl;
411
Lukas Tribusc93242c2015-11-05 13:59:30 +0100412 /* message length between 6 and 2^14 + 2048 */
413 if (msg_len < 6 || msg_len > ((1<<14) + 2048))
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100414 goto not_ssl;
415
416 bleft -= 5; data += 5;
Lukas Tribusc93242c2015-11-05 13:59:30 +0100417
418 /* return the client hello client version, not the record layer version */
419 version = (data[4] << 16) + data[5]; /* client hello version: major, minor */
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100420 } else {
421 /* SSLv2 header format, only supported for hello (msg type 1) */
422 int rlen, plen, cilen, silen, chlen;
423
424 if (*data & 0x80) {
425 if (bleft < 3)
426 goto too_short;
427 /* short header format : 15 bits for length */
428 rlen = ((data[0] & 0x7F) << 8) | data[1];
429 plen = 0;
430 bleft -= 2; data += 2;
431 } else {
432 if (bleft < 4)
433 goto too_short;
434 /* long header format : 14 bits for length + pad length */
435 rlen = ((data[0] & 0x3F) << 8) | data[1];
436 plen = data[2];
437 bleft -= 3; data += 2;
438 }
439
440 if (*data != 0x01)
441 goto not_ssl;
442 bleft--; data++;
443
444 if (bleft < 8)
445 goto too_short;
446 version = (data[0] << 16) + data[1]; /* version: major, minor */
447 cilen = (data[2] << 8) + data[3]; /* cipher len, multiple of 3 */
448 silen = (data[4] << 8) + data[5]; /* session_id_len: 0 or 16 */
449 chlen = (data[6] << 8) + data[7]; /* 16<=challenge length<=32 */
450
451 bleft -= 8; data += 8;
452 if (cilen % 3 != 0)
453 goto not_ssl;
454 if (silen && silen != 16)
455 goto not_ssl;
456 if (chlen < 16 || chlen > 32)
457 goto not_ssl;
458 if (rlen != 9 + cilen + silen + chlen)
459 goto not_ssl;
460
461 /* focus on the remaining data length */
462 msg_len = cilen + silen + chlen + plen;
463 }
464 /* We could recursively check that the buffer ends exactly on an SSL
465 * fragment boundary and that a possible next segment is still SSL,
466 * but that's a bit pointless. However, we could still check that
467 * all the part of the request which fits in a buffer is already
468 * there.
469 */
Thierry FOURNIER0a9a2b82015-05-11 15:20:49 +0200470 if (msg_len > channel_recv_limit(req) + req->buf->data - req->buf->p)
471 msg_len = channel_recv_limit(req) + req->buf->data - req->buf->p;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100472
473 if (bleft < msg_len)
474 goto too_short;
475
476 /* OK that's enough. We have at least the whole message, and we have
477 * the protocol version.
478 */
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200479 smp->data.type = SMP_T_SINT;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200480 smp->data.u.sint = version;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100481 smp->flags = SMP_F_VOLATILE;
482 return 1;
483
484 too_short:
485 smp->flags = SMP_F_MAY_CHANGE;
486 not_ssl:
487 return 0;
488}
489
490/* Try to extract the Server Name Indication that may be presented in a TLS
491 * client hello handshake message. The format of the message is the following
492 * (cf RFC5246 + RFC6066) :
493 * TLS frame :
494 * - uint8 type = 0x16 (Handshake)
495 * - uint16 version >= 0x0301 (TLSv1)
496 * - uint16 length (frame length)
497 * - TLS handshake :
498 * - uint8 msg_type = 0x01 (ClientHello)
499 * - uint24 length (handshake message length)
500 * - ClientHello :
501 * - uint16 client_version >= 0x0301 (TLSv1)
502 * - uint8 Random[32] (4 first ones are timestamp)
503 * - SessionID :
504 * - uint8 session_id_len (0..32) (SessionID len in bytes)
505 * - uint8 session_id[session_id_len]
506 * - CipherSuite :
507 * - uint16 cipher_len >= 2 (Cipher length in bytes)
508 * - uint16 ciphers[cipher_len/2]
509 * - CompressionMethod :
510 * - uint8 compression_len >= 1 (# of supported methods)
511 * - uint8 compression_methods[compression_len]
512 * - optional client_extension_len (in bytes)
513 * - optional sequence of ClientHelloExtensions (as many bytes as above):
514 * - uint16 extension_type = 0 for server_name
515 * - uint16 extension_len
516 * - opaque extension_data[extension_len]
517 * - uint16 server_name_list_len (# of bytes here)
518 * - opaque server_names[server_name_list_len bytes]
519 * - uint8 name_type = 0 for host_name
520 * - uint16 name_len
521 * - opaque hostname[name_len bytes]
522 */
523static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200524smp_fetch_ssl_hello_sni(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100525{
526 int hs_len, ext_len, bleft;
527 struct channel *chn;
528 unsigned char *data;
529
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200530 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
Willy Tarreau22ec1ea2014-11-27 20:45:39 +0100531 if (!chn->buf)
Willy Tarreau83f25922014-11-26 13:24:24 +0100532 goto not_ssl_hello;
533
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100534 bleft = chn->buf->i;
535 data = (unsigned char *)chn->buf->p;
536
537 /* Check for SSL/TLS Handshake */
538 if (!bleft)
539 goto too_short;
540 if (*data != 0x16)
541 goto not_ssl_hello;
542
Lukas Tribus57d22972014-04-10 21:36:22 +0200543 /* Check for SSLv3 or later (SSL version >= 3.0) in the record layer*/
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100544 if (bleft < 3)
545 goto too_short;
Lukas Tribus57d22972014-04-10 21:36:22 +0200546 if (data[1] < 0x03)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100547 goto not_ssl_hello;
548
549 if (bleft < 5)
550 goto too_short;
551 hs_len = (data[3] << 8) + data[4];
552 if (hs_len < 1 + 3 + 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
553 goto not_ssl_hello; /* too short to have an extension */
554
555 data += 5; /* enter TLS handshake */
556 bleft -= 5;
557
558 /* Check for a complete client hello starting at <data> */
559 if (bleft < 1)
560 goto too_short;
561 if (data[0] != 0x01) /* msg_type = Client Hello */
562 goto not_ssl_hello;
563
564 /* Check the Hello's length */
565 if (bleft < 4)
566 goto too_short;
567 hs_len = (data[1] << 16) + (data[2] << 8) + data[3];
568 if (hs_len < 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
569 goto not_ssl_hello; /* too short to have an extension */
570
571 /* We want the full handshake here */
572 if (bleft < hs_len)
573 goto too_short;
574
575 data += 4;
576 /* Start of the ClientHello message */
577 if (data[0] < 0x03 || data[1] < 0x01) /* TLSv1 minimum */
578 goto not_ssl_hello;
579
580 ext_len = data[34]; /* session_id_len */
581 if (ext_len > 32 || ext_len > (hs_len - 35)) /* check for correct session_id len */
582 goto not_ssl_hello;
583
584 /* Jump to cipher suite */
585 hs_len -= 35 + ext_len;
586 data += 35 + ext_len;
587
588 if (hs_len < 4 || /* minimum one cipher */
589 (ext_len = (data[0] << 8) + data[1]) < 2 || /* minimum 2 bytes for a cipher */
590 ext_len > hs_len)
591 goto not_ssl_hello;
592
593 /* Jump to the compression methods */
594 hs_len -= 2 + ext_len;
595 data += 2 + ext_len;
596
597 if (hs_len < 2 || /* minimum one compression method */
598 data[0] < 1 || data[0] > hs_len) /* minimum 1 bytes for a method */
599 goto not_ssl_hello;
600
601 /* Jump to the extensions */
602 hs_len -= 1 + data[0];
603 data += 1 + data[0];
604
605 if (hs_len < 2 || /* minimum one extension list length */
606 (ext_len = (data[0] << 8) + data[1]) > hs_len - 2) /* list too long */
607 goto not_ssl_hello;
608
609 hs_len = ext_len; /* limit ourselves to the extension length */
610 data += 2;
611
612 while (hs_len >= 4) {
613 int ext_type, name_type, srv_len, name_len;
614
615 ext_type = (data[0] << 8) + data[1];
616 ext_len = (data[2] << 8) + data[3];
617
618 if (ext_len > hs_len - 4) /* Extension too long */
619 goto not_ssl_hello;
620
621 if (ext_type == 0) { /* Server name */
622 if (ext_len < 2) /* need one list length */
623 goto not_ssl_hello;
624
625 srv_len = (data[4] << 8) + data[5];
626 if (srv_len < 4 || srv_len > hs_len - 6)
627 goto not_ssl_hello; /* at least 4 bytes per server name */
628
629 name_type = data[6];
630 name_len = (data[7] << 8) + data[8];
631
632 if (name_type == 0) { /* hostname */
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200633 smp->data.type = SMP_T_STR;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200634 smp->data.u.str.str = (char *)data + 9;
635 smp->data.u.str.len = name_len;
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100636 smp->flags = SMP_F_VOLATILE | SMP_F_CONST;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100637 return 1;
638 }
639 }
640
641 hs_len -= 4 + ext_len;
642 data += 4 + ext_len;
643 }
644 /* server name not found */
645 goto not_ssl_hello;
646
647 too_short:
648 smp->flags = SMP_F_MAY_CHANGE;
649
650 not_ssl_hello:
651
652 return 0;
653}
654
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200655/* Fetch the request RDP cookie identified in <cname>:<clen>, or any cookie if
Willy Tarreaub169eba2013-12-16 15:14:43 +0100656 * <clen> is empty (cname is then ignored). It returns the data into sample <smp>
657 * of type SMP_T_CSTR. Note: this decoder only works with non-wrapping data.
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100658 */
659int
Willy Tarreau87b09662015-04-03 00:22:06 +0200660fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, int clen)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100661{
662 int bleft;
663 const unsigned char *data;
664
Willy Tarreau53c9b4d2015-04-03 21:38:18 +0200665 if (!s->req.buf)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100666 return 0;
667
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100668 smp->flags = SMP_F_CONST;
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200669 smp->data.type = SMP_T_STR;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100670
Willy Tarreau22ec1ea2014-11-27 20:45:39 +0100671 bleft = s->req.buf->i;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100672 if (bleft <= 11)
673 goto too_short;
674
Willy Tarreau22ec1ea2014-11-27 20:45:39 +0100675 data = (const unsigned char *)s->req.buf->p + 11;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100676 bleft -= 11;
677
678 if (bleft <= 7)
679 goto too_short;
680
681 if (strncasecmp((const char *)data, "Cookie:", 7) != 0)
682 goto not_cookie;
683
684 data += 7;
685 bleft -= 7;
686
687 while (bleft > 0 && *data == ' ') {
688 data++;
689 bleft--;
690 }
691
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200692 if (clen) {
693 if (bleft <= clen)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100694 goto too_short;
695
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200696 if ((data[clen] != '=') ||
697 strncasecmp(cname, (const char *)data, clen) != 0)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100698 goto not_cookie;
699
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200700 data += clen + 1;
701 bleft -= clen + 1;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100702 } else {
703 while (bleft > 0 && *data != '=') {
704 if (*data == '\r' || *data == '\n')
705 goto not_cookie;
706 data++;
707 bleft--;
708 }
709
710 if (bleft < 1)
711 goto too_short;
712
713 if (*data != '=')
714 goto not_cookie;
715
716 data++;
717 bleft--;
718 }
719
720 /* data points to cookie value */
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200721 smp->data.u.str.str = (char *)data;
722 smp->data.u.str.len = 0;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100723
724 while (bleft > 0 && *data != '\r') {
725 data++;
726 bleft--;
727 }
728
729 if (bleft < 2)
730 goto too_short;
731
732 if (data[0] != '\r' || data[1] != '\n')
733 goto not_cookie;
734
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200735 smp->data.u.str.len = (char *)data - smp->data.u.str.str;
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100736 smp->flags = SMP_F_VOLATILE | SMP_F_CONST;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100737 return 1;
738
739 too_short:
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100740 smp->flags = SMP_F_MAY_CHANGE | SMP_F_CONST;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100741 not_cookie:
742 return 0;
743}
744
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200745/* Fetch the request RDP cookie identified in the args, or any cookie if no arg
746 * is passed. It is usable both for ACL and for samples. Note: this decoder
747 * only works with non-wrapping data. Accepts either 0 or 1 argument. Argument
Willy Tarreaub169eba2013-12-16 15:14:43 +0100748 * is a string (cookie name), other types will lead to undefined behaviour. The
749 * returned sample has type SMP_T_CSTR.
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200750 */
751int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200752smp_fetch_rdp_cookie(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200753{
Thierry FOURNIER0a9a2b82015-05-11 15:20:49 +0200754 return fetch_rdp_cookie_name(smp->strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
Willy Tarreaucadd8c92013-07-22 18:09:52 +0200755}
756
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100757/* returns either 1 or 0 depending on whether an RDP cookie is found or not */
758static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200759smp_fetch_rdp_cookie_cnt(const struct arg *args, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100760{
761 int ret;
762
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200763 ret = smp_fetch_rdp_cookie(args, smp, kw, private);
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100764
765 if (smp->flags & SMP_F_MAY_CHANGE)
766 return 0;
767
768 smp->flags = SMP_F_VOLATILE;
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200769 smp->data.type = SMP_T_SINT;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200770 smp->data.u.sint = ret;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100771 return 1;
772}
773
774/* extracts part of a payload with offset and length at a given position */
775static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200776smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100777{
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200778 unsigned int len_offset = arg_p[0].data.sint;
779 unsigned int len_size = arg_p[1].data.sint;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100780 unsigned int buf_offset;
781 unsigned int buf_size = 0;
782 struct channel *chn;
783 int i;
784
785 /* Format is (len offset, len size, buf offset) or (len offset, len size) */
786 /* by default buf offset == len offset + len size */
787 /* buf offset could be absolute or relative to len offset + len size if prefixed by + or - */
788
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200789 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
Willy Tarreau22ec1ea2014-11-27 20:45:39 +0100790 if (!chn->buf)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100791 return 0;
792
793 if (len_offset + len_size > chn->buf->i)
794 goto too_short;
795
796 for (i = 0; i < len_size; i++) {
797 buf_size = (buf_size << 8) + ((unsigned char *)chn->buf->p)[i + len_offset];
798 }
799
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200800 /* buf offset may be implicit, absolute or relative. If the LSB
801 * is set, then the offset is relative otherwise it is absolute.
802 */
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100803 buf_offset = len_offset + len_size;
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200804 if (arg_p[2].type == ARGT_SINT) {
805 if (arg_p[2].data.sint & 1)
806 buf_offset += arg_p[2].data.sint >> 1;
807 else
808 buf_offset = arg_p[2].data.sint >> 1;
809 }
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100810
Willy Tarreaud7bdcb82015-09-24 16:33:10 +0200811 if (!buf_size || buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) {
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100812 /* will never match */
813 smp->flags = 0;
814 return 0;
815 }
816
817 if (buf_offset + buf_size > chn->buf->i)
818 goto too_short;
819
820 /* init chunk as read only */
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200821 smp->data.type = SMP_T_BIN;
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100822 smp->flags = SMP_F_VOLATILE | SMP_F_CONST;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200823 chunk_initlen(&smp->data.u.str, chn->buf->p + buf_offset, 0, buf_size);
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100824 return 1;
825
826 too_short:
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100827 smp->flags = SMP_F_MAY_CHANGE | SMP_F_CONST;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100828 return 0;
829}
830
831/* extracts some payload at a fixed position and length */
832static int
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200833smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100834{
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200835 unsigned int buf_offset = arg_p[0].data.sint;
836 unsigned int buf_size = arg_p[1].data.sint;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100837 struct channel *chn;
838
Thierry FOURNIER0786d052015-05-11 15:42:45 +0200839 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
Willy Tarreau22ec1ea2014-11-27 20:45:39 +0100840 if (!chn->buf)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100841 return 0;
842
Willy Tarreaud7bdcb82015-09-24 16:33:10 +0200843 if (!buf_size || buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) {
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100844 /* will never match */
845 smp->flags = 0;
846 return 0;
847 }
848
849 if (buf_offset + buf_size > chn->buf->i)
850 goto too_short;
851
852 /* init chunk as read only */
Thierry FOURNIER8c542ca2015-08-19 09:00:18 +0200853 smp->data.type = SMP_T_BIN;
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100854 smp->flags = SMP_F_VOLATILE | SMP_F_CONST;
Thierry FOURNIER136f9d32015-08-19 09:07:19 +0200855 chunk_initlen(&smp->data.u.str, chn->buf->p + buf_offset, 0, buf_size ? buf_size : (chn->buf->i - buf_offset));
Willy Tarreau3889fff2015-01-13 20:20:10 +0100856 if (!buf_size && channel_may_recv(chn) && !channel_input_closed(chn))
Willy Tarreau00f00842013-08-02 11:07:32 +0200857 smp->flags |= SMP_F_MAY_CHANGE;
858
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100859 return 1;
860
861 too_short:
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100862 smp->flags = SMP_F_MAY_CHANGE | SMP_F_CONST;
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100863 return 0;
864}
865
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100866/* This function is used to validate the arguments passed to a "payload_lv" fetch
867 * keyword. This keyword allows two positive integers and an optional signed one,
868 * with the second one being strictly positive and the third one being greater than
869 * the opposite of the two others if negative. It is assumed that the types are
870 * already the correct ones. Returns 0 on error, non-zero if OK. If <err_msg> is
871 * not NULL, it will be filled with a pointer to an error message in case of
872 * error, that the caller is responsible for freeing. The initial location must
873 * either be freeable or NULL.
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200874 *
875 * Note that offset2 is stored with SINT type, but its not directly usable as is.
876 * The value is contained in the 63 MSB and the LSB is used as a flag for marking
877 * the "relative" property of the value.
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100878 */
Thierry FOURNIER49f45af2014-12-08 19:50:43 +0100879int val_payload_lv(struct arg *arg, char **err_msg)
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100880{
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200881 int relative = 0;
882 const char *str;
883
884 if (arg[0].data.sint < 0) {
885 memprintf(err_msg, "payload offset1 must be positive");
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100886 return 0;
887 }
888
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200889 if (!arg[1].data.sint) {
890 memprintf(err_msg, "payload length must be > 0");
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100891 return 0;
892 }
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200893
894 if (arg[2].type == ARGT_STR && arg[2].data.str.len > 0) {
895 if (arg[2].data.str.str[0] == '+' || arg[2].data.str.str[0] == '-')
896 relative = 1;
897 str = arg[2].data.str.str;
898 arg[2].type = ARGT_SINT;
899 arg[2].data.sint = read_int64(&str, str + arg[2].data.str.len);
900 if (*str != '\0') {
901 memprintf(err_msg, "payload offset2 is not a number");
902 return 0;
903 }
904 if (arg[0].data.sint + arg[1].data.sint + arg[2].data.sint < 0) {
905 memprintf(err_msg, "payload offset2 too negative");
906 return 0;
907 }
908 if (relative)
909 arg[2].data.sint = ( arg[2].data.sint << 1 ) + 1;
910 }
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100911 return 1;
912}
913
914/************************************************************************/
915/* All supported sample and ACL keywords must be declared here. */
916/************************************************************************/
917
918/* Note: must not be declared <const> as its list will be overwritten.
919 * Note: fetches that may return multiple types must be declared as the lowest
920 * common denominator, the type that can be casted into all other ones. For
921 * instance IPv4/IPv6 must be declared IPv4.
922 */
Willy Tarreaudc13c112013-06-21 23:16:39 +0200923static struct sample_fetch_kw_list smp_kws = {ILH, {
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200924 { "payload", smp_fetch_payload, ARG2(2,SINT,SINT), NULL, SMP_T_BIN, SMP_USE_L6REQ|SMP_USE_L6RES },
925 { "payload_lv", smp_fetch_payload_lv, ARG3(2,SINT,SINT,STR), val_payload_lv, SMP_T_BIN, SMP_USE_L6REQ|SMP_USE_L6RES },
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100926 { "rdp_cookie", smp_fetch_rdp_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_L6REQ },
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200927 { "rdp_cookie_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_L6REQ },
928 { "rep_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6RES },
929 { "req_len", smp_fetch_len, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
930 { "req_ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100931 { "req_ssl_sni", smp_fetch_ssl_hello_sni, 0, NULL, SMP_T_STR, SMP_USE_L6REQ },
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200932 { "req_ssl_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
Willy Tarreaufa957342013-01-14 16:07:52 +0100933
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200934 { "req.len", smp_fetch_len, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200935 { "req.payload", smp_fetch_payload, ARG2(2,SINT,SINT), NULL, SMP_T_BIN, SMP_USE_L6REQ },
936 { "req.payload_lv", smp_fetch_payload_lv, ARG3(2,SINT,SINT,STR), val_payload_lv, SMP_T_BIN, SMP_USE_L6REQ },
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100937 { "req.rdp_cookie", smp_fetch_rdp_cookie, ARG1(0,STR), NULL, SMP_T_STR, SMP_USE_L6REQ },
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200938 { "req.rdp_cookie_cnt", smp_fetch_rdp_cookie_cnt, ARG1(0,STR), NULL, SMP_T_SINT, SMP_USE_L6REQ },
Nenad Merdanovic5fc7d7e2015-07-07 22:00:17 +0200939 { "req.ssl_ec_ext", smp_fetch_req_ssl_ec_ext, 0, NULL, SMP_T_BOOL, SMP_USE_L6REQ },
Pradeep Jindalbb2acf52015-09-29 10:12:57 +0530940 { "req.ssl_st_ext", smp_fetch_req_ssl_st_ext, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200941 { "req.ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
Thierry FOURNIER7654c9f2013-12-17 00:20:33 +0100942 { "req.ssl_sni", smp_fetch_ssl_hello_sni, 0, NULL, SMP_T_STR, SMP_USE_L6REQ },
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200943 { "req.ssl_ver", smp_fetch_req_ssl_ver, 0, NULL, SMP_T_SINT, SMP_USE_L6REQ },
944 { "res.len", smp_fetch_len, 0, NULL, SMP_T_SINT, SMP_USE_L6RES },
Thierry FOURNIERbf65cd42015-07-20 17:45:02 +0200945 { "res.payload", smp_fetch_payload, ARG2(2,SINT,SINT), NULL, SMP_T_BIN, SMP_USE_L6RES },
946 { "res.payload_lv", smp_fetch_payload_lv, ARG3(2,SINT,SINT,STR), val_payload_lv, SMP_T_BIN, SMP_USE_L6RES },
Thierry FOURNIER07ee64e2015-07-06 23:43:03 +0200947 { "res.ssl_hello_type", smp_fetch_ssl_hello_type, 0, NULL, SMP_T_SINT, SMP_USE_L6RES },
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100948 { "wait_end", smp_fetch_wait_end, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
949 { /* END */ },
950}};
951
952
953/* Note: must not be declared <const> as its list will be overwritten.
954 * Please take care of keeping this list alphabetically sorted.
955 */
Willy Tarreaudc13c112013-06-21 23:16:39 +0200956static struct acl_kw_list acl_kws = {ILH, {
Thierry FOURNIERc5a4e982014-03-05 16:07:08 +0100957 { "payload", "req.payload", PAT_MATCH_BIN },
958 { "payload_lv", "req.payload_lv", PAT_MATCH_BIN },
959 { "req_rdp_cookie", "req.rdp_cookie", PAT_MATCH_STR },
960 { "req_rdp_cookie_cnt", "req.rdp_cookie_cnt", PAT_MATCH_INT },
961 { "req_ssl_sni", "req.ssl_sni", PAT_MATCH_STR },
962 { "req_ssl_ver", "req.ssl_ver", PAT_MATCH_INT, pat_parse_dotted_ver },
963 { "req.ssl_ver", "req.ssl_ver", PAT_MATCH_INT, pat_parse_dotted_ver },
Willy Tarreaud4c33c82013-01-07 21:59:07 +0100964 { /* END */ },
965}};
966
967
968__attribute__((constructor))
969static void __payload_init(void)
970{
971 sample_register_fetches(&smp_kws);
972 acl_register_keywords(&acl_kws);
973}
974
975/*
976 * Local variables:
977 * c-indent-level: 8
978 * c-basic-offset: 8
979 * End:
980 */