adding mmlistarc

This commit is contained in:
tengel 2024-03-20 11:28:46 -05:00
parent bdeb33a377
commit 357a84a32c

32
shell/mmlistarc.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# change all your mailman archive settings to private; useful if you have
# dozens of privates lists and didn’t realize that even though the list was
# locked down, the archives were left open to the world. The script is based
# on an older mailing list post by Daniel Clark:
# http://mail.python.org/pipermail/mailman-users/2007-February/055670.html
#
# SPDX-License-Identifier: MIT
DDB=/usr/lib/mailman/bin/dumpdb
MCL=/usr/lib/mailman/bin/config_list
DBH=/var/lib/mailman/lists
echo "mlist.archive_private = 1" > /tmp/mmlistarc.dat
for direc in "${DBH}"/* ; do
if [ -f "$direc/config.pck" ]; then
listname=${direc##*/}
echo "$listname before, after"
$DDB "$direc/config.pck" | grep -i archive_private
if [ ! -f "$direc/config.pck.backup" ]; then
cp -a "$direc/config.pck" "$direc/config.pck.backup"
fi
$MCL -i /tmp/mmlistarc.dat "$listname"
$DDB "$direc/config.pck" | grep -i archive_private
fi
done
rm -f /tmp/mmlistarc.dat
exit 0