network/squid: Added to 12.0 repository

This commit is contained in:
David Somero 2010-05-11 20:01:44 +02:00 committed by Robby Workman
parent 592862627d
commit 2bc0efd73e
9 changed files with 5121 additions and 0 deletions

20
network/squid/README Normal file
View file

@ -0,0 +1,20 @@
Squid is a high-performance proxy caching server for web clients,
supporting FTP, gopher, and HTTP data objects. Unlike traditional caching
software, squid handles all requests in a single, non-blocking, I/O-driven
process.
Squid supports SSL, extensive access controls, and full request logging.
By using the lightweight Internet Cache Protocol, squid caches can be
arranged in a hierarchy or mesh for additional bandwidth savings.
*** NOTE: default paths have changed from prior version ***
If you need the old paths, edit /etc/squid/squid.conf, /etc/rc.d/rc.squid,
and /etc/logrotate.d/squid as needed.
If you need to start squid at boot, make sure /etc/rc.d/rc.squid is
executable and add the following to /etc/rc.d/rc.local:
if [ -x /etc/rc.d/rc.squid ]; then
/etc/rc.d/rc.squid start
fi
See /usr/doc/squid-3.0.STABLE2/README.SBo for configuration help.

83
network/squid/README.SBo Normal file
View file

@ -0,0 +1,83 @@
README.SBo - configuration help for squid from SlackBuilds.org
==============================================================================
Uncomment and edit the following lines in /etc/squid.conf:
http_port <port> <option>
Set <port> to the port you want Squid to listen on, default is 3128
Set <option> to 'transparent' if you want to make Squid a
transparent proxy through the use of IPTables DNAT/REDIRECT rules.
Note that this now replaces the older method of using httpd_accel.
Leave blank otherwise.
cache_peer, never_direct/always_direct
If you have a parent cache, put it here. The administrators of the
parent cache typically provided you with instructions. You should
always ask permission before adding a parent cache. See also the
never_direct/always_direct directives.
Note, if you don't have a cache_peer, you'll most likely need to use
'always_direct allow all'
cache_dir <storage> /var/log/squid/cache <mem> <L1> <L2>
Set <storage> to 'aufs' if you want an asynchronous storage facility
that allows Squid to access the disk without blocking; otherwise
use 'ufs' here.
Set <mem> to the number of megabytes you want Squid to use for its
cache, default is '100'
Set <L1> to the number of top-level directories to use for the cache,
default is '16'
Set <L2> to the number of sub-directories to use for the cache,
default is '256'
acl, http_access, icp_access
Access control lists. This is important because it prevents people
from stealing your network resources. To fill in the
"allowed_hosts" ACL, use your network address (for instance
192.168.10.0 and your network mask.
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl localnet src 192.168.10.0/24
http_access allow manager localhost
http_access deny manager
http_access allow localnet
http_access deny all
icp_access allow localnet
icp_access deny all
cache_mgr
Put here the e-mail address of the manager:
cache_effective_user
If you must start Squid as root, find a safe user and group to run
as after startup (typically "nobody" and "nogroup"). Do not use
"root", for security reasons.
visible_hostname
The host name you advertise for the cache.
==============================================================================
After editing squid.conf to your liking, run Squid from the command
line TWICE:
% /usr/sbin/squid -z
% /usr/sbin/squid
Check in the cache.log (/var/log/squid/cache.log) that
everything is all right.

28
network/squid/doinst.sh Normal file
View file

@ -0,0 +1,28 @@
#!/bin/sh
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...
}
# Keep same perms on rc.squid.new:
if [ -e etc/rc.d/rc.squid ]; then
cp -a etc/rc.d/rc.squid etc/rc.d/rc.squid.new.incoming
cat etc/rc.d/rc.squid.new > etc/rc.d/rc.squid.new.incoming
mv etc/rc.d/rc.squid.new.incoming etc/rc.d/rc.squid.new
else
# Install executable otherwise - irrelevant unless user starts in rc.local
chmod 0755 etc/rc.d/rc.squid.new
fi
config etc/rc.d/rc.squid.new
config etc/squid/mime.conf.new
config etc/squid/squid.conf.new
config etc/squid/cachemgr.conf.new

View file

@ -0,0 +1,83 @@
#!/bin/sh
# Start/stop/restart/reload the Squid Internet Object Cache (squid)
# To make Squid start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.Squid
#
# Written for Slackware Linux by Erik Jan Tromp
# Modified by David Somero <xgizzmo@slackbuilds.org>
SQUIDCFG=/etc/squid/squid.conf
SQUIDCMD=/usr/sbin/squid
if [ ! -r $SQUIDCFG ]; then
echo "Please set the correct path to $SQUIDCFG"
exit 1
fi
if [ ! -x $SQUIDCMD ]; then
echo "$SQUIDCMD not found"
exit 1
fi
squid_start() {
# Create cache directory hierarchy if needed
ALL_DIRS=$(awk '/^cache_dir/ {print $3}' $SQUIDCFG)
[ -z "$ALL_DIRS" ] && ALL_DIRS=/var/cache/squid
for CACHE_DIR in $ALL_DIRS ; do
if [ ! -d $CACHE_DIR/00 ] ; then
echo "Creating swap directories: $SQUIDCMD -z"
$SQUIDCMD -z 2> /dev/null
break
fi
done
echo "Starting Squid: $SQUIDCMD -DF"
$SQUIDCMD -DF
}
squid_stop() {
COUNTDOWN=$(awk '/^shutdown_lifetime/ {print $2}' $SQUIDCFG)
[ -z "$COUNTDOWN" ] && COUNTDOWN=30
echo -n "Shutting down Squid in $COUNTDOWN seconds: "
$SQUIDCMD -k shutdown 2> /dev/null
while $SQUIDCMD -k check 2> /dev/null ; do
sleep 1
echo -n .
COUNTDOWN=$[ $COUNTDOWN - 1 ]
if [ $COUNTDOWN -le 0 ] ; then
$SQUIDCMD -k interrupt 2> /dev/null
sleep 1
break
fi
done
echo
}
squid_restart() {
squid_stop
sleep 1
squid_start
}
squid_reload() {
$SQUIDCMD -k reconfigure 2> /dev/null
}
case "$1" in
'start')
squid_start
;;
'stop')
squid_stop
;;
'restart')
squid_restart
;;
'reload')
squid_reload
;;
*)
echo "usage: $0 start|stop|restart|reload"
esac

20
network/squid/slack-desc Normal file
View file

@ -0,0 +1,20 @@
# 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 ':'.
|-----handy-ruler------------------------------------------------------|
squid: Squid (a popular free and open source Web proxy server and web cache)
squid:
squid: Squid is a high-performance proxy caching server for web clients,
squid: supporting FTP, gopher, and HTTP data objects.
squid:
squid: Homepage: http://www.squid-cache.org/
squid:
squid:
squid:
squid:
squid:

View file

@ -0,0 +1,118 @@
#!/bin/sh
# Slackware build script for squid
# http://www.squid-cache.org/
# Copyright 2006-2008 David Somero (dsomero@hotmail.com)
# 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=squid
VERSION=3.0.STABLE2
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
SQUIDUSER=${SQUIDUSER:-nobody}
SQUIDGROUP=${SQUIDGROUP:-nobody}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.*z*
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc/squid \
--localstatedir=/var/log/squid \
--datadir=/usr/share/squid \
--mandir=/usr/man \
--program-prefix="" \
--program-suffix="" \
--enable-snmp \
--enable-linux-netfilter \
--enable-async-io \
--build=i486-slackware-linux
make all
make install DESTDIR=$PKG
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
)
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a CONTRIBUTORS COPYING COPYRIGHT CREDITS ChangeLog INSTALL \
QUICKSTART README RELEASENOTES.html SPONSORS $CWD/README.SBo \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
chown root:root $PKG/usr/doc/$PRGNAM-$VERSION/*
mkdir -p $PKG/etc/{logrotate.d,rc.d}
cat $CWD/rc.squid.new > $PKG/etc/rc.d/rc.squid.new
cat $CWD/squid.logrotate > $PKG/etc/logrotate.d/squid
mv $PKG/etc/squid/mime.conf $PKG/etc/squid/mime.conf.new
mv $PKG/etc/squid/cachemgr.conf $PKG/etc/squid/cachemgr.conf.new
rm $PKG/etc/squid/squid.conf ; cp $CWD/squid.conf $PKG/etc/squid/squid.conf.new
mkdir -p $PKG/var/cache/squid
mkdir -p $PKG/var/run/squid
rmdir $PKG/var/log/squid/logs
chown $SQUIDUSER:$SQUIDGROUP $PKG/var/log/squid
chown $SQUIDUSER:$SQUIDGROUP $PKG/var/cache/squid
chown $SQUIDUSER:$SQUIDGROUP $PKG/var/run/squid
## Edit the config file to set the user and group to run as
sed -i -e 's%^cache_effective_user nobody%cache_effective_user '"$SQUIDUSER"'%g' \
$PKG/etc/squid/squid.conf.new
sed -i -e 's%^cache_effective_group nobody%cache_effective_group '"$SQUIDGROUP"'%g' \
$PKG/etc/squid/squid.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.tgz

4746
network/squid/squid.conf Normal file

File diff suppressed because it is too large Load diff

8
network/squid/squid.info Normal file
View file

@ -0,0 +1,8 @@
PRGNAM="squid"
VERSION="3.0.STABLE2"
HOMEPAGE="http://www.squid-cache.org/"
DOWNLOAD="http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE2.tar.bz2"
MD5SUM="21b0413c95b5b9b48e816a5f33f86312"
MAINTAINER="David Somero"
EMAIL="dsomero@hotmail.com"
APPROVED="rworkman"

View file

@ -0,0 +1,15 @@
/var/log/squid/*.log {
weekly
rotate 5
copytruncate
compress
notifempty
missingok
# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
postrotate
/usr/sbin/squid -k rotate
endscript
}