Skip to content

Commit 9b7159e

Browse files
committed
Add: add initial security intelligence library
Introduce a new security_intelligence library to gvm-libs. Add the initial public API and implementation skeleton for: - connector configuration - managed appliance models and operations - managed report models and operations - managed report page models and operations This change also adds the library build and installation files. The REST operation implementations are still placeholders and will be completed in follow-up changes.
1 parent 25e20ac commit 9b7159e

6 files changed

Lines changed: 992 additions & 4 deletions

File tree

.github/workflows/ci-c.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ jobs:
1717
- name: Check Source Format
1818
id: check
1919
run: |
20-
clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,util}/*.{c,h}
20+
clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,security_intelligence,util}/*.{c,h}
2121
git diff --exit-code
2222
- name: Report Diff
2323
if: ${{ failure() && steps.check.outcome == 'failure' }}
2424
run: |
2525
echo "## Clang Format Check" >> $GITHUB_STEP_SUMMARY
2626
echo "Found formatting issues in the source code. Please run clang-format to fix them." >> $GITHUB_STEP_SUMMARY
2727
echo '```sh' >> $GITHUB_STEP_SUMMARY
28-
echo 'clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,util}/*.{c,h}' >> $GITHUB_STEP_SUMMARY
28+
echo 'clang-format -i -style=file {agent_controller,base,boreas,gmp,http,http_scanner,openvasd,osp,security_intelligence,util}/*.{c,h}' >> $GITHUB_STEP_SUMMARY
2929
echo '```' >> $GITHUB_STEP_SUMMARY
3030
echo "## Clang Format Diff" >> $GITHUB_STEP_SUMMARY
3131
echo '```diff' >> $GITHUB_STEP_SUMMARY

CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ option(BUILD_TESTS "Build tests for the libraries" OFF)
2525
option(ENABLE_OPENVASD "Build openvasd library" ON)
2626
option(ENABLE_AGENTS "Build agent controller library" ON)
2727
option(ENABLE_CREDENTIAL_STORES "Build credential store library" ON)
28+
option(ENABLE_SECURITY_INTELLIGENCE "Build security intelligence library" ON)
2829

2930
if(NOT BUILD_STATIC)
3031
set(BUILD_SHARED ON)
@@ -317,9 +318,19 @@ if(NOT SKIP_SRC)
317318
add_subdirectory(osp)
318319
add_subdirectory(gmp)
319320

320-
if(ENABLE_OPENVASD OR ENABLE_AGENTS OR ENABLE_CREDENTIAL_STORES)
321+
if(
322+
ENABLE_OPENVASD
323+
OR ENABLE_AGENTS
324+
OR ENABLE_CREDENTIAL_STORES
325+
OR ENABLE_SECURITY_INTELLIGENCE
326+
)
321327
add_subdirectory(http)
322-
endif(ENABLE_OPENVASD OR ENABLE_AGENTS OR ENABLE_CREDENTIAL_STORES)
328+
endif(
329+
ENABLE_OPENVASD
330+
OR ENABLE_AGENTS
331+
OR ENABLE_CREDENTIAL_STORES
332+
OR ENABLE_SECURITY_INTELLIGENCE
333+
)
323334

324335
if(ENABLE_OPENVASD)
325336
add_subdirectory(http_scanner)
@@ -334,6 +345,10 @@ if(NOT SKIP_SRC)
334345
if(ENABLE_CREDENTIAL_STORES)
335346
add_subdirectory(cyberark)
336347
endif(ENABLE_CREDENTIAL_STORES)
348+
349+
if(ENABLE_SECURITY_INTELLIGENCE)
350+
add_subdirectory(security_intelligence)
351+
endif(ENABLE_SECURITY_INTELLIGENCE)
337352
endif(NOT SKIP_SRC)
338353

339354
## Documentation
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# SPDX-FileCopyrightText: 2026 Greenbone AG
2+
#
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
## Library
6+
7+
include(FindPkgConfig)
8+
9+
if(NOT PKG_CONFIG_FOUND)
10+
message(FATAL_ERROR "pkg-config executable not found. Aborting.")
11+
endif()
12+
13+
## Dependency checks
14+
15+
pkg_check_modules(GLIB REQUIRED glib-2.0>=2.42)
16+
pkg_check_modules(CURL REQUIRED libcurl>=7.83.0)
17+
pkg_check_modules(CJSON REQUIRED libcjson>=1.7.14)
18+
19+
include_directories(${GLIB_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS})
20+
21+
set(FILES security_intelligence.c)
22+
set(HEADERS security_intelligence.h)
23+
24+
if(BUILD_STATIC)
25+
add_library(gvm_security_intelligence_static STATIC ${FILES})
26+
set_target_properties(
27+
gvm_security_intelligence_static
28+
PROPERTIES
29+
OUTPUT_NAME "gvm_security_intelligence"
30+
CLEAN_DIRECT_OUTPUT 1
31+
PUBLIC_HEADER "${HEADERS}"
32+
)
33+
endif()
34+
35+
if(BUILD_SHARED)
36+
add_library(gvm_security_intelligence_shared SHARED ${FILES})
37+
set_target_properties(
38+
gvm_security_intelligence_shared
39+
PROPERTIES
40+
OUTPUT_NAME "gvm_security_intelligence"
41+
CLEAN_DIRECT_OUTPUT 1
42+
SOVERSION "${PROJECT_VERSION_MAJOR}"
43+
VERSION "${CPACK_PACKAGE_VERSION}"
44+
PUBLIC_HEADER "${HEADERS}"
45+
)
46+
47+
target_link_libraries(
48+
gvm_security_intelligence_shared
49+
LINK_PRIVATE
50+
${GLIB_LDFLAGS}
51+
${CURL_LDFLAGS}
52+
gvm_http_shared
53+
gvm_util_shared
54+
${LINKER_HARDENING_FLAGS}
55+
)
56+
endif()
57+
58+
## Tests
59+
60+
#if(BUILD_TESTS)
61+
# add_unit_test(
62+
# security-intelligence-test
63+
# agent_controller_tests.c
64+
# gvm_base_shared
65+
# gvm_util_shared
66+
# gvm_http_shared
67+
# ${GLIB_LDFLAGS}
68+
# ${CJSON_LDFLAGS}
69+
# ${CURL_LDFLAGS}
70+
# ${LINKER_HARDENING_FLAGS}
71+
# )
72+
#endif()
73+
74+
## Install
75+
76+
configure_file(
77+
libgvm_security_intelligence.pc.in
78+
${CMAKE_BINARY_DIR}/libgvm_security_intelligence.pc
79+
@ONLY
80+
)
81+
82+
install(
83+
FILES ${CMAKE_BINARY_DIR}/libgvm_security_intelligence.pc
84+
DESTINATION ${LIBDIR}/pkgconfig
85+
)
86+
87+
if(BUILD_STATIC)
88+
install(
89+
TARGETS gvm_security_intelligence_static
90+
RUNTIME DESTINATION ${BINDIR}
91+
ARCHIVE DESTINATION ${LIBDIR}
92+
PUBLIC_HEADER DESTINATION "${INCLUDEDIR}/gvm/security_intelligence"
93+
)
94+
endif()
95+
96+
if(BUILD_SHARED)
97+
install(
98+
TARGETS gvm_security_intelligence_shared
99+
RUNTIME DESTINATION ${BINDIR}
100+
LIBRARY DESTINATION ${LIBDIR}
101+
ARCHIVE DESTINATION ${LIBDIR}
102+
PUBLIC_HEADER DESTINATION "${INCLUDEDIR}/gvm/security_intelligence"
103+
)
104+
endif()
105+
106+
## End
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=@EXEC_PREFIX@
3+
libdir=@LIBDIR@
4+
includedir=@INCLUDEDIR@
5+
6+
Name: gvmlibs-security_intelligence
7+
Description: Greenbone Vulnerability Management Library security_intelligence
8+
Version: @LIBGVMCONFIG_VERSION@
9+
Requires.private: glib-2.0 >= 2.42.0
10+
Cflags: -I${includedir} -I${includedir}/gvm
11+
Libs: -L${libdir} -lgvm_security_intelligence

0 commit comments

Comments
 (0)