From 4a14e35aa72f11b04fac87d1ebc8cf8f1e2828e1 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 18 Feb 2003 06:38:34 +0000 Subject: List From: headers --- Echolot/Chain.pm | 4 +-- Echolot/Commands.pm | 4 ++- Echolot/Config.pm | 5 +++- Echolot/Log.pm | 11 ++++----- Echolot/Stats.pm | 4 +-- Echolot/Storage/File.pm | 51 +++++++++++++++++++++----------------- Echolot/Tools.pm | 13 +++++++++- TODO | 7 +++--- pingd | 16 ++++++++++-- templates/echolot.html | 8 +++++- templates/fromlinesindex.html | 57 +++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 138 insertions(+), 42 deletions(-) create mode 100644 templates/fromlinesindex.html diff --git a/Echolot/Chain.pm b/Echolot/Chain.pm index dcf6647..1a380d7 100644 --- a/Echolot/Chain.pm +++ b/Echolot/Chain.pm @@ -1,7 +1,7 @@ package Echolot::Chain; # (c) 2002 Peter Palfrader -# $Id: Chain.pm,v 1.8 2003/02/17 14:44:15 weasel Exp $ +# $Id: Chain.pm,v 1.9 2003/02/18 06:38:06 weasel Exp $ # =pod @@ -198,7 +198,7 @@ sub set_intensive_care($@) { %{$INTENSIVE_CARE{$chaintype}} = map { ($_->{'addr1'}.' '.$_->{'addr2'}) => $_->{'reason'} } @$intensive_care; if (scalar @$intensive_care) { - Echolot::Log::debug("intensive care $chaintype:\n" . join("\n", map { "\t\t$_: $INTENSIVE_CARE{$chaintype}->{$_}" } keys %{$INTENSIVE_CARE{$chaintype}} )); + Echolot::Log::debug("intensive care $chaintype:\n" . join("\n", map { "$_: $INTENSIVE_CARE{$chaintype}->{$_}" } keys %{$INTENSIVE_CARE{$chaintype}} )); } else { Echolot::Log::debug("intensive care $chaintype: (none)"); }; diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm index c370ec1..e0d7e5e 100644 --- a/Echolot/Commands.pm +++ b/Echolot/Commands.pm @@ -1,7 +1,7 @@ package Echolot::Commands; # (c) 2002 Peter Palfrader -# $Id: Commands.pm,v 1.12 2003/01/14 05:25:34 weasel Exp $ +# $Id: Commands.pm,v 1.13 2003/02/18 06:38:07 weasel Exp $ # =pod @@ -77,6 +77,8 @@ sub processCommands($) { Echolot::Globals::get()->{'scheduler'}->schedule('buildkeys', 0, time() ); } elsif ($command eq 'buildthesaurus') { Echolot::Globals::get()->{'scheduler'}->schedule('buildthesaurus', 0, time() ); + } elsif ($command eq 'buildfromlines') { + Echolot::Globals::get()->{'scheduler'}->schedule('buildfromlines', 0, time() ); } elsif ($command eq 'delete') { Echolot::Globals::get()->{'storage'}->delete_remailer(@args); } elsif ($command eq 'setremailercaps') { diff --git a/Echolot/Config.pm b/Echolot/Config.pm index 9561d55..4c887cd 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader -# $Id: Config.pm,v 1.58 2003/02/17 14:44:15 weasel Exp $ +# $Id: Config.pm,v 1.59 2003/02/18 06:38:08 weasel Exp $ # =pod @@ -88,6 +88,7 @@ sub init($) { buildstats => 5*60, # build statistics every 5 minutes buildkeys => 8*60*60, # build keyring every 8 hours buildthesaurus => 60*60, # hourly + buildfromlines => 60*60, # hourly commitprospectives => 8*60*60, # commit prospective addresses every 8 hours expire => 24*60*60, # daily getkeyconf_interval => 5*60, # send out requests every 5 minutes @@ -130,6 +131,7 @@ sub init($) { resultdir => 'results', thesaurusdir => 'results/thesaurus', thesaurusindexfile => 'results/thesaurus/index', + fromlinesindexfile => 'results/from', private_resultdir => 'results.private', indexfilebasename => 'echolot', gnupghome => 'gnupghome', @@ -180,6 +182,7 @@ sub init($) { default => { 'indexfile' => 'templates/echolot.html', 'thesaurusindexfile' => 'templates/thesaurusindex.html', + 'fromlinesindexfile' => 'templates/fromlinesindex.html', 'mlist' => 'templates/mlist.html', 'mlist2' => 'templates/mlist2.html', 'rlist' => 'templates/rlist.html', diff --git a/Echolot/Log.pm b/Echolot/Log.pm index 5078835..7e60612 100644 --- a/Echolot/Log.pm +++ b/Echolot/Log.pm @@ -1,7 +1,7 @@ package Echolot::Log; # (c) 2002 Peter Palfrader -# $Id: Log.pm,v 1.6 2003/01/14 07:38:27 weasel Exp $ +# $Id: Log.pm,v 1.7 2003/02/18 06:38:09 weasel Exp $ # =pod @@ -42,11 +42,10 @@ sub header_log($$) { $monnames[$mon], $mday, $hour, $min, $sec); - my $logstring = $time.' '. - '['.uc($level).']'. ' '. - $msg; - $logstring =~ s/\n/\n /mg; - $logstring .= "\n"; + my $prefix = $time.' ['.uc($level).'] '; + my $logstring = $msg."\n"; + my $first = 0; + $logstring =~ s/^/ $prefix . ($first++ ? ' ' : '' ) /emg; return $logstring; }; diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm index 4575562..a91dc57 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.48 2003/02/17 07:22:49 weasel Exp $ +# $Id: Stats.pm,v 1.49 2003/02/18 06:38:09 weasel Exp $ # =pod @@ -532,7 +532,7 @@ sub find_broken_chains($$$) { my $done = $stats->{$addr1}->{$addr2}->{'done'}; $done = 0 unless defined $done; ($out < Echolot::Config::get()->{'chainping_minsample'} && $done == 0) and - push (@intensive_care, { addr1 => $addr1, addr2 => $addr2, reason => "only $out samples, none returned so far" }), + push (@intensive_care, { addr1 => $addr1, addr2 => $addr2, reason => "only $out sample".($out>1?'s':'').", none returned so far" }), next; ($out > 0) or Echolot::Log::debug("Should not devide through zero ($done/$out) for $addr1, $addr2."), diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm index 46ddbd5..25d6406 100644 --- a/Echolot/Storage/File.pm +++ b/Echolot/Storage/File.pm @@ -1,7 +1,7 @@ package Echolot::Storage::File; # (c) 2002 Peter Palfrader -# $Id: File.pm,v 1.52 2003/02/17 14:44:15 weasel Exp $ +# $Id: File.pm,v 1.53 2003/02/18 06:38:10 weasel Exp $ # =pod @@ -1522,6 +1522,10 @@ Returns undef on errors. sub get_nick($$) { my ($self, $remailer) = @_; + defined $remailer or + Echolot::Log::cluck ("Undefined remailer passed to get_nick()."), + return undef; + return undef unless defined $self->{'METADATA'}->{'remailers'}->{$remailer}; return undef unless defined $self->{'METADATA'}->{'remailers'}->{$remailer}->{'conf'}; return $self->{'METADATA'}->{'remailers'}->{$remailer}->{'conf'}->{'nick'}; }; @@ -1739,7 +1743,7 @@ sub delete_remailercaps($$) { Register that the remailer I<$address> returned the From header line I<$from>. If I<$with_from> is 1 we had tried to supply our own -From, otherwhise not. +From, otherwise not. Returns 1, undef on error. @@ -1773,34 +1777,37 @@ sub register_fromline($$$$) { }; -=item $storage->B() +=item $storage->B( I<$addr>, I<$type>, I<$user_supplied> ) Return a hash reference with header From line information. -The key is the remailer address. This points to a hash of types (mix, -cpunk-rsa, ..) which point to another hash with keys B<0> (no user supplied -From header tried) and B<1> (a user supplied From header was given). These -point to yet another hash with keys B and B. +The hash has two keys, B and B, which holds the actual information. + +If there is no from line registered for the given combination, undef is returned. + +On Error, also undef is returned. =cut -sub get_fromlines($) { - my ($self) = @_; +sub get_fromline($$$$) { + my ($self, $addr, $type, $user_supplied) = @_; - my $result; - # rebuilding it so that external things cannot screw up our structure - for my $remailer_addr ( keys %{$self->{'METADATA'}->{'fromlines'}} ) { - for my $type ( keys %{$self->{'METADATA'}->{'fromlines'}->{$remailer_addr}} ) { - for my $user_supplied ( keys %{$self->{'METADATA'}->{'fromlines'}->{$remailer_addr}->{$type}} ) { - $result->{$remailer_addr}->{$user_supplied} = { - last_update => $self->{'METADATA'}->{'fromlines'}->{$remailer_addr}->{$type}->{$user_supplied}->{'last_update'}, - from => $self->{'METADATA'}->{'fromlines'}->{$remailer_addr}->{$type}->{$user_supplied}->{'from'} - }; - }; - }; - }; + defined $self->{'METADATA'}->{'fromlines'}->{$addr} or + return undef; + defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type} or + return undef; + defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied} or + return undef; - return $result; + defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'last_update'} or + Echolot::Log::cluck ("last_update is undefined with $addr $type $user_supplied."), + return undef; + defined $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'from'} or + Echolot::Log::cluck ("from is undefined with $addr $type $user_supplied."), + return undef; + + return { last_update => $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'last_update'}, + from => $self->{'METADATA'}->{'fromlines'}->{$addr}->{$type}->{$user_supplied}->{'from'} }; } diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm index 88dd0d2..9643d78 100644 --- a/Echolot/Tools.pm +++ b/Echolot/Tools.pm @@ -1,7 +1,7 @@ package Echolot::Tools; # (c) 2002 Peter Palfrader -# $Id: Tools.pm,v 1.18 2003/02/16 10:24:45 weasel Exp $ +# $Id: Tools.pm,v 1.19 2003/02/18 06:38:09 weasel Exp $ # =pod @@ -204,6 +204,17 @@ sub write_meta_information($%) { return 1; }; +sub escape_HTML_entities($) { + my ($in) = @_; + + $in =~ s/&/&/; + $in =~ s/"/"/; + $in =~ s//>/; + + return $in; +}; + sub write_HTML_file($$;$%) { my ($origfile, $template_file, $expire, %templateparams) = @_; diff --git a/TODO b/TODO index 3dc3158..cf1e172 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.49 2003/02/17 10:26:06 weasel Exp $ +$Id: TODO,v 1.50 2003/02/18 06:38:05 weasel Exp $ Legend: - Not done @@ -8,11 +8,10 @@ Legend: D Deferred X Abandoned - - have different stats philosophies (pessimist, optimist..) - - Collect default and modified From: header (and check for - extra Footer/Header) + - Print summary to log daily can be done later: + - have different stats philosophies (pessimist, optimist..) - allow capsstring overrides/additions - check gnupg version number on startup - have a way to always have certain keys in the keyring diff --git a/pingd b/pingd index 07c2601..e276e0b 100755 --- a/pingd +++ b/pingd @@ -3,7 +3,7 @@ $| = 1; # (c) 2002, 2003 Peter Palfrader -# $Id: pingd,v 1.97 2003/02/16 05:46:54 weasel Exp $ +# $Id: pingd,v 1.98 2003/02/18 06:38:06 weasel Exp $ # =pod @@ -42,6 +42,8 @@ pingd - echolot ping daemon =item B B +=item B B + =item B B =back @@ -150,6 +152,10 @@ Send a command to immediatly rebuild the keyrings. Send a command to immediatly rebuild the Thesaurus. +=item B + +Send a command to immediatly rebuild the From Header lines page. + =item B Dumps the current configuration to standard output. @@ -185,7 +191,7 @@ Print version number and exit sucessfully. Usefull only with the B, B, B, B, B, B, B, -B, or B command. +B, B, or B command. Don't send a HUP signal to the daemon which instructs it to process the commands after adding the command to the task list. @@ -290,6 +296,7 @@ use Echolot::Chain; use Echolot::Stats; use Echolot::Commands; use Echolot::Thesaurus; +use Echolot::Fromlines; use Echolot::Log; use POSIX qw(setsid); @@ -507,6 +514,7 @@ sub daemon_run($) { $scheduler->add('buildstats' , Echolot::Config::get()->{'buildstats'} , 0, \&Echolot::Stats::build_stats ); $scheduler->add('buildkeys' , Echolot::Config::get()->{'buildkeys'} , 0, \&Echolot::Stats::build_keys ); $scheduler->add('buildthesaurus' , Echolot::Config::get()->{'buildthesaurus'} , 0, \&Echolot::Thesaurus::build_thesaurus ); + $scheduler->add('buildfromlines' , Echolot::Config::get()->{'buildfromlines'} , 0, \&Echolot::Fromlines::build_fromlines ); $scheduler->add('metadata_backup' , Echolot::Config::get()->{'metadata_backup'} , 0, \&metadata_backup ); $scheduler->add('commitprospectives' , Echolot::Config::get()->{'commitprospectives'} , 0, \&commit_prospective_address ); @@ -640,6 +648,7 @@ if ($params->{'help'}) { print (" buildstats ... build remailer stats immediatly\n"); print (" buildkeys ... buid keyrings immediatly\n"); print (" buildthesaurus ... build thesaurus immediatly\n"); + print (" buildfromlines ... build fromlines immediatly\n"); print (" dumpconf dump configuration\n"); exit 0; }; @@ -687,6 +696,9 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') { } elsif ($COMMAND eq 'buildthesaurus') { Echolot::Commands::addCommand("buildthesaurus"); hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'buildfromlines') { + Echolot::Commands::addCommand("buildfromlines"); + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'process') { daemon_hup(); } elsif ($COMMAND eq 'stop') { diff --git a/templates/echolot.html b/templates/echolot.html index 82d710c..2fdce0b 100644 --- a/templates/echolot.html +++ b/templates/echolot.html @@ -3,7 +3,7 @@ Remailer Reliability Stats [<TMPL_VAR NAME="SITE_NAME">] "> - +

Remailer Reliability Stats []

@@ -122,6 +122,12 @@ over 98.0% in terms of overall reliability. Find the Thesaurus index in thesaurus/. +

From Header Lines

+ +A summary of From Headers/ each remailer uses has also +been compiled. It also lists which remailers allow setting the From: Header. + +
Created by Echolot at (individual pages diff --git a/templates/fromlinesindex.html b/templates/fromlinesindex.html new file mode 100644 index 0000000..65dc884 --- /dev/null +++ b/templates/fromlinesindex.html @@ -0,0 +1,57 @@ + + + From Headers [<TMPL_VAR NAME="SITE_NAME">] + "> + + + + +

From Headers []

+ +

+Up + +

Default From: Headers

+

+ + + + + + + + + + + + + + +
nickFrom Linestype
+ +

User Supplied From: Headers

+

+ + + + + + + + + + + + + + +
nickFrom Linestype
+ +


+Created by Echolot .
+Last update: . + + + + + -- cgit v1.2.3