Commit 89e06949 authored by sikeda's avatar sikeda
Browse files

[change] If distribution of a message is rejected or fails, delivery status...

[change] If distribution of a message is rejected or fails, delivery status notification (DSN) instead of normal report will be sent by Sympa.  This behavior may mitigate backscattering caused by unwanted situation (virus, storm of spam, system trouble, ...).


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12583 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 7dcf8d40
......@@ -12,10 +12,14 @@ Subject: [% FILTER qencode %][%|loc%]List unknown[%END%][%END%]
Subject: [% FILTER qencode %][%|loc%]Too large message[%END%][%END%]
[% ELSIF status == '5.3.0' -%]
Subject: [% FILTER qencode %][%|loc%]Message distribution: Internal server error[%END%][%END%]
[% ELSIF status == '5.6.0' -%]
Subject: [% FILTER qencode %][%|loc%]Message distribution: User error[%END%][%END%]
[% ELSIF status == '5.6.5' -%]
Subject: [% FILTER qencode %][%|loc%]Cannot personalize message[%END%][%END%]
[% ELSIF status == '5.7.0' -%]
Subject: [% FILTER qencode %][%|loc%]A virus in your mail[%END%][%END%]
[% ELSIF status == '5.7.1' -%]
Subject: [% FILTER qencode %][%|loc%]Message distribution: Authorization denied[%END%][%END%]
[% ELSE -%]
Subject: [% FILTER qencode %][%|loc(action)%]Delivery Status Notification: %1[%END%][%END%]
[% END %]
......@@ -55,6 +59,17 @@ Note: Because binary files have to be encoded in less-efficient ASCII format bef
[%|loc(list.name,list.host)%]For further information, please contact %1-request@%2[%END -%]
[% ELSIF status == '5.6.0' -%]
[%|loc(list.name,conf.sympa,list.host,cmd)%]The following message was sent to list '%1' and it contains a line '%4' that can be interpreted as a command.
If your message contained a command (like subscribe, unsubscribe, help, index, get, ...), please note that commands should never be sent to lists. Commands must be sent to %2 exclusively.
If your message was really meant to be sent to the list, it was interpreted by the software as a command. Please contact the list owner:
%1-request@%3
so that they can take care of your message.
Thank you for your attention.[%END%]
[% ELSIF status == '5.6.5' -%]
[%|loc%]Your message cannot be personalized. Please check template syntax.[%END%]
......@@ -69,6 +84,14 @@ Note: Because binary files have to be encoded in less-efficient ASCII format bef
Note, however, that many viruses fake sender's e-mail address, so it is possible that the virus didn't come from your computer. In that case, please disregard this message.[%END%]
[% ELSIF status == '5.7.1' -%]
[%|loc(list.name)%]Your message for list '%1' (attached below) was rejected.
You are not allowed to send this message for the following reason:[%END%]
[% PROCESS authorization_reject.tt2 -%]
[%|loc(list.name,list.host)%]For further information, please contact %1-request@%2[%END%]
[% ELSE -%]
[%|loc%]The following address is not a known mailing list:[%END%]
......
......@@ -30,7 +30,6 @@ use warnings;
use Sympa;
use Sympa::List;
use Sympa::Log;
use Sympa::Report;
use Sympa::Scenario;
use Sympa::Tools::Data;
use Sympa::Topic;
......@@ -44,9 +43,8 @@ sub _twist {
my $self = shift;
my $message = shift;
my $list = $message->{context};
my $messageid = $message->{message_id};
my $msg_string = $message->as_string;
my $list = $message->{context};
my $messageid = $message->{message_id};
# Now check if the sender is an authorized address.
my $sender = $self->{confirmed_by} || $message->{sender};
......@@ -108,15 +106,16 @@ sub _twist {
$message,
$list
);
Sympa::Report::reject_report_msg(
'intern',
'Message ignored because scenario "send" cannot be evaluated',
$sender,
{'msg_id' => $messageid, 'message' => $message},
$list->{'domain'},
$msg_string,
$list
Sympa::send_notify_to_listmaster(
$list,
'mail_intern_error',
{ error =>
'Message ignored because scenario "send" cannot be evaluated',
who => $sender,
msg_id => $messageid,
}
);
Sympa::send_dsn($list, $message, {}, '5.3.0');
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
......@@ -261,14 +260,12 @@ sub _twist {
$log->syslog('notice',
'Unable to send template "%s" to %s',
$result->{'tt2'}, $sender);
Sympa::Report::reject_report_msg('auth',
$result->{'reason'}, $sender, {'message' => $message},
$list->{'domain'}, $msg_string, $list);
Sympa::send_dsn($list, $message,
{reason => $result->{'reason'}}, '5.7.1');
}
} else {
Sympa::Report::reject_report_msg('auth', $result->{'reason'},
$sender, {'message' => $message},
$list->{'domain'}, $msg_string, $list);
Sympa::send_dsn($list, $message,
{reason => $result->{'reason'}}, '5.7.1');
}
}
$log->db_log(
......@@ -286,15 +283,15 @@ sub _twist {
} else {
$log->syslog('err',
'Unknown action %s returned by the scenario "send"', $action);
Sympa::Report::reject_report_msg(
'intern',
'Unknown action returned by the scenario "send"',
$sender,
{'msg_id' => $messageid, 'message' => $message},
$list->{'domain'},
$msg_string,
$list
Sympa::send_notify_to_listmaster(
$list,
'mail_intern_error',
{ error => 'Unknown action returned by the scenario "send"',
who => $sender,
msg_id => $messageid,
}
);
Sympa::send_dsn($list, $message, {}, '5.3.0');
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
......
......@@ -26,13 +26,11 @@ package Sympa::Spindle::DoForward;
use strict;
use warnings;
use POSIX qw();
use Sympa;
use Conf;
use Sympa::Log;
use Sympa::Mailer;
use Sympa::Report;
use base qw(Sympa::Spindle::ProcessIncoming);
......@@ -59,11 +57,8 @@ sub _twist {
}
my $function = $message->{listtype};
my $msg = $message->as_entity; #FIXME: not required.
my $messageid = $message->{'message_id'};
my $msg_string = $message->as_string; #FIMXE: not required.
my $sender = $message->{'sender'};
chomp $sender;
my $messageid = $message->{message_id};
my $sender = $message->{sender};
if ($message->{'spam_status'} eq 'spam') {
$log->syslog(
......@@ -95,26 +90,8 @@ sub _twist {
$name,
$messageid
);
my $sympa_email = Conf::get_robot_conf($robot, 'sympa');
unless (
Sympa::send_file(
$robot,
'list_unknown',
$sender,
{ 'list' => $name,
'date' => POSIX::strftime(
"%d %b %Y %H:%M",
localtime(time)
),
'boundary' => $sympa_email . time,
'header' => $message->header_as_string,
'auto_submitted' => 'auto-replied'
}
)
) {
$log->syslog('notice',
'Unable to send template "list_unknown" to %s', $sender);
}
Sympa::send_dsn($message->{context} || '*', $message, {},
'5.1.1');
return undef;
}
......@@ -154,21 +131,20 @@ sub _twist {
$log->syslog('err',
'Message for %s function %s ignored, %s undefined in list %s',
$name, $function, $function, $name);
my $string =
sprintf
'Impossible to forward a message to %s function %s : undefined in this list',
$name, $function;
Sympa::Report::reject_report_msg(
'intern', $string, $sender,
{ 'msg_id' => $messageid,
'entry' => 'forward',
'function' => $function,
'message' => $msg
},
$robot,
$msg_string,
$list
Sympa::send_notify_to_listmaster(
$message->{context} || '*',
'mail_intern_error',
{ error => sprintf(
'Impossible to forward a message to %s function %s : undefined in this list',
$name, $function
),
who => $sender,
msg_id => $messageid,
entry => 'forward',
function => $function,
}
);
Sympa::send_dsn($message->{context} || '*', $message, {}, '5.3.0');
$log->db_log(
'robot' => $robot,
'list' => $list->{'name'},
......@@ -207,20 +183,20 @@ sub _twist {
unless (defined Sympa::Mailer->instance->store($message, \@rcpt)) {
$log->syslog('err', 'Impossible to forward mail for %s function %s',
$name, $function);
my $string =
sprintf 'Impossible to forward a message for %s function %s',
$name, $function;
Sympa::Report::reject_report_msg(
'intern', $string, $sender,
{ 'msg_id' => $messageid,
'entry' => 'forward',
'function' => $function,
'message' => $msg
},
$robot,
$msg_string,
$list
Sympa::send_notify_to_listmaster(
$message->{context} || '*',
'mail_intern_error',
{ error => sprintf(
'Impossible to forward a message for %s function %s',
$name, $function
),
who => $sender,
msg_id => $messageid,
entry => 'forward',
function => $function,
}
);
Sympa::send_dsn($message->{context} || '*', $message, {}, '5.3.0');
$log->db_log(
'robot' => $robot,
'list' => $list->{'name'},
......
......@@ -26,13 +26,11 @@ package Sympa::Spindle::DoMessage;
use strict;
use warnings;
use POSIX qw();
use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
use Sympa::Report;
use base qw(Sympa::Spindle::ProcessIncoming); # Deriving _splicing_to().
......@@ -49,24 +47,7 @@ sub _twist {
# List unknown.
unless (ref $message->{context} eq 'Sympa::List') {
$log->syslog('notice', 'Unknown list %s', $message->{localpart});
unless (
Sympa::send_file(
$message->{context},
'list_unknown',
$message->{sender},
{ 'list' => $message->{localpart},
'date' =>
POSIX::strftime("%d %b %Y %H:%M", localtime(time)),
'header' => $message->header_as_string,
'auto_submitted' => 'auto-replied'
}
)
) {
$log->syslog('notice',
'Unable to send template "list_unknown" to %s',
$message->{sender});
}
Sympa::send_dsn($message->{context} || '*', $message, {}, '5.1.1');
return undef;
}
my $list = $message->{context};
......@@ -77,12 +58,11 @@ sub _twist {
$Conf::Conf{'lang'}, 'en'
);
my $messageid = $message->{message_id};
my $msg_string = $message->as_string;
my $sender = $message->{'sender'};
my $messageid = $message->{message_id};
my $sender = $message->{sender};
$log->syslog('info',
"Processing message %s for %s with priority %s, <%s>",
'Processing message %s for %s with priority %s, <%s>',
$message, $list, $list->{'admin'}{'priority'}, $messageid);
if ($self->{_msgid}{$list->get_id}{$messageid}) {
......@@ -113,9 +93,7 @@ sub _twist {
if (defined $cmd) {
$log->syslog('err',
'Found command "%s" in message, ignoring message', $cmd);
Sympa::Report::reject_report_msg('user', 'routing_error', $sender,
{'message' => $message},
$list->{'domain'}, $msg_string, $list);
Sympa::send_dsn($list, $message, {cmd => $cmd}, '5.6.0');
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
......@@ -138,16 +116,7 @@ sub _twist {
$log->syslog('info',
'Message for %s from %s rejected because too large (%d > %d)',
$list, $sender, $message->{size}, $max_size);
Sympa::Report::reject_report_msg(
'user',
'message_too_large',
$sender,
{ 'msg_size' => int($message->{'size'} / 1024),
'max_size' => int($max_size / 1024)
},
$list->{'domain'},
'', $list
);
Sympa::send_dsn($list, $message, {}, '5.2.3');
$log->db_log(
'robot' => $list->{'domain'},
'list' => $list->{'name'},
......
......@@ -37,7 +37,6 @@ use Sympa::List;
use Sympa::Log;
use Sympa::Mailer;
use Sympa::Process;
use Sympa::Report;
use Sympa::Tools::Data;
use base qw(Sympa::Spindle);
......@@ -151,12 +150,10 @@ sub _twist {
return undef;
}
## Unknown robot
# Unknown robot.
unless ($message->{'md5_check'} or Conf::valid_robot($robot)) {
$log->syslog('err', 'Robot %s does not exist', $robot);
Sympa::Report::reject_report_msg('user', 'list_unknown', $sender,
{'listname' => $listname, 'message' => $message},
'*', $message->as_string, '');
Sympa::send_dsn('*', $message, {}, '5.1.2');
$log->db_log(
'robot' => $robot,
'list' => $listname,
......@@ -246,18 +243,7 @@ sub _twist {
'msg_id' => $msg_id,
}
);
# FIXME: send DSN.
Sympa::Report::reject_report_msg(
'user',
'list_unknown',
$sender,
{ 'listname' => $listname,
'message' => $message
},
$robot,
$message->as_string,
''
);
Sympa::send_dsn($robot, $message, {}, '5.3.5');
return undef;
}
......@@ -290,18 +276,7 @@ sub _twist {
'msg_id' => $msg_id,
}
);
# FIXME: send DSN.
Sympa::Report::reject_report_msg(
'user',
'dyn_cant_create',
$sender,
{ 'listname' => $listname,
'message' => $message
},
$robot,
$message->as_string,
''
);
Sympa::send_dsn($robot, $message, {}, '5.3.5');
$log->db_log(
'robot' => $dyn_family->{'robot'},
'list' => $listname,
......@@ -325,16 +300,8 @@ sub _twist {
$list,
$dyn_list_family
);
# FIXME: send DSN.
Sympa::Report::reject_report_msg(
'user',
'dyn_cant_create',
$sender,
{'listname' => $list->{'name'}, 'message' => $message},
$robot,
$message->as_string,
''
);
# As list may be purged, use robot context.
Sympa::send_dsn($robot, $message, {}, '4.2.1');
$log->db_log(
'robot' => $robot,
'list' => $list->{'name'},
......@@ -367,19 +334,8 @@ sub _twist {
$log->syslog('err',
'Dynamic list %s from %s family has ZERO subscribers',
$list, $dyn_list_family);
# FIXME: send DSN.
Sympa::Report::reject_report_msg(
'user',
'list_unknown',
$sender,
{ 'listname' => $list->{'name'},
'list' => {'name' => $list->{'name'}, 'host' => $robot},
'message' => $message
},
$robot,
$message->as_string,
''
);
# As list may be purged, use robot context.
Sympa::send_dsn($robot, $message, {}, '4.2.4');
$log->db_log(
'robot' => $robot,
'list' => $list->{'name'},
......@@ -426,9 +382,9 @@ sub _twist {
$message,
$list
);
Sympa::Report::reject_report_msg('intern', '', $sender,
{'msg_id' => $msg_id, 'message' => $message},
$robot, $message->as_string, $list);
Sympa::send_notify_to_listmaster($list, 'mail_intern_error',
{error => '', who => $sender, msg_id => $msg_id,});
Sympa::send_dsn($list, $message, {}, '5.3.0');
return undef;
}
......
......@@ -36,7 +36,6 @@ use Sympa::List;
use Sympa::Log;
use Sympa::Mailer;
use Sympa::Process;
use Sympa::Report;
use Sympa::Tools::Data;
use base qw(Sympa::Spindle);
......@@ -176,12 +175,10 @@ sub _twist {
return undef;
}
## Unknown robot
# Unknown robot.
unless ($message->{'md5_check'} or Conf::valid_robot($robot)) {
$log->syslog('err', 'Robot %s does not exist', $robot);
Sympa::Report::reject_report_msg('user', 'list_unknown', $sender,
{'listname' => $listname, 'message' => $message},
'*', $message->as_string, '');
Sympa::send_dsn('*', $message, {}, '5.1.2');
$log->db_log(
'robot' => $robot,
'list' => $listname,
......@@ -242,17 +239,8 @@ sub _twist {
} else {
unless (ref $list eq 'Sympa::List') {
$log->syslog('err', 'List %s does not exist', $listname);
Sympa::Report::reject_report_msg(
'user',
'list_unknown',
$sender,
{ 'listname' => $listname,
'message' => $message
},
$robot,
$message->as_string,
''
);
Sympa::send_dsn($message->{context} || '*', $message, {},
'5.1.1');
$log->db_log(
'robot' => $robot,
'list' => $listname,
......
......@@ -31,6 +31,7 @@ use Sympa;
use Conf;
use Sympa::Language;
use Sympa::Log;
use Sympa::Report;
use Sympa::Tools::Data;
use base qw(Sympa::Spindle);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment