summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author pyllyukko2011-08-13 13:43:55 +0200
committer Niels Horn2011-08-13 13:43:55 +0200
commit81c46c614c8a4e12fbda3920ce4d2f925774d8b3 (patch)
treef285dcf5bd0455a75cf4ebd6efd5d7e375c19d33
parent5511d6be945f0e58c0812d2ae2da20cc3bb0c0f6 (diff)
downloadslackbuilds-81c46c614c8a4e12fbda3920ce4d2f925774d8b3.tar.gz
network/modsecurity-apache: Added (a web application firewall)
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
-rw-r--r--network/modsecurity-apache/README22
-rw-r--r--network/modsecurity-apache/doinst.sh15
-rw-r--r--network/modsecurity-apache/modsecurity-apache.SlackBuild112
-rw-r--r--network/modsecurity-apache/modsecurity-apache.info10
-rw-r--r--network/modsecurity-apache/slack-desc19
5 files changed, 178 insertions, 0 deletions
diff --git a/network/modsecurity-apache/README b/network/modsecurity-apache/README
new file mode 100644
index 0000000000..cdf88372f3
--- /dev/null
+++ b/network/modsecurity-apache/README
@@ -0,0 +1,22 @@
+ModSecurity(tm) is an open source, free web application firewall (WAF)
+Apache module. WAFs are deployed to establish an external security layer
+that increases security, detects and prevents attacks before they reach web
+applications. It provides protection from a range of attacks against web
+applications and allows for HTTP traffic monitoring and real-time analysis
+with little or no changes to existing infrastructure.
+
+You can get started with ModSecurity by adding the following lines to the
+appropriate sections of Apache's main configuration file (x86
+architecture):
+
+LoadModule security2_module lib/httpd/modules/mod_security2.so
+Include /etc/httpd/extra/modsecurity-recommended.conf
+
+This SlackBuild will also verify the package's PGP signature
+if the following conditions are met:
+
+- You have GnuPG installed
+- You have the appropriate public PGP key (0x6980F8B0)
+ in your trustedkeys.gpg keyring
+- You have downloaded the sig file from
+ http://www.modsecurity.org/download/modsecurity-apache_${VERSION}.tar.gz.asc
diff --git a/network/modsecurity-apache/doinst.sh b/network/modsecurity-apache/doinst.sh
new file mode 100644
index 0000000000..4edf9ce1c2
--- /dev/null
+++ b/network/modsecurity-apache/doinst.sh
@@ -0,0 +1,15 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/httpd/extra/modsecurity-recommended.conf.new
+
diff --git a/network/modsecurity-apache/modsecurity-apache.SlackBuild b/network/modsecurity-apache/modsecurity-apache.SlackBuild
new file mode 100644
index 0000000000..e065cf877e
--- /dev/null
+++ b/network/modsecurity-apache/modsecurity-apache.SlackBuild
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# Slackware build script for ModSecurity
+
+# Written by pyllyukko
+
+PRGNAM=modsecurity-apache
+VERSION=${VERSION:-2.6.1}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf ${PRGNAM}_${VERSION}
+
+# The package can be verified with Breno Silva Pinto's PGP key (0x6980F8B0)
+# If we have GPG installed, we try to verify the signature.
+if [ -x "/usr/bin/gpg" -a -x "/usr/bin/gpgv" ]
+then
+ set +e
+ # This will check if we have the correct key in our keyring.
+ # For the trustedkeys.gpg, see "man 1 gpgv".
+ /usr/bin/gpg --keyring trustedkeys.gpg --no-default-keyring --list-keys 0x6980F8B0 &>/dev/null
+ GPG_RET=${?}
+ # 2 means we don't have his key, 0 means we do.
+ set -e
+ # If we have the key and the signature file, we verify the package with GPG
+ if [ ${GPG_RET} -eq 0 -a \
+ -f "${CWD}/${PRGNAM}_${VERSION}.tar.gz.asc" ]
+ then
+ /usr/bin/gpgv "${CWD}/${PRGNAM}_${VERSION}.tar.gz.asc"
+ fi
+fi
+
+tar xvf $CWD/${PRGNAM}_${VERSION}.tar.gz
+cd ${PRGNAM}_${VERSION}
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Fix location of http module.
+# It's messy, actually, as the Makefile has a hardcoded libdir and also copies
+# the lib to the httpd/modules directory without using the DESTDIR, really
+# INSTALLing the library even when we only want to create a package :(
+sed \
+ -e "/^pkglibdir/s|/lib|/lib${LIBDIRSUFFIX}|" \
+ -e "s|\$(APXS_MODULES)|\$(DESTDIR)\$(APXS_MODULES)|" \
+ -i apache2/Makefile.in
+# oh, and since it wanted to install locally, we need to manually create the
+# directory in the package...
+mkdir -p $PKG/$(apxs -q LIBEXECDIR)
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --build=$ARCH-slackware-linux
+
+make
+make install-strip DESTDIR=$PKG
+
+# It leaves two copies of the library, we'll only need one
+rm $PKG/usr/lib${LIBDIRSUFFIX}/*.so
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ CHANGES LICENSE NOTICE README.TXT README_WINDOWS.TXT authors.txt doc/Reference_Manual.html \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/etc/httpd/extra
+cat modsecurity.conf-recommended > $PKG/etc/httpd/extra/modsecurity-recommended.conf.new
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/modsecurity-apache/modsecurity-apache.info b/network/modsecurity-apache/modsecurity-apache.info
new file mode 100644
index 0000000000..9663bb63b4
--- /dev/null
+++ b/network/modsecurity-apache/modsecurity-apache.info
@@ -0,0 +1,10 @@
+PRGNAM="modsecurity-apache"
+VERSION="2.6.1"
+HOMEPAGE="http://www.modsecurity.org/"
+DOWNLOAD="http://www.modsecurity.org/download/modsecurity-apache_2.6.1.tar.gz http://www.modsecurity.org/download/modsecurity-apache_2.6.1.tar.gz.asc"
+MD5SUM="762d2d1fcd47dd0d348bea737a956dac 8bade09a8fe680f7e217bafd3d142cde"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="pyllyukko"
+EMAIL="pyllyukko AT maimed dot org"
+APPROVED="Niels Horn"
diff --git a/network/modsecurity-apache/slack-desc b/network/modsecurity-apache/slack-desc
new file mode 100644
index 0000000000..965de92af6
--- /dev/null
+++ b/network/modsecurity-apache/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+modsecurity-apache: ModSecurity for Apache (a web application firewall)
+modsecurity-apache:
+modsecurity-apache: ModSecurity is an open source, free web application
+modsecurity-apache: firewall (WAF) Apache module. WAFs are deployed to
+modsecurity-apache: establish an external security layer that increases
+modsecurity-apache: security, detects and prevents attacks before they reach
+modsecurity-apache: web applications.
+modsecurity-apache:
+modsecurity-apache:
+modsecurity-apache: Homepage: http://www.modsecurity.org/
+modsecurity-apache: