From 952c093f0fd8113e5f3859e89d92fcba5579ed16 Mon Sep 17 00:00:00 2001 From: Willy Sudiarto Raharjo Date: Sat, 3 Oct 2015 08:57:50 +0700 Subject: network/mod_bw: Added (apache module). Signed-off-by: Willy Sudiarto Raharjo --- network/mod_bw/README | 10 ++++ network/mod_bw/apache24.patch | 29 ++++++++++++ network/mod_bw/apr_atomic_fix.patch | 18 ++++++++ network/mod_bw/mod_bw.SlackBuild | 92 +++++++++++++++++++++++++++++++++++++ network/mod_bw/mod_bw.info | 10 ++++ network/mod_bw/slack-desc | 19 ++++++++ 6 files changed, 178 insertions(+) create mode 100644 network/mod_bw/README create mode 100644 network/mod_bw/apache24.patch create mode 100644 network/mod_bw/apr_atomic_fix.patch create mode 100644 network/mod_bw/mod_bw.SlackBuild create mode 100644 network/mod_bw/mod_bw.info create mode 100644 network/mod_bw/slack-desc (limited to 'network') diff --git a/network/mod_bw/README b/network/mod_bw/README new file mode 100644 index 0000000000..36f4f5ccb9 --- /dev/null +++ b/network/mod_bw/README @@ -0,0 +1,10 @@ +The httpd web server doesn't really have a way to control how much +resources a given virtual host can have or a user can request. + +This module should be able to limit access to certain areas +of the website and to limit mailicious users + +You will need to add the following line to /etc/httpd/httpd.conf: +LoadModule bw_module lib{64}/httpd/modules/mod_bw.so + +See mod_bw-0.7.txt for configuration diff --git a/network/mod_bw/apache24.patch b/network/mod_bw/apache24.patch new file mode 100644 index 0000000000..7554aea1d3 --- /dev/null +++ b/network/mod_bw/apache24.patch @@ -0,0 +1,29 @@ +--- mod_bw.c.NEW 2014-10-06 12:14:47.963722589 +1100 ++++ mod_bw.c 2014-10-06 12:15:44.767721163 +1100 +@@ -472,7 +472,7 @@ + return e[i].rate; + + case T_IP: +- if (apr_ipsubnet_test(e[i].x.ip, r->connection->remote_addr)) { ++ if (apr_ipsubnet_test(e[i].x.ip, r->connection->client_addr)) { + return e[i].rate; + } + break; +@@ -555,7 +555,7 @@ + return e[i].max; + + case T_IP: +- if (apr_ipsubnet_test(e[i].x.ip, r->connection->remote_addr)) { ++ if (apr_ipsubnet_test(e[i].x.ip, r->connection->client_addr)) { + return e[i].max; + } + break; +@@ -600,7 +600,7 @@ + return e[i].sid; + + case T_IP: +- if (apr_ipsubnet_test(e[i].x.ip, r->connection->remote_addr)) { ++ if (apr_ipsubnet_test(e[i].x.ip, r->connection->client_addr)) { + return e[i].sid; + } + break; diff --git a/network/mod_bw/apr_atomic_fix.patch b/network/mod_bw/apr_atomic_fix.patch new file mode 100644 index 0000000000..4cc2dd5817 --- /dev/null +++ b/network/mod_bw/apr_atomic_fix.patch @@ -0,0 +1,18 @@ +--- mod_bw.c.orig 2009-12-09 12:56:13.629281024 +1100 ++++ mod_bw.c 2009-12-09 12:56:30.598862905 +1100 +@@ -58,15 +58,6 @@ + #define BANDWIDTH_ENABLED 1<<1 + #define SHARED_FILENAME "logs/bwmod_runtime_status" + +-/* Compatibility for ARP < 1 */ +-#if (APR_MAJOR_VERSION < 1) +- #define apr_atomic_inc32 apr_atomic_inc +- #define apr_atomic_dec32 apr_atomic_dec +- #define apr_atomic_add32 apr_atomic_add +- #define apr_atomic_cas32 apr_atomic_cas +- #define apr_atomic_set32 apr_atomic_set +-#endif +- + /* Enum types of "from address" */ + enum from_type { + T_ALL, diff --git a/network/mod_bw/mod_bw.SlackBuild b/network/mod_bw/mod_bw.SlackBuild new file mode 100644 index 0000000000..c08a48a602 --- /dev/null +++ b/network/mod_bw/mod_bw.SlackBuild @@ -0,0 +1,92 @@ +#!/bin/sh + +# Slackware build script for mod_bw + +# Copyright 2015 Willy Sudiarto Raharjo +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=mod_bw +VERSION=${VERSION:-0.7} +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 +tar xvf $CWD/$PRGNAM-$VERSION.tgz +cd $PRGNAM +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Patches from AUR +patch < $CWD/apr_atomic_fix.patch +patch < $CWD/apache24.patch + +apxs -c -o $PRGNAM.so $PRGNAM.c + +mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules +install -m 755 .libs/$PRGNAM.so $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules/ + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a $PRGNAM.txt $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/mod_bw/mod_bw.info b/network/mod_bw/mod_bw.info new file mode 100644 index 0000000000..4e0caaca82 --- /dev/null +++ b/network/mod_bw/mod_bw.info @@ -0,0 +1,10 @@ +PRGNAM="mod_bw" +VERSION="0.7" +HOMEPAGE="http://bwmod.sourceforge.net" +DOWNLOAD="http://bwmod.sourceforge.net/files/mod_bw-0.7.tgz" +MD5SUM="d792a892517ca89f21ac2a6c01e6ccb2" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Willy Sudiarto Raharjo" +EMAIL="willysr@slackbuilds.org" diff --git a/network/mod_bw/slack-desc b/network/mod_bw/slack-desc new file mode 100644 index 0000000000..1766341283 --- /dev/null +++ b/network/mod_bw/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------------------------------------------------------| +mod_bw: mod_bw (apache module) +mod_bw: +mod_bw: The httpd web server doesn't really have a way to control how much +mod_bw: resources a given virtual host can have or a user can request. +mod_bw: This module should be able to limit access to certain areas +mod_bw: of the website and to limit mailicious users. +mod_bw: +mod_bw: Developer : Ivan Barrera A. +mod_bw: Project URL: http://bwmod.sourceforge.net/ +mod_bw: +mod_bw: -- cgit v1.2.3