From bcb4b53f7c2aec7062fac9f468496381a257ad82 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 2 Jul 2002 18:03:55 +0000 Subject: ping cpunk without pgponly in clear too --- Echolot/Conf.pm | 25 ++++++++++++++++++++----- Echolot/Pinger.pm | 15 ++++++++++----- Echolot/Pinger/CPunk.pm | 21 ++++++++++++--------- Echolot/Stats.pm | 4 ++-- TODO | 1 - 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm index 76b8aa0..6e8a6fd 100644 --- a/Echolot/Conf.pm +++ b/Echolot/Conf.pm @@ -1,7 +1,7 @@ package Echolot::Conf; # (c) 2002 Peter Palfrader -# $Id: Conf.pm,v 1.8 2002/07/02 17:06:59 weasel Exp $ +# $Id: Conf.pm,v 1.9 2002/07/02 18:03:55 weasel Exp $ # =pod @@ -29,7 +29,8 @@ sub send_requests() { for my $remailer (Echolot::Globals::get()->{'storage'}->get_addresses()) { next unless ($remailer->{'status'} eq 'active'); next unless ($remailer->{'fetch'}); - print "Sending requests to ".$remailer->{'address'}."\n"; + print "Sending requests to ".$remailer->{'address'}."\n" + if Echolot::Config::get()->{'verbose'}; for my $type (qw{conf key help stats}) { Echolot::Tools::send_message( 'To' => $remailer->{'address'}, @@ -68,6 +69,20 @@ sub remailer_conf($$$) { } else { Echolot::Globals::get()->{'storage'}->restore_ttl( $remailer->{'address'} ); Echolot::Globals::get()->{'storage'}->set_caps($remailer_type, $remailer_caps, $remailer_nick, $remailer_address, $time); + + # if remailer is cpunk and not pgponly + if (($remailer_caps =~ /\bcpunk\b/) && !($remailer_caps =~ /\bpgponly\b/)) { + Echolot::Globals::get()->{'storage'}->set_key( + 'cpunk-clear', + $remailer_nick, + $remailer->{'address'}, + 'N/A', + 'none', + 'N/A', + 'N/A', + 'N/A', + $time); + } } @@ -192,9 +207,9 @@ sub parse_cpunk_key($$$) { my @pgp_keys = ($reply =~ /^-----BEGIN \s PGP \s PUBLIC \s KEY \s BLOCK-----\r?\n (?:.+\r?\n)* - \r?\n - (?:[a-zA-Z0-9+\/=]*\r?\n)+ - -----END \s PGP \s PUBLIC \s KEY \s BLOCK-----$/xmg ); + \r?\n + (?:[a-zA-Z0-9+\/=]*\r?\n)+ + -----END \s PGP \s PUBLIC \s KEY \s BLOCK-----$/xmg ); for my $key (@pgp_keys) { my ( $stdin_fh, $stdout_fh, $stderr_fh, $status_fh ) = ( IO::Handle->new(), diff --git a/Echolot/Pinger.pm b/Echolot/Pinger.pm index 6ffe729..86ba068 100644 --- a/Echolot/Pinger.pm +++ b/Echolot/Pinger.pm @@ -1,7 +1,7 @@ package Echolot::Pinger; # (c) 2002 Peter Palfrader -# $Id: Pinger.pm,v 1.9 2002/07/02 17:04:51 weasel Exp $ +# $Id: Pinger.pm,v 1.10 2002/07/02 18:03:55 weasel Exp $ # =pod @@ -50,13 +50,18 @@ sub do_mix_ping($$$$$) { sub do_cpunk_ping($$$$$$) { my ($address, $type, $keyid, $time, $to, $body) = @_; - my %key = Echolot::Globals::get()->{'storage'}->get_key($address, $type, $keyid); + my $keyhash; + if ($type ne 'cpunk-clear') { + my %key = Echolot::Globals::get()->{'storage'}->get_key($address, $type, $keyid); + $keyhash = { $keyid => \%key }; + }; Echolot::Pinger::CPunk::ping( $body, $to, [ { address => $address, - keyid => $keyid } ], - { $keyid => \%key }, + keyid => $keyid, + encrypt => ($type ne 'cpunk-clear') } ], + $keyhash, $type eq 'cpunk-rsa' ) or return 0; @@ -78,7 +83,7 @@ sub do_ping($$$) { my $to = Echolot::Tools::make_address('ping'); if ($type eq 'mix') { do_mix_ping($address, $key, $now, $to, $body); - } elsif ($type eq 'cpunk-rsa' || $type eq 'cpunk-dsa') { + } elsif ($type eq 'cpunk-rsa' || $type eq 'cpunk-dsa' || $type eq 'cpunk-clear') { do_cpunk_ping($address, $type, $key, $now, $to, $body); } else { cluck ("Don't know how to handle ping type $type"); diff --git a/Echolot/Pinger/CPunk.pm b/Echolot/Pinger/CPunk.pm index 2c80d4d..90b8b8a 100644 --- a/Echolot/Pinger/CPunk.pm +++ b/Echolot/Pinger/CPunk.pm @@ -1,7 +1,7 @@ package Echolot::Pinger::CPunk; # (c) 2002 Peter Palfrader -# $Id: CPunk.pm,v 1.3 2002/07/02 14:21:38 weasel Exp $ +# $Id: CPunk.pm,v 1.4 2002/07/02 18:03:55 weasel Exp $ # =pod @@ -196,14 +196,17 @@ sub ping($$$$$) { "Anon-To: $to\n". "\n". $msg; - my $encrypted = encrypt_to($msg, $hop->{'keyid'}, $keys, $pgp2compat); - (defined $encrypted) or - cluck("Encrypted is undefined"), - return undef; - $msg = "::\n". - "Encrypted: PGP\n". - "\n". - $encrypted; + + if ($hop->{'encrypt'}) { + my $encrypted = encrypt_to($msg, $hop->{'keyid'}, $keys, $pgp2compat); + (defined $encrypted) or + cluck("Encrypted is undefined"), + return undef; + $msg = "::\n". + "Encrypted: PGP\n". + "\n". + $encrypted; + }; $to = $hop->{'address'}; } diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm index 013e398..ea91066 100644 --- a/Echolot/Stats.pm +++ b/Echolot/Stats.pm @@ -1,7 +1,7 @@ package Echolot::Stats; # (c) 2002 Peter Palfrader -# $Id: Stats.pm,v 1.7 2002/07/02 17:05:22 weasel Exp $ +# $Id: Stats.pm,v 1.8 2002/07/02 18:03:55 weasel Exp $ # =pod @@ -388,7 +388,7 @@ sub build_lists() { build_mlist1( \@rems, 'mlist'); build_list2( \@rems, 'mlist2'); - $rems = build_rems(['cpunk-rsa', 'cpunk-dsa']); + $rems = build_rems(['cpunk-rsa', 'cpunk-dsa', 'cpunk-clear']); @rems = grep { $_->{'showit'} } @$rems; build_rlist1( \@rems, 'rlist'); build_list2( \@rems, 'rlist2'); diff --git a/TODO b/TODO index 4966e41..919087f 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ for 2.0: make setup easy/document setup make a private [rm]list showing all remailers - ping cpunk without pgponly in clear too configure pinging options (i.e. cpunkt-{rsa,dsa,none}, mix) for later: -- cgit v1.2.3