aboutsummaryrefslogtreecommitdiffstats
path: root/security/samhain/Makefile
blob: 2e2204d1cced9398dd81f2a79a28d5c34a0c2ab4 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# New ports collection makefile for:    samhain
# Date created:             9 January 2003
# Whom:                 lx
#
# $FreeBSD$

PORTNAME=   samhain
PORTVERSION=    2.3.2
CATEGORIES= security
MASTER_SITES=   http://la-samhna.de/archive/ \
        http://redundancy.redundancy.org/mirror/
DISTNAME=   samhain_signed-${PORTVERSION}

MAINTAINER= lx@FreeBSD.org
COMMENT=    The Samhain Intrusion Detection System

OPTIONS=    KCHECK "Enable rogue KLD detection" off \
        GPG "Enable GnuPG support" off \
        MYSQL "Enable MySQL logging" off \
        POSTGRESQL "Enable PostgreSQL logging" off \
        XML_LOGS "Enable XML-formatted logs" on \
        LIBWRAP "Enable TCP wrapper support" on \
        PRELUDE "Enable Prelude Framework support" off

SUB_FILES+= pkg-install

WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}

CONFLICTS=  samhain-client-2*

.include <bsd.port.pre.mk>

.if defined(WITH_GPG)
BUILD_DEPENDS+= gpg:${PORTSDIR}/security/gnupg
.endif

GNU_CONFIGURE=  yes
USE_RC_SUBR=    yes
CONFIGURE_ARGS= --enable-login-watch --localstatedir=/var \
        --mandir=${PREFIX}/man --enable-suidcheck

.if !defined(WITHOUT_XML_LOGS)
CONFIGURE_ARGS+=    --enable-xml-log
.endif
.if defined(WITH_RUNAS_USER)
CONFIGURE_ARGS+=    --enable-identity=${WITH_RUNAS_USER}
.else
CONFIGURE_ARGS+=    --enable-identity=yule
.endif
.if defined(WITH_KCHECK)
CONFIGURE_ARGS+=    --with-kcheck
.endif
.if defined(WITH_GPG)
CONFIGURE_ARGS+=    --with-gpg=${PREFIX}/bin/gpg
.endif
.if defined(WITH_MYSQL)
CONFIGURE_ARGS+=    --with-database=mysql \
            --with-cflags=-I${LOCALBASE}/include/mysql \
            --with-libs=-L${LOCALBASE}/lib/mysql
.endif
.if defined(WITH_POSTGRESQL)
CONFIGURE_ARGS+=    --with-database=postgresql
.endif
.if !defined(WITHOUT_LIBWRAP)
CONFIGURE_ARGS+=    --with-libwrap
.endif
.if defined(WITH_CLIENT)
CONFIGURE_ARGS+=    --enable-network=client \
        --with-data-file=REQ_FROM_SERVER/var/lib/samhain/data.samhain \
        --with-config-file=REQ_FROM_SERVER
PLIST_SUB+= SAMHAIN="" SETPWD="" YULE="@comment "
EXTRA_PATCHES+= ${FILESDIR}/fixsamhainrc.patch
MAN5=   samhainrc.5
MAN8=   samhain.8
.elif defined(WITH_SERVER)
CONFIGURE_ARGS+=    --enable-network=server
SUB_LIST+=  WITH_YULE="yes"
PLIST_SUB+= YULE="" SAMHAIN="@comment " SETPWD="@comment "
EXTRA_PATCHES+= ${FILESDIR}/fixyulerc.patch
MAN5=   yulerc.5
MAN8=   yule.8
.else
SUB_LIST+=  WITH_YULE=""
PLIST_SUB+= SAMHAIN="" YULE="@comment " SETPWD="@comment "
EXTRA_PATCHES+= ${FILESDIR}/fixsamhainrc.patch
MAN5=   samhainrc.5
MAN8=   samhain.8
.endif
.if defined(WITH_LOG_SERVER)
CONFIGURE_ARGS+=    --with-logserver=${WITH_LOG_SERVER}
.endif
.if defined(WITH_ALT_LOG_SERVER)
CONFIGURE_ARGS+=    --with-altlogserver=${WITH_ALT_LOG_SERVER}
.endif
.if defined(WITH_PRELUDE)
LIB_DEPENDS+=       prelude.11:${PORTSDIR}/security/libprelude
CONFIGURE_ARGS+=    --with-prelude
.endif

pre-everything::

.if !defined(WITH_CLIENT) && !defined(WITH_SERVER)
    @${ECHO_MSG}
    @${ECHO_MSG} "Building Samhain in standalone mode."
    @${ECHO_MSG} "If you wish to enable networked mode, please hit CTRL-C"
    @${ECHO_MSG} "now, and build samhain from the samhain-client and"
    @${ECHO_MSG} "samhain-server ports."
    @${ECHO_MSG}
.endif

.if defined(WITH_CLIENT) && defined(WITH_SERVER)
IGNORE=     can't build client and server at once
.endif

.if defined(WITH_KCHECK)
    @${ECHO_MSG}
    @${ECHO_MSG} "Building with kernel checking requires reading /dev/kmem"
    @${ECHO_MSG} "and /dev/mem. If you're not building as root, please hit"
    @${ECHO_MSG} "Control-C and restart the build as root."
    @${ECHO_MSG}
.endif

.if defined(WITH_MYSQL) && !defined(WITH_XML_LOGS)
IGNORE=     XML logging is required to log to MySQL
.endif

.if defined(WITH_POSTGRESQL) && !defined(WITH_XML_LOGS)
IGNORE=     XML logging is required to log to Postgres
.endif

post-extract:
    @${TAR} -C ${WRKDIR} -xzf ${WRKSRC}.tar.gz
    @${RM} ${WRKSRC}.tar.gz ${WRKSRC}.tar.gz.asc

pre-install:
    @PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL

post-install:
.if !defined(WITH_SERVER)
    @${CP} ${WRKSRC}/init/samhain.startFreeBSD ${PREFIX}/etc/rc.d/samhain.sh
    @${CP} ${WRKSRC}/samhainrc ${PREFIX}/etc/samhainrc.sample
    @${CHGRP} wheel ${PREFIX}/etc/samhainrc.sample
.else
    @${CP} ${WRKSRC}/init/samhain.startFreeBSD ${PREFIX}/etc/rc.d/yule.sh
    @${CP} ${WRKSRC}/yulerc ${PREFIX}/etc/yulerc.sample
.endif
.if !defined(NOPORTDOCS)
    ${MKDIR} ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/MANUAL-2_3.pdf ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/HOWTO-client+server.html ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/HOWTO-client+server-troubleshooting.html ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/HOWTO-samhain+GnuPG.html ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/HOWTO-write-modules.html ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/FAQ.html ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/README.UPGRADE ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/README ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/BUGS ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/sh_mounts.txt ${DOCSDIR}
    ${INSTALL_MAN} ${WRKSRC}/docs/sh_userfiles.txt ${DOCSDIR}
.endif

    @${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>