scripts/shell/mmlistarc.sh
2024-03-20 11:28:46 -05:00

32 lines
1,001 B
Bash
Executable file

#!/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