This commit is contained in:
A13501350
2025-09-19 03:58:12 +08:00
parent 5802c016a0
commit 84425206e8
2 changed files with 58 additions and 78 deletions

View File

@@ -9,73 +9,54 @@ on:
- v2/test-ci-windows - v2/test-ci-windows
jobs: jobs:
inspect-apache: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Check Apache24 bin directory - name: Create test files (MSYS2)
uses: msys2/setup-msys2@v2
shell: msys2 {0}
run: | run: |
$binPath = "C:\tools\Apache24\bin" # 创建测试目录和文件
Write-Host "=== Apache24 bin Directory Contents ===" mkdir -p test-files
if (Test-Path $binPath) { echo "This is a test file" > test-files/test.txt
Write-Host "Directory exists at: $binPath" echo "fuzzy definition file" > test-files/fuzzy.def
Write-Host "Files and subdirectories:"
Get-ChildItem -Path $binPath -Recurse | ForEach-Object {
if ($_.PSIsContainer) {
Write-Host " [DIR] $($_.FullName)"
} else {
Write-Host " [FILE] $($_.FullName) ($($_.Length) bytes)"
}
}
} else {
Write-Host "Bin directory does not exist at: $binPath"
}
shell: pwsh
- name: Check Apache24 include directory # 复制到工作区目录
mkdir -p ${{ github.workspace }}/artifacts
cp -r test-files/* ${{ github.workspace }}/artifacts/
# 验证文件已复制
echo "Files in artifacts directory:"
ls -la ${{ github.workspace }}/artifacts/
- name: Verify file transfer (PowerShell)
shell: powershell
run: | run: |
$includePath = "C:\tools\Apache24\include" Write-Host "Checking transferred files in PowerShell:"
Write-Host "=== Apache24 include Directory Contents ===" Get-ChildItem -Path "${{ github.workspace }}\artifacts" -Recurse
if (Test-Path $includePath) {
Write-Host "Directory exists at: $includePath" # 验证文件内容
Write-Host "Files and subdirectories:" Write-Host "Content of test.txt:"
Get-ChildItem -Path $includePath -Recurse | ForEach-Object { Get-Content "${{ github.workspace }}\artifacts\test.txt"
if ($_.PSIsContainer) {
Write-Host " [DIR] $($_.FullName)" Write-Host "Content of fuzzy.def:"
Get-Content "${{ github.workspace }}\artifacts\fuzzy.def"
# 检查文件是否存在
$testFile = "${{ github.workspace }}\artifacts\test.txt"
$fuzzyFile = "${{ github.workspace }}\artifacts\fuzzy.def"
if (Test-Path $testFile -PathType Leaf) {
Write-Host "✓ test.txt successfully transferred"
} else { } else {
Write-Host " [FILE] $($_.FullName) ($($_.Length) bytes)" Write-Host "✗ test.txt not found"
} exit 1
} }
# 特别检查 APR 头文件 if (Test-Path $fuzzyFile -PathType Leaf) {
Write-Host "`n=== APR Header Files ===" Write-Host "✓ fuzzy.def successfully transferred"
Get-ChildItem -Path $includePath -Filter "apr*.h" -Recurse | ForEach-Object {
Write-Host " $($_.FullName)"
}
# 检查是否存在 apr_perms_set.h
$permsSetPath = Join-Path $includePath "apr_perms_set.h"
if (Test-Path $permsSetPath) {
Write-Host "`nFOUND: apr_perms_set.h exists at $permsSetPath"
} else { } else {
Write-Host "`nMISSING: apr_perms_set.h not found in $includePath" Write-Host "✗ fuzzy.def not found"
exit 1
} }
} else {
Write-Host "Include directory does not exist at: $includePath"
}
shell: pwsh
- name: Check Apache24 directory structure
run: |
$apachePath = "C:\tools\Apache24"
Write-Host "=== Apache24 Overall Structure ==="
if (Test-Path $apachePath) {
Write-Host "Apache24 directory exists at: $apachePath"
Write-Host "Top-level directories:"
Get-ChildItem -Path $apachePath -Directory | ForEach-Object {
Write-Host " - $($_.Name)"
}
} else {
Write-Host "Apache24 directory does not exist at: $apachePath"
}
shell: pwsh

View File

@@ -4,6 +4,7 @@ project(ModSecurityIIS C CXX)
find_package(LibXml2 CONFIG REQUIRED) find_package(LibXml2 CONFIG REQUIRED)
find_package(PCRE2 CONFIG REQUIRED) find_package(PCRE2 CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED)
find_package(APR CONFIG REQUIRED)
# iis/CMakeLists.txt # iis/CMakeLists.txt
set(IIS_MODULE_NAME "modsecurityiis") # Name should match the original output set(IIS_MODULE_NAME "modsecurityiis") # Name should match the original output
@@ -125,9 +126,10 @@ target_include_directories(${IIS_MODULE_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../apache2 ${CMAKE_CURRENT_SOURCE_DIR}/../apache2
${CMAKE_CURRENT_SOURCE_DIR}/../apache2/libinjection ${CMAKE_CURRENT_SOURCE_DIR}/../apache2/libinjection
${LIBXML2_INCLUDE_DIR}/libxml ${LIBXML2_INCLUDE_DIR}/libxml
${PCRE_INCLUDE_DIRS} ${PCRE2_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR} # 添加构建目录以访问生成的头文件 ${APR_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
) )
# Include standalone directory if it exists # Include standalone directory if it exists
@@ -139,6 +141,12 @@ endif()
# Apache-specific includes # Apache-specific includes
if(APACHE_ROOT) if(APACHE_ROOT)
if(NOT EXISTS "${APACHE_ROOT}")
message(FATAL_ERROR "APACHE_ROOT is defined but the directory '${APACHE_ROOT}' does not exist. Please set APACHE_ROOT to a valid Apache installation directory.")
endif()
if(NOT EXISTS "${APACHE_ROOT}/lib")
message(FATAL_ERROR "APACHE_ROOT/lib directory does not exist. Expected: '${APACHE_ROOT}/lib'. Please ensure Apache libraries are available.")
endif()
target_include_directories(${IIS_MODULE_NAME} PRIVATE target_include_directories(${IIS_MODULE_NAME} PRIVATE
${APACHE_ROOT}/include ${APACHE_ROOT}/include
) )
@@ -166,24 +174,15 @@ if(WITH_LUA)
target_include_directories(${IIS_MODULE_NAME} PRIVATE ${LUA_INCLUDE_DIR}) target_include_directories(${IIS_MODULE_NAME} PRIVATE ${LUA_INCLUDE_DIR})
endif() endif()
# Default Apache root based on architecture
if(NOT APACHE_ROOT)
if(ARCHITECTURE STREQUAL "x64")
set(APACHE_ROOT "C:/Apache24_x64" CACHE PATH "Path to Apache x64 installation")
else()
set(APACHE_ROOT "C:/Apache24_x86" CACHE PATH "Path to Apache x86 installation")
endif()
endif()
option(WITH_YAJL "Enable YAJL support" OFF) option(WITH_YAJL "Enable YAJL support" OFF)
if(WITH_YAJL) if(WITH_YAJL)
# Manually find YAJL if config.cmake is not available (e.g., from vcpkg) # Manually find YAJL if config.cmake is not available (e.g., from vcpkg)
find_path(YAJL_INCLUDE_DIR yajl/yajl_common.h find_path(YAJL_INCLUDE_DIR yajl/yajl_common.h
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/${ARCHITECTURE}-windows/include" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/build/vcpkg_installed/${ARCHITECTURE}-windows/include"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
find_library(YAJL_LIBRARY NAMES yajl find_library(YAJL_LIBRARY NAMES yajl
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/${ARCHITECTURE}-windows/lib" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/build/vcpkg_installed/${ARCHITECTURE}-windows/lib"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
@@ -193,7 +192,7 @@ if(WITH_YAJL)
target_compile_definitions(${IIS_MODULE_NAME} PRIVATE WITH_YAJL) target_compile_definitions(${IIS_MODULE_NAME} PRIVATE WITH_YAJL)
target_include_directories(${IIS_MODULE_NAME} PRIVATE ${YAJL_INCLUDE_DIRS}) target_include_directories(${IIS_MODULE_NAME} PRIVATE ${YAJL_INCLUDE_DIRS})
else() else()
message(WARNING "YAJL not found. Please ensure yajl is installed via vcpkg in the iis/vcpkg_installed directory. Disabling YAJL support.") message(WARNING "YAJL not found. YAJL_INCLUDE_DIR: '${YAJL_INCLUDE_DIR}', YAJL_LIBRARY: '${YAJL_LIBRARY}'. Please ensure yajl is installed via vcpkg in the vcpkg_installed directory. Disabling YAJL support.")
option(WITH_YAJL "Enable YAJL support" OFF) # Disable if not found option(WITH_YAJL "Enable YAJL support" OFF) # Disable if not found
endif() endif()
endif() endif()
@@ -203,7 +202,7 @@ if(WITH_SSDEEP)
set(SSDEEP_ROOT "" CACHE PATH "Path to manually built ssdeep") set(SSDEEP_ROOT "" CACHE PATH "Path to manually built ssdeep")
if(NOT SSDEEP_ROOT OR NOT EXISTS "${SSDEEP_ROOT}") if(NOT SSDEEP_ROOT OR NOT EXISTS "${SSDEEP_ROOT}")
message(WARNING "SSDEEP_ROOT is not defined or path does not exist. Please set SSDEEP_ROOT to the ssdeep installation directory. Disabling SSDEEP support.") message(WARNING "SSDEEP_ROOT is not defined or path does not exist. Current SSDEEP_ROOT: '${SSDEEP_ROOT}'. Please set SSDEEP_ROOT to the ssdeep installation directory. Disabling SSDEEP support.")
set(WITH_SSDEEP OFF CACHE BOOL "Enable SSDEEP support" FORCE) set(WITH_SSDEEP OFF CACHE BOOL "Enable SSDEEP support" FORCE)
else() else()
message(STATUS "SSDEEP_ROOT: ${SSDEEP_ROOT}") message(STATUS "SSDEEP_ROOT: ${SSDEEP_ROOT}")