summaryrefslogtreecommitdiff
blob: 1c32608e1940301b98f112cc2486e31f655d50b7 (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/snort/snort-1.8.7.ebuild,v 1.11 2003/09/05 23:40:10 msterret Exp $

IUSE="ssl postgres mysql"

S=${WORKDIR}/${P}
DESCRIPTION="Libpcap-based packet sniffer/logger/lightweight IDS"
SRC_URI="http://www.snort.org/dl/${P}.tar.gz"
HOMEPAGE="http://www.snort.org"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86 sparc "

DEPEND="virtual/glibc
	>=net-libs/libpcap-0.6.2-r1
	~net-libs/libnet-1.0.2a
	postgres? ( >=dev-db/postgresql-7.2 )
	mysql? ( >=dev-db/mysql-3.23.26 )
	ssl? ( >=dev-libs/openssl-0.9.6b )"

RDEPEND="virtual/glibc
	dev-lang/perl
	>=net-libs/libpcap-0.6.2-r1
	postgres? ( >=dev-db/postgresql-7.2 )
	mysql? ( >=dev-db/mysql-3.23.26 )
	ssl? ( >=dev-libs/openssl-0.9.6b )"

src_compile() {

	local myconf

	use postgres && myconf="${myconf} --with-postgresql" \
		|| myconf="${myconf} --without-postgresql"
	use mysql && myconf="${myconf} --with-mysql" \
		|| myconf="${myconf} --without-mysql"
	use ssl && myconf="${myconf} --with-openssl" \
		|| myconf="${myconf} --without-openssl"

	./configure \
		--prefix=/usr \
		--without-odbc \
		--without-oracle \
		--enable-pthreads \
		--enable-flexresp \
		--enable-smbalerts \
		--mandir=/usr/share/man \
		--host=${CHOST} ${myconf} || die "bad ./configure"

	emake || die "compile problem"
}

src_install () {

	make DESTDIR=${D} install || die

	dodir /var/log/snort
	touch ${D}/var/log/snort/.keep

	insinto /usr/lib/snort/bin
	doins contrib/{create_mysql,snortlog,*.pl}

	dodoc AUTHORS BUGS COPYING CREDITS ChangeLog FAQ INSTALL LICENSE
	dodoc NEWS README* RULES.SAMPLE SnortUsersManual.pdf USAGE
	docinto contrib ; dodoc contrib/*

	insinto /etc/snort
	doins classification.config *.rules
	newins snort.conf snort.conf.distrib

	exeinto /etc/init.d ; newexe ${FILESDIR}/snort.rc6 snort
	insinto /etc/conf.d ; newins ${FILESDIR}/snort.confd snort
}

pkg_postinst() {

	if ! grep -q ^snort: /etc/group ; then
		groupadd snort || die "problem adding group snort"
	fi
	if ! grep -q ^snort: /etc/passwd ; then
		useradd -g snort -s /dev/null -d /var/log/snort -c "snort" snort
		assert "problem adding user snort"
	fi
	usermod -c "snort" snort || die "usermod problem"
	usermod -d "/var/log/snort" snort || die "usermod problem"
	usermod -g "snort" snort || die "usermod problem"
	usermod -s "/dev/null" snort || die "usermod problem"
	echo "ignore any message about CREATE_HOME above..."

	chown snort.snort /var/log/snort
	chmod 0770 /var/log/snort
}