diff --git a/createlinks b/createlinks index 3ff579a..c03ff7c 100644 --- a/createlinks +++ b/createlinks @@ -10,3 +10,31 @@ foreach my $event (qw/webapps-update ipasserelle-update bootstrap-ldap-save/){ event_link("ipasserelle-mailman-init-domain", "$event", "55"); } +foreach my $event (qw(mailman-addlist mailman-rmlist)){ + event_link($event, $event, "02"); + templates2events("/var/service/qpsmtpd/config/goodrcptto", $event); + templates2events("/var/qmail/users/assign", $event); + safe_symlink("/var/qmail/bin/qmail-newu", + "root/etc/e-smith/events/$event/S55email-assign"); + safe_symlink("sighup", + "root/etc/e-smith/events/$event/services2adjust/qpsmtpd"); + safe_symlink("sighup", + "root/etc/e-smith/events/$event/services2adjust/sqpsmtpd"); +} + +templates2events( "/usr/lib/mailman/Mailman/mm_cfg.py", "bootstrap-console-save"); + +foreach my $event (qw(mailman-update domain-create domain-delete)){ + templates2events( "/usr/lib/mailman/Mailman/mm_cfg.py", $event); + templates2events( "/etc/httpd/conf/httpd.conf", $event); + safe_symlink("/usr/lib/mailman/bin/post-install", + "root/etc/e-smith/events/$event/S20mailman-post-install"); + safe_symlink("../actions/mailman-restart", + "root/etc/e-smith/events/$event/S94mailman-restart"); +} + +safe_symlink("sigusr1", "root/etc/e-smith/events/mailman-update/services2adjust/httpd-e-smith"); + +service_link_enhanced('mailman', 'S98', '7'); +service_link_enhanced('mailman', 'K12', '6'); +service_link_enhanced('mailman', 'K12', '0'); diff --git a/root/etc/e-smith/db/configuration/defaults/mailman/SitePass b/root/etc/e-smith/db/configuration/defaults/mailman/SitePass new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/db/configuration/defaults/mailman/status b/root/etc/e-smith/db/configuration/defaults/mailman/status new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/mailman/status @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/defaults/mailman/type b/root/etc/e-smith/db/configuration/defaults/mailman/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/mailman/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/events/actions/mailman-addlist b/root/etc/e-smith/events/actions/mailman-addlist new file mode 100755 index 0000000..f8847c8 --- /dev/null +++ b/root/etc/e-smith/events/actions/mailman-addlist @@ -0,0 +1,71 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 2000-2001 e-smith, inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Technical support for this program is available from e-smith, inc. +# For details, please visit our web site at www.e-smith.com or +# call us on 1 888 ESMITH 1 (US/Canada toll free) or +1 613 564 8000 +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use Errno; +use esmith::config; +use esmith::util; +use esmith::db; + +my %conf; +tie %conf, 'esmith::config'; + +my %accounts; +tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; + +my $listName = $ARGV [1]; +my $domain = $ARGV [2]; + +die "Listname argument missing." unless defined ($listName); +$domain = db_get(\%conf, "DomainName") unless defined ($domain); + +my $listStatus = db_get_type(\%accounts, $listName); +die "$listName already exists and is not a mailman mailing list.\n" if ($listStatus && $listStatus ne "mailmanlist"); +db_set(\%accounts, $listName, "mailmanlist", { Domain => "$domain" }); + +my $cookedListName = $listName; +$cookedListName =~ s/\./:/g; +my $alias = "/usr/lib/mailman/aliases/.qmail-$listName"; + +my %queues = ("", "post", + "-admin", "admin", + "-bounces", "bounces", + "-confirm", "confirm", + "-join", "join", + "-leave", "leave", + "-owner", "owner", + "-request", "request", + "-subscribe", "subscribe", + "-unsubscribe", "unsubscribe"); + +umask(002); +while(my ($tail,$que) = each(%queues)) +{ + open(ALIAS, "> $alias$tail") or die "Cannot open $alias. $!\n"; + print ALIAS "| /var/qmail/bin/preline /usr/lib/mailman/mail/mailman $que $listName\n"; + close ALIAS or die "Cannot close $alias. $!\n"; + chown(41,41,"$alias$tail"); +} diff --git a/root/etc/e-smith/events/actions/mailman-restart b/root/etc/e-smith/events/actions/mailman-restart new file mode 100644 index 0000000..165798b --- /dev/null +++ b/root/etc/e-smith/events/actions/mailman-restart @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------------- +# $Id: tug-restart,v 1.23 2003/06/25 14:04:54 msoulier Exp $ +#---------------------------------------------------------------------- +# copyright (C) 1999-2003 Mitel Networks Corporation +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use warnings; +use esmith::ConfigDB; +use esmith::util; + +use constant TRUE => 1; +use constant FALSE => 0; + +my $action; + +my $db = esmith::ConfigDB->open_ro + or die "Failed to open configuration database.\n"; + +my $status = $db->get_prop('mailman', 'status') || 'disabled'; + +if ($status eq 'enabled') +{ + $action = 'start'; + $action = 'restart' if is_running(); +} +else +{ + $action = ''; + $action = 'stop' if is_running(); +} + +if ($action && $action ne '') +{ + esmith::util::serviceControl( + NAME => 'mailman', + ACTION => $action, + BACKGROUND => 'true' + ) or die "Failed to $action mailman\n"; +} + +exit 0; + +sub is_running +{ + chomp( my $output = `/usr/bin/sv s /service/mailman` ); + if ($output =~ /run:\s\/service\/mailman(\/)?:\s\(pid\s\d+\)/) + { + return TRUE; + } + return FALSE; +} diff --git a/root/etc/e-smith/events/actions/mailman-restart~ b/root/etc/e-smith/events/actions/mailman-restart~ new file mode 100644 index 0000000..165798b --- /dev/null +++ b/root/etc/e-smith/events/actions/mailman-restart~ @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------------- +# $Id: tug-restart,v 1.23 2003/06/25 14:04:54 msoulier Exp $ +#---------------------------------------------------------------------- +# copyright (C) 1999-2003 Mitel Networks Corporation +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use warnings; +use esmith::ConfigDB; +use esmith::util; + +use constant TRUE => 1; +use constant FALSE => 0; + +my $action; + +my $db = esmith::ConfigDB->open_ro + or die "Failed to open configuration database.\n"; + +my $status = $db->get_prop('mailman', 'status') || 'disabled'; + +if ($status eq 'enabled') +{ + $action = 'start'; + $action = 'restart' if is_running(); +} +else +{ + $action = ''; + $action = 'stop' if is_running(); +} + +if ($action && $action ne '') +{ + esmith::util::serviceControl( + NAME => 'mailman', + ACTION => $action, + BACKGROUND => 'true' + ) or die "Failed to $action mailman\n"; +} + +exit 0; + +sub is_running +{ + chomp( my $output = `/usr/bin/sv s /service/mailman` ); + if ($output =~ /run:\s\/service\/mailman(\/)?:\s\(pid\s\d+\)/) + { + return TRUE; + } + return FALSE; +} diff --git a/root/etc/e-smith/events/actions/mailman-rmlist b/root/etc/e-smith/events/actions/mailman-rmlist new file mode 100755 index 0000000..53869a4 --- /dev/null +++ b/root/etc/e-smith/events/actions/mailman-rmlist @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 2000-2001 e-smith, inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Technical support for this program is available from e-smith, inc. +# For details, please visit our web site at www.e-smith.com or +# call us on 1 888 ESMITH 1 (US/Canada toll free) or +1 613 564 8000 +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use Errno; +use esmith::config; +use esmith::util; +use esmith::db; + +my %conf; +tie %conf, 'esmith::config'; + +my %accounts; +tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; + +my $listName = $ARGV [1]; + +die "Listname argument missing." unless defined ($listName); + +my $listStatus = db_get_type(\%accounts, $listName); +db_delete(\%accounts, $listName) if ($listStatus && $listStatus eq "mailmanlist"); + +my $alias = "/usr/lib/mailman/aliases/.qmail-$listName"; + +my %queues = ("", "post", + "-admin", "admin", + "-bounces", "bounces", + "-confirm", "confirm", + "-join", "join", + "-leave", "leave", + "-owner", "owner", + "-request", "request", + "-subscribe", "subscribe", + "-unsubscribe", "unsubscribe"); + +while(my ($tail,$que) = each(%queues)) +{ + unlink("$alias$tail"); +} diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/10defaults b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/10defaults new file mode 100644 index 0000000..8506bcf --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/10defaults @@ -0,0 +1,46 @@ +# -*- python -*- + +# Copyright (C) 1998 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +"""This is the module which takes your site-specific settings. + +From a raw distribution it should be copied to mm_cfg.py. If you +already have an mm_cfg.py, be careful to add in only the new settings +you want. The complete set of distributed defaults, with annotation, +are in ./Defaults. In mm_cfg, override only those you want to +change, after the + + from Defaults import * + +line (see below). + +Note that these are just default settings - many can be overridden via the +admin and user interfaces on a per-list or per-user basis. + +Note also that some of the settings are resolved against the active list +setting by using the value as a format string against the +list-instance-object's dictionary - see the distributed value of +DEFAULT_MSG_FOOTER for an example.""" + + +####################################################### +# Here's where we get the distributed defaults. # + +from Defaults import * +import pwd, grp + diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/20override b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/20override new file mode 100644 index 0000000..e1be83e --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/20override @@ -0,0 +1,22 @@ +############################################################## +# Here's where we override shipped defaults with settings # +# suitable for the RPM package. # +ADMINDB_PAGE_TEXT_LIMIT = 8192 +DEFAULT_ADMIN_MEMBER_CHUNKSIZE = 50 +DEFAULT_BOUNCE_MATCHING_HEADERS = """ +""" +DEFAULT_DIGEST_SIZE_THRESHHOLD = 250 +DEFAULT_MAX_MESSAGE_SIZE = 100 +DEFAULT_MAX_NUM_RECIPIENTS = 25 +DEFAULT_MSG_FOOTER = """_______________________________________________ +%(description)s +%(list_name)s@%(host_name)s +%(web_page_url)slistinfo%(cgiext)s/%(list_name)s +""" +LOG_DIR = '/var/log/mailman' +MAILMAN_UID = pwd.getpwnam('mailman')[2] +MAILMAN_GID = grp.getgrnam('mailman')[2] +PUBLIC_ARCHIVE_URL = 'http://%(hostname)s/mailman/public/%(listname)s' +QUEUE_DIR = '/var/spool/mailman/qfiles' +USE_ENVELOPE_SENDER = 1 + diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/30hostname b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/30hostname new file mode 100644 index 0000000..ca62928 --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/30hostname @@ -0,0 +1,7 @@ +############################################################## +# Put YOUR site-specific configuration below, in mm_cfg.py . # +# See Defaults.py for explanations of the values. # + +DEFAULT_EMAIL_HOST = '{ $DomainName }' +DEFAULT_URL_HOST = '{ $DomainName }' + diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/40archiver b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/40archiver new file mode 100644 index 0000000..0d5de86 --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/40archiver @@ -0,0 +1,17 @@ +{ + $OUT = ""; + if( -x "/usr/lib/mailman/mhonarc/filter") + { + $OUT .= "PUBLIC_EXTERNAL_ARCHIVER = '/usr/lib/mailman/mhonarc/filter %(listname)s'\n"; + $OUT .= "PRIVATE_EXTERNAL_ARCHIVER = '/usr/lib/mailman/mhonarc/filter %(listname)s'\n"; + $OUT .= "PUBLIC_EXTERNAL_ARCHIVER = '/usr/lib/mailman/mhonarc/filter %(listname)s'\n"; + $OUT .= "PRIVATE_EXTERNAL_ARCHIVER = '/usr/lib/mailman/mhonarc/filter %(listname)s'\n"; + } + else + { + $OUT .= "PUBLIC_EXTERNAL_ARCHIVER = 0\n"; + $OUT .= "PRIVATE_EXTERNAL_ARCHIVER = 0\n"; + $OUT .= "PUBLIC_EXTERNAL_ARCHIVER = 0\n"; + $OUT .= "PRIVATE_EXTERNAL_ARCHIVER = 0\n"; + } +} diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/50MTA b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/50MTA new file mode 100644 index 0000000..7d03939 --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/50MTA @@ -0,0 +1,6 @@ +############################################################## +# Set MTA to special SME.py module for creation/deletion # +# of lists. # + +MTA = 'SME' + diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/60virtual b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/60virtual new file mode 100644 index 0000000..4229482 --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/60virtual @@ -0,0 +1,16 @@ +{ + # vim: ft=perl: + use esmith::DomainsDB; + + my $domains = esmith::DomainsDB->open_ro; + $OUT = ''; + + foreach my $domainrec ($domains->domains) + { + next if $domainrec->prop('SystemServiceDomain'); + $OUT .= "add_virtualhost('$domainrec->{key}', '$domainrec->{key}')\n"; + } + # Also add the FQDN of the box itself, in case the list is being addressed + # in that fashion. + $OUT .= "add_virtualhost('$SystemName.$DomainName', '$SystemName.$DomainName')\n"; +} diff --git a/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/90cleanup b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/90cleanup new file mode 100644 index 0000000..cbdc063 --- /dev/null +++ b/root/etc/e-smith/templates/usr/lib/mailman/Mailman/mm_cfg.py/90cleanup @@ -0,0 +1,21 @@ +############################################################## +# The following are set to clean up variables that were set # +# above. Do not change or remove these unless you know what # +# you are doing. # + +DEFAULT_DIGEST_FOOTER = DEFAULT_MSG_FOOTER +DEFAULT_HOST_NAME = DEFAULT_EMAIL_HOST +DEFAULT_URL = DEFAULT_URL_PATTERN % DEFAULT_URL_HOST +INQUEUE_DIR = os.path.join(QUEUE_DIR, 'in') +OUTQUEUE_DIR = os.path.join(QUEUE_DIR, 'out') +CMDQUEUE_DIR = os.path.join(QUEUE_DIR, 'commands') +BOUNCEQUEUE_DIR = os.path.join(QUEUE_DIR, 'bounces') +NEWSQUEUE_DIR = os.path.join(QUEUE_DIR, 'news') +ARCHQUEUE_DIR = os.path.join(QUEUE_DIR, 'archive') +SHUNTQUEUE_DIR = os.path.join(QUEUE_DIR, 'shunt') +VIRGINQUEUE_DIR = os.path.join(QUEUE_DIR, 'virgin') +BADQUEUE_DIR = os.path.join(QUEUE_DIR, 'bad') +MAILDIR_DIR = os.path.join(QUEUE_DIR, 'maildir') + +# Note - if you're looking for something that is imported from mm_cfg, but you +# didn't find it above, it's probably in Defaults.py. diff --git a/root/etc/e-smith/templates/var/qmail/users/assign/90mailmanlists b/root/etc/e-smith/templates/var/qmail/users/assign/90mailmanlists new file mode 100644 index 0000000..e49153e --- /dev/null +++ b/root/etc/e-smith/templates/var/qmail/users/assign/90mailmanlists @@ -0,0 +1,56 @@ +{ + use esmith::config; + use esmith::db; + + $OUT = ''; + + # Generate mailman user assignments for mailing lists. These will be handled + # by ~mailman/aliases/.qmail-listname and ~mailman/aliases/.qmail-listname-ext. + + my %accounts; + tie %accounts, 'esmith::config', "/home/e-smith/db/accounts"; + + my (undef, undef, $uid, $gid, undef, undef, undef, $dir, undef) + = getpwnam("mailman"); + + # It is almost impossible to get Text::Template to output nothing + # on failure. It can be done by removing the newline at the end of + # this file but that is messy. Therefore, we'll simply return an + # error message that will make qmail-newu fail. Also send a + # warning message that will be captured in the logs. + + unless (defined $uid && defined $gid && defined $dir) + { + my $msg = + "Failed to obtain user details for \'mailman\' " + . "while processing group assignments."; + + warn "$msg\n"; + $OUT = $msg; + return; + } + + my $mailman_assign = "mailman:${uid}:${gid}:${dir}/aliases"; + + foreach my $listname (db_get(\%accounts)) + { + next unless db_get_type(\%accounts, $listname) eq "mailmanlist"; + + # Assign mail for listname@ + $OUT .= "=${listname}:${mailman_assign}:-:${listname}:\n"; + + # Assign mail for listname-ext@ + $OUT .= "+${listname}-:${mailman_assign}:-${listname}-::\n"; + } + + # Need to remove the final newline character. Blank lines in + # /var/qmail/users/assign are prohibited. + + chomp($OUT); + + # Failsafe: /var/qmail/users/assign cannot have blank lines. + # Therefore, if $OUT is empty, simply set up an assign for the + # ezmlm user. + + $OUT = "=mailman:${mailman_assign}:::" unless $OUT; +} diff --git a/root/etc/e-smith/templates/var/service/qpsmtpd/config/goodrcptto/80mailman b/root/etc/e-smith/templates/var/service/qpsmtpd/config/goodrcptto/80mailman new file mode 100644 index 0000000..fecb07a --- /dev/null +++ b/root/etc/e-smith/templates/var/service/qpsmtpd/config/goodrcptto/80mailman @@ -0,0 +1,3 @@ +{ + $OUT .= "mailman\@$_\n" for (@domains); +} diff --git a/root/sbin/e-smith/alias2mailman b/root/sbin/e-smith/alias2mailman new file mode 100644 index 0000000..5f28a24 --- /dev/null +++ b/root/sbin/e-smith/alias2mailman @@ -0,0 +1,68 @@ +#!/bin/sh +#---------------------------------------------------------------------- +# Copyright (C) 2006 Gordon Rowell +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License or more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#---------------------------------------------------------------------- + +# Quick conversion of ~alias file to mailman + +LIST=$1 +OWNER=$2 + +TYPE=$(db accounts gettype $LIST) + +if [ -n "$TYPE" ] +then + echo "$LIST is an existing account of type $TYPE" + exit 1 +fi + +ALIAS_FILE=/var/qmail/alias/.qmail-$LIST + +if [ ! -f $ALIAS_FILE ] +then + echo "$ALIAS_FILE doesn't exist" + exit 2 +fi + +OWNER=$(config getprop mailman DefaultOwner) +OWNER=${OWNER:-"admin@$DOMAIN"} + +/usr/lib/mailman/bin/newlist -q $LIST $OWNER dummypass > /dev/null 2>&1 || : + +cat > /tmp/hide << EOF +advertised = 1 +archive_private = 1 +send_reminders = 0 +send_welcome_msg = 0 +send_goodbye_msg = 0 +description = 'Mailing list $LIST' +EOF + +/usr/lib/mailman/bin/config_list -i /tmp/hide $LIST > /dev/null 2>&1 || : +rm -f /tmp/hide + +/usr/lib/mailman/bin/change_pw -l $LIST 2> /dev/null || + echo "New mailman password: *UNCHANGED*"; : + +grep -v '^#' $ALIAS_FILE | + sed -e 's/&//' | + /usr/lib/mailman/bin/add_members -r - -a n $LIST + +expand-template /var/qmail/users/assign +/var/qmail/bin/qmail-newu + +mv $ALIAS_FILE $ALIAS_FILE.mailman diff --git a/root/usr/lib/mailman/Mailman/MTA/SME.py b/root/usr/lib/mailman/Mailman/MTA/SME.py new file mode 100644 index 0000000..4031f6f --- /dev/null +++ b/root/usr/lib/mailman/Mailman/MTA/SME.py @@ -0,0 +1,55 @@ +# Copyright (C) 2001,2002 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +"""Creation/deletion hooks for the SME and Q-Mail +""" + +import os +import time +import errno +import pwd +from stat import * + +from Mailman import mm_cfg +from Mailman import Utils +from Mailman import LockFile +from Mailman.i18n import _ +from Mailman.MTA.Utils import makealiases +from Mailman.Logging.Syslog import syslog + + + +def create(mlist, cgi=0, nolock=0): + listname = mlist.internal_name() + msg = 'command failed: %s (status: %s, %s)' + acmd = '/usr/lib/mailman/bin/smelist addlist ' + listname + status = (os.system(acmd) >> 8) & 0xff + if status: + errstr = os.strerror(status) + syslog('error', msg, acmd, status, errstr) + raise RuntimeError, msg % (acmd, status, errstr) + + + +def remove(mlist, cgi=0): + listname = mlist.internal_name() + msg = 'command failed: %s (status: %s, %s)' + acmd = '/usr/lib/mailman/bin/smelist rmlist ' + listname + status = (os.system(acmd) >> 8) & 0xff + if status: + errstr = os.strerror(status) + syslog('error', msg, acmd, status, errstr) + raise RuntimeError, msg % (acmd, status, errstr) diff --git a/root/usr/lib/mailman/bin/post-install b/root/usr/lib/mailman/bin/post-install new file mode 100644 index 0000000..62e72b7 --- /dev/null +++ b/root/usr/lib/mailman/bin/post-install @@ -0,0 +1,33 @@ +#!/bin/bash + +[ -d /var/lib/mailman/lists/mailman ] && exit 0 + +echo " " +DOMAIN=`/sbin/e-smith/config get DomainName` +if [ ! -d /var/lib/mailman/lists/mailman ]; then + MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + LENGTH="8" + while [ "${n:=1}" -le "$LENGTH" ]; do + PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}" + let n+=1 + done + echo "* New site password: $PASS" + /sbin/e-smith/config setprop mailman SitePass $PASS + + /usr/lib/mailman/bin/mmsitepass "$PASS" > /dev/null 2>&1 || : + /usr/lib/mailman/bin/newlist -q mailman admin@${DOMAIN} dummypass > /dev/null 2>&1 || : + cat > /tmp/hide << EOF +advertised = 0 +archive_private = 1 +description = 'Mailman Mailing List' +EOF + /usr/lib/mailman/bin/config_list -i /tmp/hide mailman > /dev/null 2>&1 || : + rm -f /tmp/hide + echo -n "* " + /usr/lib/mailman/bin/change_pw -l mailman 2> /dev/null || echo "New mailman password: *UNCHANGED*"; : + "/usr/lib/mailman/bin/add_members -r - -a n mailman << EOF + admin@${DOMAIN} +EOF" > /dev/null 2>&1 || : +else + /etc/e-smith/events/actions/email-assign || : +fi diff --git a/root/usr/lib/mailman/bin/smelist b/root/usr/lib/mailman/bin/smelist new file mode 100644 index 0000000..ef94fb7 --- /dev/null +++ b/root/usr/lib/mailman/bin/smelist @@ -0,0 +1,31 @@ +#!/usr/bin/perl -wT + +package esmith; +use strict; +use esmith::util; + +my $usage = "$0 is not meant to be called from the command line. +"; + +my ($event, $list) = @ARGV; +die $usage unless $event; +die $usage unless $list; + +BEGIN +{ + $ENV {'PATH'} = ''; + $ENV {'SHELL'} = '/bin/bash'; + delete $ENV {'ENV'}; +} + +die "Unknown event $event" + unless ($event =~ /^(addlist|rmlist|update)$/); +$event = $1; + +die "Invalid list name $list" + unless ($list =~ /^([\w\-\._]+)$/); +$list = $1; + +esmith::util::setRealToEffective (); +system ("/sbin/e-smith/signal-event", "mailman-$event", "$list") == 0 + or die ("Error occurred while modifying mailman list $list.\n");