diff options
author | Jeremy HOCDE <jeremyhocde@gmail.com> | 2017-07-21 23:05:33 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2017-07-22 06:57:34 +0700 |
commit | a200cf1452dca7d0ab5ab6ccf09d61339d6bd625 (patch) | |
tree | 3b5c81c1932eac58f96007f3baf715e93168cefa | |
parent | ea930a9237d403035e1f8a534dce9482390d2063 (diff) | |
download | slackbuilds-a200cf1452dca7d0ab5ab6ccf09d61339d6bd625.tar.gz |
system/squidclamav: Added (Clamav ICAP service for Squid).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/squidclamav/README | 28 | ||||
-rw-r--r-- | system/squidclamav/doinst.sh | 14 | ||||
-rw-r--r-- | system/squidclamav/slack-desc | 19 | ||||
-rw-r--r-- | system/squidclamav/squidclamav.SlackBuild | 106 | ||||
-rw-r--r-- | system/squidclamav/squidclamav.conf | 83 | ||||
-rw-r--r-- | system/squidclamav/squidclamav.info | 10 |
6 files changed, 260 insertions, 0 deletions
diff --git a/system/squidclamav/README b/system/squidclamav/README new file mode 100644 index 0000000000..fd77f63ee4 --- /dev/null +++ b/system/squidclamav/README @@ -0,0 +1,28 @@ +squidclamav (Clamav ICAP service and redirector for Squid) + +SquidClamav is an antivirus for Squid proxy based on the award +winning ClamAv anti-virus toolkit. + +Optional dependency: squidGuard + + +Building and configuring squid +------------------------------ + +You must have built squid with the option "ICAP=yes", for example: + ICAP=yes ./squid.SlackBuild + +Add this into your squid.conf: + +# icap squidclamav +icap_enable on +icap_send_client_ip on +icap_send_client_username on +icap_client_username_encode off +icap_client_username_header X-Authenticated-User +icap_preview_enable on +icap_preview_size 1024 +icap_service service_avi_req reqmod_precache icap://localhost:1344/squidclamav bypass=off +adaptation_access service_avi_req allow all +icap_service service_avi_resp respmod_precache icap://localhost:1344/squidclamav bypass=on +adaptation_access service_avi_resp allow all diff --git a/system/squidclamav/doinst.sh b/system/squidclamav/doinst.sh new file mode 100644 index 0000000000..b8161e4c14 --- /dev/null +++ b/system/squidclamav/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/squidclamav.conf.new diff --git a/system/squidclamav/slack-desc b/system/squidclamav/slack-desc new file mode 100644 index 0000000000..3bf03d79a1 --- /dev/null +++ b/system/squidclamav/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------------------------------------------------------| +squidclamav: squidclamav (Clamav ICAP service and redirector for Squid) +squidclamav: +squidclamav: SquidClamav is an antivirus for Squid proxy based on the ClamAv +squidclamav: anti-virus toolkit. +squidclamav: +squidclamav: http://squidclamav.darold.net/ +squidclamav: +squidclamav: +squidclamav: +squidclamav: +squidclamav: diff --git a/system/squidclamav/squidclamav.SlackBuild b/system/squidclamav/squidclamav.SlackBuild new file mode 100644 index 0000000000..d6f636e70d --- /dev/null +++ b/system/squidclamav/squidclamav.SlackBuild @@ -0,0 +1,106 @@ +#!/bin/sh + +# Slackware build script for squidclamav + +# Copyright 2017 Jeremy HOCDE +# 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=squidclamav +VERSION=${VERSION:-6.16} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -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 +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$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 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +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 + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +rm $PKG/etc/squidclamav.conf +cat $CWD/squidclamav.conf > $PKG/etc/squidclamav.conf.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + INSTALL README doc/ \ + $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 +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/system/squidclamav/squidclamav.conf b/system/squidclamav/squidclamav.conf new file mode 100644 index 0000000000..d3b84cdaa3 --- /dev/null +++ b/system/squidclamav/squidclamav.conf @@ -0,0 +1,83 @@ +#----------------------------------------------------------------------------- +# SquidClamav default configuration file +# +# To know to customize your configuration file, see squidclamav manpage +# or go to http://squidclamav.darold.net/ +# +#----------------------------------------------------------------------------- +# +# Global configuration +# + +# Maximum size of a file that may be scanned. Any file bigger that this value +# will not be scanned. +maxsize 5000000 + +# When a virus is found then redirect the user to this URL. If this directive +# is disabled squidclamav will use c-icap error templates to report issues. +#redirect http://proxy.domain.dom/cgi-bin/clwarn.cgi +redirect http://proxy.domain.dom/cgi-bin/clwarn.cgi + +# Path to the squiGuard binary if you want URL filtering, note that you'd better +# use the squid configuration directive 'url_rewrite_program' instead. +#squidguard /usr/local/squidGuard/bin/squidGuard +#squidguard /usr/bin/squidGuard + +# Path to the clamd socket, use clamd_local if you use Unix socket or if clamd +# is listening on an Inet socket, comment clamd_local and set the clamd_ip and +# clamd_port to the corresponding value. +#clamd_local /var/run/clamav/clamd.ctl +clamd_local /var/run/clamav/clamd.socket +#clamd_ip 192.168.1.5,127.0.0.1 +#clamd_port 3310 + +# Set the timeout for clamd connection. Default is 1 second, this is a good +# value but if you have slow service you can increase up to 3. +timeout 1 + +# Force SquidClamav to log all virus detection or squiguard block redirection +# to the c-icap log file. +logredir 0 + +# Enable / disable DNS lookup of client ip address. Default is enabled '1' to +# preserve backward compatibility but you must desactivate this feature if you +# don't use trustclient with hostname in the regexp or if you don't have a DNS +# on your network. Disabling it will also speed up squidclamav. +dnslookup 1 + +# Enable / Disable Clamav Safe Browsing feature. You mus have enabled the +# corresponding behavior in clamd by enabling SafeBrowsing into freshclam.conf +# Enabling it will first make a safe browsing request to clamd and then the +# virus scan request. +safebrowsing 0 + +# +# Here is some defaut regex pattern to have a high speed proxy on system +# with low resources. +# + +# Do not scan images +#abort ^.*\.(ico|gif|png|jpg)$ +#abortcontent ^image\/.*$ + +# Do not scan text files +#abort ^.*\.(css|xml|xsl|js|html|jsp)$ +#abortcontent ^text\/.*$ +#abortcontent ^application\/x-javascript$ + +# Do not scan streamed videos +#abortcontent ^video\/x-flv$ +#abortcontent ^video\/mp4$ + +# Do not scan flash files +#abort ^.*\.swf$ +#abortcontent ^application\/x-shockwave-flash$ + +# Do not scan sequence of framed Microsoft Media Server (MMS) data packets +#abortcontent ^.*application\/x-mms-framed.*$ + +# White list some sites +#whitelist .*\.clamav.net + +# See also 'trustuser' and 'trustclient' configuration directives + diff --git a/system/squidclamav/squidclamav.info b/system/squidclamav/squidclamav.info new file mode 100644 index 0000000000..f41ff9effa --- /dev/null +++ b/system/squidclamav/squidclamav.info @@ -0,0 +1,10 @@ +PRGNAM="squidclamav" +VERSION="6.16" +HOMEPAGE="http://squidclamav.darold.net/" +DOWNLOAD="https://downloads.sourceforge.net/project/squidclamav/squidclamav/6.16/squidclamav-6.16.tar.gz" +MD5SUM="d5c2e588b4162ed873aa678a47a65f0b" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="clamav squid c-icap" +MAINTAINER="Jeremy HOCDE" +EMAIL="jeremyhocde@gmail.com" |