summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Conf.pm22
-rw-r--r--Echolot/Config.pm6
-rw-r--r--Echolot/Storage/File.pm30
-rw-r--r--Echolot/Thesaurus.pm4
4 files changed, 54 insertions, 8 deletions
diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm
index 34b381e..d240e84 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.13 2002/07/06 18:34:01 weasel Exp $
+# $Id: Conf.pm,v 1.14 2002/07/07 01:12:00 weasel Exp $
#
=pod
@@ -62,6 +62,26 @@ sub send_requests() {
Echolot::Globals::get()->{'storage'}->enable_commit();
};
+sub check_resurrection() {
+ Echolot::Globals::get()->{'storage'}->delay_commit();
+ for my $remailer (Echolot::Globals::get()->{'storage'}->get_addresses()) {
+ next unless ($remailer->{'status'} eq 'ttl timeout');
+ next unless ($remailer->{'fetch'});
+ next unless ($remailer->{'resurrection_ttl'});
+ print "Sending requests to ".$remailer->{'address'}." to check for resurrection\n"
+ if Echolot::Config::get()->{'verbose'};
+ for my $type (qw{conf key help stats adminkey}) {
+ Echolot::Tools::send_message(
+ 'To' => $remailer->{'address'},
+ 'Subject' => 'remailer-'.$type,
+ 'Token' => $type.'.'.$remailer->{'id'})
+ };
+ Echolot::Globals::get()->{'storage'}->decrease_resurrection_ttl($remailer->{'address'});
+ };
+ Echolot::Globals::get()->{'storage'}->enable_commit();
+};
+
+
sub remailer_caps($$$;$) {
my ($conf, $token, $time, $dontexpire) = @_;
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index 140e22d..ebe2a29 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.16 2002/07/07 00:42:46 weasel Exp $
+# $Id: Config.pm,v 1.17 2002/07/07 01:12:00 weasel Exp $
#
=pod
@@ -61,7 +61,8 @@ sub init($) {
recipient_delimiter => '+',
dev_random => '/dev/random',
hash_len => 8,
- addresses_default_ttl => 5, # days
+ addresses_default_ttl => 5, # getkeyconf seconds (days)
+ check_resurrection_ttl => 8, # check_resurrection seconds (weeks)
smarthost => 'localhost',
mailindir => 'mail',
mailerrordir => 'mail-errors',
@@ -79,6 +80,7 @@ sub init($) {
commitprospectives => 8*60*60, # commit prospective addresses every 8 hours
expire => 24*60*60, # daily
getkeyconf => 24*60*60, # daily
+ check_resurrection => 7*24*60*60, # weekly
build_thesaurus => 60*60, # hourly
resultdir => 'results',
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index cf01092..021bff6 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.26 2002/07/03 12:09:03 weasel Exp $
+# $Id: File.pm,v 1.27 2002/07/07 01:12:00 weasel Exp $
#
=pod
@@ -523,6 +523,7 @@ sub get_address($$) {
id => $self->{'METADATA'}->{'addresses'}->{$addr}->{'id'},
address => $_,
fetch => $self->{'METADATA'}->{'addresses'}->{$addr}->{'fetch'},
+ resurrection_ttl => $self->{'METADATA'}->{'addresses'}->{$addr}->{'resurrection_ttl'},
};
return $result;
@@ -627,22 +628,45 @@ sub decrease_ttl($$) {
return 0;
$self->{'METADATA'}->{'addresses'}->{$address}->{'ttl'} --;
$self->{'METADATA'}->{'addresses'}->{$address}->{'status'} = 'ttl timeout',
- warn("Remailer $address disabled: ttl expired\n")
+ warn("Remailer $address disabled: ttl expired\n"),
+ $self->{'METADATA'}->{'addresses'}->{$address}->{'resurrection_ttl'} = Echolot::Config::get()->{'check_resurrection_ttl'}
if ($self->{'METADATA'}->{'addresses'}->{$address}->{'ttl'} <= 0);
# FIXME have proper logging
$self->commit();
return 1;
};
+sub decrease_resurrection_ttl($$) {
+ my ($self, $address) = @_;
+
+ defined ($self->{'METADATA'}->{'addresses'}->{$address}) or
+ cluck ("$address does not exist in Metadata address list"),
+ return 0;
+ ($self->{'METADATA'}->{'addresses'}->{$address}->{'status'} eq 'ttl timeout') or
+ cluck ("$address is not in ttl timeout status"),
+ return 0;
+ $self->{'METADATA'}->{'addresses'}->{$address}->{'resurrection_ttl'} --;
+ $self->{'METADATA'}->{'addresses'}->{$address}->{'status'} = 'dead',
+ warn("Remailer $address is dead\n"),
+ if ($self->{'METADATA'}->{'addresses'}->{$address}->{'resurrection_ttl'} <= 0);
+ # FIXME have proper logging
+ $self->commit();
+ return 1;
+};
+
sub restore_ttl($$) {
my ($self, $address) = @_;
defined ($self->{'METADATA'}->{'addresses'}->{$address}) or
cluck ("$address does not exist in Metadata address list"),
return 0;
+ warn("Remailer $address is alive and active again\n")
+ unless ($self->{'METADATA'}->{'addresses'}->{$address}->{'status'} eq 'active');
$self->{'METADATA'}->{'addresses'}->{$address}->{'ttl'} = Echolot::Config::get()->{'addresses_default_ttl'};
+ delete $self->{'METADATA'}->{'addresses'}->{$address}->{'resurrection_ttl'};
$self->{'METADATA'}->{'addresses'}->{$address}->{'status'} = 'active' if
- ($self->{'METADATA'}->{'addresses'}->{$address}->{'status'} eq 'ttl timeout');
+ ($self->{'METADATA'}->{'addresses'}->{$address}->{'status'} eq 'ttl timeout' ||
+ $self->{'METADATA'}->{'addresses'}->{$address}->{'status'} eq 'dead');
$self->commit();
return 1;
};
diff --git a/Echolot/Thesaurus.pm b/Echolot/Thesaurus.pm
index 2e0d6cd..ba68a69 100644
--- a/Echolot/Thesaurus.pm
+++ b/Echolot/Thesaurus.pm
@@ -1,7 +1,7 @@
package Echolot::Thesaurus;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Thesaurus.pm,v 1.4 2002/07/07 00:42:46 weasel Exp $
+# $Id: Thesaurus.pm,v 1.5 2002/07/07 01:12:00 weasel Exp $
#
=pod
@@ -34,7 +34,7 @@ sub build_thesaurus() {
closedir(DIR);
- my $exire_date = time() - Echolot::Config::get()->{'expire_thesaurus'};
+ my $expire_date = time() - Echolot::Config::get()->{'expire_thesaurus'};
my $data;
for my $filename (@files) {