summaryrefslogtreecommitdiff
path: root/security/sguil-sensor/Makefile
blob: ff3b1edfa316d2a2052c2aea54840c41c308e9bc (plain) (blame)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# New ports collection makefile for:	sguil-sensor
# Date created:				23 Mar 2006
# Whom:					Paul Schmehl <pauls@utdallas.edu>
#
# $FreeBSD$
#

PORTNAME=	sguil-sensor
PORTVERSION=	0.7.0
PORTREVISION=	2
CATEGORIES=	security
MASTER_SITES=	SF
MASTER_SITE_SUBDIR=	sguil

MAINTAINER=	pauls@utdallas.edu
COMMENT=	Sguil is a network security monitoring program

LIB_DEPENDS=	tls:${PORTSDIR}/devel/tcltls
RUN_DEPENDS=	snort:${PORTSDIR}/security/snort \
		barnyard:${PORTSDIR}/security/barnyard-sguil \
		${LOCALBASE}/lib/tclx8.4/tclx.tcl:${PORTSDIR}/lang/tclX

OPTIONS=	SANCP "Include sancp sensor" off \
		PADS "Include pads sensor" off

NO_BUILD=	yes
USE_RC_SUBR=	example_agent.sh pcap_agent.sh snort_agent.sh
TCLSH_CMD?=	tclsh8.4
WRKSRC=		${WRKDIR}/sguil-${PORTVERSION}
SUB_LIST=	SGUILDIR=${SGUILDIR}
SUB_FILES=	pkg-message example_agent.sh pcap_agent.sh snort_agent.sh
PLIST_SUB=	SGUILDIR=${SGUILDIR}
SGUILDIR?=	sguil-sensor
AGENTS=		example_agent.tcl pads_agent.tcl pcap_agent.tcl sancp_agent.tcl snort_agent.tcl

PORTDOCS=	CHANGES FAQ INSTALL INSTALL.openbsd LICENSE.QPL \
		OPENSSL.README TODO UPGRADE USAGE sguildb.dia

.include <bsd.port.pre.mk>

WITH_PCRE=	true

.if defined(WITH_SANCP)
RUN_DEPENDS+=	sancp:${PORTSDIR}/security/sancp
USE_RC_SUBR+=	sancp_agent.sh
SUB_FILES+=	sancp_agent.sh
PLIST_SUB+=	USESANCP=
.else
PLIST_SUB+=	USESANCP="@comment "
.endif

.if defined(WITH_PADS)
RUN_DEPENDS+=	pads:${PORTSDIR}/net-mgmt/pads
USE_RC_SUBR+=	pads_agent.sh
SUB_FILES+=	pads_agent.sh
PLIST_SUB+=	USEPADS=
.else
PLIST_SUB+=	USEPADS="@comment "
.endif

post-patch:
.for f in ${AGENTS}
	@${REINPLACE_CMD} -e 's:exec tclsh:exec ${PREFIX}/bin/${TCLSH_CMD}:g' \
		${WRKSRC}/sensor/${f}
	@${REINPLACE_CMD} -e 's:/etc/:${PREFIX}/etc/${SGUILDIR}/:g' \
		${WRKSRC}/sensor/${f}
.endfor

do-install:
	@${MKDIR} ${PREFIX}/bin/${SGUILDIR}
	@${MKDIR} ${PREFIX}/etc/${SGUILDIR}
.for f in example_agent.tcl pcap_agent.tcl snort_agent.tcl
	${INSTALL_SCRIPT} -m 751 ${WRKSRC}/sensor/${f} \
		${PREFIX}/bin/${SGUILDIR}/${f}
.endfor
.for f in log_packets.sh
	${INSTALL_SCRIPT} -m 751 ${WRKSRC}/sensor/${f} \
		${PREFIX}/bin/${SGUILDIR}/${f}
.endfor
.for f in example_agent.conf pcap_agent.conf snort_agent.conf
	${INSTALL_DATA} ${WRKSRC}/sensor/${f} \
		${PREFIX}/etc/${SGUILDIR}/${f}-sample
.endfor
.for f in log_packets.conf
	${INSTALL_DATA} ${FILESDIR}/${f} \
		${PREFIX}/etc/${SGUILDIR}/${f}-sample
.endfor
.if defined(WITH_SANCP)
.for f in sancp_agent.conf
	${INSTALL_DATA} ${WRKSRC}/sensor/${f} \
		${PREFIX}/etc/${SGUILDIR}/${f}-sample
.endfor
.for f in sancp.conf
	${INSTALL_DATA} ${WRKSRC}/sensor/sancp/${f} \
		${PREFIX}/etc/${f}-sample
.endfor
.for f in sancp_agent.tcl
	${INSTALL_SCRIPT} ${WRKSRC}/sensor/${f} \
		${PREFIX}/bin/${SGUILDIR}/${f}
.endfor
.endif
.if defined(WITH_PADS)
.for f in pads_agent.conf
	${INSTALL_DATA} ${WRKSRC}/sensor/${f} \
		${PREFIX}/etc/${SGUILDIR}/${f}-sample
.endfor
.for f in pads_agent.tcl
	${INSTALL_SCRIPT} ${WRKSRC}/sensor/${f} \
		${PREFIX}/bin/${SGUILDIR}/${f}
.endfor
.endif
post-install:

.if !defined(NOPORTDOCS)
	@${MKDIR} ${DOCSDIR}
	cd ${WRKSRC}/doc && ${INSTALL_DATA} \
		${PORTDOCS} ${DOCSDIR}
.endif
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>