Skip to Content.
Sympa Menu

en - Re: [sympa-users] Custom email sent on create list request

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Michael Howe <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-users] Custom email sent on create list request
  • Date: Thu, 01 Oct 2015 12:19:32 +0100

Hi Steve,

On 30/09/15 17:44, Steve Rich wrote:
> Hi all,
>
> We are currently running Sympa 6.2.3 and allow external users to use our
> service. However, we restrict list creation requests to users within
> our domains using the following scenario:
>
> title.gettext Only Duke users can request list creation
>
> is_listmaster([sender]) md5,smime -> do_it
> match([sender], /.*\@([\w])*\.?duke\.edu$/) md5,smime -> listmaster,notify
> match([sender], /\@gms\.edu\.sg$/) md5,smime -> listmaster,notify
> match([sender], /\@dku\.edu\.cn$/) md5,smime -> listmaster,notify
> true() md5,smime -> reject
>
> We require the lists to be approved by our service desk so that
> additional actions can be performed at list creation (reserving the
> address in identity management systems to prevent mail alias conflicts
> in various systems, vetting the list name, etc.)
>
> Currently, we have our ticketing system’s email address listed as a
> listmaster to cheaply get list creation requests to open a ticket so
> that the bean counter gods are appeased. This has the undesired effect
> of opening a ticket every time a notice is sent to the listmasters
> (sync_include failures, 100% subscriber bounce scenarios, web_internal
> failures, etc).
>
> I am seeking a way to have the list creation/change request generate a
> notice to a specific address outside of the listmasters. Currently, I
> am toying with the idea of a custom condition that:
>
> * Evaluates the regex of the requestor just like the above scenario.
> o If allowed
> + Sends a notice using perl smtp to the ticketing system.
> + Returns true to the scenario
> o Else
> + Don’t send to the ticketing system
> + Return false to the scenario
>
> Does this approach seem logical or is there a better way to do it?

This sounds very familiar. I patched our version of sympa (Debian's
6.1.17) to add `list_request_notifications_to` and
`error_notifications_to` config options. This allows list creation and
renaming requests to be sent to our helpdesk and error messages to go to
my team's tracking system. It also drops mails that would be sent to
listmaster if there are no owners or they all have nomail set, because
we decided that we didn't care about such messages.

I attach the patch; I'm happy to submit it as a feature request if it
seems like a useful feature. (Alternatively, if someone comes up with a
cleaner solution, I'll happily adopt that on my system!) On re-reading,
it's got some logic that may need to be tweaked for wider consumption.
(I also have no idea how it will apply to 6.2; we haven't looked at 6.2
yet.)

Best wishes,

Michael

--
Michael Howe, Infrastructure and Hosting Team
Systems Development and Support
IT Services, University of Oxford
Description: Send listmaster notifications to other addresses
Add list_request_notifications_to and error_notifications_to options. If the
former is set, any list request emails are sent to it, rather than
listmasters.
If the latter is set, any listmaster emails should be sent to it rather than
listmasters.
Author: Michael Howe <address@concealed>
Forwarded: no
Last-Update: 2014-09-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- sympa.orig/src/lib/List.pm
+++ sympa/src/lib/List.pm
@@ -3993,7 +3993,23 @@
}
}
my $host = &Conf::get_robot_conf($robot, 'host');
- my $listmaster = &Conf::get_robot_conf($robot, 'listmaster');
+
+ # Notify listmasters unless overridden
+ my $listmaster;
+ my %request_map = (
+ 'request_list_creation' => 1,
+ 'request_list_renaming' => 1,
+ );
+ if( $request_map{$operation} ){
+ $listmaster = Conf::get_robot_conf($robot,
'list_request_notifications_to');
+ }
+ unless( $listmaster ){
+ $listmaster = &Conf::get_robot_conf($robot,
'error_notifications_to');
+ }
+ unless ($listmaster) {
+ $listmaster = &Conf::get_robot_conf($robot, 'listmaster');
+ }
+
my $to = "$Conf::Conf{'listmaster_email'}\@$host";
my $options = {}; ## options for send_global_file()

@@ -4114,8 +4130,8 @@
my $robot = $self->{'domain'};

unless (@to) {
- do_log('notice', 'No owner defined or all of them use nomail option
in list %s ; using listmasters as default', $self->{'name'} );
- @to = split /,/, &Conf::get_robot_conf($robot, 'listmaster');
+ do_log('err', 'No owner defined or all of them use nomail option in
list %s - dropping message for operation %s', $self->{'name'}, $operation );
+ return undef;
}
unless (defined $operation) {
&do_log('err','List::send_notify_to_owner(%s) : missing incoming
parameter "$operation"', $self->{'name'});
--- sympa.orig/src/lib/confdef.pm
+++ sympa/src/lib/confdef.pm
@@ -281,6 +281,24 @@
advice => 'Sympa will associate listmaster privileges to these
email addresses (mail and web interfaces). Some error reports may also be
sent to these addresses.',
},
{
+ name => 'error_notifications_to',
+ default => '',
+ query => 'Addresses for error notifications',
+ file => 'sympa.conf',
+ vhost => '1',
+ edit => '1',
+ advice => 'Email addresses to receive error reports (defaults to
the listmaster value(s) if not set).',
+ },
+ {
+ name => 'list_request_notifications_to',
+ default => '',
+ query => 'Addresses for list request notifications',
+ file => 'sympa.conf',
+ vhost => '1',
+ edit => '1',
+ advice => 'Email addresses to receive list creation requests
(defaults to the error_notifications_to value(s) if not set).',
+ },
+ {
name => 'email',
default => 'sympa',
query => 'Local part of sympa email adresse',
--- sympa.orig/src/sympa.pl.in
+++ sympa/src/sympa.pl.in
@@ -1682,7 +1682,14 @@
$hdr->delete('X-Sympa-Family');

if ($function eq "listmaster") {
- my $listmasters = &Conf::get_robot_conf($robot, 'listmasters');
+ my $listmasters;
+ if( &Conf::get_robot_conf($robot, 'list_request_notifications_to') ){
+ $listmasters = &Conf::get_robot_conf($robot,
'list_request_notifications_to_array');
+ } elsif( &Conf::get_robot_conf($robot, 'error_notifications_to') ){
+ $listmasters = &Conf::get_robot_conf($robot,
'error_notifications_to_array');
+ } else {
+ $listmasters = &Conf::get_robot_conf($robot, 'listmasters');
+ }
@rcpt = @{$listmasters};
&do_log('notice', 'Warning : no listmaster defined in sympa.conf')
unless (@rcpt);
--- sympa.orig/src/lib/Conf.pm
+++ sympa/src/lib/Conf.pm
@@ -374,6 +374,15 @@
$Conf{'listmaster'} =~ s/\s//g ;
@{$Conf{'listmasters'}} = split(/,/, $Conf{'listmaster'});

+ # Used by sympa.pl:
+ if( $Conf{'list_request_notifications_to'} ){
+ $Conf{'list_request_notifications_to'} =~ s/\s//g;
+ @{$Conf{'list_request_notifications_to_array'}} = split(/,/,
$Conf{'list_request_notifications_to'});
+ }
+ if( $Conf{'error_notifications_to'} ){
+ $Conf{'error_notifications_to'} =~ s/\s//g;
+ @{$Conf{'error_notifications_to_array'}} = split(/,/,
$Conf{'error_notifications_to'});
+ }

## Set Regexp for accepted list suffixes
if (defined ($Conf{'list_check_suffixes'})) {
@@ -575,6 +584,16 @@
@{$robot_conf->{$robot}{'listmasters'}} = split(/,/,
$robot_conf->{$robot}{'listmaster'})
if $robot_conf->{$robot}{'listmaster'};

+ # Used by sympa.pl:
+ if( $robot_conf->{$robot}->{'list_request_notifications_to'} ){
+ $robot_conf->{$robot}->{'list_request_notifications_to'} =~
s/\s//g;
+
@{$robot_conf->{$robot}->{'list_request_notifications_to_array'}} =
split(/,/, $robot_conf->{$robot}->{'list_request_notifications_to'});
+ }
+ if( $robot_conf->{$robot}->{'error_notifications_to'} ){
+ $robot_conf->{$robot}->{'error_notifications_to'} =~ s/\s//g;
+ @{$robot_conf->{$robot}->{'error_notifications_to_array'}} =
split(/,/, $robot_conf->{$robot}->{'error_notifications_to'});
+ }
+
## Default for 'host' is the domain
$robot_conf->{$robot}{'host'} ||= $robot;




Archive powered by MHonArc 2.6.19+.

Top of Page