From 9e111481efd49b311da09a209f143b991c8e2093 Mon Sep 17 00:00:00 2001 From: fengweihao Date: Mon, 7 Sep 2020 18:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=89=E8=A3=85=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=20=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=AE=9A=E6=97=B6=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8Dip=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E9=9C=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 ++-- cmake/Package.cmake | 7 ++++--- platform/src/verify_policy.cpp | 3 ++- script/{ => service}/verify-policy.service | 0 script/{ => tarball}/tarball.sh | 0 script/tmpfiles/verify_policy.conf | 7 +++++++ 6 files changed, 15 insertions(+), 6 deletions(-) rename script/{ => service}/verify-policy.service (100%) rename script/{ => tarball}/tarball.sh (100%) create mode 100644 script/tmpfiles/verify_policy.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index dc84d5c..766a001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ if(NOT CMAKE_BUILD_TYPE) endif() if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set (CMAKE_INSTALL_PREFIX "/home/tsg/verify-policy" CACHE PATH "default install path" FORCE ) + set (CMAKE_INSTALL_PREFIX "/opt/tsg/verify-policy" CACHE PATH "default install path" FORCE ) endif() # Global compile options @@ -45,7 +45,7 @@ endif() add_custom_target("install-program" COMMAND ${CMAKE_COMMAND} ARGS -DCOMPONENT=Program -P cmake_install.cmake) add_custom_target("install-profile" COMMAND ${CMAKE_COMMAND} ARGS -DCOMPONENT=Profile -P cmake_install.cmake) -add_custom_target("tarball" COMMAND sh ${CMAKE_SCRIPT_PATH}/tarball.sh ${TARGET_VERSION} ${TARGET_DESCRIBE}) +add_custom_target("tarball" COMMAND sh ${CMAKE_SCRIPT_PATH}/tarball/tarball.sh ${TARGET_VERSION} ${TARGET_DESCRIBE}) enable_testing() #add_subdirectory(conf) diff --git a/cmake/Package.cmake b/cmake/Package.cmake index c5022b4..5bb224b 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -22,14 +22,15 @@ set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PreInstall.in) #set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostUninstall.in) #set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PreUninstall.in) -set(CMAKE_INSTALL_PREFIX "/home/tsg/verify-policy") -set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX /home/tsg) +set(CMAKE_INSTALL_PREFIX "/opt/tsg/verify-policy") +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX /opt/tsg) install(PROGRAMS build/platform/verify-policy DESTINATION ./bin) install(DIRECTORY ./conf DESTINATION ./) install(DIRECTORY ./resource DESTINATION ./) -install(FILES script/verify-policy.service DESTINATION /usr/lib/systemd/system/) +install(FILES script/service/verify-policy.service DESTINATION /usr/lib/systemd/system/) +install(FILES script/tmpfiles/verify_policy.conf DESTINATION /usr/lib/tmpfiles.d/) # Must uninstall the debug package before install release package if(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/platform/src/verify_policy.cpp b/platform/src/verify_policy.cpp index fa07442..13de274 100644 --- a/platform/src/verify_policy.cpp +++ b/platform/src/verify_policy.cpp @@ -320,7 +320,8 @@ cJSON *get_query_from_request(const char *data, int thread_id) goto free; } hit_cnt = http_policy_scan(verify_policy->type, &verify_policy->verify_object[i], data_obj, ctx); - if(0 == strcasecmp(verify_policy->verify_object[i].attri_name, "ip")) + if(0 == strcasecmp(verify_policy->verify_object[i].attri_name, "source") || + 0 == strcasecmp(verify_policy->verify_object[i].attri_name, "destination")) { ipaddr_free(verify_policy->verify_object[i].ip_addr); } diff --git a/script/verify-policy.service b/script/service/verify-policy.service similarity index 100% rename from script/verify-policy.service rename to script/service/verify-policy.service diff --git a/script/tarball.sh b/script/tarball/tarball.sh similarity index 100% rename from script/tarball.sh rename to script/tarball/tarball.sh diff --git a/script/tmpfiles/verify_policy.conf b/script/tmpfiles/verify_policy.conf new file mode 100644 index 0000000..f7fe4cc --- /dev/null +++ b/script/tmpfiles/verify_policy.conf @@ -0,0 +1,7 @@ +#Type Path Mode User Group Age Argument +d /var/log/verify-policy/ 0755 - - 7d - +d /run/verify-policy/pangu_files 0755 - - - - +d /run/verify-policy/rulescan_tmp 0755 - - - - +L /opt/tsg/verify-policy/logs - - - - /var/log/verify-policy +L /opt/tsg/verify-policy/pangu_files - - - - /run/verify-policy/pangu_files +L /opt/tsg/verify-policy/rulescan_tmp - - - - /run/verify-policy/rulescan_tmp