summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-06-05 21:10:16 +0800
committeryangwei <[email protected]>2024-06-12 04:19:29 +0800
commit123a903a45091a8bc8d6126b2c0b084d7e9a83ad (patch)
tree0702529304a124860a8622e7a9b13dce75f70ec8
parent0a0609fb518eaa73a91be95a0b8fd258380ce9f1 (diff)
🧪 test(test env upgrade): based toolkit from sapp4.2 to 4.3v2.0.16
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--CMakeLists.txt1
-rw-r--r--bin/ssl.inf4
-rw-r--r--bin/ssl_defer.inf10
-rw-r--r--cmake/preInstall.sh4
-rw-r--r--cmake/preUninstall.sh1
-rw-r--r--src/SSL_Analyze.c8
-rw-r--r--src/SSL_Message.c14
-rw-r--r--test/CMakeLists.txt6
-rw-r--r--test/test_protocol_run.zipbin795325 -> 3181539 bytes
10 files changed, 33 insertions, 17 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 70b0f2c..b34b4be 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,7 @@ variables:
BUILD_IMAGE_CENTOS8: "git.mesalab.cn:7443/mesa_platform/build-env:rockylinux"
BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/
INSTALL_DEPENDENCY_PLATFORM: sapp-devel libasan systemd-devel libnsl
- INSTALL_DEPENDENCY_FRAMEWORK: libMESA_handle_logger-devel libcjson-devel libMESA_field_stat2-devel framework_env libMESA_prof_load-devel libbreakpad_mini-devel libMESA_htable-devel
+ INSTALL_DEPENDENCY_FRAMEWORK: libMESA_handle_logger-devel libcjson-devel libMESA_field_stat2-devel framework_env libMESA_prof_load-devel libbreakpad_mini-devel libMESA_htable-devel libfieldstat3 libMESA_jump_layer
INSTALL_PREFIX: "/home/mesasoft/sapp_run/"
stages:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8a2df8..7053c74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,6 @@ else()
endif()
include_directories(/opt/MESA/include/MESA/)
-include_directories(./src/inc/)
include_directories(./src/)
include_directories(include)
diff --git a/bin/ssl.inf b/bin/ssl.inf
index 188a96e..f73af40 100644
--- a/bin/ssl.inf
+++ b/bin/ssl.inf
@@ -10,7 +10,3 @@ GETPLUGID_FUNC=SSL_GETPLUGID
[TCP]
FUNC_FLAG=ALL
FUNC_NAME=SSL_ENTRY
-
-[TCP_ALL]
-FUNC_FLAG=ALL
-FUNC_NAME=SSL_DETAIN_ENTRY
diff --git a/bin/ssl_defer.inf b/bin/ssl_defer.inf
new file mode 100644
index 0000000..1ae4691
--- /dev/null
+++ b/bin/ssl_defer.inf
@@ -0,0 +1,10 @@
+[PLUGINFO]
+PLUGNAME=SSL_DEFER
+SO_PATH=./plug/protocol/ssl/ssl.so
+INIT_FUNC=SSL_DEFER_INIT
+DESTROY_FUNC=SSL_DEFER_DESTROY
+
+
+[TCP_ALL]
+FUNC_FLAG=ALL
+FUNC_NAME=SSL_DETAIN_ENTRY
diff --git a/cmake/preInstall.sh b/cmake/preInstall.sh
index ccce914..6cfa366 100644
--- a/cmake/preInstall.sh
+++ b/cmake/preInstall.sh
@@ -14,4 +14,8 @@ if [[ -z `grep -rn 'SSL' ${DST}/etc/entrylist.conf` ]];then
fi
if [[ -z `grep -rn 'JA3_FINGERPRINT_LABEL' ${DST}/etc/project_list.conf` ]];then
echo "JA3_FINGERPRINT_LABEL struct" >> ${DST}/etc/project_list.conf
+fi
+
+if [[ -z `grep -rn 'ssl_defer.inf' ${DST}/plug/conflist.inf` ]];then
+ sed -i '$a ./plug/protocol/ssl/ssl_defer.inf' ${DST}/plug/conflist.inf
fi \ No newline at end of file
diff --git a/cmake/preUninstall.sh b/cmake/preUninstall.sh
index e01923e..2b439ac 100644
--- a/cmake/preUninstall.sh
+++ b/cmake/preUninstall.sh
@@ -10,4 +10,5 @@ if [ $1 == 0 ]; then
sed -i '/ssl.inf/d' ${DST}/plug/conflist.inf
sed -i '/SSL/d' ${DST}/etc/entrylist.conf
+ sed -i '/ssl_defer.inf/d' ${DST}/plug/conflist.inf
fi
diff --git a/src/SSL_Analyze.c b/src/SSL_Analyze.c
index cff6096..23060ad 100644
--- a/src/SSL_Analyze.c
+++ b/src/SSL_Analyze.c
@@ -271,6 +271,10 @@ void ssl_frag_chello_free(struct streaminfo *a_tcp)
return;
}
+
+extern "C" int SSL_DEFER_INIT(void){return 0;};
+extern "C" void SSL_DEFER_DESTROY(void){};
+
int SSL_INIT(void)
{
memset(&g_ssl_prog_para,0,sizeof(ssl_prog_runtime_parameter_t));
@@ -305,8 +309,8 @@ int SSL_INIT(void)
value = 1;
FS_set_para(g_ssl_prog_para.stat_handler, CREATE_THREAD, &value, sizeof(value));
FS_set_para(g_ssl_prog_para.stat_handler, APP_NAME, g_ssl_prog_para.stat_appname, strlen(g_ssl_prog_para.stat_appname)+1);
- FS_set_para(g_ssl_prog_para.stat_handler, STATS_SERVER_IP, g_ssl_prog_para.stat_dst_ip, strlen(g_ssl_prog_para.stat_dst_ip)+1);
- FS_set_para(g_ssl_prog_para.stat_handler, STATS_SERVER_PORT, &g_ssl_prog_para.stat_dst_port, sizeof(g_ssl_prog_para.stat_dst_port));
+ //FS_set_para(g_ssl_prog_para.stat_handler, STATS_SERVER_IP, g_ssl_prog_para.stat_dst_ip, strlen(g_ssl_prog_para.stat_dst_ip)+1);
+ //FS_set_para(g_ssl_prog_para.stat_handler, STATS_SERVER_PORT, &g_ssl_prog_para.stat_dst_port, sizeof(g_ssl_prog_para.stat_dst_port));
g_ssl_prog_para.stat_field[SSL_STAT_PKTS_C2S] = FS_register(g_ssl_prog_para.stat_handler,FS_STYLE_FIELD,FS_CALC_CURRENT,"ssl_c2s_pkts");
g_ssl_prog_para.stat_field[SSL_STAT_PKTS_S2C] = FS_register(g_ssl_prog_para.stat_handler,FS_STYLE_FIELD,FS_CALC_CURRENT,"ssl_s2c_pkts");
g_ssl_prog_para.stat_field[SSL_STAT_BITS_C2S] = FS_register(g_ssl_prog_para.stat_handler,FS_STYLE_FIELD,FS_CALC_CURRENT,"ssl_c2s_bytes");
diff --git a/src/SSL_Message.c b/src/SSL_Message.c
index 15de60a..34d3ef3 100644
--- a/src/SSL_Message.c
+++ b/src/SSL_Message.c
@@ -929,7 +929,7 @@ UCHAR ssl_analyseSsl(char *pcSslData, int iDataLen, int *res, ssl_stream *a_ssl_
struct ssl_frag_chello *ssl_frag_chello_get0(struct streaminfo *a_tcp)
{
- if(g_ssl_prog_para.detain_frag_chello_num == 0 || a_tcp->curdir != DIR_C2S || a_tcp->dir != DIR_DOUBLE)return NULL;
+ if(g_ssl_prog_para.detain_frag_chello_num == 0)return NULL;
struct frag_chello_internal *pkts = (struct frag_chello_internal *)stream_bridge_async_data_get(a_tcp, g_ssl_prog_para.frag_chello_exdata_idx);
if(pkts)
{
@@ -940,7 +940,8 @@ struct ssl_frag_chello *ssl_frag_chello_get0(struct streaminfo *a_tcp)
static void ssl_detain_frag_chello(const struct streaminfo *a_tcp)
{
- if(g_ssl_prog_para.detain_frag_chello_num == 0 || a_tcp->curdir != DIR_C2S || a_tcp->dir != DIR_DOUBLE)return;
+ if(g_ssl_prog_para.detain_frag_chello_num == 0)return;
+ if(a_tcp->curdir != DIR_C2S)return;
struct frag_chello_internal *pkts = (struct frag_chello_internal *)stream_bridge_async_data_get(a_tcp, g_ssl_prog_para.frag_chello_exdata_idx);
if (pkts == NULL)
@@ -1030,7 +1031,8 @@ UCHAR ssl_analyseStream(struct streaminfo *a_tcp, void **pme, int thread_seq, vo
a_ssl_stream->uiCurBuffLen += iSslDateLen;
iSslDateLen = a_ssl_stream->uiCurBuffLen;
pcSslData = a_ssl_stream->pcSslBuffer;
- ssl_detain_frag_chello(a_tcp);
+ if(*(unsigned char *)(a_ssl_stream->pcSslBuffer)==CLIENT_HELLO)
+ ssl_detain_frag_chello(a_tcp);
}
else
{
@@ -1047,7 +1049,8 @@ UCHAR ssl_analyseStream(struct streaminfo *a_tcp, void **pme, int thread_seq, vo
/*is ssl_stream, need buffer data*/
if (iRet < 0 || iRet >= iSslDateLen)
{
- ssl_detain_chello_finish(a_tcp);
+ if(a_ssl_stream->pcSslBuffer!=NULL && *(unsigned char *)(a_ssl_stream->pcSslBuffer)==CLIENT_HELLO)
+ ssl_detain_chello_finish(a_tcp);
a_ssl_stream->uiCurBuffLen = 0;
}
else
@@ -1060,7 +1063,8 @@ UCHAR ssl_analyseStream(struct streaminfo *a_tcp, void **pme, int thread_seq, vo
}
fn_vMemCpy(a_ssl_stream->pcSslBuffer, (int)a_ssl_stream->uiMaxBuffLen, pcSslData + iRet, (int)(iSslDateLen - iRet));
a_ssl_stream->uiCurBuffLen = iSslDateLen - iRet;
- ssl_detain_frag_chello(a_tcp);
+ if(*(unsigned char *)(a_ssl_stream->pcSslBuffer)==CLIENT_HELLO)
+ ssl_detain_frag_chello(a_tcp);
}
return return_val;
}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1394e6b..0365676 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -8,7 +8,7 @@ include(ExternalProject)
ExternalProject_Add(ProtoTest PREFIX ProtoTest
URL ${CMAKE_CURRENT_SOURCE_DIR}/test_protocol_run.zip
- URL_MD5 71d8284b59af0286b5f31f0a3160bc44
+ URL_MD5 7e9f0f8345ca83665b4314cddc06ea96
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
@@ -27,15 +27,13 @@ set(PROTO_TEST_RUN_DIR ${SOURCE_DIR})
add_executable(proto_test_main IMPORTED GLOBAL)
add_dependencies(proto_test_main ProtoTest)
-set_property(TARGET proto_test_main PROPERTY IMPORTED_LOCATION ${SOURCE_DIR}/test_protocol_plug_main)
+set_property(TARGET proto_test_main PROPERTY IMPORTED_LOCATION ${SOURCE_DIR}/plugin_test_main)
add_library(${lib_name}_test_plug SHARED ${lib_name}_test_plug.cpp)
target_link_libraries(${lib_name}_test_plug MESA_prof_load cjson)
set_target_properties(${lib_name}_test_plug PROPERTIES PREFIX "")
-add_test(NAME UPDATE_SAPP_LOG COMMAND bash -c "sed -i 's/fatal/info/' ${PROTO_TEST_RUN_DIR}/etc/sapp_log.conf")
-
add_test(NAME COPY_SO COMMAND sh -c "cp ${CMAKE_BINARY_DIR}/${lib_name}.so ${PROTO_TEST_RUN_DIR}/plug/protocol/${lib_name}/${lib_name}.so")
add_test(NAME COPY_TEST_SO COMMAND sh -c "cp ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_test_plug.so ${PROTO_TEST_RUN_DIR}/plug/business/${lib_name}_test_plug/${lib_name}_test_plug.so")
diff --git a/test/test_protocol_run.zip b/test/test_protocol_run.zip
index 996f3fa..9e8fd46 100644
--- a/test/test_protocol_run.zip
+++ b/test/test_protocol_run.zip
Binary files differ