commit:     10414bf03e312ad3f46e5639c270aaadf3eb181c
Author:     Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Thu Jul 14 12:38:43 2022 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 17:20:42 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10414bf0

dev-libs/modsecurity: new package

Modsecurity is a library that can be used by Nginx:
https://github.com/SpiderLabs/ModSecurity-nginx

For Apache, Modsecurity 2.x is still recommended.

Bug: https://bugs.gentoo.org/726614
Closes: https://bugs.gentoo.org/718358
Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 dev-libs/modsecurity/Manifest                 |  1 +
 dev-libs/modsecurity/metadata.xml             | 35 ++++++++++++
 dev-libs/modsecurity/modsecurity-3.0.7.ebuild | 80 +++++++++++++++++++++++++++
 3 files changed, 116 insertions(+)

diff --git a/dev-libs/modsecurity/Manifest b/dev-libs/modsecurity/Manifest
new file mode 100644
index 000000000000..30ec689bf75f
--- /dev/null
+++ b/dev-libs/modsecurity/Manifest
@@ -0,0 +1 @@
+DIST modsecurity-v3.0.7.tar.gz 3333372 BLAKE2B 
f391e2057b95a26a16efaa5f9d86acdd030b2f32d3da3ebac4e5eccdae7c9c6453bdb6b4e2d7f49ce189760d5c5de7d656aa5796fe2723e2e6f5493c93420913
 SHA512 
d8caf5946b598b16c4481938f22c1116595286811cfdb01d95db95ab061f7045751f2aa98e515df239bceb3f1a6dce2ecd5b24c954bddc27997fa64e9e429730

diff --git a/dev-libs/modsecurity/metadata.xml 
b/dev-libs/modsecurity/metadata.xml
new file mode 100644
index 000000000000..dac598b1ea55
--- /dev/null
+++ b/dev-libs/modsecurity/metadata.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person" proxied="yes">
+               <email>hydrapo...@gmail.com</email>
+               <name>Tomáš Mózes</name>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>proxy-ma...@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <use>
+       <flag name="fuzzyhash">
+               Support fuzzy hash computations (to detect malware, for example)
+               using the <pkg>app-crypt/ssdeep</pkg> package.
+       </flag>
+       <flag name="geoip2">
+               Pull in <pkg>dev-libs/libmaxminddb</pkg> for use by the 
SecGeoLookupDb
+               directive.
+       </flag>
+       <flag name="json">
+               Suppose JSON in the request body parser through
+               <pkg>dev-libs/yajl</pkg>.
+       </flag>
+       <flag name="lmdb">
+               Add LMDB backend support
+       </flag>
+       <flag name="pcre2">
+               Use <pkg>dev-libs/libpcre2</pkg> as regex implementation
+       </flag>
+       </use>
+       <upstream>
+               <remote-id type="github">SpiderLabs/ModSecurity</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-libs/modsecurity/modsecurity-3.0.7.ebuild 
b/dev-libs/modsecurity/modsecurity-3.0.7.ebuild
new file mode 100644
index 000000000000..cd66bb0b989d
--- /dev/null
+++ b/dev-libs/modsecurity/modsecurity-3.0.7.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{1..4} )
+
+inherit lua-single
+
+MY_P=${PN}-v${PV}
+
+DESCRIPTION="Application firewall and intrusion detection"
+HOMEPAGE="https://github.com/SpiderLabs/ModSecurity";
+SRC_URI="https://github.com/SpiderLabs/ModSecurity/releases/download/v${PV}/${MY_P}.tar.gz";
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc fuzzyhash geoip geoip2 json lmdb lua pcre2"
+
+REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
+RDEPEND="dev-libs/libpcre:=
+       dev-libs/libxml2
+       net-misc/curl
+       fuzzyhash? ( app-crypt/ssdeep )
+       geoip? ( dev-libs/geoip )
+       geoip2? ( dev-libs/libmaxminddb )
+       json? ( dev-libs/yajl )
+       lmdb? ( dev-db/lmdb )
+       lua? ( ${LUA_DEPS} )
+       pcre2? ( dev-libs/libpcre2:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig
+       doc? ( app-doc/doxygen[dot] )"
+
+DOCS=( AUTHORS CHANGES README.md modsecurity.conf-recommended unicode.mapping )
+
+pkg_setup() {
+       use lua && lua-single_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       # 2 tests fail without portage too
+       # https://github.com/SpiderLabs/ModSecurity/issues/2772
+       sed -i '/test\/test-cases\/regression\/auditlog.json \\/d' Makefile.in 
|| die
+       sed -i '/test\/test-cases\/regression\/issue-2000.json \\/d' 
Makefile.in || die
+       sed -i '/test\/test-cases\/regression\/config-secremoterules.json \\/d' 
Makefile.in || die
+       sed -i '/test\/test-cases\/regression\/operator-ipMatchFromFile.json 
\\/d' Makefile.in || die
+}
+
+src_configure() {
+       local myconf=(
+               $(use_with fuzzyhash ssdeep)
+               $(use_with geoip )
+               $(use_with geoip2 maxmind)
+               $(use_with json yajl)
+               $(use_with lmdb)
+               $(use_with lua)
+               $(use_with pcre2)
+       )
+
+       econf "${myconf[@]}"
+}
+
+src_compile() {
+       default
+
+       if use doc; then
+               cd doc && doxygen doxygen.cfg || die
+       fi
+}
+
+src_install() {
+       default
+       use doc && dodoc -r doc/html
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to