Old 01-03-2006, 12:11 PM   #1
jre

Senior Member
Join Date: Sep 2005
Posts: 588
Default Update&Init Script

In this thread you will find a script to run PeerGuardian automatically. This is not a new version of PeerGuardian.
Packages named peerguardian-YYYYMMDD.jre.zip are additional to peerguardnf (PeerGuardian 1.5 beta). They won't work if this isn't already installed.
The more actual package named peerguardian-cvs20060228-5-YYYYMMDD.jre.zip won't work with the old PeerGuardian 1.5 beta but depends on lestlest's PeerGuardian 1.5cvs version. The script is already part of this new deb-package so you don't have to download it anymore!
The install routine is made for Debian but might work on other systems as well, just try it. Always check if your system is still running as it ought to. I give you some hints to check if PeerGuardian is blocking in the README, but you also need to check if your firewall (if you have one) is working as it is supposed to. Firewall users have to change their rules from ACCEPT to PEERGUARDIAN!


Hi all,
I've made a new script based on my old one and other stuff from this forum, especially from JFM and /meth/usr.

Features:
- start and stop PeerGuardian
- insert/remove iptables
- update the blocklist
- unblock IPs
- supports plaintext and v2.0binary blocklistformat
- LSB compatible service control script (not really, but the beginning is done)

Attention, changed behavior since last script:
'start' doesn't update the blocklist, so your system boots faster.
Use 'reload' to update blocklist and (re-)start PeerGuardian!

Every comment/improvement is very welcome!

The script consists of the following components:

Insert iptables

Remove iptables

Start PeerGuardian
Check if old blocklist is installed
Rename logfile
Start PeerGuardian
Remove iptables
sleep 1
Insert Iptables
Stop PeerGuardian
killall peerguardnf
Remove iptables
Restart PeerGuardian
Stop PeerGuardian
sleep 4
Start PeerGuardian
Force-Reload PeerGuardian
Update PeerGuardian
Restart PeerGuardian
Reload PeerGuardian (actually the same as force-reload)

Update PeerGuardian
Check if any blocklist was updated and download new ones
End if no blocklist needed updating
Else build the new blocklist
Unblock IPs from the blocklist
Install new blocklist
Status (not implemented yet)

Happy new Year
jre

Last edited by jre : 04-01-2006 at 09:17 AM. Reason: Updated intro and removed obsolete package.
jre is offline   Reply With Quote

 
Old 01-05-2006, 12:58 PM   #2
jre

Senior Member
Join Date: Sep 2005
Posts: 588
Default Re: Update&Init Script

I've added some files to the above script:
README
INSTALL
UNINSTALL
cron.daily_peerguardian

After unzipping the package just type "./INSTALL".
Afterwards PeerGuardian will be started at every bootup and the blocklist will be updated once a day. This script is made for Debian. It starts in Runlevel 2. Customize it, if this doesn't fit for you.

That was much easier than making the script really LSB compatible
But I think this will be a great help for new users.

Greetings
jre

Last edited by jre : 03-18-2006 at 12:39 PM. Reason: Removed obsolete package in attachment.
jre is offline   Reply With Quote

 
Old 01-21-2006, 05:02 PM   #3
jre

Senior Member
Join Date: Sep 2005
Posts: 588
Default Debian Update&Init Script

Some changes again:

There's a new file /etc/peerguardian/blocklists. Here you can insert the complete URLs of the blocklists. This allows
- different websites with blocklists
- packed and unpacked blocklists (ATM only .gz supported, but this is easy to extend.)
- different blocklist formats (ATM the script supposes a file *.p2b to be in PGv2-format and else supposes plaintext files)

An own logfile for this script (/var/log/peerguardian.log)

Logrotation for both logfiles (PG.log and peerguardian.log)

Improved Installing and Uninstalling (for Debian, but might work for other distros, too. If something is not working it tries to give you hints.)


Just download the attachment, unzip it, read the README and type ./INSTALL

I hope this is usefull for you, comments/improvements are very welcome.
jre

Last edited by jre : 03-18-2006 at 12:35 PM. Reason: Removed obsolete package in attachment.
jre is offline   Reply With Quote

 
Old 01-22-2006, 09:17 AM   #4
truckdiver

Member
Join Date: Jan 2006
Posts: 5
Default Re: Update&Init Script

does this solve the problem with PG disabling firewall ?
truckdiver is offline   Reply With Quote

 
Old 01-23-2006, 07:18 AM   #5
b3an

Junior Member
Join Date: Jan 2006
Posts: 1
Default Re: Update&Init Script

Thank you!


This script so far works perfectly. Updates and restarts all handle fine.
b3an is offline   Reply With Quote

 
Old 01-23-2006, 08:41 AM   #6
jre

Senior Member
Join Date: Sep 2005
Posts: 588
Default Re: Update&Init Script

truckdiver: Never tested it on a firewall, but I think that it will work. Just try it!

I took the iptables-stuff from JFM in this thread:
http://forums.phoenixlabs.org/t9505-...rkconnect.html
iptables -I INPUT 1 -j QUEUE > /dev/null 2>&1
iptables -I FORWARD 1 -j QUEUE > /dev/null 2>&1
iptables -I OUTPUT 1 -j QUEUE > /dev/null 2>&1
This inserts the rules not only for INPUT and OUTPUT (as PeerGuardian already does it) but also for FORWARD (important for firewalls, I think) and all of them always on first place.

If this doesn't work for you just change in the script the insert_iptables and remove_iptables sections. Comment out the old entries and uncomment the previously outcommented lines there. You will then have /meth/usr's solution from here:
http://forums.phoenixlabs.org/showth...?t=7270&page=3

Please don't think that I know anything about this stuff. All that I know today is what I learned while writing this script and reading this forum. So don't trust me - test and check it yourself.
jre
jre is offline   Reply With Quote

 
Old 01-23-2006, 07:44 PM   #7
truckdiver

Member
Join Date: Jan 2006
Posts: 5
Default Re: Update&Init Script

just tried it, the script works GREAt, but unfortunately it kills my firewall (firestarter) or i guess its iptables thats killed or disabled or whatever

its like this: i start your script, and firestarter no more blocks anything (ive tested by having remote computers ping me and firestarter is set to block pings - but it lets the pings through

if i stop/restarts firestarter the pings are again blocked, but now peerguardian (your script) doesent block anything :(

there must be a way to get this to work ?
truckdiver is offline   Reply With Quote

 
Old 01-24-2006, 02:45 AM   #8
/meth/usr

Member
Join Date: Dec 2005
Posts: 22
Default Re: Update&Init Script

Quote:
Originally Posted by truckdiver
just tried it, the script works GREAt, but unfortunately it kills my firewall (firestarter) or i guess its iptables thats killed or disabled or whatever

its like this: i start your script, and firestarter no more blocks anything (ive tested by having remote computers ping me and firestarter is set to block pings - but it lets the pings through

if i stop/restarts firestarter the pings are again blocked, but now peerguardian (your script) doesent block anything :(

there must be a way to get this to work ?
try using -A instead of -I for the iptables insertion, like:
iptables -A INPUT -j QUEUE
instead of
iptables -I INPUT 1 -j QUEUE

I can't remember exactly, but I think the QUEUE rules accept the packet if they don't block it, without going through the rest of the rules in the chain, so putting it first in your chains may be causing trouble.
If that doesn't work, you'll need to consult someone familiar with firestarter on where to insert the rules.

BTW, nice work on the script jre
/meth/usr is offline   Reply With Quote

 
Old 01-24-2006, 07:13 AM   #9
jre

Senior Member
Join Date: Sep 2005
Posts: 588
Default Re: Update&Init Script

/meth/usr: Thx You know much is based on your work.
Please tell me, do you still use this solution for your dedicated firewall:
Code:
# change iptables rules from defaults to ones that work on a firewall
iptables -D CUSTOMFORWARD -j PEERGUARDFORWARD > /dev/null 2>&1
iptables --flush PEERGUARDFORWARD > /dev/null 2>&1
iptables --delete-chain PEERGUARDFORWARD > /dev/null 2>&1

iptables --new PEERGUARDFORWARD
iptables -D INPUT -j QUEUE
iptables -D OUTPUT -j QUEUE
iptables -A PEERGUARDFORWARD -j QUEUE
iptables -A CUSTOMFORWARD -j PEERGUARDFORWARD
Or would this work with you, too:
Code:
iptables -D INPUT -j QUEUE > /dev/null 2>&1
iptables -D FORWARD -j QUEUE > /dev/null 2>&1
iptables -D OUTPUT -j QUEUE > /dev/null 2>&1

iptables -A INPUT -j QUEUE > /dev/null 2>&1
iptables -A FORWARD -j QUEUE > /dev/null 2>&1
iptables -A OUTPUT -j QUEUE > /dev/null 2>&1
Am I right that CUSTOMFORWARD is something specific for IPCop?

If anyone has any solution for his specific system (regarding iptables and firewalls), please post it here.
jre

Last edited by jre : 01-24-2006 at 12:39 PM.
jre is offline   Reply With Quote

 
Old 01-24-2006, 12:35 PM   #10
jre

Senior Member
Join Date: Sep 2005
Posts: 588
Default Re: Update&Init Script

Just a little update, I had a mistake in the section for converting v.2 blocklists to plaintext. But until blocklist.org gives us lists again this section isn't used anyway. [Dreaming of blocklist.org working completely again ...]
And some other little changes ...
BTW: I don't want to spam this forum with too many attachments, so if server space is rare I might delete the old attachments.

jre

Last edited by jre : 03-18-2006 at 12:40 PM. Reason: Removed obsolete package in attachment.
jre is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux PeerGuardian update script for bluetack.co.uk jre PeerGuardian Linux 31 01-28-2007 10:28 AM
Check peer guardian is running script saffir PeerGuardian Windows 4 12-22-2006 11:29 AM
Have been hacked for 4 weeks. Being_Hacked Misc. 19 09-14-2006 10:54 AM
Wifi Batch Script Patrick_Bateman Coding/Scripting 0 09-28-2005 02:43 PM


All times are GMT -5. The time now is 07:32 PM.


  

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© Phoenix Labs Staff