summaryrefslogtreecommitdiff
path: root/security/wazuh-agent/Makefile
blob: 6b9bbc65dc89ffb5862efb16f5d5f0d5dc4521ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

PORTNAME=	wazuh
DISTVERSIONPREFIX=	v
DISTVERSION=	4.1.3
CATEGORIES=	security
MASTER_SITES=	https://packages.wazuh.com/deps/11/libraries/sources/
PKGNAMESUFFIX=	-agent
DISTFILES=	cJSON.tar.gz libplist.tar.gz curl.tar.gz libdb.tar.gz libffi.tar.gz \
		libyaml.tar.gz openssl.tar.gz procps.tar.gz sqlite.tar.gz zlib.tar.gz \
		audit-userspace.tar.gz msgpack.tar.gz bzip2.tar.gz libpcre2.tar.gz
DIST_SUBDIR=	${PORTNAME}-${DISTVERSION}
EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}

MAINTAINER=	m.muenz@gmail.com
COMMENT=	Security tool to monitor and check logs and intrusions

LICENSE=	GPLv2
LICENSE_FILE=	${WRKSRC}/LICENSE

BROKEN_aarch64=		fails to compile: rootcheck/os_string.c:188:20: use of undeclared identifier '__LDPGSZ'
BROKEN_i386=		fails to build external OpenSSL dependency

USES=		gmake perl5 readline shebangfix uidfix
USE_GITHUB=	yes
USE_RC_SUBR=	${PORTNAME}-agent

SHEBANG_FILES=	${WRKSRC}/contrib/util.sh \
		${WRKSRC}/src/external/openssl/Configurations/unix-checker.pm \
		${WRKSRC}/src/init/ossec-client.sh \
		${WRKSRC}/wodles/oscap/oscap.py \
		${WRKSRC}/active-response/*.sh

CONFLICTS_INSTALL=	ossec-*

USERS=		ossec ossecm ossecr
GROUPS=		ossec

OSSEC_GROUP=	ossec
OSSEC_USER=	ossec

WAZUHMOD750=	/ /logs/ossec /bin /lib /queue /queue/diff /ruleset /ruleset/sca /wodles \
		/active-response /active-response/bin /agentless /var /backup /queue/rids \
		/wodles/oscap /wodles/oscap/content

WAZUHMOD770=	/logs /queue/alerts /queue/fim /queue/fim/db /queue/ossec /etc /etc/shared \
		/.ssh /var/run /var/upgrade /var/wodles /var/incoming

WAZUHPREFIX=	/var/ossec

# extract all extra distfiles in src/external
post-extract:
	@for file in ${DISTFILES}; do \
		if ! (cd ${WRKSRC}/src/external && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS}); \
		then \
			exit 1; \
		fi; \
	done

do-build:
	@cd ${WRKSRC}/src && ${GMAKE} TARGET=agent

do-install:
	@for mod750 in ${WAZUHMOD750}; do \
		${MKDIR} -m 0750 ${STAGEDIR}${WAZUHPREFIX}$$mod750; \
	done

	@for mod770 in ${WAZUHMOD770}; do \
		${MKDIR} -m 0770 ${STAGEDIR}${WAZUHPREFIX}$$mod770; \
	done

	${MKDIR} -m 1770 ${STAGEDIR}${WAZUHPREFIX}/tmp
	${INSTALL_PROGRAM} ${WRKSRC}/src/ossec-logcollector ${STAGEDIR}${WAZUHPREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/src/ossec-syscheckd ${STAGEDIR}${WAZUHPREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/src/ossec-execd ${STAGEDIR}${WAZUHPREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/src/manage_agents ${STAGEDIR}${WAZUHPREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/src/wazuh-modulesd ${STAGEDIR}${WAZUHPREFIX}/bin/
	${INSTALL_PROGRAM} ${WRKSRC}/src/ossec-agentd ${STAGEDIR}${WAZUHPREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/src/libwazuhext.so ${STAGEDIR}${WAZUHPREFIX}/lib
	${INSTALL_PROGRAM} ${WRKSRC}/src/agent-auth ${STAGEDIR}${WAZUHPREFIX}/bin
	${CP} ${WRKSRC}/active-response/*.sh ${STAGEDIR}${WAZUHPREFIX}/active-response/bin/
	${CP} ${WRKSRC}/active-response/firewalls/*.sh ${STAGEDIR}${WAZUHPREFIX}/active-response/bin/
	${CP} ${WRKSRC}/etc/internal_options.conf ${STAGEDIR}${WAZUHPREFIX}/etc/
	${CP} ${WRKSRC}/etc/local_internal_options.conf ${STAGEDIR}${WAZUHPREFIX}/etc/local_internal_options.conf
	${CP} ${WRKSRC}/etc/ossec-agent.conf ${STAGEDIR}${WAZUHPREFIX}/etc/ossec.conf
	${CP} ${WRKSRC}/etc/ossec-agent.conf ${STAGEDIR}${WAZUHPREFIX}/etc/ossec.conf.sample
	${CP} /dev/null ${STAGEDIR}${WAZUHPREFIX}/etc/client.keys
	${INSTALL_SCRIPT} /dev/null ${STAGEDIR}${WAZUHPREFIX}/logs/ossec.log
	${INSTALL_SCRIPT} /dev/null ${STAGEDIR}${WAZUHPREFIX}/logs/ossec.json
	${INSTALL_SCRIPT} /dev/null ${STAGEDIR}${WAZUHPREFIX}/logs/active-responses.log
	${INSTALL_SCRIPT} ${WRKSRC}/contrib/util.sh ${STAGEDIR}${WAZUHPREFIX}/bin/
	${INSTALL_SCRIPT} ${WRKSRC}/src/init/ossec-client.sh ${STAGEDIR}${WAZUHPREFIX}/bin/ossec-control
	${INSTALL_SCRIPT} ${WRKSRC}/src/agentlessd/scripts/* ${STAGEDIR}${WAZUHPREFIX}/agentless/
	${INSTALL_SCRIPT} ${WRKSRC}/src/rootcheck/db/*.txt ${STAGEDIR}${WAZUHPREFIX}/etc/shared/
	${INSTALL_SCRIPT} ${WRKSRC}/etc/wpk_root.pem ${STAGEDIR}${WAZUHPREFIX}/etc/
	${INSTALL_SCRIPT} ${WRKSRC}/wodles/oscap/oscap.py ${STAGEDIR}${WAZUHPREFIX}/wodles/oscap
	${INSTALL_SCRIPT} ${WRKSRC}/wodles/oscap/template_*.xsl ${STAGEDIR}${WAZUHPREFIX}/wodles/oscap

.include <bsd.port.mk>