The Windows build of libModSecurity uses Build Tools for Visual Studio 2022 (for Visual C++ & CMake) and Conan package manager.
C:\BuildTools\VC\Auxiliary\Build\vcvars64.bat
conan profile detect --force
libinjection
and regression tests)
git submodule init
git submodule update
Install the prerequisites listed in the previous section, checkout libModSecurity and from the directory where it's located execute:
vcbuild.bat [build_configuration] [arch] [USE_ASAN]
where [build_configuration]
can be: Release
(default), RelWithDebInfo
, MinSizeRel
or Debug
, and [arch]
can be: x86_64
(default) or x86
.
Built files will be located in the directory: build\win32\build\[build_configuration]
and include:
libModSecurity.dll
unit_tests.exe
regression_tests.exe
benchmark.exe
rules_optimization.exe
simple_example_using_c.exe
using_bodies_in_chunks.exe
reading_logs_via_rule_message.exe
reading_logs_with_offset.exe
multithread.exe
rules_check.exe
NOTE: When building a different configuration, it's recommended to reset:
build\win32\build
conan remove * -c
By default the following all the following features are enabled by including the associated third-party library through a Conan package:
Each of these can be turned off by updating the associated HAVE_xxx
variable (setting it to zero) in the beginning of the libModSecurity section of CMakeLists.txt
.
AddressSanitizer (aka ASan) is a memory error detector for C/C++.
To generate a build with Address Sanitizer, add the USE_ASAN
optional third argument to vcbuild.bat
. For example:
vcbuild.bat Debug x86_64 USE_ASAN
NOTE: USE_ASAN
does not work with Release
& MinSizeRel
configurations because they do not include debug info (it is only compatible with Debug
& RelWithDebInfo
builds).
A Dockerfile
configuration file is provided in the docker
subdir that creates a Windows container image which installs the prerequisites and builds libModSecurity and other binaries.
NOTE: Windows containers are supported in Docker Desktop for Windows, using the Switch to Windows containers... option on the context menu of the system tray icon.
To build the docker image, execute the following command (from the build\win32\docker
directory):
docker build -t libmodsecurity:latest -m 4GB .
BUILD_TYPE
, ARCH
& USE_ASAN
respectively). For example, to generate a debug build, add the following argument:
--build-arg BUILD_TYPE=Debug
Once the image is generated, the library and associated binaries (tests & examples) are located in the C:\src\ModSecurity\build\win32\build\[build_type]
directory.
To extract the library (libModSecurity.dll
) from the image, you can execute the following commands:
docker container create --name [container_name] libmodsecurity
docker cp [container_name]:C:\src\ModSecurity\build\win32\build\[build_type]\libModSecurity.dll .
libModSecurity.dll
filename out, you can copy all the built binaries (including examples & tests).Additionally, the image can be used interactively for additional development work by executing:
docker run -it libmodsecurity
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )