Peerguardian(deb Package) Installation ?


omi
 Share

Messages recommandés

Voici mon adaptation du tuto du site Phoenixlabs pour debian.

http://forums.phoenixlabs.org/t7270-p-peer...ate-script.html

------------------------------------------------------------------

Télécharger le peerguardnfxxx.deb (PeerGuardian)

http://sourceforge.net/projects/peerguardian/

Installer le deb:

dpkg -i peerguardnf-1.5beta.i386.deb

Creer le répertoire où le script va copier le fichier Blocklist:

mkdir /etc/peerguardian

Crèer un script peerguardian.sh avec ce code:

# version for bluetack.co.uk lists!

#!/bin/sh

# Update new blocklists and start/stop/restart PeerGuardian

#

# This program is free software; you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation; either version 2 of the License, or

# (at your option) any later version.

#

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU General Public License for more details.

#

# You should have received a copy of the GNU General Public License

# along with this program; if not, write to the Free Software

# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

# testdescription

#

#CONFIGURATION

# Make sure PG_ETC points to the directory where

# you want to put your downloaded blocklists.

PG_ETC=/etc/peerguardian/

# Remove the lists you don't want to download and

# use from BLOCKLISTS.

BLOCKLISTS="level1"

PG_CONF=/etc/PG.conf

PG_LOG=/var/log/PG.log

PG_LIST=/etc/p2p.p2b.p2p

#The URL where the blocklists reside

URL=http://www.bluetack.co.uk/config

#The format of the lists to download

SUFFIX=gz

#The format after unpacking

SUFFIX2=txt

endscript () {

date +"------------ "%F" "%X" "%Z" End PeerGuardian Script"

exit $1

}

date +"------------ "%F" "%X" "%Z" Begin PeerGuardian $1"

case "$1" in

'start')

cd "$PG_ETC"

# check if blockfiles were updated:

UPDATED=""

for i in $BLOCKLISTS ; do

TIMESTAMP=0

if [ -e $i.$SUFFIX ] ; then

TIMESTAMP=`stat --format=%y $i.$SUFFIX`

echo "File $i.$SUFFIX last updated $TIMESTAMP"

TIMESTAMP=`stat --format=%Y $i.$SUFFIX`

fi

wget -N $URL/$i.$SUFFIX

if [ `stat --format=%Y $i.$SUFFIX` -gt $TIMESTAMP ] ; then

UPDATED=$i

fi

done

# if none of the blockfiles were updated:

if [ -z $UPDATED ] ; then

echo "No blocklists needed updating."

echo "Starting PeerGuardian"

mv $PG_LOG $PG_LOG.backup

peerguardnf -h -m -d -c "$PG_CONF" -l "$PG_LOG"

endscript 0

fi

# if any blockfiles were updated:

for i in $BLOCKLISTS ; do

gunzip -c $i.$SUFFIX > $i.$SUFFIX2

BLOCKLISTSCAT="$BLOCKLISTSCAT $i.$SUFFIX2"

done

cat $BLOCKLISTSCAT | peerguardnf -f merged.p2b.p2p

for i in $BLOCKLISTS ; do

rm $i.$SUFFIX2

done

# uncomment below to unblock Yahoo! Mail and whatever

# else needs unblocking here. Do this also in the

# restart section.

grep -v -i "yahoo\!" merged.p2b.p2p | grep -v -i "Microsoft" | grep -v "Google" > merged.p2b.p2p.tmp

mv merged.p2b.p2p.tmp merged.p2b.p2p

mv $PG_LIST $PG_LIST.backup

mv merged.p2b.p2p $PG_LIST

mv $PG_LOG $PG_LOG.backup

echo "Starting PeerGuardian"

peerguardnf -h -m -d -c "$PG_CONF" -l "$PG_LOG"

endscript 0

;;

'stop')

echo "Stopping PeerGuardian"

killall peerguardnf > /dev/null 2>&1

endscript 0

;;

'restart')

cd "$PG_ETC"

# check if blockfiles were updated:

UPDATED=""

for i in $BLOCKLISTS ; do

TIMESTAMP=0

if [ -e $i.$SUFFIX ] ; then

TIMESTAMP=`stat --format=%y $i.$SUFFIX`

echo "File $i.$SUFFIX last updated $TIMESTAMP"

TIMESTAMP=`stat --format=%Y $i.$SUFFIX`

fi

wget -N $URL/$i.$SUFFIX

if [ `stat --format=%Y $i.$SUFFIX` -gt $TIMESTAMP ] ; then

UPDATED=$i

fi

done

# if none of the blockfiles were updated:

if [ -z $UPDATED ] ; then

echo "No blocklists needed updating."

echo "Stopping PeerGuardian"

killall peerguardnf > /dev/null 2>&1

mv $PG_LOG $PG_LOG.backup

sleep 4

echo "Starting PeerGuardian"

peerguardnf -h -m -d -c "$PG_CONF" -l "$PG_LOG"

endscript 0

fi

# if any blockfiles were updated:

for i in $BLOCKLISTS ; do

gunzip -c $i.$SUFFIX > $i.$SUFFIX2

BLOCKLISTSCAT="$BLOCKLISTSCAT $i.$SUFFIX2"

done

cat $BLOCKLISTSCAT | peerguardnf -f merged.p2b.p2p

for i in $BLOCKLISTS ; do

rm $i.$SUFFIX2

done

# uncomment below to unblock Yahoo! Mail and whatever

# else needs unblocking here. Do this also in the

# restart section.

grep -v -i "yahoo\!" merged.p2b.p2p | grep -v -i "Microsoft" | grep -v "Google" > merged.p2b.p2p.tmp

mv merged.p2b.p2p.tmp merged.p2b.p2p

echo "Stopping PeerGuardian"

killall peerguardnf > /dev/null 2>&1

mv $PG_LIST $PG_LIST.backup

mv merged.p2b.p2p $PG_LIST

mv $PG_LOG $PG_LOG.backup

sleep 4

echo "Starting PeerGuardian"

peerguardnf -h -m -d -c "$PG_CONF" -l "$PG_LOG"

endscript 0

;;

*)

echo "Usage: $0 { start | stop | restart }"

;;

esac

exit 0

Copier le fichier peerguardian.sh:

cp peerguardian.sh /usr/local/bin

Changer les droits d'accès au fichier:

chmod -c 755 /usr/local/bin/peerguardian.sh

Pour démarrer peerguardian:

sh peerguardian.sh start

Pour stoper peerguardian:

sh peerguardian.sh stop

Pour redémarrer peerguardian:

sh peerguardian.sh restart

Mon problème est le suivant:

Une fois le script exécuté, tous ce passe normalement le fichier block list est téléchargé et mis à jours si nécessaire, ensuite le peerGuardian me confirme qu'il fonctionne, ce que je ne comprends pas c'est que si exécute PeerGuardian avec le même block list depuis un poste Windows(PeerGuardian v.199 pr14) j'ai toujours des adresses IP boquées.

Exemple:

debian:~# debian:~# sh peerguardian.sh start

-bash: debian:~#: command not found

debian:~# ------------ 2006-02-23 14:17:57 CET Begin PeerGuardian start

-bash: ------------: command not found

debian:~# File level1.gz last updated 2006-02-12 02:10:39.000000000 +0100

-bash: File: command not found

debian:~# --14:17:57-- http://www.bluetack.co.uk/config/level1.gz

-bash: --14:17:57--: command not found

debian:~# => `level1.gz'

Resolving www.bluetack.co.uk... 67.18.178.4

Connecting to www.bluetack.co.uk[67.18.178.4]:80... connected.

-bash: command substitution: line 1: unexpected EOF while looking for matching `''

HTTP request sent, awaiting response... 301 Moved Permanently

-bash: command substitution: line 8: syntax error: unexpected end of file

-bash: bad substitution: no closing "`" in `level1.gz'

debian:~# > Resolving www.bluetack.co.uk... 67.18.178.4

Location: http://dialspace.dial.pipex.com/town/pipex...etack/level1.gz [following]

--14:18:00-- http://dialspace.dial.pipex.com/town/pipex...etack/level1.gz

-bash: www.bluetack.co.uk...: command not found

=> `level1.gz'

debian:~# > Connecting to www.bluetack.co.uk[67.18.178.4]:80... connected.

Resolving dialspace.dial.pipex.com... 195.129.111.57, 195.129.111.58, 195.129.111.59, ...

-bash: to: command not found

debian:~# > HTTP request sent, awaiting response... 301 Moved Permanently

Connecting to dialspace.dial.pipex.com[195.129.111.57]:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1,555,948 [text/plain]

Server file no newer than local file `level1.gz' -- not retrieving.

No blocklists needed updating.

Starting PeerGuardian

------------ 2006-02-23 14:18:24 CET End PeerGuardian Script

-bash: request: command not found

debian:~# > Location: http://dialspace.dial.pipex.com/town/pipex...etack/level1.gz [following]

-bash: http://dialspace.dial.pipex.com/town/pipex...tack/level1.gz: No such file or directory

debian:~# > --14:18:00-- http://dialspace.dial.pipex.com/town/pipex...etack/level1.gz

-bash: http://dialspace.dial.pipex.com/town/pipex...tack/level1.gz: No such file or directory

debian:~# > => `level1.gz'

Resolving dialspace.dial.pipex.com... 195.129.111.57, 195.129.111.58, 195.129.111.59, ...

Connecting to dialspace.dial.pipex.com[195.129.111.57]:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1,555,948 [text/plain]

Server file no newer than local file `level1.gz' -- not retrieving.

No blocklists needed updating.

Starting PeerGuardian

------------ 2006-02-23 14:18:24 CET End PeerGuardian Script

debian:~#

Lien vers le commentaire
Partager sur d'autres sites

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant
 Share