summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Echolot/Commands.pm8
-rw-r--r--Echolot/Conf.pm31
-rw-r--r--Echolot/Stats.pm4
-rw-r--r--Echolot/Storage/File.pm46
-rw-r--r--README5
-rw-r--r--TODO1
-rwxr-xr-xpingd81
7 files changed, 152 insertions, 24 deletions
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm
index d00f2c0..d5ef445 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.4 2002/07/03 00:54:40 weasel Exp $
+# $Id: Commands.pm,v 1.5 2002/07/03 11:08:21 weasel Exp $
#
=pod
@@ -71,6 +71,12 @@ sub processCommands($) {
Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', time() );
} elsif ($command eq 'delete') {
Echolot::Globals::get()->{'storage'}->delete_remailer(@args);
+ } elsif ($command eq 'setremailercaps') {
+ my $addr = shift @args;
+ my $conf = join(' ', @args);
+ Echolot::Conf::set_caps_manually($addr, $conf);
+ } elsif ($command eq 'deleteremailercaps') {
+ Echolot::Globals::get()->{'storage'}->delete_remailercaps(@args);
} else {
warn("Unkown command: $_\n");
};
diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm
index 6e8a6fd..bc14f84 100644
--- a/Echolot/Conf.pm
+++ b/Echolot/Conf.pm
@@ -1,7 +1,7 @@
package Echolot::Conf;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Conf.pm,v 1.9 2002/07/02 18:03:55 weasel Exp $
+# $Id: Conf.pm,v 1.10 2002/07/03 11:08:21 weasel Exp $
#
=pod
@@ -121,6 +121,35 @@ sub remailer_conf($$$) {
return 1;
};
+sub set_caps_manually($$) {
+ my ($addr, $caps) = @_;
+
+ defined $addr or
+ cluck("Address not defined."),
+ return 0;
+ defined $caps or
+ cluck("Caps not defined."),
+ return 0;
+
+ print "Setting caps for $addr manually to $caps\n"
+ if Echolot::Config::get()->{'verbose'};
+
+ my $remailer = Echolot::Globals::get()->{'storage'}->get_address($addr);
+ defined $remailer or
+ cluck("Remailer address $addr did not give a valid remailer."),
+ return 0;
+ my $id = $remailer->{'id'};
+ defined $id or
+ cluck("Remailer address $addr did not give a remailer with an id."),
+ return 0;
+ my $token = 'conf.'.$id;
+
+ my $conf = "Remailer-Type: set-manually\n$caps";
+ remailer_conf($conf, $token, time + 10 * 365 * 24 * 60 * 60); # FIXME: Y2036
+
+ return 1;
+};
+
sub parse_mix_key($$$) {
my ($reply, $time, $remailer) = @_;
diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm
index e1b68bb..2ed203f 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.9 2002/07/02 23:16:53 weasel Exp $
+# $Id: Stats.pm,v 1.10 2002/07/03 11:08:21 weasel Exp $
#
=pod
@@ -342,7 +342,7 @@ sub build_list2($$) {
printf F "\n\n\nRemailer-Capabilities:\n\n";
for my $remailer (sort {$a->{'caps'} cmp $b->{'caps'}} @$rems) {
- print F $remailer->{'caps'},"\n"
+ print F $remailer->{'caps'},"\n" if defined $remailer->{'caps'};
}
close (F);
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index e082fbd..a075e93 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.24 2002/07/03 01:07:16 weasel Exp $
+# $Id: File.pm,v 1.25 2002/07/03 11:08:21 weasel Exp $
#
=pod
@@ -511,18 +511,28 @@ sub commit_prospective_address($) {
$self->enable_commit(1);
};
+sub get_address($$) {
+ my ($self, $addr) = @_;
+
+ defined ($self->{'METADATA'}->{'addresses'}->{$addr}) or
+ cluck ("$addr does not exist in Metadata"),
+ return undef;
+
+ my $result = {
+ status => $self->{'METADATA'}->{'addresses'}->{$addr}->{'status'},
+ id => $self->{'METADATA'}->{'addresses'}->{$addr}->{'id'},
+ address => $_,
+ fetch => $self->{'METADATA'}->{'addresses'}->{$addr}->{'fetch'},
+ };
+
+ return $result;
+};
+
sub get_addresses($) {
my ($self) = @_;
my @addresses = keys %{$self->{'METADATA'}->{'addresses'}};
- my @return_data = map {
- my %tmp;
- $tmp{'status'} = $self->{'METADATA'}->{'addresses'}->{$_}->{'status'};
- $tmp{'id'} = $self->{'METADATA'}->{'addresses'}->{$_}->{'id'};
- $tmp{'address'} = $_;
- $tmp{'fetch'} = $self->{'METADATA'}->{'addresses'}->{$_}->{'fetch'};
- \%tmp;
- } @addresses;
+ my @return_data = map { $self->get_address($_); } @addresses;
return @return_data;
};
@@ -949,6 +959,24 @@ sub delete_remailer($$) {
return 1;
};
+sub delete_remailercaps($$) {
+ my ($self, $address) = @_;
+
+ print "Deleting conf for remailer $address\n"
+ if Echolot::Config::get()->{'verbose'};
+
+ if (defined $self->{'METADATA'}->{'remailers'}->{$address}) {
+ delete $self->{'METADATA'}->{'remailers'}->{$address}->{'conf'}
+ if defined $self->{'METADATA'}->{'remailers'}->{$address}->{'conf'};
+ } else {
+ cluck("Remailer $address does not exist in remailers")
+ };
+ $self->commit();
+
+ return 1;
+};
+
+
# sub convert($) {
diff --git a/README b/README
index 3233cb8..253f3ef 100644
--- a/README
+++ b/README
@@ -99,6 +99,5 @@ restart pingd.
-Please report bugs and feature requests to Peter Palfrader
-<peter@palfrader.org>.
-
+Please report bugs and feature requests at
+http://savannah.gnu.org/bugs/?group=echolot
diff --git a/TODO b/TODO
index 497f953..7bee800 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,4 @@
for 2.0:
- have mix stats for mixmasters without -conf reply (lcs, passthru).
build pgp public rings
for later:
diff --git a/pingd b/pingd
index eb7289d..cc68ca1 100755
--- a/pingd
+++ b/pingd
@@ -1,7 +1,7 @@
#!/usr/bin/perl -wT
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: pingd,v 1.14 2002/07/03 00:54:40 weasel Exp $
+# $Id: pingd,v 1.15 2002/07/03 11:08:21 weasel Exp $
#
=pod
@@ -26,6 +26,10 @@ pingd - echolot ping daemon
=item B<pingd> B<set> option=value [option=value..] I<address> [I<address> ...]
+=item B<pingd> B<setremailercaps> I<capsstring>
+
+=item B<pingd> B<deleteremailercaps> I<address>
+
=item B<pingd> B<getkeyconf>
=item B<pingd> B<dumpconf>
@@ -99,6 +103,21 @@ either B<on> or B<off>.
=back
+=item B<setremailercaps> I<capsstring>
+
+Some remailers (Mixmaster V2 - currently lcs and passthru2) don't return a
+useable remailer-conf message. For such remailers you need to set it manually.
+
+For instance:
+
+ ./pingd setremailercaps '$remailer{"passthru2"} = "<mixer@immd1.informatik.uni-erlangen.de> mix middle";'
+ ./pingd setremailercaps '$remailer{"lcs"} = "<mix@anon.lcs.mit.edu> mix klen1000";'
+
+=item B<deleteremailercaps> I<address>
+
+Delete remailer-conf data for I<address>. The config data will be reset from
+the next valid remailer-conf reply by the remailer.
+
=item B<getkeyconf>
Send a command to immediatly request keys and configuration from remailers.
@@ -107,6 +126,8 @@ Send a command to immediatly request keys and configuration from remailers.
Dumps the current configuration to standard output.
+=back
+
=head1 OPTIONS
=over
@@ -121,7 +142,8 @@ Print a short help and exit sucessfully.
=item --nohup
-Usefull only when passwd with the B<add>, B<set> or B<getkeyconf> command.
+Usefull only when passwd with the B<add>, B<set>, B<setremailercaps>,
+B<deleteremailercaps> or B<getkeyconf> 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.
@@ -142,9 +164,9 @@ F<pingd.conf>
=head1 SIGNALS
-On B<SIGINT>, B<SIGQUIT>, and B<SIGTERM> B<pingd> will schedule an exist
-for after the current actions are finished or immediatly if no actions are
-currently beeing processed. It will then write all metadata and metadata to
+On B<SIGINT>, B<SIGQUIT>, and B<SIGTERM> B<pingd> will schedule a shutdown
+for as soon as the current actions are finished or immediatly if no actions are
+currently beeing processed. It will then write all metadata and pingdata to
disk and close all files cleanly before exiting.
On B<SIGHUP> <pingd> will execute any pending commands from the commands file
@@ -154,7 +176,7 @@ This can be used if you want to rotate that file.
=head1 AUTHOR
-Peter Palfrader E<lt>peter@palfrader.org<gt>
+Peter Palfrader E<lt>peter@palfrader.orgE<gt>
=head1 SEE ALSO
@@ -162,7 +184,7 @@ echolot Documentation
=head1 BUGS
-Please report them at <lt>URL:http://savannah.gnu.org/bugs/?group=echolot<gt>
+Please report them at E<lt>URL:http://savannah.gnu.org/bugs/?group=echolotE<gt>
=cut
@@ -265,6 +287,35 @@ sub command_set(@) {
};
};
+sub command_setremailercaps(@) {
+ my @argv = @_;
+
+ my @caps;
+ for my $caps (@argv) {
+ my ($remailer_nick, $remailer_address) = ($caps =~ /^\s* \$remailer{"(.*)"} \s*=\s* "<(.*@.*)>.*"; \s*$/ix);
+ die ("caps '$caps' is not a valid remailer caps line\n") unless (defined $remailer_nick && defined $remailer_address);
+ push @caps, {
+ address => $remailer_address,
+ caps => $caps };
+ };
+ for my $caps (@caps) {
+ Echolot::Commands::addCommand("setremailercaps ".$caps->{'address'}." ".$caps->{'caps'});
+ };
+};
+
+sub command_deleteremailercaps(@) {
+ my @argv = @_;
+
+ my @addresses;
+ for my $address (@argv) {
+ die ("argument $address is not a valid email address\n") unless ($address =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ );
+ push @addresses, $address;
+ };
+
+ for my $address (@argv) {
+ Echolot::Commands::addCommand("deleteremailercaps $address");
+ };
+};
sub pid_exists() {
@@ -408,6 +459,20 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') {
} else {
print "Don't forget to run $PROGRAM_NAME process. You may also use --hup in the future\n";
};
+} elsif ($COMMAND eq 'setremailercaps') {
+ command_setremailercaps(@ARGV);
+ if (!$params->{'nohup'} && pid_exists()) {
+ daemon_hup()
+ } else {
+ print "Don't forget to run $PROGRAM_NAME process. You may also use --hup in the future\n";
+ };
+} elsif ($COMMAND eq 'deleteremailercaps') {
+ command_deleteremailercaps(@ARGV);
+ if (!$params->{'nohup'} && pid_exists()) {
+ daemon_hup()
+ } else {
+ print "Don't forget to run $PROGRAM_NAME process. You may also use --hup in the future\n";
+ };
} elsif ($COMMAND eq 'getkeyconf') {
Echolot::Commands::addCommand("getkeyconf");
if (!$params->{'nohup'} && pid_exists()) {
@@ -420,6 +485,8 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') {
} elsif ($COMMAND eq 'stop') {
daemon_stop();
} elsif ($COMMAND eq 'start') {
+ die ("Pidfile '".Echolot::Config::get()->{'pidfile'}."' exists\n")
+ if pid_exists();
make_dirs();
if ($params->{'detach'}) {
print "Detaching.\n";