mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-09 01:58:13 +00:00
build: remove webserver from minimal build
Co-Authored-By: Lorenzo Fontana <fontanalorenz@gmail.com> Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
This commit is contained in:
parent
9d88bfd0d4
commit
bdd14604d4
@ -39,6 +39,7 @@ add_custom_command(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/outputs.proto
|
${CMAKE_CURRENT_SOURCE_DIR}/outputs.proto
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
if(MINIMAL_BUILD)
|
||||||
add_executable(
|
add_executable(
|
||||||
falco
|
falco
|
||||||
configuration.cpp
|
configuration.cpp
|
||||||
@ -48,7 +49,6 @@ add_executable(
|
|||||||
statsfilewriter.cpp
|
statsfilewriter.cpp
|
||||||
falco.cpp
|
falco.cpp
|
||||||
"${SYSDIG_SOURCE_DIR}/userspace/sysdig/fields_info.cpp"
|
"${SYSDIG_SOURCE_DIR}/userspace/sysdig/fields_info.cpp"
|
||||||
webserver.cpp
|
|
||||||
grpc_context.cpp
|
grpc_context.cpp
|
||||||
grpc_server_impl.cpp
|
grpc_server_impl.cpp
|
||||||
grpc_request_context.cpp
|
grpc_request_context.cpp
|
||||||
@ -58,43 +58,97 @@ add_executable(
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.grpc.pb.cc
|
${CMAKE_CURRENT_BINARY_DIR}/outputs.grpc.pb.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.pb.cc
|
${CMAKE_CURRENT_BINARY_DIR}/outputs.pb.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/schema.pb.cc)
|
${CMAKE_CURRENT_BINARY_DIR}/schema.pb.cc)
|
||||||
|
else()
|
||||||
|
add_executable(
|
||||||
|
falco
|
||||||
|
configuration.cpp
|
||||||
|
logger.cpp
|
||||||
|
falco_outputs.cpp
|
||||||
|
event_drops.cpp
|
||||||
|
statsfilewriter.cpp
|
||||||
|
falco.cpp
|
||||||
|
"${SYSDIG_SOURCE_DIR}/userspace/sysdig/fields_info.cpp"
|
||||||
|
webserver.cpp
|
||||||
|
grpc_context.cpp
|
||||||
|
grpc_server_impl.cpp
|
||||||
|
grpc_request_context.cpp
|
||||||
|
grpc_server.cpp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/version.grpc.pb.cc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/version.pb.cc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/outputs.grpc.pb.cc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/outputs.pb.cc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/schema.pb.cc)
|
||||||
|
|
||||||
add_dependencies(falco civetweb string-view-lite)
|
add_dependencies(falco civetweb)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_dependencies(falco string-view-lite)
|
||||||
|
|
||||||
if(USE_BUNDLED_DEPS)
|
if(USE_BUNDLED_DEPS)
|
||||||
add_dependencies(falco yamlcpp)
|
add_dependencies(falco yamlcpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
if(MINIMAL_BUILD)
|
||||||
falco
|
target_include_directories(
|
||||||
PUBLIC
|
falco
|
||||||
"${SYSDIG_SOURCE_DIR}/userspace/sysdig"
|
PUBLIC
|
||||||
"${PROJECT_SOURCE_DIR}/userspace/engine"
|
"${SYSDIG_SOURCE_DIR}/userspace/sysdig"
|
||||||
"${PROJECT_BINARY_DIR}/userspace/falco"
|
"${PROJECT_SOURCE_DIR}/userspace/engine"
|
||||||
"${PROJECT_BINARY_DIR}/driver/src"
|
"${PROJECT_BINARY_DIR}/userspace/falco"
|
||||||
"${STRING_VIEW_LITE_INCLUDE}"
|
"${PROJECT_BINARY_DIR}/driver/src"
|
||||||
"${YAMLCPP_INCLUDE_DIR}"
|
"${STRING_VIEW_LITE_INCLUDE}"
|
||||||
"${CIVETWEB_INCLUDE_DIR}"
|
"${YAMLCPP_INCLUDE_DIR}"
|
||||||
"${OPENSSL_INCLUDE_DIR}"
|
"${OPENSSL_INCLUDE_DIR}"
|
||||||
"${GRPC_INCLUDE}"
|
"${GRPC_INCLUDE}"
|
||||||
"${GRPCPP_INCLUDE}"
|
"${GRPCPP_INCLUDE}"
|
||||||
"${PROTOBUF_INCLUDE}"
|
"${PROTOBUF_INCLUDE}"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
"${DRAIOS_DEPENDENCIES_DIR}/yaml-${DRAIOS_YAML_VERSION}/target/include")
|
"${DRAIOS_DEPENDENCIES_DIR}/yaml-${DRAIOS_YAML_VERSION}/target/include")
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
falco
|
falco
|
||||||
falco_engine
|
falco_engine
|
||||||
sinsp
|
sinsp
|
||||||
"${GPR_LIB}"
|
"${GPR_LIB}"
|
||||||
"${GRPC_LIB}"
|
"${GRPC_LIB}"
|
||||||
"${GRPCPP_LIB}"
|
"${GRPCPP_LIB}"
|
||||||
"${PROTOBUF_LIB}"
|
"${PROTOBUF_LIB}"
|
||||||
"${OPENSSL_LIBRARY_SSL}"
|
"${OPENSSL_LIBRARY_SSL}"
|
||||||
"${OPENSSL_LIBRARY_CRYPTO}"
|
"${OPENSSL_LIBRARY_CRYPTO}"
|
||||||
"${LIBYAML_LIB}"
|
"${LIBYAML_LIB}"
|
||||||
"${YAMLCPP_LIB}"
|
"${YAMLCPP_LIB}")
|
||||||
"${CIVETWEB_LIB}")
|
else()
|
||||||
|
target_include_directories(
|
||||||
|
falco
|
||||||
|
PUBLIC
|
||||||
|
"${SYSDIG_SOURCE_DIR}/userspace/sysdig"
|
||||||
|
"${PROJECT_SOURCE_DIR}/userspace/engine"
|
||||||
|
"${PROJECT_BINARY_DIR}/userspace/falco"
|
||||||
|
"${PROJECT_BINARY_DIR}/driver/src"
|
||||||
|
"${STRING_VIEW_LITE_INCLUDE}"
|
||||||
|
"${YAMLCPP_INCLUDE_DIR}"
|
||||||
|
"${CIVETWEB_INCLUDE_DIR}"
|
||||||
|
"${OPENSSL_INCLUDE_DIR}"
|
||||||
|
"${GRPC_INCLUDE}"
|
||||||
|
"${GRPCPP_INCLUDE}"
|
||||||
|
"${PROTOBUF_INCLUDE}"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
"${DRAIOS_DEPENDENCIES_DIR}/yaml-${DRAIOS_YAML_VERSION}/target/include")
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
falco
|
||||||
|
falco_engine
|
||||||
|
sinsp
|
||||||
|
"${GPR_LIB}"
|
||||||
|
"${GRPC_LIB}"
|
||||||
|
"${GRPCPP_LIB}"
|
||||||
|
"${PROTOBUF_LIB}"
|
||||||
|
"${OPENSSL_LIBRARY_SSL}"
|
||||||
|
"${OPENSSL_LIBRARY_CRYPTO}"
|
||||||
|
"${LIBYAML_LIB}"
|
||||||
|
"${YAMLCPP_LIB}"
|
||||||
|
"${CIVETWEB_LIB}")
|
||||||
|
endif()
|
||||||
|
|
||||||
configure_file(config_falco.h.in config_falco.h)
|
configure_file(config_falco.h.in config_falco.h)
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@ limitations under the License.
|
|||||||
#include "falco_engine.h"
|
#include "falco_engine.h"
|
||||||
#include "config_falco.h"
|
#include "config_falco.h"
|
||||||
#include "statsfilewriter.h"
|
#include "statsfilewriter.h"
|
||||||
|
#ifndef MINIMAL_BUILD
|
||||||
#include "webserver.h"
|
#include "webserver.h"
|
||||||
|
#endif
|
||||||
#include "grpc_server.h"
|
#include "grpc_server.h"
|
||||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
#include "banned.h" // This raises a compilation error when certain functions are used
|
||||||
|
|
||||||
@ -461,7 +463,9 @@ int falco_init(int argc, char **argv)
|
|||||||
double duration;
|
double duration;
|
||||||
scap_stats cstats;
|
scap_stats cstats;
|
||||||
|
|
||||||
|
#ifndef MINIMAL_BUILD
|
||||||
falco_webserver webserver;
|
falco_webserver webserver;
|
||||||
|
#endif
|
||||||
falco::grpc::server grpc_server;
|
falco::grpc::server grpc_server;
|
||||||
std::thread grpc_server_thread;
|
std::thread grpc_server_thread;
|
||||||
|
|
||||||
@ -1225,6 +1229,7 @@ int falco_init(int argc, char **argv)
|
|||||||
delete mesos_api;
|
delete mesos_api;
|
||||||
mesos_api = 0;
|
mesos_api = 0;
|
||||||
|
|
||||||
|
#ifndef MINIMAL_BUILD
|
||||||
if(trace_filename.empty() && config.m_webserver_enabled && !disable_k8s_audit)
|
if(trace_filename.empty() && config.m_webserver_enabled && !disable_k8s_audit)
|
||||||
{
|
{
|
||||||
std::string ssl_option = (config.m_webserver_ssl_enabled ? " (SSL)" : "");
|
std::string ssl_option = (config.m_webserver_ssl_enabled ? " (SSL)" : "");
|
||||||
@ -1232,6 +1237,7 @@ int falco_init(int argc, char **argv)
|
|||||||
webserver.init(&config, engine, outputs);
|
webserver.init(&config, engine, outputs);
|
||||||
webserver.start();
|
webserver.start();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// gRPC server
|
// gRPC server
|
||||||
if(config.m_grpc_enabled)
|
if(config.m_grpc_enabled)
|
||||||
@ -1302,7 +1308,9 @@ int falco_init(int argc, char **argv)
|
|||||||
inspector->close();
|
inspector->close();
|
||||||
engine->print_stats();
|
engine->print_stats();
|
||||||
sdropmgr.print_stats();
|
sdropmgr.print_stats();
|
||||||
|
#ifndef MINIMAL_BUILD
|
||||||
webserver.stop();
|
webserver.stop();
|
||||||
|
#endif
|
||||||
if(grpc_server_thread.joinable())
|
if(grpc_server_thread.joinable())
|
||||||
{
|
{
|
||||||
grpc_server.shutdown();
|
grpc_server.shutdown();
|
||||||
@ -1315,7 +1323,9 @@ int falco_init(int argc, char **argv)
|
|||||||
|
|
||||||
result = EXIT_FAILURE;
|
result = EXIT_FAILURE;
|
||||||
|
|
||||||
|
#ifndef MINIMAL_BUILD
|
||||||
webserver.stop();
|
webserver.stop();
|
||||||
|
#endif
|
||||||
if(grpc_server_thread.joinable())
|
if(grpc_server_thread.joinable())
|
||||||
{
|
{
|
||||||
grpc_server.shutdown();
|
grpc_server.shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user