Accueil

De wiki.pingwho.org
Aller à : navigation, rechercher

MediaWiki a été installé.

Consultez le Guide de l’utilisateur pour plus d’informations sur l’utilisation de ce logiciel de wiki.

Pour démarrer

Squidguard Auto Update script

Fichier:SquidGuard AU.sh

#!/bin/bash
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION="This script is used to update your SquidGuard database"
HOMEPAGE="http://www.squidguard.org"

SRC_URI="ftp://ftp.univ-tlse1.fr/blacklist"
DATABASE="/etc/squidGuard/db/blacklists"
CONFIGFILE="/etc/squidGuard/squidGuard.conf"
SQUIDUSER="squid"
SQUIDPID="/var/run/squid.pid"
LOGFILE="/var/log/squidGuard"

# Highlight colors
MESG="\e[1;32m *\e[0;39m"
WARN="\a\e[1;33m * WARNING:\e[0;39m"

echo
echo -e "$MESG ${DESCRIPTION}"
echo -e "$MESG Look at \e[1;34m${HOMEPAGE} \e[0;39mfor more information"
echo

# Pre-processing tests
[ $EUID != 0 ] && echo -e "$WARN This script must be run as root, exiting !" && exit 1
[ ! -f ${CONFIGFILE} ] && echo -e "$WARN The configuration file ${CONFIGFILE} does not exist !" && exit 1
[ ! -e ${SQUIDPID} ] && echo -e "$WARN Squid is not running !" && exit 1

for base in `awk '$1 == "dest" { print $2 }' ${CONFIGFILE} | sort` # Parse squidGuard config file
do
   echo -e "$MESG Downloading the database ${base} ..."
      cd /tmp
       wget --continue --quiet --timeout=30 ${SRC_URI}/${base}.tar.gz
        if [ ! -e ${base}.tar.gz ]; then
                echo
                echo -e "$WARN The base \"${base}\" was not found on this server ..."
                echo "            Please make your checks !"
                exit 1

        fi
       tar -xvzf ${base}.tar.gz -C ${DATABASE}
       rm /tmp/${base}.tar.gz

       echo -e "$MESG Generating the database ${base} ... This could take a while, please wait ..."
       /usr/bin/squidGuard -b -C ${DATABASE}/${base}/urls || exit 1
       /usr/bin/squidGuard -b -C ${DATABASE}/${base}/domains || exit 1
       echo
done

echo -e "$MESG Checking permissions ..."
chown -R ${SQUIDUSER}:${SQUIDUSER} ${DATABASE}
chown -R ${SQUIDUSER}:${SQUIDUSER} ${LOGFILE}

/etc/init.d/squid reload
exit 0
<?xml version="1.0" encoding="UTF-8"?>
<pkgmetadata>
  <herd>squidguard_AU</herd>
   <use>
    <flag name="cron">Add cron task for squidguard_AU</flag>
    <flag name="systemd">Use systemd as system management daemon</flag>
   </use>
    <maintainer>
      <email>jaypeche@gmail.com</email>
    </maintainer>
  <longdescription>
This utility is used to update your SquidGuard database
  </longdescription>
</pkgmetadata>