This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tsg-master/src/tsg_ssl_utils.cpp

480 lines
13 KiB
C++
Raw Normal View History

Squashed commit of the following: commit 91574444c3950c37b0147ad923f8eef08e029ca8 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Dec 3 11:44:16 2019 +0800 公共字段中的通信市时长单位是:ms;转换单位 KNI发日志需等待TFE结束,需提前构造streaminfo日志字段,调整包数字节数统计位置 细化调整日志 commit ff053e3e2cad06804f852e8b46275865f4e85b0c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:38:35 2019 +0800 增加调试日志信息 commit 2d1a530165be653f5ee3ee41bc89521e1be830f4 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:27:06 2019 +0800 使用前置声明结构体,修改接口函数原型 commit 27f0cfc91a6d85c0460d87e3e3ee05e4df02dc3c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 10:33:48 2019 +0800 提供TLD_append_streaminfo函数接口供KNI使用 修改配置文件 commit ed0b17a49d4cf01294240265b5c3a907d763418d Merge: 132d807 04963fe Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:44:28 2019 +0800 Merge branch 'feature-kni' into 'develop' 增加http解析部分 See merge request tango/tsg_master!3 commit 04963fe1bfb56ce4712817d2683796d8833362e3 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:41:43 2019 +0800 增加http解析部分 commit 132d807af17882081510ce8af05bdd9706eac52e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 26 16:58:54 2019 +0800 调整调试日志内容 commit 8cfc6b32fd40a21062a3f2e9cf23d34bb4a66f3a Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 19:30:08 2019 +0800 增加调试日志信息 commit 4aef0628e541ea2616f24d62cc2748474c2d8edc Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 18:36:48 2019 +0800 增加调试信息 commit 7c9dabdab58db3405cbb86d0e98694ad38e8b26c Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:51:37 2019 +0800 矫正tableinfo配置项 commit 34ec2059ea017cad0dfc1ef02b16c0c01924b738 Merge: 27cb2ad 2b96c05 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:00:18 2019 +0800 Merge branch 'develop' of https://git.mesalab.cn/tango/tsg_master into develop commit 27cb2ad3b2da0d9ce7307513f0e119b181ad13b6 Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 19:21:08 2019 +0800 获取包数、字节数与sapp头文件不一致,导致统计信息颠倒 删除从vxlan里获取信息 commit 2b96c050d50561a4c1f1f042904e81f8bdb93cec Merge: 0a11db6 8d954e4 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 21 10:22:42 2019 +0800 Merge branch 'feature-kni' into 'develop' 修改proto初始值为PROTO_UNKONWN See merge request tango/tsg_master!2 commit 46a233b78242f6515963c8235d4ac0702492f32b Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 10:18:08 2019 +0800 KNI发送日志的线程不是sapp申请的,所以不能使用dictator_malloc申请内存 增加user_region日志字段 commit 8d954e4cc58c9e10ef917eb6cad480a9a0a599e9 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 20 19:55:59 2019 +0800 修改proto初始值为PROTO_UNKONWN commit 0a11db6d2eee3e187a4242abce9f2e66b02b30ce Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:02:54 2019 +0800 增加总控配置文件 commit 5c04ba23aa312b174e6707d2cf62b4b7e48f7a03 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:00:35 2019 +0800 SSL_SNI和HTTP_HOST的deny动作由总控负责处理 修复获取全局流ID时的错误 commit 291c05ea79fe3eda8fdef68079808e321cf2d1f5 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 16:40:19 2019 +0800 增加获取全局流ID的接口 调整总控注册为TCP入口 commit 28da97b53b7777a3a024a0df191fe3239c0e981a Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 14:45:41 2019 +0800 支持平台提供的APP_STATE_KILL_OTHER 修复BUG,天剑流标签时未对协议进行赋值,导致tfe颁发证书失败 commit 7912ec54b2669ca7aa84a1885dcca025135c7d0e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 18:41:31 2019 +0800 修复BUG,命中拦截策略时未对类型进行赋值,导致KNI获取不到命中结果 添加总控配置文件 添加FS2统计日志 添加错误日志 构造适用sapp4.0的rpm commit 484feaed94006226f610ef68015c4a38ac150054 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 13:39:37 2019 +0800 增加获取deny结果规则的接口 修复自测试过程中遇到的BUG commit 5165173025f7dd9d6719475b7b586fb470840d1d Merge: 186e591 6b6cbef Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Mon Nov 18 15:46:03 2019 +0800 Merge branch 'feature-fast-path' into feature-kni commit 6b6cbeffa1469becf9cbeea927102067eb9fad08 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 14:50:32 2019 +0800 修复初始化错误 commit e7532d6280c71ec79dc535eacb5e151ee25dfd45 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:33:29 2019 +0800 添加遗漏头文件tsg_entry.h commit f33d11c50b01db96f7df652cd0f1dd314a71939e Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:29:28 2019 +0800 修复编译错误 commit 88d9368cee4afac762f5be1f786a74a259c09e85 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:25:38 2019 +0800 合并头文件,删除无用头文件 commit 382ca0a7932bbda8bbb735cd9d71e4984af0c145 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:25 2019 +0800 Delete tsg_types.h commit ab58f918e5ff3f6c22c1403a303c06653c3b3b3d Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:05 2019 +0800 Delete tsg_log_id.h commit 3b13075701f1459f4bf24cb173ceb5c20a5857a8 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:20:57 2019 +0800 Delete tsg_entry.h commit 186e591dbffea44b5f01d1a3e5de8bf226746f6c Merge: 39f82ed 91c511c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:44 2019 +0800 Merge branch 'master' into feature-kni commit 39f82ed3f70718b975ca215c486fbe736f6a06b1 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:39 2019 +0800 接口适配 commit 8913a7d22eacccc639fe6ae2fd21f21b269b9b18 Author: liuxueli <liuxueli@iie.ac.cn> Date: Fri Nov 15 19:29:54 2019 +0800 规则排序功能 统一发送日志功能 commit 1cb2358fea5ad03fddb7f69c062bcebe3821073e Merge: c76bc55 bd65acc Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 14 15:06:35 2019 +0800 合并master修改 commit c76bc5534dcc4128b1e9b73e8fc25d981056411c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:56:19 2019 +0800 接口增加protocol参数 commit db7282dab7f157bb3fd82f1843f7d953d2dbc1ec Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:24:22 2019 +0800 扫描接口增加domain commit 56fadd73b2560fcea04a30a60bae9fa1c9ed4d72 Merge: f9aee05 9e738ae Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:08:55 2019 +0800 Merge branch 'master' into feature-kni commit f9aee05bcc1b87e8c9dfd9f6deeedd3570a9905f Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:17:59 2019 +0800 修改ssl_utils文件名 commit 452a08790cbe91e4e854e72778816cb9137a4605 Merge: 3abe8a2 c1ffc53 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:12:14 2019 +0800 Merge branch 'master' into feature-kni commit 3abe8a2fc5a3acacb29ddfa1b3be8ad9771d4324 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:11:38 2019 +0800 添加kni模块扫描部分
2019-12-09 18:58:05 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "tsg_ssl_utils.h"
#define ALLOC(type, number) ((type *)calloc(sizeof(type), number))
#define FREE(p) {free(*p);*p=NULL;}
#define KNI_STRING_MAX 2048
struct cipher_suite cipher_suite_list[] =
{
{0xC030, "ECDHE-RSA-AES256-GCM-SHA384"},
{0xC02C, "ECDHE-ECDSA-AES256-GCM-SHA384"},
{0xC028, "ECDHE-RSA-AES256-SHA384"},
{0xC024, "ECDHE-ECDSA-AES256-SHA384"},
{0xC014, "ECDHE-RSA-AES256-SHA"},
{0xC00A, "ECDHE-ECDSA-AES256-SHA"},
{0x00A5, "DH-DSS-AES256-GCM-SHA384"},
{0x00A3, "DHE-DSS-AES256-GCM-SHA384"},
{0x00A1, "DH-RSA-AES256-GCM-SHA384"},
{0x009F, "DHE-RSA-AES256-GCM-SHA384"},
{0x006B, "DHE-RSA-AES256-SHA256"},
{0x006A, "DHE-DSS-AES256-SHA256"},
{0x0069, "DH-RSA-AES256-SHA256"},
{0x0068, "DH-DSS-AES256-SHA256"},
{0x0039, "DHE-RSA-AES256-SHA"},
{0x0038, "DHE-DSS-AES256-SHA"},
{0x0037, "DH-RSA-AES256-SHA"},
{0x0036, "DH-DSS-AES256-SHA"},
{0x0088, "DHE-RSA-CAMELLIA256-SHA"},
{0x0087, "DHE-DSS-CAMELLIA256-SHA"},
{0x0086, "DH-RSA-CAMELLIA256-SHA"},
{0x0085, "DH-DSS-CAMELLIA256-SHA"},
{0xC019, "AECDH-AES256-SHA"},
{0x00A7, "ADH-AES256-GCM-SHA384"},
{0x006D, "ADH-AES256-SHA256"},
{0x003A, "ADH-AES256-SHA"},
{0x0089, "ADH-CAMELLIA256-SHA"},
{0xC032, "ECDH-RSA-AES256-GCM-SHA384"},
{0xC02E, "ECDH-ECDSA-AES256-GCM-SHA384"},
{0xC02A, "ECDH-RSA-AES256-SHA384"},
{0xC026, "ECDH-ECDSA-AES256-SHA384"},
{0xC00F, "ECDH-RSA-AES256-SHA"},
{0xC005, "ECDH-ECDSA-AES256-SHA"},
{0x009D, "AES256-GCM-SHA384"},
{0x003D, "AES256-SHA256"},
{0x0035, "AES256-SHA"},
{0x0084, "CAMELLIA256-SHA"},
{0x008D, "PSK-AES256-CBC-SHA"},
{0xC02F, "ECDHE-RSA-AES128-GCM-SHA256"},
{0xC02B, "ECDHE-ECDSA-AES128-GCM-SHA256"},
{0xC027, "ECDHE-RSA-AES128-SHA256"},
{0xC023, "ECDHE-ECDSA-AES128-SHA256"},
{0xC013, "ECDHE-RSA-AES128-SHA"},
{0xC009, "ECDHE-ECDSA-AES128-SHA"},
{0x00A4, "DH-DSS-AES128-GCM-SHA256"},
{0x00A2, "DHE-DSS-AES128-GCM-SHA256"},
{0x00A0, "DH-RSA-AES128-GCM-SHA256"},
{0x009E, "DHE-RSA-AES128-GCM-SHA256"},
{0x0067, "DHE-RSA-AES128-SHA256"},
{0x0040, "DHE-DSS-AES128-SHA256"},
{0x003F, "DH-RSA-AES128-SHA256"},
{0x003E, "DH-DSS-AES128-SHA256"},
{0x0033, "DHE-RSA-AES128-SHA"},
{0x0032, "DHE-DSS-AES128-SHA"},
{0x0031, "DH-RSA-AES128-SHA"},
{0x0030, "DH-DSS-AES128-SHA"},
{0x009A, "DHE-RSA-SEED-SHA"},
{0x0099, "DHE-DSS-SEED-SHA"},
{0x0098, "DH-RSA-SEED-SHA"},
{0x0097, "DH-DSS-SEED-SHA"},
{0x0045, "DHE-RSA-CAMELLIA128-SHA"},
{0x0044, "DHE-DSS-CAMELLIA128-SHA"},
{0x0043, "DH-RSA-CAMELLIA128-SHA"},
{0x0042, "DH-DSS-CAMELLIA128-SHA"},
{0xC018, "AECDH-AES128-SHA"},
{0x00A6, "ADH-AES128-GCM-SHA256"},
{0x006C, "ADH-AES128-SHA256"},
{0x0034, "ADH-AES128-SHA"},
{0x009B, "ADH-SEED-SHA"},
{0x0046, "ADH-CAMELLIA128-SHA"},
{0xC031, "ECDH-RSA-AES128-GCM-SHA256"},
{0xC02D, "ECDH-ECDSA-AES128-GCM-SHA256"},
{0xC029, "ECDH-RSA-AES128-SHA256"},
{0xC025, "ECDH-ECDSA-AES128-SHA256"},
{0xC00E, "ECDH-RSA-AES128-SHA"},
{0xC004, "ECDH-ECDSA-AES128-SHA"},
{0x009C, "AES128-GCM-SHA256"},
{0x003C, "AES128-SHA256"},
{0x002F, "AES128-SHA"},
{0x0096, "SEED-SHA"},
{0x0041, "CAMELLIA128-SHA"},
{0x008C, "PSK-AES128-CBC-SHA"},
{0xC012, "ECDHE-RSA-DES-CBC3-SHA"},
{0xC008, "ECDHE-ECDSA-DES-CBC3-SHA"},
{0x0016, "EDH-RSA-DES-CBC3-SHA"},
{0x0013, "EDH-DSS-DES-CBC3-SHA"},
{0x0010, "DH-RSA-DES-CBC3-SHA"},
{0x000D, "DH-DSS-DES-CBC3-SHA"},
{0xC017, "AECDH-DES-CBC3-SHA"},
{0x001B, "ADH-DES-CBC3-SHA"},
{0xC00D, "ECDH-RSA-DES-CBC3-SHA"},
{0xC003, "ECDH-ECDSA-DES-CBC3-SHA"},
{0x000A, "DES-CBC3-SHA"},
{0x0007, "IDEA-CBC-SHA"},
{0x008B, "PSK-3DES-EDE-CBC-SHA"},
{0x0021, "KRB5-IDEA-CBC-SHA"},
{0x001F, "KRB5-DES-CBC3-SHA"},
{0x0025, "KRB5-IDEA-CBC-MD5"},
{0x0023, "KRB5-DES-CBC3-MD5"},
{0xC011, "ECDHE-RSA-RC4-SHA"},
{0xC007, "ECDHE-ECDSA-RC4-SHA"},
{0xC016, "AECDH-RC4-SHA"},
{0x0018, "ADH-RC4-MD5"},
{0xC00C, "ECDH-RSA-RC4-SHA"},
{0xC002, "ECDH-ECDSA-RC4-SHA"},
{0x0005, "RC4-SHA"},
{0x0004, "RC4-MD5"},
{0x008A, "PSK-RC4-SHA"},
{0x0020, "KRB5-RC4-SHA"},
{0x0024, "KRB5-RC4-MD5"},
{0xC010, "ECDHE-RSA-NULL-SHA"},
{0xC006, "ECDHE-ECDSA-NULL-SHA"},
{0xC015, "AECDH-NULL-SHA"},
{0xC00B, "ECDH-RSA-NULL-SHA"},
{0xC001, "ECDH-ECDSA-NULL-SHA"},
{0x003B, "NULL-SHA256"},
{0x0002, "NULL-SHA"},
{0x0001, "NULL-MD5"}
};
struct cipher_suite cipher_suite_list_tls13[] =
{
{0x1301, "TLS_AES_128_GCM_SHA256"},
{0x1302, "TLS_AES_256_GCM_SHA384"},
{0x1303, "TLS_CHACHA20_POLY1305_SHA256"},
{0x1304, "TLS_AES_128_CCM_SHA256"},
{0x1305, "TLS_AES_128_CCM_8_SHA256"}
};
void ssl_chello_free(struct ssl_chello* chello)
{
if(chello==NULL)
{
return;
}
free(chello->sni);
chello->sni = NULL;
free(chello->alpn);
chello->alpn = NULL;
free(chello->cipher_suites);
chello->cipher_suites = NULL;
free(chello->cipher_suites_tls13);
chello->cipher_suites_tls13 = NULL;
free(chello);
}
static char* parse_alpn_extension(const unsigned char* buff, size_t buff_len, enum chello_parse_result* result)
{
size_t pos = 0;
size_t len = ((size_t)buff[pos] << 8) + (size_t)buff[pos + 1];
if(2 + len != buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return NULL;
}
char* alpn = ALLOC(char, len + 1);
strncpy((char*)alpn, (const char*)buff + 2, len);
alpn[len] = '\0';
*result = CHELLO_PARSE_SUCCESS;
return alpn;
}
static char* parse_server_name_extension(const unsigned char* buff, size_t buff_len, enum chello_parse_result* result)
{
size_t pos = 2; /* skip server name list length */
size_t len;
char* sni = NULL;
while (pos + 3 < buff_len)
{
len = ((size_t)buff[pos + 1] << 8) + (size_t)buff[pos + 2];
if (pos + 3 + len > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return NULL;
}
switch (buff[pos])
{
case 0x00: /* host_name */
sni = (char*)malloc(len + 1);
strncpy(sni, (const char*)buff + pos + 3, len);
sni[len] = '\0';
*result = CHELLO_PARSE_SUCCESS;
default:
break;
Squashed commit of the following: commit 91574444c3950c37b0147ad923f8eef08e029ca8 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Dec 3 11:44:16 2019 +0800 公共字段中的通信市时长单位是:ms;转换单位 KNI发日志需等待TFE结束,需提前构造streaminfo日志字段,调整包数字节数统计位置 细化调整日志 commit ff053e3e2cad06804f852e8b46275865f4e85b0c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:38:35 2019 +0800 增加调试日志信息 commit 2d1a530165be653f5ee3ee41bc89521e1be830f4 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:27:06 2019 +0800 使用前置声明结构体,修改接口函数原型 commit 27f0cfc91a6d85c0460d87e3e3ee05e4df02dc3c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 10:33:48 2019 +0800 提供TLD_append_streaminfo函数接口供KNI使用 修改配置文件 commit ed0b17a49d4cf01294240265b5c3a907d763418d Merge: 132d807 04963fe Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:44:28 2019 +0800 Merge branch 'feature-kni' into 'develop' 增加http解析部分 See merge request tango/tsg_master!3 commit 04963fe1bfb56ce4712817d2683796d8833362e3 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:41:43 2019 +0800 增加http解析部分 commit 132d807af17882081510ce8af05bdd9706eac52e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 26 16:58:54 2019 +0800 调整调试日志内容 commit 8cfc6b32fd40a21062a3f2e9cf23d34bb4a66f3a Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 19:30:08 2019 +0800 增加调试日志信息 commit 4aef0628e541ea2616f24d62cc2748474c2d8edc Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 18:36:48 2019 +0800 增加调试信息 commit 7c9dabdab58db3405cbb86d0e98694ad38e8b26c Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:51:37 2019 +0800 矫正tableinfo配置项 commit 34ec2059ea017cad0dfc1ef02b16c0c01924b738 Merge: 27cb2ad 2b96c05 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:00:18 2019 +0800 Merge branch 'develop' of https://git.mesalab.cn/tango/tsg_master into develop commit 27cb2ad3b2da0d9ce7307513f0e119b181ad13b6 Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 19:21:08 2019 +0800 获取包数、字节数与sapp头文件不一致,导致统计信息颠倒 删除从vxlan里获取信息 commit 2b96c050d50561a4c1f1f042904e81f8bdb93cec Merge: 0a11db6 8d954e4 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 21 10:22:42 2019 +0800 Merge branch 'feature-kni' into 'develop' 修改proto初始值为PROTO_UNKONWN See merge request tango/tsg_master!2 commit 46a233b78242f6515963c8235d4ac0702492f32b Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 10:18:08 2019 +0800 KNI发送日志的线程不是sapp申请的,所以不能使用dictator_malloc申请内存 增加user_region日志字段 commit 8d954e4cc58c9e10ef917eb6cad480a9a0a599e9 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 20 19:55:59 2019 +0800 修改proto初始值为PROTO_UNKONWN commit 0a11db6d2eee3e187a4242abce9f2e66b02b30ce Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:02:54 2019 +0800 增加总控配置文件 commit 5c04ba23aa312b174e6707d2cf62b4b7e48f7a03 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:00:35 2019 +0800 SSL_SNI和HTTP_HOST的deny动作由总控负责处理 修复获取全局流ID时的错误 commit 291c05ea79fe3eda8fdef68079808e321cf2d1f5 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 16:40:19 2019 +0800 增加获取全局流ID的接口 调整总控注册为TCP入口 commit 28da97b53b7777a3a024a0df191fe3239c0e981a Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 14:45:41 2019 +0800 支持平台提供的APP_STATE_KILL_OTHER 修复BUG,天剑流标签时未对协议进行赋值,导致tfe颁发证书失败 commit 7912ec54b2669ca7aa84a1885dcca025135c7d0e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 18:41:31 2019 +0800 修复BUG,命中拦截策略时未对类型进行赋值,导致KNI获取不到命中结果 添加总控配置文件 添加FS2统计日志 添加错误日志 构造适用sapp4.0的rpm commit 484feaed94006226f610ef68015c4a38ac150054 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 13:39:37 2019 +0800 增加获取deny结果规则的接口 修复自测试过程中遇到的BUG commit 5165173025f7dd9d6719475b7b586fb470840d1d Merge: 186e591 6b6cbef Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Mon Nov 18 15:46:03 2019 +0800 Merge branch 'feature-fast-path' into feature-kni commit 6b6cbeffa1469becf9cbeea927102067eb9fad08 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 14:50:32 2019 +0800 修复初始化错误 commit e7532d6280c71ec79dc535eacb5e151ee25dfd45 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:33:29 2019 +0800 添加遗漏头文件tsg_entry.h commit f33d11c50b01db96f7df652cd0f1dd314a71939e Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:29:28 2019 +0800 修复编译错误 commit 88d9368cee4afac762f5be1f786a74a259c09e85 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:25:38 2019 +0800 合并头文件,删除无用头文件 commit 382ca0a7932bbda8bbb735cd9d71e4984af0c145 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:25 2019 +0800 Delete tsg_types.h commit ab58f918e5ff3f6c22c1403a303c06653c3b3b3d Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:05 2019 +0800 Delete tsg_log_id.h commit 3b13075701f1459f4bf24cb173ceb5c20a5857a8 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:20:57 2019 +0800 Delete tsg_entry.h commit 186e591dbffea44b5f01d1a3e5de8bf226746f6c Merge: 39f82ed 91c511c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:44 2019 +0800 Merge branch 'master' into feature-kni commit 39f82ed3f70718b975ca215c486fbe736f6a06b1 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:39 2019 +0800 接口适配 commit 8913a7d22eacccc639fe6ae2fd21f21b269b9b18 Author: liuxueli <liuxueli@iie.ac.cn> Date: Fri Nov 15 19:29:54 2019 +0800 规则排序功能 统一发送日志功能 commit 1cb2358fea5ad03fddb7f69c062bcebe3821073e Merge: c76bc55 bd65acc Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 14 15:06:35 2019 +0800 合并master修改 commit c76bc5534dcc4128b1e9b73e8fc25d981056411c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:56:19 2019 +0800 接口增加protocol参数 commit db7282dab7f157bb3fd82f1843f7d953d2dbc1ec Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:24:22 2019 +0800 扫描接口增加domain commit 56fadd73b2560fcea04a30a60bae9fa1c9ed4d72 Merge: f9aee05 9e738ae Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:08:55 2019 +0800 Merge branch 'master' into feature-kni commit f9aee05bcc1b87e8c9dfd9f6deeedd3570a9905f Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:17:59 2019 +0800 修改ssl_utils文件名 commit 452a08790cbe91e4e854e72778816cb9137a4605 Merge: 3abe8a2 c1ffc53 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:12:14 2019 +0800 Merge branch 'master' into feature-kni commit 3abe8a2fc5a3acacb29ddfa1b3be8ad9771d4324 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:11:38 2019 +0800 添加kni模块扫描部分
2019-12-09 18:58:05 +08:00
}
pos += 3 + len;
}
if (pos != buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
}
return sni;
}
static enum chello_parse_result parse_extensions(const unsigned char* buff, size_t buff_len, struct ssl_chello* chello) {
size_t pos = 0;
/* Parse each 4 bytes for the extension header */
while (pos + 4 <= buff_len)
{
size_t len = ((size_t)buff[pos + 2] << 8) + (size_t)buff[pos + 3];
/* Check if it's a server name extension */
if (buff[pos] == 0x00 && buff[pos + 1] == 0x00)
{
if (pos + 4 + len > buff_len)
{
return CHELLO_PARSE_INVALID_FORMAT;
}
enum chello_parse_result result = CHELLO_PARSE_SUCCESS;
chello->sni = parse_server_name_extension(buff + pos + 4, len, &result);
if(result != CHELLO_PARSE_SUCCESS)
{
return result;
}
}
/* Check if it's a alpn extension */
if (buff[pos] == 0x00 && buff[pos + 1] == 0x10)
{
if (pos + 4 + len > buff_len)
{
return CHELLO_PARSE_INVALID_FORMAT;
}
enum chello_parse_result result = CHELLO_PARSE_SUCCESS;
chello->alpn = parse_alpn_extension(buff + pos + 4, len, &result);
if(result != CHELLO_PARSE_SUCCESS)
{
return result;
}
}
if (buff[pos] == 0xff && buff[pos + 1] == 0xce)//identify encrypt sni
{
chello->is_encrypt_sni = 1;
}
Squashed commit of the following: commit 91574444c3950c37b0147ad923f8eef08e029ca8 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Dec 3 11:44:16 2019 +0800 公共字段中的通信市时长单位是:ms;转换单位 KNI发日志需等待TFE结束,需提前构造streaminfo日志字段,调整包数字节数统计位置 细化调整日志 commit ff053e3e2cad06804f852e8b46275865f4e85b0c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:38:35 2019 +0800 增加调试日志信息 commit 2d1a530165be653f5ee3ee41bc89521e1be830f4 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:27:06 2019 +0800 使用前置声明结构体,修改接口函数原型 commit 27f0cfc91a6d85c0460d87e3e3ee05e4df02dc3c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 10:33:48 2019 +0800 提供TLD_append_streaminfo函数接口供KNI使用 修改配置文件 commit ed0b17a49d4cf01294240265b5c3a907d763418d Merge: 132d807 04963fe Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:44:28 2019 +0800 Merge branch 'feature-kni' into 'develop' 增加http解析部分 See merge request tango/tsg_master!3 commit 04963fe1bfb56ce4712817d2683796d8833362e3 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:41:43 2019 +0800 增加http解析部分 commit 132d807af17882081510ce8af05bdd9706eac52e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 26 16:58:54 2019 +0800 调整调试日志内容 commit 8cfc6b32fd40a21062a3f2e9cf23d34bb4a66f3a Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 19:30:08 2019 +0800 增加调试日志信息 commit 4aef0628e541ea2616f24d62cc2748474c2d8edc Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 18:36:48 2019 +0800 增加调试信息 commit 7c9dabdab58db3405cbb86d0e98694ad38e8b26c Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:51:37 2019 +0800 矫正tableinfo配置项 commit 34ec2059ea017cad0dfc1ef02b16c0c01924b738 Merge: 27cb2ad 2b96c05 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:00:18 2019 +0800 Merge branch 'develop' of https://git.mesalab.cn/tango/tsg_master into develop commit 27cb2ad3b2da0d9ce7307513f0e119b181ad13b6 Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 19:21:08 2019 +0800 获取包数、字节数与sapp头文件不一致,导致统计信息颠倒 删除从vxlan里获取信息 commit 2b96c050d50561a4c1f1f042904e81f8bdb93cec Merge: 0a11db6 8d954e4 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 21 10:22:42 2019 +0800 Merge branch 'feature-kni' into 'develop' 修改proto初始值为PROTO_UNKONWN See merge request tango/tsg_master!2 commit 46a233b78242f6515963c8235d4ac0702492f32b Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 10:18:08 2019 +0800 KNI发送日志的线程不是sapp申请的,所以不能使用dictator_malloc申请内存 增加user_region日志字段 commit 8d954e4cc58c9e10ef917eb6cad480a9a0a599e9 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 20 19:55:59 2019 +0800 修改proto初始值为PROTO_UNKONWN commit 0a11db6d2eee3e187a4242abce9f2e66b02b30ce Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:02:54 2019 +0800 增加总控配置文件 commit 5c04ba23aa312b174e6707d2cf62b4b7e48f7a03 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:00:35 2019 +0800 SSL_SNI和HTTP_HOST的deny动作由总控负责处理 修复获取全局流ID时的错误 commit 291c05ea79fe3eda8fdef68079808e321cf2d1f5 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 16:40:19 2019 +0800 增加获取全局流ID的接口 调整总控注册为TCP入口 commit 28da97b53b7777a3a024a0df191fe3239c0e981a Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 14:45:41 2019 +0800 支持平台提供的APP_STATE_KILL_OTHER 修复BUG,天剑流标签时未对协议进行赋值,导致tfe颁发证书失败 commit 7912ec54b2669ca7aa84a1885dcca025135c7d0e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 18:41:31 2019 +0800 修复BUG,命中拦截策略时未对类型进行赋值,导致KNI获取不到命中结果 添加总控配置文件 添加FS2统计日志 添加错误日志 构造适用sapp4.0的rpm commit 484feaed94006226f610ef68015c4a38ac150054 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 13:39:37 2019 +0800 增加获取deny结果规则的接口 修复自测试过程中遇到的BUG commit 5165173025f7dd9d6719475b7b586fb470840d1d Merge: 186e591 6b6cbef Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Mon Nov 18 15:46:03 2019 +0800 Merge branch 'feature-fast-path' into feature-kni commit 6b6cbeffa1469becf9cbeea927102067eb9fad08 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 14:50:32 2019 +0800 修复初始化错误 commit e7532d6280c71ec79dc535eacb5e151ee25dfd45 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:33:29 2019 +0800 添加遗漏头文件tsg_entry.h commit f33d11c50b01db96f7df652cd0f1dd314a71939e Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:29:28 2019 +0800 修复编译错误 commit 88d9368cee4afac762f5be1f786a74a259c09e85 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:25:38 2019 +0800 合并头文件,删除无用头文件 commit 382ca0a7932bbda8bbb735cd9d71e4984af0c145 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:25 2019 +0800 Delete tsg_types.h commit ab58f918e5ff3f6c22c1403a303c06653c3b3b3d Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:05 2019 +0800 Delete tsg_log_id.h commit 3b13075701f1459f4bf24cb173ceb5c20a5857a8 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:20:57 2019 +0800 Delete tsg_entry.h commit 186e591dbffea44b5f01d1a3e5de8bf226746f6c Merge: 39f82ed 91c511c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:44 2019 +0800 Merge branch 'master' into feature-kni commit 39f82ed3f70718b975ca215c486fbe736f6a06b1 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:39 2019 +0800 接口适配 commit 8913a7d22eacccc639fe6ae2fd21f21b269b9b18 Author: liuxueli <liuxueli@iie.ac.cn> Date: Fri Nov 15 19:29:54 2019 +0800 规则排序功能 统一发送日志功能 commit 1cb2358fea5ad03fddb7f69c062bcebe3821073e Merge: c76bc55 bd65acc Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 14 15:06:35 2019 +0800 合并master修改 commit c76bc5534dcc4128b1e9b73e8fc25d981056411c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:56:19 2019 +0800 接口增加protocol参数 commit db7282dab7f157bb3fd82f1843f7d953d2dbc1ec Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:24:22 2019 +0800 扫描接口增加domain commit 56fadd73b2560fcea04a30a60bae9fa1c9ed4d72 Merge: f9aee05 9e738ae Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:08:55 2019 +0800 Merge branch 'master' into feature-kni commit f9aee05bcc1b87e8c9dfd9f6deeedd3570a9905f Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:17:59 2019 +0800 修改ssl_utils文件名 commit 452a08790cbe91e4e854e72778816cb9137a4605 Merge: 3abe8a2 c1ffc53 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:12:14 2019 +0800 Merge branch 'master' into feature-kni commit 3abe8a2fc5a3acacb29ddfa1b3be8ad9771d4324 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:11:38 2019 +0800 添加kni模块扫描部分
2019-12-09 18:58:05 +08:00
pos += (4 + len);
}
/* Check we ended where we expected to */
if (pos != buff_len)
{
return CHELLO_PARSE_INVALID_FORMAT;
}
return CHELLO_PARSE_SUCCESS;
}
static char* parse_cipher_suites(struct cipher_suite* _cipher_suite_list, int n, const unsigned char* buff, size_t buff_len, enum chello_parse_result* result)
{
char* cipher_suites_str = (char* )malloc(KNI_STRING_MAX);
cipher_suites_str[0] = '\0';
size_t pos = 0;
int flag = 0;
while(pos < buff_len)
{
int i = 0;
for(i = 0;i < n; i++)
{
int val = (buff[pos] << 8) + buff[pos + 1];
if(_cipher_suite_list[i].value == val)
{
if(strnlen(_cipher_suite_list[i].name, KNI_STRING_MAX) + strnlen(cipher_suites_str, KNI_STRING_MAX) + 1 > KNI_STRING_MAX)
{
flag = 1;
break;
}
strncat(cipher_suites_str, _cipher_suite_list[i].name, KNI_STRING_MAX);
strncat(cipher_suites_str, ":", KNI_STRING_MAX);
}
}
pos += 2;
if(flag == 1)
{
break;
}
}
int len = strnlen(cipher_suites_str, KNI_STRING_MAX);
if(len > 0)
{
cipher_suites_str[len-1] = '\0';
}
if(pos != buff_len && flag == 0)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
free(cipher_suites_str);
return NULL;
}
*result = CHELLO_PARSE_SUCCESS;
return cipher_suites_str;
}
struct ssl_chello* ssl_chello_parse(const unsigned char* buff, size_t buff_len, enum chello_parse_result* result)
{
if(buff == NULL)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return NULL;
}
if(buff_len < 1)
{
*result = CHELLO_PARSE_NOT_ENOUGH_BUFF;
return NULL;
}
if(buff[0] != 0x80 && buff[0] != 0x16)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return NULL;
}
/* SSL 2.0 compatible Client Hello
* High bit of first byte (length) and content type is Client Hello
* See RFC5246 Appendix E.2
* if it is SSL 2.0, only parse version
*/
if(buff[0] == 0x80)
{
struct ssl_chello* _chello = (struct ssl_chello*)ALLOC(struct ssl_chello, 1);
_chello->min_version.major = 0x02;
if(buff_len < 2)
{
*result = CHELLO_PARSE_NOT_ENOUGH_BUFF;
return _chello;
}
size_t len = (size_t)buff[1];
if (buff_len < len + 2)
{
*result = CHELLO_PARSE_NOT_ENOUGH_BUFF;
return _chello;
}
buff_len = len + 2;
size_t pos = 2;
/* Handshark Message Type: Client Hello */
if (pos + 1 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
if (buff[pos] != 0x01)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
pos += 1;
/* Version */
if(pos + 2 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
_chello->max_version.major = buff[pos];
_chello->max_version.minor = buff[pos + 1];
_chello->max_version.ossl_format=(uint16_t)_chello->max_version.major<<8|_chello->max_version.minor;
*result = CHELLO_PARSE_SUCCESS;
return _chello;
}
else
{
if (buff_len < 5)
{
*result = CHELLO_PARSE_NOT_ENOUGH_BUFF;
return NULL;
}
if(buff[1] != 3 || buff[2] > 4 || buff[2] < 0)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return NULL;
}
struct ssl_chello* _chello = (struct ssl_chello*)ALLOC(struct ssl_chello, 1);
_chello->min_version.major = buff[1];
_chello->min_version.minor = buff[2];
_chello->min_version.ossl_format=(uint16_t)_chello->min_version.major<<8|_chello->min_version.minor;
_chello->max_version.major = (uint8_t)(-1);
_chello->max_version.minor = (uint8_t)(-1);
Squashed commit of the following: commit 91574444c3950c37b0147ad923f8eef08e029ca8 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Dec 3 11:44:16 2019 +0800 公共字段中的通信市时长单位是:ms;转换单位 KNI发日志需等待TFE结束,需提前构造streaminfo日志字段,调整包数字节数统计位置 细化调整日志 commit ff053e3e2cad06804f852e8b46275865f4e85b0c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:38:35 2019 +0800 增加调试日志信息 commit 2d1a530165be653f5ee3ee41bc89521e1be830f4 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 11:27:06 2019 +0800 使用前置声明结构体,修改接口函数原型 commit 27f0cfc91a6d85c0460d87e3e3ee05e4df02dc3c Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 27 10:33:48 2019 +0800 提供TLD_append_streaminfo函数接口供KNI使用 修改配置文件 commit ed0b17a49d4cf01294240265b5c3a907d763418d Merge: 132d807 04963fe Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:44:28 2019 +0800 Merge branch 'feature-kni' into 'develop' 增加http解析部分 See merge request tango/tsg_master!3 commit 04963fe1bfb56ce4712817d2683796d8833362e3 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Tue Nov 26 17:41:43 2019 +0800 增加http解析部分 commit 132d807af17882081510ce8af05bdd9706eac52e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 26 16:58:54 2019 +0800 调整调试日志内容 commit 8cfc6b32fd40a21062a3f2e9cf23d34bb4a66f3a Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 19:30:08 2019 +0800 增加调试日志信息 commit 4aef0628e541ea2616f24d62cc2748474c2d8edc Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 18:36:48 2019 +0800 增加调试信息 commit 7c9dabdab58db3405cbb86d0e98694ad38e8b26c Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:51:37 2019 +0800 矫正tableinfo配置项 commit 34ec2059ea017cad0dfc1ef02b16c0c01924b738 Merge: 27cb2ad 2b96c05 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 25 10:00:18 2019 +0800 Merge branch 'develop' of https://git.mesalab.cn/tango/tsg_master into develop commit 27cb2ad3b2da0d9ce7307513f0e119b181ad13b6 Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 19:21:08 2019 +0800 获取包数、字节数与sapp头文件不一致,导致统计信息颠倒 删除从vxlan里获取信息 commit 2b96c050d50561a4c1f1f042904e81f8bdb93cec Merge: 0a11db6 8d954e4 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 21 10:22:42 2019 +0800 Merge branch 'feature-kni' into 'develop' 修改proto初始值为PROTO_UNKONWN See merge request tango/tsg_master!2 commit 46a233b78242f6515963c8235d4ac0702492f32b Author: liuxueli <liuxueli@iie.ac.cn> Date: Thu Nov 21 10:18:08 2019 +0800 KNI发送日志的线程不是sapp申请的,所以不能使用dictator_malloc申请内存 增加user_region日志字段 commit 8d954e4cc58c9e10ef917eb6cad480a9a0a599e9 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 20 19:55:59 2019 +0800 修改proto初始值为PROTO_UNKONWN commit 0a11db6d2eee3e187a4242abce9f2e66b02b30ce Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:02:54 2019 +0800 增加总控配置文件 commit 5c04ba23aa312b174e6707d2cf62b4b7e48f7a03 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 18:00:35 2019 +0800 SSL_SNI和HTTP_HOST的deny动作由总控负责处理 修复获取全局流ID时的错误 commit 291c05ea79fe3eda8fdef68079808e321cf2d1f5 Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 16:40:19 2019 +0800 增加获取全局流ID的接口 调整总控注册为TCP入口 commit 28da97b53b7777a3a024a0df191fe3239c0e981a Author: liuxueli <liuxueli@iie.ac.cn> Date: Wed Nov 20 14:45:41 2019 +0800 支持平台提供的APP_STATE_KILL_OTHER 修复BUG,天剑流标签时未对协议进行赋值,导致tfe颁发证书失败 commit 7912ec54b2669ca7aa84a1885dcca025135c7d0e Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 18:41:31 2019 +0800 修复BUG,命中拦截策略时未对类型进行赋值,导致KNI获取不到命中结果 添加总控配置文件 添加FS2统计日志 添加错误日志 构造适用sapp4.0的rpm commit 484feaed94006226f610ef68015c4a38ac150054 Author: liuxueli <liuxueli@iie.ac.cn> Date: Tue Nov 19 13:39:37 2019 +0800 增加获取deny结果规则的接口 修复自测试过程中遇到的BUG commit 5165173025f7dd9d6719475b7b586fb470840d1d Merge: 186e591 6b6cbef Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Mon Nov 18 15:46:03 2019 +0800 Merge branch 'feature-fast-path' into feature-kni commit 6b6cbeffa1469becf9cbeea927102067eb9fad08 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 14:50:32 2019 +0800 修复初始化错误 commit e7532d6280c71ec79dc535eacb5e151ee25dfd45 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:33:29 2019 +0800 添加遗漏头文件tsg_entry.h commit f33d11c50b01db96f7df652cd0f1dd314a71939e Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:29:28 2019 +0800 修复编译错误 commit 88d9368cee4afac762f5be1f786a74a259c09e85 Author: liuxueli <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:25:38 2019 +0800 合并头文件,删除无用头文件 commit 382ca0a7932bbda8bbb735cd9d71e4984af0c145 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:25 2019 +0800 Delete tsg_types.h commit ab58f918e5ff3f6c22c1403a303c06653c3b3b3d Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:21:05 2019 +0800 Delete tsg_log_id.h commit 3b13075701f1459f4bf24cb173ceb5c20a5857a8 Author: 刘学利 <liuxueli@iie.ac.cn> Date: Mon Nov 18 13:20:57 2019 +0800 Delete tsg_entry.h commit 186e591dbffea44b5f01d1a3e5de8bf226746f6c Merge: 39f82ed 91c511c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:44 2019 +0800 Merge branch 'master' into feature-kni commit 39f82ed3f70718b975ca215c486fbe736f6a06b1 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Fri Nov 15 21:22:39 2019 +0800 接口适配 commit 8913a7d22eacccc639fe6ae2fd21f21b269b9b18 Author: liuxueli <liuxueli@iie.ac.cn> Date: Fri Nov 15 19:29:54 2019 +0800 规则排序功能 统一发送日志功能 commit 1cb2358fea5ad03fddb7f69c062bcebe3821073e Merge: c76bc55 bd65acc Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Thu Nov 14 15:06:35 2019 +0800 合并master修改 commit c76bc5534dcc4128b1e9b73e8fc25d981056411c Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:56:19 2019 +0800 接口增加protocol参数 commit db7282dab7f157bb3fd82f1843f7d953d2dbc1ec Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:24:22 2019 +0800 扫描接口增加domain commit 56fadd73b2560fcea04a30a60bae9fa1c9ed4d72 Merge: f9aee05 9e738ae Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 19:08:55 2019 +0800 Merge branch 'master' into feature-kni commit f9aee05bcc1b87e8c9dfd9f6deeedd3570a9905f Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:17:59 2019 +0800 修改ssl_utils文件名 commit 452a08790cbe91e4e854e72778816cb9137a4605 Merge: 3abe8a2 c1ffc53 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:12:14 2019 +0800 Merge branch 'master' into feature-kni commit 3abe8a2fc5a3acacb29ddfa1b3be8ad9771d4324 Author: 崔一鸣 <cuiyiming@iie.ac.cn> Date: Wed Nov 13 16:11:38 2019 +0800 添加kni模块扫描部分
2019-12-09 18:58:05 +08:00
_chello->sni = NULL;
_chello->alpn = NULL;
_chello->cipher_suites = NULL;
_chello->cipher_suites_tls13 = NULL;
/* TLS record length */
size_t len = ((size_t)buff[3] << 8) + (size_t)buff[4] + 5;
if (buff_len < len)
{
*result = CHELLO_PARSE_NOT_ENOUGH_BUFF;
return _chello;
}
buff_len = len;
size_t pos = 5;
if (pos + 1 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
if (buff[pos] != 0x01)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
pos += 4;
if(pos + 2 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
_chello->max_version.major = buff[pos];
_chello->max_version.minor = buff[pos+1];
_chello->max_version.ossl_format=(uint16_t)_chello->max_version.major<<8|_chello->max_version.minor;
pos += 34;
/* Session ID */
if (pos + 1 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
len = (size_t)buff[pos];
pos += 1 + len;
/* Cipher Suites */
if (pos + 2 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
len = ((size_t)buff[pos] << 8) + (size_t)buff[pos + 1];
pos += 2;
if(pos + len > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
int n = sizeof(cipher_suite_list) / sizeof(struct cipher_suite);
_chello->cipher_suites = parse_cipher_suites(cipher_suite_list, n, buff + pos, len, result);
if(*result != CHELLO_PARSE_SUCCESS)
{
return _chello;
}
n = sizeof(cipher_suite_list_tls13) / sizeof(struct cipher_suite);
_chello->cipher_suites_tls13 = parse_cipher_suites(cipher_suite_list_tls13, n, buff + pos, len, result);
if(*result != CHELLO_PARSE_SUCCESS)
{
return _chello;
}
pos += len;
/* Compression Methods */
if (pos >= buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
len = (size_t)buff[pos];
pos += 1 + len;
/* no extensions */
if(pos == buff_len)
{
*result = CHELLO_PARSE_SUCCESS;
return _chello;
}
/* Extensions */
if (pos + 2 > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
len = ((size_t)buff[pos] << 8) + (size_t)buff[pos + 1];
pos += 2;
if (pos + len > buff_len)
{
*result = CHELLO_PARSE_INVALID_FORMAT;
return _chello;
}
enum chello_parse_result ret = parse_extensions(buff + pos, len, _chello);
*result = ret;
return _chello;
}
}