<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>hartvig.de &#187; privacy</title>
	<atom:link href="http://hartvig.de/tag/privacy/feed/" rel="self" type="application/rss+xml" />
	<link>http://hartvig.de</link>
	<description></description>
	<lastBuildDate>Mon, 19 Jul 2010 17:33:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Protect your privacy using Peerguardian in Ubuntu</title>
		<link>http://hartvig.de/2008/protect-your-privacy-using-peerguardian-in-ubuntu/</link>
		<comments>http://hartvig.de/2008/protect-your-privacy-using-peerguardian-in-ubuntu/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 22:10:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[privacy]]></category>

		<guid isPermaLink="false">http://hartvig.de/?p=208</guid>
		<description><![CDATA[PeerGuardian is a free, open source, IP address blocking software programs capable of blocking incoming and outgoing addresses. The application uses a blocklist of IP addresses to filter the computers of several organisations. The system is also capable of blocking advertising, spyware and government upon user preferences. Installation Go to sourceforge.net and download the file [...]]]></description>
			<content:encoded><![CDATA[<p>PeerGuardian is a free, open source, IP address blocking software programs capable of blocking incoming and outgoing addresses. The application uses a <a href="http://en.wikipedia.org/wiki/Blacklist#Computing" target="_blank">blocklist</a> of IP addresses to filter the computers of several organisations. The system is also capable of blocking <a href="http://en.wikipedia.org/wiki/Advertising" target="_blank">advertising</a>, <a href="http://en.wikipedia.org/wiki/Spyware" target="_blank">spyware</a> and <a href="http://en.wikipedia.org/wiki/Government" target="_blank">government</a> upon user preferences.<br />
<img STYLE="border: none" src="http://www.hartvig.de/files/images/stop.png"/><br />
<span id="more-208"></span><br />
<strong>Installation</strong><br />
Go to <a href="http://sourceforge.net/project/showfiles.php?group_id=131687&amp;package_id=148849">sourceforge.net</a> and download the file peerguardnf-1.5beta.i386.deb. Install it using</p>
<pre class="prettyprint">sudo dpkg -i peerguardnf-1.5beta.i386.deb</pre>
<p>Now, create the directory /etc/peerguardian. This is where the list of blocked hosts will be stored</p>
<pre class="prettyprint">sudo mkdir /etc/peerguardian</pre>
<p>Next, open the file /usr/local/bin/peerguardian.sh with your favorite text editor</p>
<pre class="prettyprint">sudo vim /usr/local/bin/peerguardian.sh</pre>
<p>Paste the following code into the file and save it:<br />
<font size="-2"></p>
<pre class="prettyprint">
# 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>&#038;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>&#038;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>&#038;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
</pre>
<p></font><br />
Now, make it executable by running</p>
<pre class="prettyprint">sudo chmod -c 755 /usr/local/bin/peerguardian.sh</pre>
<p><strong>Using Peerguardian</strong><br />
To start Peerguardian run</p>
<pre class="prettyprint">sudo peerguardian.sh start</pre>
<p>Stopping it goes as</p>
<pre class="prettyprint">sudo peerguardian.sh stop</pre>
<p>To update the blocking lists run</p>
<pre class="prettyprint">sudo peerguardian.sh restart</pre>
<p><strong>Updating blocklists automatically</strong><br />
Add the following line to the file /etc/crontab</p>
<pre class="prettyprint">0 13    * * *   root    peerguardian.sh restart</pre>
<p><strong>Monitoring</strong><br />
You can monitor Peerguardian by inspecting the log file /var/log/PG.log</p>
<pre class="prettyprint">watch tail /var/log/PG.log</pre>
<p><strong>References</strong><br />
[1] This <a href="http://ubuntuforums.org/showthread.php?t=95793">post</a> on ubuntuforums.org</p>
]]></content:encoded>
			<wfw:commentRss>http://hartvig.de/2008/protect-your-privacy-using-peerguardian-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
