diff options
Diffstat (limited to 'network/rejik')
-rw-r--r-- | network/rejik/README | 15 | ||||
-rw-r--r-- | network/rejik/doinst.sh | 14 | ||||
-rw-r--r-- | network/rejik/fixconf.patch | 47 | ||||
-rw-r--r-- | network/rejik/fixdestdir.patch | 74 | ||||
-rw-r--r-- | network/rejik/rejik.SlackBuild | 94 | ||||
-rw-r--r-- | network/rejik/rejik.info | 10 | ||||
-rw-r--r-- | network/rejik/slack-desc | 19 |
7 files changed, 273 insertions, 0 deletions
diff --git a/network/rejik/README b/network/rejik/README new file mode 100644 index 0000000000..f973d4b769 --- /dev/null +++ b/network/rejik/README @@ -0,0 +1,15 @@ +Rejik is redirector for SQUID, based on DBL filters +It is aimed for block: AD, porno, warez, banners etc +Primary targeted for RU-speaking zone of internet. + +Add this line to squid.conf to activate redirection +redirect_program /var/lib/rejik/redirector /etc/squid/redirector.conf + + +************************************************** +If you are using squid version above 3.4 +Download updated sources "http://rejik.ru/download/redirector-3.2.11_squid_3.4.tgz" +"MD5: 259b7ee7e7228ed4a14e27fb3ae964f0" + +And add changes to squid.conf, redirect_program replaced by: +url_rewrite_program /var/lib/rejik/redirector /etc/squid/redirector.conf diff --git a/network/rejik/doinst.sh b/network/rejik/doinst.sh new file mode 100644 index 0000000000..d14634e173 --- /dev/null +++ b/network/rejik/doinst.sh @@ -0,0 +1,14 @@ +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/squid/redirector.conf.dist.new diff --git a/network/rejik/fixconf.patch b/network/rejik/fixconf.patch new file mode 100644 index 0000000000..6ba87508de --- /dev/null +++ b/network/rejik/fixconf.patch @@ -0,0 +1,47 @@ +--- redirector.conf.dist- 2014-04-13 16:18:26.105058254 +0300 ++++ redirector.conf.dist 2014-04-13 16:21:55.893896100 +0300 +@@ -14,7 +14,7 @@ + # change_log filename # Log file of change contest. + # # Comment for turn off + # +-# make-cache /usr/local/rejik3/make-cache # path to make-cache binary ++# make-cache /var/lib/rejik/make-cache # path to make-cache binary + # + # work_ip IP # Ip adress or network + # work_ip IP/MASK # or file with ip for +@@ -70,27 +70,26 @@ + # + ############################################################# + +-error_log /usr/local/rejik3/redirector.err +-change_log /usr/local/rejik3/redirector.log +-make-cache /usr/local/rejik3/make-cache +- +-#allow_urls /usr/local/rejik3/banlists/allow_urls ++error_log /var/log/squid/rejik/redirector.err ++change_log /var/log/squid/rejik/redirector.log ++make-cache /var/lib/rejik/make-cache ++#allow_urls /var/lib/rejik/banlists/allow_urls + #write_hostname_to_log on + + <BANNER> +-ban_dir /usr/local/rejik3/banlists/banners ++ban_dir /var/lib/rejik/banlists/banners + url http://127.0.0.1/ban/1x1.gif + #log off + + <PORNO> +-ban_dir /usr/local/rejik3/banlists/porno ++ban_dir /var/lib/rejik/banlists/porno + url http://127.0.0.1/ban/porno.html + + <MP3> +-ban_dir /usr/local/rejik3/banlists/mp3 ++ban_dir /var/lib/rejik/banlists/mp3 + url http://127.0.0.1/ban/mp3.html + + <JS> +-ban_dir /usr/local/rejik3/banlists/js ++ban_dir /var/lib/rejik/banlists/js + url http://127.0.0.1/ban/js.js + #log off diff --git a/network/rejik/fixdestdir.patch b/network/rejik/fixdestdir.patch new file mode 100644 index 0000000000..c0c5478a65 --- /dev/null +++ b/network/rejik/fixdestdir.patch @@ -0,0 +1,74 @@ +--- Makefile- 2014-04-17 19:12:52.415410443 +0300 ++++ Makefile 2014-04-17 19:13:19.979613470 +0300 +@@ -1,7 +1,8 @@ + ### Edit this: +-INSTALL_PATH=/usr/local/rejik3 +-SQUID_USER=squid +-SQUID_GROUP=squid ++INSTALL_PATH=/var/lib/rejik ++DSTDIR_PATH=${DSTDIR}${INSTALL_PATH} ++SQUID_USER=nobody ++SQUID_GROUP=nogroup + + CC=gcc -Wall + INCLUDE=-I/usr/include -I/usr/local/include -I/usr/include/pcre +@@ -40,36 +41,38 @@ + + install: + # Make dirs +- mkdir -p ${INSTALL_PATH}/tools ++ mkdir -p ${DSTDIR_PATH}/tools ++ mkdir -p ${DSTDIR}/etc/squid ++ mkdir -p ${DSTDIR}/var/log/squid/rejik + + # Install redirector +- cp make-cache ${INSTALL_PATH} +- cp redirector ${INSTALL_PATH} +- cp redirector.conf.dist ${INSTALL_PATH} ++ cp make-cache ${DSTDIR_PATH} ++ cp redirector ${DSTDIR_PATH} ++ cp redirector.conf.dist ${DSTDIR}/etc/squid + + # Install tools +- echo "#!/bin/sh" > ${INSTALL_PATH}/tools/check-redirector +- echo 'su ${SQUID_USER} -c "echo \"http://sex.ru 127.0.0.1/- - GET\" | ${INSTALL_PATH}/redirector ${INSTALL_PATH}/redirector.conf;"' >> ${INSTALL_PATH}/tools/check-redirector +- chmod 755 ${INSTALL_PATH}/tools/check-redirector ++ echo "#!/bin/sh" > ${DSTDIR_PATH}/tools/check-redirector ++ echo 'su ${SQUID_USER} -c "echo \"http://sex.ru 127.0.0.1/- - GET\" | ${INSTALL_PATH}/redirector ${INSTALL_PATH}/redirector.conf;"' >> ${DSTDIR_PATH}/tools/check-redirector ++ chmod 755 ${DSTDIR_PATH}/tools/check-redirector + +- echo "#!/bin/sh" > ${INSTALL_PATH}/tools/set-permissions +- echo 'chown -R ${SQUID_USER}:${SQUID_GROUP} ${INSTALL_PATH}' >> ${INSTALL_PATH}/tools/set-permissions +- chmod 755 ${INSTALL_PATH}/tools/set-permissions ++ echo "#!/bin/sh" > ${DSTDIR_PATH}/tools/set-permissions ++ echo 'chown -R ${SQUID_USER}:${SQUID_GROUP} ${INSTALL_PATH}' >> ${DSTDIR_PATH}/tools/set-permissions ++ chmod 755 ${DSTDIR_PATH}/tools/set-permissions + + +- cp tools/kill-cache ${INSTALL_PATH}/tools +- chmod 755 ${INSTALL_PATH}/tools/kill-cache ++ cp tools/kill-cache ${DSTDIR_PATH}/tools ++ chmod 755 ${DSTDIR_PATH}/tools/kill-cache + +- cp tools/benchmark ${INSTALL_PATH}/tools +- chmod 755 ${INSTALL_PATH}/tools/benchmark ++ cp tools/benchmark ${DSTDIR_PATH}/tools ++ chmod 755 ${DSTDIR_PATH}/tools/benchmark + +- cp tools/IN.gz ${INSTALL_PATH}/tools +- chmod 644 ${INSTALL_PATH}/tools/IN.gz ++ cp tools/IN.gz ${DSTDIR_PATH}/tools ++ chmod 644 ${DSTDIR_PATH}/tools/IN.gz + + # Set permissions +- chown -R ${SQUID_USER}:${SQUID_GROUP} ${INSTALL_PATH} +- chmod 770 ${INSTALL_PATH} +- chmod 644 ${INSTALL_PATH}/redirector.conf.dist +- chmod 755 ${INSTALL_PATH}/redirector +- chmod 755 ${INSTALL_PATH}/make-cache ++ chown -R ${SQUID_USER}:${SQUID_GROUP} ${DSTDIR_PATH} ${DSTDIR} ${DSTDIR}/var/log/squid/rejik ++ chmod 770 ${DSTDIR_PATH} ++ chmod 644 ${DSTDIR}/etc/squid/redirector.conf.dist ++ chmod 755 ${DSTDIR_PATH}/redirector ++ chmod 755 ${DSTDIR_PATH}/make-cache + diff --git a/network/rejik/rejik.SlackBuild b/network/rejik/rejik.SlackBuild new file mode 100644 index 0000000000..7f065932fa --- /dev/null +++ b/network/rejik/rejik.SlackBuild @@ -0,0 +1,94 @@ +#!/bin/sh + +# Slackware build script for Rejik + +# Copyright 2014 Oleg A. Deordiev Ukraine/Odessa +# 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=rejik +TARNAME=redirector +VERSION=${VERSION:-3.2.11} +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 $TARNAME-$VERSION +tar xvf $CWD/$TARNAME-$VERSION.tgz +cd $TARNAME-$VERSION +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 {} \; + +# Add destination path to makefile +patch -p 0 < $CWD/fixdestdir.patch +# Fix config file for new location +patch -p 0 < $CWD/fixconf.patch + +DSTDIR=$PKG make +DSTDIR=$PKG make install + +cd .. + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp $TARNAME-$VERSION/{AUTHORS,COPYING,INSTALL} $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mv $PKG/etc/squid/redirector.conf.dist $PKG/etc/squid/redirector.conf.dist.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/rejik/rejik.info b/network/rejik/rejik.info new file mode 100644 index 0000000000..623888349c --- /dev/null +++ b/network/rejik/rejik.info @@ -0,0 +1,10 @@ +PRGNAM="rejik" +VERSION="3.2.11" +HOMEPAGE="http://rejik.ru" +DOWNLOAD="http://rejik.ru/download/redirector-3.2.11.tgz" +MD5SUM="82af25a1cc144b949837ee3ae882ec23" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="squid" +MAINTAINER="Oleg A. Deordiev" +EMAIL="admin@ifconfig.com.ua" diff --git a/network/rejik/slack-desc b/network/rejik/slack-desc new file mode 100644 index 0000000000..bd549411f3 --- /dev/null +++ b/network/rejik/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------------------------------------------------------| +rejik: rejik (squid redirector) +rejik: +rejik: Rejik is redirector for SQUID, based on DBL filters +rejik: It is aimed for block: AD, porno, warez, banners etc +rejik: Primary targeted for RU-speaking zone of internet. +rejik: +rejik: +rejik: +rejik: +rejik: +rejik: |