| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/www-apache/mod_security/mod_security-2.6.7.ebuild,v 1.1 2012/08/01 22:47:49 flameeyes Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
inherit apache-module
|
| 8 |
|
| 9 |
MY_PN=modsecurity-apache
|
| 10 |
MY_PV=${PV/_rc/-rc}
|
| 11 |
MY_P=${MY_PN}_${MY_PV}
|
| 12 |
|
| 13 |
DESCRIPTION="Web application firewall and Intrusion Detection System for Apache."
|
| 14 |
HOMEPAGE="http://www.modsecurity.org/"
|
| 15 |
SRC_URI="mirror://sourceforge/project/mod-security/${MY_PN}/${MY_PV}/${MY_P}.tar.gz"
|
| 16 |
|
| 17 |
LICENSE="Apache-2.0"
|
| 18 |
SLOT="0"
|
| 19 |
KEYWORDS="~amd64 ~ppc ~sparc ~x86"
|
| 20 |
IUSE="geoip curl lua"
|
| 21 |
|
| 22 |
DEPEND=">=dev-libs/libxml2-2.7.8
|
| 23 |
dev-libs/libpcre
|
| 24 |
lua? ( >=dev-lang/lua-5.1 )
|
| 25 |
curl? ( >=net-misc/curl-7.15.1 )
|
| 26 |
www-servers/apache[apache2_modules_unique_id]"
|
| 27 |
RDEPEND="${DEPEND}
|
| 28 |
geoip? ( dev-libs/geoip )"
|
| 29 |
PDEPEND="www-apache/modsecurity-crs"
|
| 30 |
|
| 31 |
S="${WORKDIR}/${MY_P}"
|
| 32 |
|
| 33 |
APACHE2_MOD_FILE="apache2/.libs/${PN}2.so"
|
| 34 |
APACHE2_MOD_DEFINE="SECURITY"
|
| 35 |
|
| 36 |
# Tests require symbols only defined within the Apache binary.
|
| 37 |
RESTRICT=test
|
| 38 |
|
| 39 |
need_apache2
|
| 40 |
|
| 41 |
src_prepare() {
|
| 42 |
cp "${FILESDIR}"/modsecurity.conf "${T}"/79_modsecurity.conf || die
|
| 43 |
}
|
| 44 |
|
| 45 |
src_configure() {
|
| 46 |
econf \
|
| 47 |
--enable-shared --disable-static \
|
| 48 |
--with-apxs="${APXS}" \
|
| 49 |
$(use_enable curl mlogc) \
|
| 50 |
$(use_with lua) \
|
| 51 |
|| die "econf failed"
|
| 52 |
}
|
| 53 |
|
| 54 |
src_compile() {
|
| 55 |
if ! use geoip; then
|
| 56 |
sed -i -e '/SecGeoLookupDb/s:^:#:' \
|
| 57 |
"${T}"/79_modsecurity.conf || die
|
| 58 |
fi
|
| 59 |
|
| 60 |
emake || die
|
| 61 |
}
|
| 62 |
|
| 63 |
src_test() {
|
| 64 |
emake check || die
|
| 65 |
}
|
| 66 |
|
| 67 |
src_install() {
|
| 68 |
apache-module_src_install
|
| 69 |
|
| 70 |
# install manually rather than by using the APACHE2_MOD_CONF
|
| 71 |
# variable since we have to edit it to set things up properly.
|
| 72 |
insinto "${APACHE_MODULES_CONFDIR}"
|
| 73 |
doins "${T}"/79_modsecurity.conf
|
| 74 |
|
| 75 |
dodoc CHANGES
|
| 76 |
|
| 77 |
keepdir /var/cache/modsecurity
|
| 78 |
fowners apache:apache /var/cache/modsecurity
|
| 79 |
fperms 0770 /var/cache/modsecurity
|
| 80 |
}
|
| 81 |
|
| 82 |
pkg_postinst() {
|
| 83 |
if [[ -f "${ROOT}"/etc/apache/modules.d/99_mod_security.conf ]]; then
|
| 84 |
ewarn "You still have the configuration file 99_mod_security.conf."
|
| 85 |
ewarn "Please make sure to remove that and keep only 79_modsecurity.conf."
|
| 86 |
ewarn ""
|
| 87 |
fi
|
| 88 |
elog "The base configuration file has been renamed 79_modsecurity.conf"
|
| 89 |
elog "so that you can put your own configuration as 90_modsecurity_local.conf or"
|
| 90 |
elog "equivalent."
|
| 91 |
elog ""
|
| 92 |
elog "That would be the correct place for site-global security rules."
|
| 93 |
elog "Note: 80_modsecurity_crs.conf is used by www-apache/modsecurity-crs"
|
| 94 |
}
|