[sysadmin-bin] add banning script
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] add banning script
- Date: Sat, 13 Apr 2013 14:09:49 +0000 (UTC)
commit e5dc1209561558a0d2428715f9338762520c201d
Author: Olav Vitters <olav vitters nl>
Date: Sat Apr 13 16:09:47 2013 +0200
add banning script
mail/ban_mailman | 34 ++++++++++++++++++++++++++++++++++
mail/helper_ban_mailman | 12 ++++++++++++
2 files changed, 46 insertions(+)
---
diff --git a/mail/ban_mailman b/mail/ban_mailman
new file mode 100755
index 0000000..d12a950
--- /dev/null
+++ b/mail/ban_mailman
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+#####################################################################
+# This script is licensed with the GNU General Public License
+# version 3. For more information visit:
+#
+# http://www.gnu.org/licenses/gpl.html
+#
+# Attribution is NOT required, but a mention of HealthWyze.org
+# would be greatly appreciated. Produced by Thomas Corriher.
+#####################################################################
+
+
+####### Change MAILMAN_BIN to match local setup
+
+MAILMAN_BIN='/usr/lib/mailman/bin'
+
+let ID=$(id -un)
+
+if [ "$ID" != "mailman" ]
+ then echo "Run this script only as mailman. Aborting."; exit 1
+ else true
+fi
+
+####### Remove '--nouserack' to send notifications to users
+####### that they have been terminated. The normal Mailman
+####### unsubscribe message text is used.
+
+function KILL_BAN {
+ $MAILMAN_BIN/remove_members --fromall --nouserack "$1"
+ $MAILMAN_BIN/withlist -a -r helper_ban_mailman -- "$1"
+}
+
+for i in "$@"; do KILL_BAN "$i"; done
diff --git a/mail/helper_ban_mailman b/mail/helper_ban_mailman
new file mode 100755
index 0000000..72fead3
--- /dev/null
+++ b/mail/helper_ban_mailman
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import sys
+sys.path.append('$MAILMAN_BIN')
+
+def add_banned(mlist, address):
+ if not mlist.Locked():
+ mlist.Lock()
+ if address not in mlist.ban_list:
+ mlist.ban_list.append(address)
+ mlist.Save()
+ mlist.Unlock()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]