You are not logged in.

#1 2005-08-04 14:33:21

Kirby
Member
Registered: 2005-08-04
Posts: 10

[REQUEST] Peerguardian

I have not been able to compile this program for beans.....I have tried every suggestion on their forums, and still no go.  So I'm asking for help here....hopefully someone will have better luck compiling than I did

http://methlabs.org/projects/peerguardian-linuxosx/

Offline

#2 2005-08-04 23:00:37

topito
Member
From: Catalonia
Registered: 2004-03-25
Posts: 118
Website

Re: [REQUEST] Peerguardian

I have it installed, I have no time to write a PKGBUILD but it was easy to install, this is what I did:

wget http://voxel.dl.sourceforge.net/sourceforge/peerguardian/pglinux-1.5beta.tar.gz
cd pglinux-1.5beta
./configure --prefix=/usr
make
su
cp peerguardnf /usr/bin
cp PG.conf /etc/peerguardian.conf
cp p2p.p2b.p2p /etc/p2p.p2b.p2p

make install didn't work, that's why I copied everything by hand, then I edited /etc/peerguardian.conf:

$ cat /etc/peerguardian.conf

#
# PGD.conf -- This is a basic PGD configuration file.
# To really apply changes reload proftpd after modifications.
#

# Modify the block file below to match the block file you use
BLOCKFILE=/etc/p2p.p2b.p2p

# Please edit below if you wish not to block certain ports with
# were in the format 80,25,x,x; or leave it blank if you don't wish
# to use this feature.
PORTS_NOT_TO_BLOCK=22,80,443;

ADMIN_NAME=admin
ADMIN_PASSWORD=d033e22ae348aeb5660fc2140aec35850c4da997

Then I wrote a rc.d script to run peerguardian as a deamon:

$ cat /etc/rc.d/peerguardian

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID /usr/bin/peerguardnf`
case "$1" in
  start)
    stat_busy "Starting PeerGuardian Daemon"
    if [ -z "$PID" ]; then
       /usr/bin/peerguardnf -d -c /etc/peerguardian.conf -l /var/log/peerguardian.log -h -m
    fi
    if [ ! -z "$PID" -o $? -gt 0 ]; then
      stat_fail
    else
      add_daemon peerguardian
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping PeerGuardian Daemon"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon peerguardian
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac

then create a log file as root:

touch /var/log/peerguardian.log

If everything went ok:

/etc/rc.d/peerguardian start

And peerguardian should be running, you can add "peerguardian" in your rc.conf daemons to run it at boot.

Check /var/log/peerguardian.log, it should says something like:

Reading blocklist
detected binary blocklist
Entering daemon mode
Allowing all traffic on port 22
Allowing all traffic on port 80
Allowing all traffic on port 443
Blocking 63799 ranges (702060665 IP addresses)

Ask if you have any problem, I will be glab to help you wink

Offline

#3 2005-08-05 00:47:18

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

i might make a pkgbuild for this tonight
so if you can wait.. you can have a nice pacman version!

Offline

#4 2005-08-05 02:49:46

Kirby
Member
Registered: 2005-08-04
Posts: 10

Re: [REQUEST] Peerguardian

I thank everyone for their help and commitment smile

just one last thing.....there is a GUI that is being created over here:

http://methlabs.org/forums/showthread.php?t=5932
http://www.methlabs.org/pg2-linux/peerg … 1.2.tar.gz

the only problem is that it has been hard for me to compile Gambas with QT support, so I can compile the GUI (says something about the QT header files not being there).  Hopefully someone has a miracle solution for that???  wink

Offline

#5 2005-08-05 03:36:09

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: [REQUEST] Peerguardian

There is a  gambas PKGBUILD in AUR: http://aur.archlinux.org/packages.php?d … s=1&ID=271 Have you tried it?

Offline

#6 2005-08-05 10:02:40

topito
Member
From: Catalonia
Registered: 2004-03-25
Posts: 118
Website

Re: [REQUEST] Peerguardian

Father wrote:

i might make a pkgbuild for this tonight
so if you can wait.. you can have a nice pacman version!

Cool smile

Offline

#7 2005-08-06 07:03:26

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

mok.. heres the pkg.. tell me if theres any problems
it installs and runs, but i havent tested it since i dont have iptables in my kernel

thanks to topito, i used your rc script.. hope you dont mind!
thanks to Pointer for the update script! greatly appreciated!

itll be on the AUR in a minute or two
[edit] its now in the aur [/edit]

[edit2] updated 'update' script [/edit2]
[edit3] updated 'update' script [/edit3]

PKGBUILD

#contributor: Adam Griffiths <adam_griffithsAATTdart.net.au>
#rc script by: topito 
#update script by: Pointer
#Thanks guys!
pkgname=peerguardian
pkgver=1.5beta
pkgrel=1
pkgdesc="PeerGuardian 2 is Methlabs premier IP blocker. PeerGuardian 2 is the safest and easiest way to protect your privacy 
on P2P"
url="http://methlabs.org/projects/peerguardian-linuxosx/"
depends=('iptables')
source=("http://dl.sourceforge.net/sourceforge/$pkgname/pglinux-$pkgver.tar.gz")
install=(peerguardian.install)
md5sums=(0fb2bc5501b031604fc56eec3bd35fa4)

build()
{
        cd $startdir/src/pglinux-$pkgver

        ./configure --prefix=/usr
        make || return 1
        # make install doesnt work currently, so we'll manually copy the files
#       make DESTDIR=$startdir/pkg install

# ** start manual copy
        mkdir -p $startdir/pkg/etc/peerguardian
        mkdir -p $startdir/pkg/usr/bin

        # copy files
        cp ./peerguardnf $startdir/pkg/usr/bin
        cp ./PG.conf $startdir/pkg/etc/peerguardian/peerguardian.conf
        # copy banned server list, but name it something USEFULL!
        cp ./p2p.p2b.p2p $startdir/pkg/etc/peerguardian/banned.list
# ** end manual copy

        mkdir -p $startdir/pkg/etc/rc.d
        mkdir -p $startdir/pkg/etc/cron.daily
        mkdir -p $startdir/pkg/var/log

        # copy our daemon script
        cp ../../peerguardian $startdir/pkg/etc/rc.d
        chown root.root $startdir/pkg/etc/rc.d/peerguardian
        chmod 755 $startdir/pkg/etc/rc.d/peerguardian

        # copy our update script
        cp ../../peerguardian-update $startdir/pkg/etc/cron.daily
        chown root.root $startdir/pkg/etc/cron.daily/peerguardian-update
        chmod 755 $startdir/pkg/etc/cron.daily/peerguardian-update 
        
        # create a log file
        touch $startdir/pkg/var/log/peerguardian.log
        chown root.root $startdir/pkg/var/log/peerguardian.log
        chmod 640 $startdir/pkg/var/log/peerguardian.log

        # update our config file
        sed -i "s\/etc/p2p.p2b.p2p/etc/peerguardian/banned.list\" $startdir/pkg/etc/peerguardian/peerguardian.conf
}

peerguardian.install

post_install()
 {
        echo "----------------------------"
        echo "Please edit your settings in '/etc/peerguardian/peerguardian.conf'"
        echo "----------------------------"
}

op=$1
shift

$op $*

peerguardian

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID /usr/bin/peerguardnf`
case "$1" in
  start)
    stat_busy "Starting PeerGuardian Daemon"
    if [ -z "$PID" ]; then
       /usr/bin/peerguardnf -d -c /etc/peerguardian/peerguardian.conf -l /var/log/peerguardian.log -h -m
    fi
    if [ ! -z "$PID" -o $? -gt 0 ]; then

      stat_fail
    else
      add_daemon peerguardian

      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping PeerGuardian Daemon"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon peerguardian
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac

peerguardian-update

#!/bin/bash

CONF_DIR=/etc/peerguardian
LIST_FILE=banned.list

cd $CONF_DIR

# remove our last list
rm $LIST_FILE

# download our new list
cd $CONF_DIR
wget -c blocklist.org/p2p.p2b.gz
wget -c blocklist.org/gov.p2b.gz
wget -c blocklist.org/spy.p2b.gz
wget -c blocklist.org/ads.p2b.gz
wget -c blocklist.org/edu.p2b.gz

# convert the different formats into one banned list
for n in $CONF_DIR/*.gz
do
        echo Extracting $n
        gunzip $n
done

for n in $CONF_DIR/*.p2b
do
        echo Converting $n
        peerguardnf -n $n
done

for n in $CONF_DIR/*.p2p
do
        echo Appending $n
        cat $n >> $CONF_DIR/$LIST_FILE
done

#clean up our files
rm $CONF_DIR/{*.gz,*.p2p,*.p2b}

# restart our daemon
killall peerguardnf
/usr/bin/peerguardnf -d -c $CONF_DIR/peerguardian.conf -l /var/log/peerguardian.log -h -m

Offline

#8 2005-08-06 10:55:58

Pointer
Member
From: Hannover, Germany
Registered: 2005-01-29
Posts: 39

Re: [REQUEST] Peerguardian

thanks smile


[14:52] [sven@linux ~]$ dmesg
Jabber-ID: sven-schaefer@jabber.ccc.de

Offline

#9 2005-08-06 11:46:38

Pointer
Member
From: Hannover, Germany
Registered: 2005-01-29
Posts: 39

Re: [REQUEST] Peerguardian

i add a daily peerguardian.list update script

--REMOVED ITS IN THE AUR VERSION--


[14:52] [sven@linux ~]$ dmesg
Jabber-ID: sven-schaefer@jabber.ccc.de

Offline

#10 2005-08-06 11:51:38

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

package is in AUR
i changed some things to conform to the arch package guidelines (which i finally got around to reading.. oops!)
i should probably go back and fix up my old packages

you dont have to re-makepkg the files, but it would probably be best.. only the file locations changed.. ie, /etc/peerguardian.conf -> /etc/peerguardian/peerguardian.conf

Offline

#11 2005-08-06 12:01:16

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

damn! i thought i was done packaging!
ill add this to the package now.. and merge it with the changes..

when im done, could you remove your PKGBUILDs from the post so that we dont confuse people!

thanks guys

if only i had iptables in my kernel i could use the damn thing!

Offline

#12 2005-08-06 12:02:46

Pointer
Member
From: Hannover, Germany
Registered: 2005-01-29
Posts: 39

Re: [REQUEST] Peerguardian

ok


[14:52] [sven@linux ~]$ dmesg
Jabber-ID: sven-schaefer@jabber.ccc.de

Offline

#13 2005-08-06 12:16:09

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

updated the pkgbuild in the thread and aur!

thanks guys! great work

Offline

#14 2005-08-06 12:36:22

Beavis
Member
From: UK
Registered: 2005-01-01
Posts: 71

Re: [REQUEST] Peerguardian

This package definately gets my vote. Excellent job everyone and thank you.

Offline

#15 2005-08-06 12:38:49

Beavis
Member
From: UK
Registered: 2005-01-01
Posts: 71

Re: [REQUEST] Peerguardian

Just added my vote in AUR  smile

Offline

#16 2005-08-06 13:14:26

Pointer
Member
From: Hannover, Germany
Registered: 2005-01-29
Posts: 39

Re: [REQUEST] Peerguardian

peerguardian ist great, 30mins with edonkey an 200 blocked ips big_smile


[14:52] [sven@linux ~]$ dmesg
Jabber-ID: sven-schaefer@jabber.ccc.de

Offline

#17 2005-08-06 14:53:40

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

Pointer pm'ed me with an update to his 'update' script.

ive modified the one in the thread and AUR.

please update!!

Offline

#18 2005-08-06 18:22:32

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [REQUEST] Peerguardian

Nice job, thanks. However, IMHO 'rm *.p2b' and 'rm *.p2p' should be moved to the end of peerguardian-update (why leave junk in /etc/peerguardian?). rm *.gz isn't needed at all, because of gunzip.

Additionally, anyone knows a way of leaving out single IPs? I had to remove edu from updates, as I couldn't connect to my shell ;-)

-edit-

One more thing: you could use 'install' command instead of cp. Config files don't need to be executable. Neither has to be the log file ;-)

Offline

#19 2005-08-06 21:01:04

Father
Member
From: Australia
Registered: 2004-06-01
Posts: 209

Re: [REQUEST] Peerguardian

the rm's are to clear the previous list files so they can be updated from the website.

i dont understand how that leaves junk in /etc/peerguardian?

cp.. install.. same thing anyway..

ill remove the executable flag later.. tiiirrrreedd


[edit] man im an idot.. yeah i see what you mean..
it downloads the files and adds them into the list.. but only removes the raw files at the start of the next update! ..heh.. i blame being tired!

the only thing about using 'install' is it might be less clear what its doing
cp blah chmod blah is very obvious.. and step by step..
ill look into it.. either way.. minor..
thanks for poiting that out though.. [/edit]

[edit2] updated 'update' script to clean out downloaded files at the end of an update [/edit2]

Offline

Board footer

Powered by FluxBB