Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[mldonkey] configuration et confidentialité
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
CoinCoin
Tux's lil' helper
Tux's lil' helper


Joined: 30 Apr 2004
Posts: 100
Location: France

PostPosted: Tue May 11, 2004 5:38 pm    Post subject: [mldonkey] configuration et confidentialité Reply with quote

Bonjour tout le monde :)

bon je me suis enfin décidé à installer mldonkey, la compatibilté avec plusieurs réseaux m'a décidé et notamment le support bittorent. Néanmoins le logiciel m'a l'air tout de même bien complexe, et j'ai un mal fou à accéder au wiki du mldonkeyworld, j'imagine qu'ils ont qq problèmes de serveurs.

C'est pour cela que je permets de vous poser quelques questions ici.

Est-il avantageux de changer les ports par défauts?
Y a-t-il un moyen de filtrer les IPs comme pour emule? est-ce vraiment interessant?
Y a t'il un howto ou une aide complète autres que le wiki?


Merci!
_________________
J'aime la bière, même si la recette n'est pas libre.
Back to top
View user's profile Send private message
LostControl
l33t
l33t


Joined: 02 Mar 2004
Posts: 885
Location: La Glane, Suisse

PostPosted: Tue May 11, 2004 6:10 pm    Post subject: Reply with quote

Salut,

Très bon choix :D Je l'utilise depuis un bon moment sur mon serveur et je dois dire qu'il va pas mal ! Le top du top, c'est l'interface web (http://localhost:4080 ou l'adresse de l'ordi qui fait tourner MlDonkey) ! SUPERBE !

1/ Je vois pas trop l'avantage de changer les ports par défaut... Désolé je peux pas t'en dire plus :(
2/ Je n'ai jamais utilisé cette fonction mais je crois qu'il y a ça :
Code:
(* IP blocking list filename (peerguardian format) *)
 ip_blocking = "./guarding.p2p"
C'est dans downloads.ini
3/ http://mldonkey.berlios.de est le mieux que j'ai pu trouver sur le Net. En général, le serveur est assez rapide... Y'a aussi le forum qui peut être utile ! Franchement je pense pas que tu trouveras mieux que le wiki de Mldonkey World

A+
Back to top
View user's profile Send private message
CryoGen
Veteran
Veteran


Joined: 11 Feb 2004
Posts: 1426
Location: Bamako - Mali - Afrique

PostPosted: Tue May 11, 2004 8:28 pm    Post subject: Reply with quote

Une petite question :D ?

Est-il compatible avec le reseau overnet et ses fichiers temp ? car j'ai quelque dl en cours :lol: (rien de grave lol)
_________________
- CryoGen` on #gentoofr@irc.freenode.net
- ~amd64 / KDE4
- I'm the bone of my sword...
Back to top
View user's profile Send private message
LostControl
l33t
l33t


Joined: 02 Mar 2004
Posts: 885
Location: La Glane, Suisse

PostPosted: Tue May 11, 2004 8:40 pm    Post subject: Reply with quote

MlDonkey télécharge très bien sur le réseau Overnet ! En fait, quand tu démarres un download sur eDonkey, il recherche et télécharge également sur Overnet :D Les protocoles doivent être suffisamment similaires je pense !

Tu peux essayer de copier tes fichiers en cours dans le répertoire temp/ de MlDonkey et de faire un "Recover Temp" ou "Scan Temp" je sais plus ! Bon, je garantis pas la manip :wink:

A+
Back to top
View user's profile Send private message
silentdav
n00b
n00b


Joined: 24 Oct 2003
Posts: 56

PostPosted: Sat May 22, 2004 11:25 pm    Post subject: Re: [mldonkey] configuration et confidentialité Reply with quote

CoinCoin wrote:

Y a-t-il un moyen de filtrer les IPs comme pour emule? est-ce vraiment interessant?
Merci!

oui il y a un moyen, place le fichier guarding.p2p dans ton répertoire .mldonkey (le filtrage se fait à partir de mldonkey)

au sinon il existe un script perl qui te génère toujours à partir de "guarding.p2p" un fichier pour certains parefeu (dont iptables)
Code:
#!/usr/bin/perl
#
# ipblacklist_convert - (c) 2003 Pierre Etchemaïté
#
# This 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.
#
use strict;
use Getopt::Long qw(GetOptions);

sub usage($) {
    my $code = shift;
    my $selfname = $0;
    $selfname =~ s@^.*/@@;
    print STDERR <<"EOF";

NAME
  $selfname - IP black lists converter

SYNOPSIS
  $selfname [ -ipprefix filename=level | -peerguardian filename ] ...
    { -jay filename } { -arno filename } { -iptables filename }

  $selfname -help

DESCRIPTION
  $selfname can read IP black lists in different formats
  (currently ip.prefix and Peer Guardian formats), remove RFC1918 and
  IANA reserved IPs from those lists (that your firewalling rules
  should already filter out), merge the ranges, and output new IP
  black list in one or several other formats (currently Jay's
  firewall, ARNO's firewall, and plain iptables bash script
  formats).

EXAMPLES
  $selfname -peerguardian guarding.p2p -jay block-ip.user
    Takes all rules from the PeerGuardian list "guarding.p2p" and output a
    Jay's firewall firewalling file "block-ip.user".

  $selfname -ipprefix ip.prefix=110 -arno iptables-blocked-hosts
    Takes all rules with score lower than 110 from the ipprefix list
    "ip.prefix", and output an ARNO's firewall filtering list,
    "iptables-blocked-hosts".

  $selfname -ipprefix ip.prefix=110 -peerguardian guarding.p2p -iptable block-hosts.sh
    Takes all rules with score lower than 110 from the ipprefix list
    "ip.prefix", all rules from the PeerGuardian list "guarding.p2p", merge
    them, and output a plain iptables bash script "block-hosts.sh".

EOF
   
    exit $code;
}

my(@IANA) = ();

foreach my $a (0,1,2,5,7,23,27,31,36,37,39,41,42,58..60,70..79,83..127,197,223..255) {
    $IANA[$a] = 1;
}

sub bad_ip($) {
    my $v = shift;
    my (@x) = ();
    foreach my $i (1..4) {
   unshift @x, $v % 256;
   $v = int($v / 256);
    }
# IANA reserved
    return 1 if $IANA[$x[0]];
# rfc 1918
    return 1 if $x[0] == 10;
    return 1 if $x[0] == 172 && $x[1] >= 16 && $x[1] < 32;
    return 1 if $x[0] == 192 && $x[1] == 168;
    return 0;
}

sub string_to_ip($) {
    my $s = shift;
    my (@x) = split(/\./, $s);
    die "wrong ip number: $s" unless scalar @x == 4;
    for(my $i=0;$i<4;$i++) {
   die "wrong ip number: $s" if $x[$i] < 0 || $x[$i] > 255;
    };
    return (($x[0]*256+$x[1])*256+$x[2])*256+$x[3];
}

sub ip_to_string($) {
    my $v = shift;
    my (@x) = ();
    foreach my $i (1..4) {
   unshift @x, $v % 256;
   $v = int($v / 256);
    }
    return join(".", @x);
}

sub zone_to_string($) {
    my $z = shift;
    return ip_to_string($z->[1])." - ".ip_to_string($z->[2])." : ".$z->[0];
}

sub interval_to_cidrs($$) {
    my $begin = shift;
    my $end = shift;
    $end++; # address *after* the end
    my (@cidrs) = ();
    my($mask, $netmask, $size);

    $size = 1;
    $mask = 32;
    $netmask = 0;
    while($begin+$size <= $end) {
   if($begin & $size) {
       push @cidrs, {'address' => $begin, 'netmask' => 0xffffffff & ~$netmask, 'mask' => $mask, 'size' => $size};
       $begin += $size;
   }
   $mask--;
   $netmask += $netmask+1;
   $size += $size;
    }
    while($begin < $end) {
   if($begin+$size <= $end) {
       push @cidrs, {'address' => $begin, 'netmask' => 0xffffffff & ~$netmask, 'mask' => $mask, 'size' => $size};
       $begin += $size;
   }
   $mask++;
   $netmask = int($netmask/2);
   $size = int($size/2);
    }
    return @cidrs;
}

my @list = ();

sub parse_peerguardian($) {
    my $filename = shift;
    local *PGBL;
    unless (open(PGBL, "<$filename")) {
   print STDERR "$filename not found\n";
        usage(1);
    }
    print STDERR "$filename found, parsing...\n";
    while(<PGBL>) {
   chomp;
   next if /^$/;
   my ($desc, $begin, $end) = ( m/^(.*):\s*([0-9.]+)\s*-\s*([0-9.]+)\s*$/ );
   if($desc) {
       my $ipbegin = string_to_ip($begin);
       my $ipend = string_to_ip($end);
       if(bad_ip($ipbegin) || bad_ip($ipend)) {
      print STDERR "Reserved range ", ip_to_string($ipbegin), '-', ip_to_string($ipend), " already filtered by standard firewalling rules, discarding\n";
       } else {
      push @list, [$desc, $ipbegin, $ipend];
       }
   } else {
       print STDERR "Doesn't parse: $_\n";
   }
    }
    close PGBL;
}

sub parse_ipprefix($$) {
    my $filename = shift;
    my $threshold = shift;
    local *CDBL;
    unless (open(CDBL, "<$filename")) {
   print STDERR "$filename not found\n";
   usage(1);
    }
    print STDERR "$filename found, parsing...\n";
    while(<CDBL>) {
   chomp;
   next if /^$/;
   my ($begin, $end, $lvl, $desc) = ( m/^([0-9.]+)\s*-\s*([0-9.]+)\s*,\s*(\d+)\s*,?\s*(.*)$/ );
   if($desc) {
       # low level <=> suspicious, high level <=> harmless
       if($lvl <= $threshold) {
      my $ipbegin = string_to_ip($begin);
      my $ipend = string_to_ip($end);
      if(bad_ip($ipbegin) || bad_ip($ipend)) {
          print STDERR "Reserved range ", ip_to_string($ipbegin), '-', ip_to_string($ipend), " already filtered by standard firewalling rules, discarding\n";
      } else {
          push @list, [$desc, $ipbegin, $ipend];
      }
       }
   } else {
       print STDERR "Doesn't parse: $_\n";
   }
    }
    close CDBL;
}

my(%ipprefixfiles) = ();
my(@peerguardianfiles) = ();
my($jayout,$arnoout,$iptablesout);

Getopt::Long::Configure();
eval {
    GetOptions(
        'ipprefix=s' => \%ipprefixfiles,
        'peerguardian=s' => \@peerguardianfiles,
        'jay=s' => \$jayout,
        'arno=s' => \$arnoout,
        'iptables=s' => \$iptablesout,
        'help|h|?' => \&usage);
};
if ($@) {
    print "$@\n";
    usage(1);
}

{
    my($ok) = 0;
    foreach my $out ($jayout, $arnoout, $iptablesout) {
   if(defined $out) {
       $ok = 1;
   } else {
       $out = '/dev/null'; # works thanks to aliasing
   }
    }
    if(!$ok) {
   print STDERR "no output selected\n";
   usage(1);
    }
}

map { parse_ipprefix($_, $ipprefixfiles{$_}) } keys %ipprefixfiles;
map { parse_peerguardian($_) } @peerguardianfiles;

if(!scalar @list) {
    print STDERR "Empty list\n";
    usage(1);
}
print STDERR scalar @list, " entries\n";

print STDERR "removing duplicates, merging zones...\n";
# Should we avoid merging zones that have different descriptions ?
my $DESCMATTERS = 0;

@list = sort { $a->[1] <=> $b->[1] || $a->[2] <=> $b->[2] } @list;
# map { print zone_to_string($_), "\n" } @list;

my (@mergedlist) = ();
my $last = shift @list;
while(scalar @list) {
    my $next = shift @list;
    if($next->[1] > $last->[2]+1 ||
       ($DESCMATTERS && ($last->[0] ne $next->[0]))) {
   push @mergedlist, $last;
   $last = $next;
    } else {
   print STDERR "Merging zones with different descriptions:\n".zone_to_string($last)."\n".zone_to_string($next)."\n" unless $last->[0] eq $next->[0];
   if ($next->[2] > $last->[2]) {
       $last->[2] = $next->[2];
   } else {
       print STDERR "redundant interval: ".zone_to_string($next)."\n";
   }
    }
}
push @mergedlist, $last;
print STDERR scalar @mergedlist, " remaining entries\n";
# map { print zone_to_string($_), "\n" } @mergedlist;

my $filtered_before = 0;
my $filtered_after = 0;
my $total_cidrs = 0;

open(ARNO, ">$arnoout") or die "$arnoout: $!";
open(JAY, ">$jayout") or die "$jayout: $!";
open(IPTABLE, ">$iptablesout") or die "$iptablesout: $!";

print IPTABLE <<'EOF';
#!/bin/bash

# Create special MLDONKEY chain
iptables -t filter -N MLDONKEY
iptables -t filter -F MLDONKEY

# Create the logdrop chain to log & drop a packet
iptables -t filter -N MLDONKEY_LOGDROP
iptables -t filter -F MLDONKEY_LOGDROP
iptables -t filter -A MLDONKEY_LOGDROP -j LOG --log-prefix "MLDONKEY"
iptables -t filter -A MLDONKEY_LOGDROP -j DROP

# Jump to the special MLD chain at the end of the INPUT chain (commented out)
#iptables -t nat -A INPUT -j MLDONKEY

# List of ip ranges to ban
EOF

foreach my $z (@mergedlist) {
    print ARNO "# ", zone_to_string($z), "\n";
    my $before += $z->[2] - $z->[1] + 1;
    my $after = 0;
    my(@cidrs) = interval_to_cidrs($z->[1], $z->[2]);
    foreach my $cidr (@cidrs) {
   print ARNO ip_to_string($cidr->{address}), "/", $cidr->{'mask'}, "\n";
   print JAY ip_to_string($cidr->{address}), "/", $cidr->{'mask'}, ":$z->[0]\n";
        print IPTABLE "iptables -t filter -I INPUT 1 -s ", ip_to_string($cidr->{address}), "/", $cidr->{'mask'}, " -j MLDONKEY_LOGDROP\n";
# " --log-prefix \"", substr($z->[0], 0, 29), "\"" ?
   $after += $cidr->{'size'};
    }
    die "CIDR conversion went wrong!\n" if $after != $before;
    $filtered_before += $before;
    $filtered_after += $after;
    $total_cidrs += scalar @cidrs;
}
close ARNO;
close JAY;
close IPTABLE;
print STDERR "$total_cidrs CIDRs, IPs filtered: $filtered_after\n";

tu peux trouver un exemple du fichier guarding.p2p à http://xs.tech.nu/ :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum