diff options
author | Peter Palfrader <peter@palfrader.org> | 2003-02-18 06:38:34 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2003-02-18 06:38:34 +0000 |
commit | 4a14e35aa72f11b04fac87d1ebc8cf8f1e2828e1 (patch) | |
tree | 6efaaa4a5a31a08e387bfd658630cd81cc14a4b7 | |
parent | 8008d99c22778c8735d4ad24352a61e2d7c17d84 (diff) |
List From: headers
-rw-r--r-- | Echolot/Chain.pm | 4 | ||||
-rw-r--r-- | Echolot/Commands.pm | 4 | ||||
-rw-r--r-- | Echolot/Config.pm | 5 | ||||
-rw-r--r-- | Echolot/Log.pm | 11 | ||||
-rw-r--r-- | Echolot/Stats.pm | 4 | ||||
-rw-r--r-- | Echolot/Storage/File.pm | 51 | ||||
-rw-r--r-- | Echolot/Tools.pm | 13 | ||||
-rw-r--r-- | TODO | 7 | ||||
-rwxr-xr-x | pingd | 16 | ||||
-rw-r--r-- | templates/echolot.html | 8 | ||||
-rw-r--r-- | templates/fromlinesindex.html | 57 |
11 files changed, 138 insertions, 42 deletions
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 <peter@palfrader.org> -# $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 <peter@palfrader.org> -# $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 <peter@palfrader.org> -# $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 <peter@palfrader.org> -# $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 <peter@palfrader.org> -# $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 <peter@palfrader.org> -# $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<get_fromlines>() +=item $storage->B<get_fromline>( 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<last_update> and B<from>. +The hash has two keys, B<last_update> and B<from>, 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 <peter@palfrader.org> -# $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/</</; + $in =~ s/>/>/; + + return $in; +}; + sub write_HTML_file($$;$%) { my ($origfile, $template_file, $expire, %templateparams) = @_; @@ -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 @@ -3,7 +3,7 @@ $| = 1; # (c) 2002, 2003 Peter Palfrader <peter@palfrader.org> -# $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<pingd> B<buildthesaurus> +=item B<pingd> B<buildfromlines> + =item B<pingd> B<dumpconf> =back @@ -150,6 +152,10 @@ Send a command to immediatly rebuild the keyrings. Send a command to immediatly rebuild the Thesaurus. +=item B<buildfromlines> + +Send a command to immediatly rebuild the From Header lines page. + =item B<dumpconf> Dumps the current configuration to standard output. @@ -185,7 +191,7 @@ Print version number and exit sucessfully. Usefull only with the B<add>, B<set>, B<setremailercaps>, B<deleteremailercaps>, B<getkeyconf>, B<sendpings>, B<buildstats>, -B<buildkeys>, or B<buildthesaurus> command. +B<buildkeys>, B<buildthesaurus>, or B<buildfromlines> 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 @@ <title>Remailer Reliability Stats [<TMPL_VAR NAME="SITE_NAME">]</title> <META HTTP-EQUIV="Expires" CONTENT="<TMPL_VAR NAME="EXPIRES">"> <link href="echolot.css" rel="stylesheet" type="text/css"> - <!-- $Id: echolot.html,v 1.10 2002/12/03 02:59:13 weasel Exp $ --> + <!-- $Id: echolot.html,v 1.11 2003/02/18 06:38:13 weasel Exp $ --> </head> <body> <h1>Remailer Reliability Stats [<TMPL_VAR NAME="SITE_NAME">]</h1> @@ -122,6 +122,12 @@ over 98.0% in terms of overall reliability. Find the Thesaurus index in <a href="thesaurus/">thesaurus/</a>. </TMPL_IF> +<h2>From Header Lines</h2> + +A summary of <a href="from.html">From Headers/</a> each remailer uses has also +been compiled. It also lists which remailers allow setting the From: Header. +</TMPL_IF> + <hr> Created by <a href="http://www.palfrader.org/echolot/">Echolot <TMPL_VAR NAME="version"></a> at <TMPL_VAR NAME="CURRENT_TIMESTAMP"> (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 @@ +<html> +<head> + <title>From Headers [<TMPL_VAR NAME="SITE_NAME">]</title> + <META HTTP-EQUIV="Expires" CONTENT="<TMPL_VAR NAME="EXPIRES">"> + <link href="echolot.css" rel="stylesheet" type="text/css"> + <!-- $Id: fromlinesindex.html,v 1.1 2003/02/18 06:38:34 weasel Exp $ --> +</head> +<body> +<h1>From Headers [<TMPL_VAR NAME="SITE_NAME">]</h1> + +<p> +<a href="./">Up</a> + +<h2>Default From: Headers</h2> +<p> +<table border=1> + +<tr><tr><th>nick</th><th>From Lines</th><th>type</th></tr> + +<TMPL_LOOP NAME="default"> + <TMPL_LOOP NAME="data"> + <tr> + <td><TMPL_VAR NAME="nick"></td> + <td><TMPL_VAR NAME="from"></td> + <td><small><TMPL_VAR NAME="types"></small></td> + </tr> + </TMPL_LOOP> +</TMPL_LOOP> + +</table> + +<h2>User Supplied From: Headers</h2> +<p> +<table border=1> + +<tr><tr><th>nick</th><th>From Lines</th><th>type</th></tr> + +<TMPL_LOOP NAME="usersupplied"> + <TMPL_LOOP NAME="data"> + <tr> + <td><TMPL_VAR NAME="nick"></td> + <td><TMPL_VAR NAME="from"></td> + <td><small><TMPL_VAR NAME="types"></small></td> + </tr> + </TMPL_LOOP> +</TMPL_LOOP> + +</table> + +<hr> +Created by <a href="http://www.palfrader.org/echolot/">Echolot <TMPL_VAR NAME="version"></a>.<br> +Last update: <TMPL_VAR NAME="CURRENT_TIMESTAMP">. +</body> + +<!-- vim:set ts=2: --> +<!-- vim:set shiftwidth=2: --> +</html> |