ajout de la recette pacman pour compiler wazuh-agent

This commit is contained in:
2023-07-19 06:44:05 +00:00
parent 4b99e810e1
commit 6d7efefda3
9 changed files with 451 additions and 5 deletions
@@ -0,0 +1,50 @@
diff --git a/src/Makefile b/src/Makefile
index 58eb041a33..c807ed5f3d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -391,7 +391,7 @@ ifeq (,$(filter ${V},YES yes y Y 1))
QUIET_ENDCOLOR= @printf '%b' ${ENDCOLOR} 1>&2;
endif
-MING_BASE:=
+#MING_BASE:=
ifeq (${TARGET}, winagent)
# Avoid passing environment variables such CFLAGS to external Makefiles
ifeq (${CC}, gcc)
@@ -447,8 +447,8 @@ endif #winagent
OSSEC_CC =${QUIET_CC}${MING_BASE}${CC}
OSSEC_CCBIN =${QUIET_CCBIN}${MING_BASE}${CC}
OSSEC_SHARED =${QUIET_CCBIN}${MING_BASE}${CC} -shared
-OSSEC_LINK =${QUIET_LINK}${MING_BASE}ar -crus
-OSSEC_RANLIB =${QUIET_RANLIB}${MING_BASE}ranlib
+OSSEC_LINK =${QUIET_LINK}${MING_BASE}${AR} -crus
+OSSEC_RANLIB =${QUIET_RANLIB}${MING_BASE}${RANLIB}
OSSEC_WINDRES =${QUIET_CCBIN}${MING_BASE}windres
@@ -765,7 +765,7 @@ ifeq (${MAKECMDGOALS},agent)
$(error Do not use 'agent' directly, use 'TARGET=agent')
endif
-agent: external ${CPPLIBDEPS}
+agent:
ifneq (${uname_S},HP-UX)
${MAKE} ${BUILD_CMAKE_PROJECTS}
endif
@@ -883,6 +883,7 @@ ifeq (${uname_S},Darwin)
EXTERNAL_LIBS += ${LIBPLIST_LIB}
endif
+EXTERNAL_LIBS :=
.PHONY: external test_external
external: test_external $(EXTERNAL_LIBS) $(JEMALLOC_LIB)
@@ -1334,7 +1335,7 @@ endif
####################
WAZUHEXT_LIB = libwazuhext.$(SHARED)
WAZUH_LIB = libwazuhshared.$(SHARED)
-BUILD_LIBS = libwazuh.a $(WAZUHEXT_LIB)
+BUILD_LIBS = libwazuh.a
$(BUILD_SERVER) $(BUILD_AGENT) $(WINDOWS_BINS): $(BUILD_LIBS)
@@ -0,0 +1,65 @@
diff --git a/src/shared_modules/dbsync/CMakeLists.txt b/src/shared_modules/dbsync/CMakeLists.txt
index 02bf1aa7f7..a9e9bda451 100644
--- a/src/shared_modules/dbsync/CMakeLists.txt
+++ b/src/shared_modules/dbsync/CMakeLists.txt
@@ -43,10 +43,15 @@ include_directories(${CMAKE_SOURCE_DIR}/include/)
include_directories(${CMAKE_SOURCE_DIR}/src/)
include_directories(${SHARED_MODULES}/utils/)
include_directories(${SHARED_MODULES}/common/)
+include_directories(${STAGING_DIR}/usr/include/)
+include_directories(${STAGING_DIR}/usr/include/cjson/)
+include_directories(${STAGING_DIR}/usr/include/curl/)
link_directories(${SRC_FOLDER})
link_directories(${SRC_FOLDER}/external/sqlite/)
link_directories(${SRC_FOLDER}/external/cJSON/)
+link_directories(${STAGING_DIR}/lib/)
+link_directories(${STAGING_DIR}/usr/lib/)
file(GLOB DBSYNC_SRC
"${CMAKE_SOURCE_DIR}/src/*.cpp"
diff --git a/src/shared_modules/rsync/CMakeLists.txt b/src/shared_modules/rsync/CMakeLists.txt
index 22c791405e..6dd2182b89 100644
--- a/src/shared_modules/rsync/CMakeLists.txt
+++ b/src/shared_modules/rsync/CMakeLists.txt
@@ -45,11 +45,16 @@ include_directories(${CMAKE_SOURCE_DIR}/src/)
include_directories(${SHARED_MODULES}/dbsync/include/)
include_directories(${SHARED_MODULES}/utils/)
include_directories(${SHARED_MODULES}/common/)
+include_directories(${STAGING_DIR}/usr/include/)
+include_directories(${STAGING_DIR}/usr/include/cjson/)
+include_directories(${STAGING_DIR}/usr/include/curl/)
link_directories(${SHARED_MODULES}/dbsync/build/lib/)
link_directories(${SRC_FOLDER})
link_directories(${SRC_FOLDER}/external/cJSON/)
link_directories(${SRC_FOLDER}/external/openssl/)
+link_directories(${STAGING_DIR}/lib/)
+link_directories(${STAGING_DIR}/usr/lib/)
file(GLOB RSYNC_SRC
"${CMAKE_SOURCE_DIR}/src/*.cpp")
diff --git a/src/data_provider/CMakeLists.txt b/src/data_provider/CMakeLists.txt
index 84c5710d1a..5493364c7b 100644
--- a/src/data_provider/CMakeLists.txt
+++ b/src/data_provider/CMakeLists.txt
@@ -50,6 +50,10 @@ include_directories(${SRC_FOLDER}/external/pacman/lib/libalpm/)
include_directories(${SRC_FOLDER}/external/libarchive/libarchive/)
include_directories(${SRC_FOLDER}/external/rpm/builddir/output/include/)
endif(NOT CMAKE_CHECK_CENTOS5)
+include_directories(${STAGING_DIR}/usr/include/)
+include_directories(${STAGING_DIR}/usr/include/cjson/)
+include_directories(${STAGING_DIR}/usr/include/curl/)
+
link_directories(${SRC_FOLDER})
link_directories(${SRC_FOLDER}/external/sqlite/)
@@ -64,6 +68,8 @@ link_directories(${SRC_FOLDER}/external/libarchive/.libs/)
link_directories(${SRC_FOLDER}/external/rpm/builddir/)
endif(NOT CMAKE_CHECK_CENTOS5)
link_directories(${SRC_FOLDER}/external/openssl/)
+link_directories(${STAGING_DIR}/lib/)
+link_directories(${STAGING_DIR}/usr/lib/)
+188
View File
@@ -0,0 +1,188 @@
<!--
Wazuh - Agent - Default configuration for Yocto build
More info at: https://documentation.wazuh.com
Mailing list: https://groups.google.com/forum/#!forum/wazuh
-->
<ossec_config>
<client>
<server>
<address>MANAGER_IP</address>
<port>1514</port>
<protocol>tcp</protocol>
</server>
<config-profile>yocto, zeus</config-profile>
<notify_time>10</notify_time>
<time-reconnect>60</time-reconnect>
<auto_restart>yes</auto_restart>
<crypto_method>aes</crypto_method>
</client>
<client_buffer>
<!-- Agent buffer options -->
<disabled>no</disabled>
<queue_size>5000</queue_size>
<events_per_second>500</events_per_second>
</client_buffer>
<!-- Policy monitoring -->
<rootcheck>
<disabled>no</disabled>
<check_files>yes</check_files>
<check_trojans>yes</check_trojans>
<check_dev>yes</check_dev>
<check_sys>yes</check_sys>
<check_pids>yes</check_pids>
<check_ports>yes</check_ports>
<check_if>yes</check_if>
<!-- Frequency that rootcheck is executed - every 12 hours -->
<frequency>43200</frequency>
<rootkit_files>etc/shared/rootkit_files.txt</rootkit_files>
<rootkit_trojans>etc/shared/rootkit_trojans.txt</rootkit_trojans>
<skip_nfs>yes</skip_nfs>
</rootcheck>
<wodle name="cis-cat">
<disabled>yes</disabled>
<timeout>1800</timeout>
<interval>1d</interval>
<scan-on-start>yes</scan-on-start>
<java_path>wodles/java</java_path>
<ciscat_path>wodles/ciscat</ciscat_path>
</wodle>
<!-- Osquery integration -->
<wodle name="osquery">
<disabled>yes</disabled>
<run_daemon>yes</run_daemon>
<log_path>/var/log/osquery/osqueryd.results.log</log_path>
<config_path>/etc/osquery/osquery.conf</config_path>
<add_labels>yes</add_labels>
</wodle>
<!-- System inventory -->
<wodle name="syscollector">
<disabled>no</disabled>
<interval>1h</interval>
<scan_on_start>yes</scan_on_start>
<hardware>yes</hardware>
<os>yes</os>
<network>yes</network>
<packages>yes</packages>
<ports all="no">yes</ports>
<processes>yes</processes>
<!-- Database synchronization settings -->
<synchronization>
<max_eps>10</max_eps>
</synchronization>
</wodle>
<sca>
<enabled>yes</enabled>
<scan_on_start>yes</scan_on_start>
<interval>12h</interval>
<skip_nfs>yes</skip_nfs>
</sca>
<!-- File integrity monitoring -->
<syscheck>
<disabled>no</disabled>
<!-- Frequency that syscheck is executed default every 12 hours -->
<frequency>43200</frequency>
<scan_on_start>yes</scan_on_start>
<!-- Directories to check (perform all possible verifications) -->
<directories>/etc,/usr/bin,/usr/sbin</directories>
<directories>/bin,/sbin,/boot</directories>
<!-- Files/directories to ignore -->
<ignore>/etc/mtab</ignore>
<ignore>/etc/hosts.deny</ignore>
<ignore>/etc/mail/statistics</ignore>
<ignore>/etc/random-seed</ignore>
<ignore>/etc/random.seed</ignore>
<ignore>/etc/adjtime</ignore>
<ignore>/etc/httpd/logs</ignore>
<ignore>/etc/utmpx</ignore>
<ignore>/etc/wtmpx</ignore>
<ignore>/etc/cups/certs</ignore>
<ignore>/etc/dumpdates</ignore>
<ignore>/etc/svc/volatile</ignore>
<!-- File types to ignore -->
<ignore type="sregex">.log$|.swp$</ignore>
<!-- Check the file, but never compute the diff -->
<nodiff>/etc/ssl/private.key</nodiff>
<skip_nfs>yes</skip_nfs>
<skip_dev>yes</skip_dev>
<skip_proc>yes</skip_proc>
<skip_sys>yes</skip_sys>
<!-- Nice value for Syscheck process -->
<process_priority>10</process_priority>
<!-- Maximum output throughput -->
<max_eps>100</max_eps>
<!-- Database synchronization settings -->
<synchronization>
<enabled>yes</enabled>
<interval>5m</interval>
<max_interval>1h</max_interval>
<max_eps>10</max_eps>
</synchronization>
</syscheck>
<!-- Log analysis -->
<localfile>
<log_format>syslog</log_format>
<location>/var/ossec/logs/active-responses.log</location>
</localfile>
<localfile>
<log_format>syslog</log_format>
<location>/var/log/dpkg.log</location>
</localfile>
<localfile>
<log_format>command</log_format>
<command>df -P</command>
<frequency>360</frequency>
</localfile>
<localfile>
<log_format>full_command</log_format>
<command>netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d</command>
<alias>netstat listening ports</alias>
<frequency>360</frequency>
</localfile>
<localfile>
<log_format>full_command</log_format>
<command>last -n 20</command>
<frequency>360</frequency>
</localfile>
<!-- Active response -->
<active-response>
<disabled>no</disabled>
<ca_store>etc/wpk_root.pem</ca_store>
<ca_store>/path/to/my_cert.pem</ca_store>
<ca_verification>yes</ca_verification>
</active-response>
<!-- Choose between "plain", "json", or "plain,json" for the format of internal logs -->
<logging>
<log_format>plain</log_format>
</logging>
</ossec_config>
@@ -0,0 +1,18 @@
[Unit]
Description=Wazuh agent
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=forking
Environment="LD_LIBRARY_PATH=/var/ossec/lib"
ExecStart=/usr/bin/env /var/ossec/bin/wazuh-control start
ExecStop=/usr/bin/env /var/ossec/bin/wazuh-control stop
ExecReload=/usr/bin/env /var/ossec/bin/wazuh-control reload
KillMode=process
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
+3 -2
View File
@@ -5,7 +5,7 @@ SUMMARY = "The agent runs on the host you want to monitor and communicates with
MAINTAINER = "Vincent BENOIT <vincent.benoit@benserv.fr>"
LIC_FILES_CHKSUM = "file://LICENSE;md5=i522ae3a9266aa0b86a5f314c85dbb560"
LICENSE = "CLOSED"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
FILESEXTRAPATHS:prepend := "${THISDIR}/files-4.4:"
DEPENDS = "curl-native \
audit-userspace \
@@ -31,6 +31,7 @@ DEPENDS = "curl-native \
popt \
msgpack-c \
rpm \
pacman \
cmake-native \
wazuh-users \
"
@@ -44,7 +45,6 @@ SRC_URI = " \
file://ossec.conf \
file://wazuh-agent.service \
file://0001-Makefile.patch \
file://0002-headers-correction.patch \
file://0003-CMakeLists.patch \
"
@@ -56,6 +56,7 @@ SYSTEMD_AUTO_ENABLE = "enable"
SYSTEMD_SERVICE:${PN} = "wazuh-agent.service"
EXTRA_OEMAKE = ' \
-j 1 \
CC="${CC}" \
CXX="${CXX}" \
RANLIB="${RANLIB}" \