From cbf774b383252ab3635e127cee2841168442234a Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 21 Feb 2017 01:18:32 +0100 Subject: [PATCH] Initial import --- install_mailman.sh | 2305 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2305 insertions(+) create mode 100755 install_mailman.sh diff --git a/install_mailman.sh b/install_mailman.sh new file mode 100755 index 0000000..fd9831f --- /dev/null +++ b/install_mailman.sh @@ -0,0 +1,2305 @@ +#!/usr/bin/env bash + +## - Default values - not necessarily needed +## - +_MAILMAN_VERSION=2.1.16 + +_MAILMAN_USER=mailman +_MAILMAN_ADMIN_EMAIL="admin@initiativenserver.de" + +_MAILMAN_SRC_BASE_DIR=/usr/local/src/mailsystem + +_WEBSERVER_USER=www-data +_WEBSERVER_ADMIN_EMAIL="admin@initiativenserver.de" + +_REQUIRED_DEB_PACKAGES="python2.7 python2.7-dev" + +## - Domains, die von Malman verwaltet werden sollen +## - +## - fqn-domain1|ipv4-domain1|ipv6-domain1|vhost-dir [fqn-domain2|ipv4-domain2|ipv6domain2|vhost-dir] .. +## - +_DOMAINS="lists.aktionsbuendnis-brandenburg.de|83.223.85.102|2a01:30:1fff:3::102|/usr/local/apache2/conf/vhosts/1 + lists.initiativenserver.de|83.223.85.103|2a01:30:1fff:3::103|/usr/local/apache2/conf/vhosts/2" + +## - +## - Ende: Default values + + +## --- Some functions +## --- +echononl(){ + echo X\\c > /tmp/shprompt$$ + if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then + echo -e -n "$*\\c" 1>&2 + else + echo -e -n "$*" 1>&2 + fi + rm /tmp/shprompt$$ +} + +fatal(){ + echo "" + echo -e "Fehler: $*" + echo "" + echo -e "\t\033[31m\033[1mInstalllation wird abgebrochen\033[m\033[m" + echo "" + exit 1 +} + +echo_ok() { + echo -e "\033[75G[ \033[1;32mok\033[m ]" + ## echo -e " [ ok ]" +} +echo_failed(){ + echo -e "\033[75G[ \033[1;31mfailed\033[m ]" + ## echo -e " [ failed ]" +} +echo_skipped() { + echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]" +} +## --- +## --- END: functions + +_curdir=`pwd` + + +clear +echo -e "\033[21G\033[32mInstallationsscript für den Listenmanager \"Mailman\" \033[m" +echo + +## - root user? +## - +if [ "$(id -u)" != "0" ]; then + fatal Skript muss als \"root\" ausgeführt werden +fi + +DISTRIBUTION= +echo "" +echo -e "\033[32m-- Linux Distribution\033[m" +echo "" +echo "Um welche Linux Distribution handelt es sich?" +echo "" +echo "[1] Debian" +echo "[2] andere" +echo "" +echononl "Eingabe: " + +while [ "$DISTRIBUTION" != "Debian" -a "$DISTRIBUTION" != "other" ];do + read OPTION + case $OPTION in + 1) DISTRIBUTION="Debian" + ;; + 2) DISTRIBUTION="other" + ;; + *) echo "" + echo -e "\tFalsche Eingabe ! [ 1 = Debian ; 2 = andere ]" + echo "" + echononl "Eingabe:" + ;; + esac +done + +clear +echo "" +echo -e "\033[21G\033[32mMailman\033[m" +echo "" +echo "Gib die Versionsnummer der Mailman-Distribution an." +echo "" +MAILMAN_VERSION= +while [ "X$MAILMAN_VERSION" = "X" ] +do + echononl "Mailman Version [$_MAILMAN_VERSION]: " + read MAILMAN_VERSION + if [ "X$MAILMAN_VERSION" = "X" ]; then + MAILMAN_VERSION=$_MAILMAN_VERSION + fi + + _MAILMAN_INSTALL_DIR=/usr/local/mailman-$MAILMAN_VERSION + _MAILMAN_DATA_DIR=/data/MAILMAN-$MAILMAN_VERSION + distfile=mailman-${MAILMAN_VERSION}.tar.gz +done + + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Gib den Namen des Verzeichnisses in das MAILMAN installiert werden soll an." +echo "" +MAILMAN_INSTALL_DIR= +while [ "X$MAILMAN_INSTALL_DIR" = "X" ] +do + echononl "Mailman Installationsverzeichnis [${_MAILMAN_INSTALL_DIR}]: " + read MAILMAN_INSTALL_DIR + if [ "X$MAILMAN_INSTALL_DIR" = "X" ]; then + MAILMAN_INSTALL_DIR=$_MAILMAN_INSTALL_DIR + LINK=yes + fi + +done + + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Gib User Namen und User Gruppe für Mailman ein.." +echo "" +MAILMAN_USER= +while [ "X$MAILMAN_USER" = "X" ] +do + echononl "MAILMAN-User [${_MAILMAN_USER}]: " + read MAILMAN_USER + if [ "X$MAILMAN_USER" = "X" ]; then + MAILMAN_USER=$_MAILMAN_USER + fi +done +MAILMAN_GROUP= +while [ "X$MAILMAN_GROUP" = "X" ] +do + echononl "MAILMAN-Gruppe [$MAILMAN_USER]: " + read MAILMAN_GROUP + if [ "X$MAILMAN_GROUP" = "X" ]; then + MAILMAN_GROUP=$MAILMAN_USER + fi +done + +echo +echo "" +echo "Gib eine Admin E-Mailadresse für Mailman ein.." +echo "" +MAILMAN_ADMIN_EMAIL= +while [ "X$MAILMAN_ADMIN_EMAIL" = "X" ] +do + echononl "Mailman Admin E-Mail [$_MAILMAN_ADMIN_EMAIL]: " + read MAILMAN_ADMIN_EMAIL + if [ "X$MAILMAN_ADMIN_EMAIL" = "X" ]; then + MAILMAN_ADMIN_EMAIL=$_MAILMAN_ADMIN_EMAIL + fi +done + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Passworte .." +_MAILMAN_MASTER_PASS_1="X" +_MAILMAN_MASTER_PASS_2="Y" +echo "" +while [ "$_MAILMAN_MASTER_PASS_1" != "$_MAILMAN_MASTER_PASS_2" ] +do + echononl "Master Passwort Mailman: " + read -s _MAILMAN_MASTER_PASS_1 + echo + if [ "X$_MAILMAN_MASTER_PASS_1" = "X" ]; then + echo -e "\n\t\033[33m\033[1mPassworteingabe erforderlich!\033[m\n" + continue + fi + echononl "Passwortwiederholung: " + read -s _MAILMAN_MASTER_PASS_2 + echo + if [ "X$_MAILMAN_MASTER_PASS_2" = "X" ]; then + echo -e "\n\t\033[33m\033[1mPasswortwiederholung erforderlich!\033[m\n" + continue + fi + if [ "$_MAILMAN_MASTER_PASS_1" != "$_MAILMAN_MASTER_PASS_2" ];then + echo -e "\n\t\033[33m\033[1mPassworteingaben sind nicht identisch!\033[m\n" + else + MAILMAN_MASTER_PASS=$_MAILMAN_MASTER_PASS_2 + fi +done +_MAILMAN_ADMIN_PASS_1="X" +_MAILMAN_ADMIN_PASS_2="Y" +echo "" +while [ "$_MAILMAN_ADMIN_PASS_1" != "$_MAILMAN_ADMIN_PASS_2" ] +do + echononl "Passwort zum Esrtellen von Mailinglisten: " + read -s _MAILMAN_ADMIN_PASS_1 + echo + if [ "X$_MAILMAN_ADMIN_PASS_1" = "X" ]; then + echo -e "\n\t\033[33m\033[1mPassworteingabe erforderlich!\033[m\n" + continue + fi + echononl "Passwortwiederholung: " + read -s _MAILMAN_ADMIN_PASS_2 + echo + if [ "X$_MAILMAN_ADMIN_PASS_2" = "X" ]; then + echo -e "\n\t\033[33m\033[1mPasswortwiederholung erforderlich!\033[m\n" + continue + fi + if [ "$_MAILMAN_ADMIN_PASS_1" != "$_MAILMAN_ADMIN_PASS_2" ];then + echo -e "\n\t\033[33m\033[1mPassworteingaben sind nicht identisch!\033[m\n" + else + MAILMAN_ADMIN_PASS=$_MAILMAN_ADMIN_PASS_2 + fi +done +echo "" +_LIST_MAILMAN_PASS_1="X" +_LIST_MAILMAN_PASS_2="Y" +while [ "$_LIST_MAILMAN_PASS_1" != "$_LIST_MAILMAN_PASS_2" ] +do + echononl "Passwort Systemweite Liste \"mailman\": " + read -s _LIST_MAILMAN_PASS_1 + echo + if [ "X$_LIST_MAILMAN_PASS_1" = "X" ]; then + echo -e "\n\t\033[33m\033[1mPassworteingabe erforderlich!\033[m\n" + continue + fi + echononl "Passwortwiederholung: " + read -s _LIST_MAILMAN_PASS_2 + echo + if [ "X$_LIST_MAILMAN_PASS_2" = "X" ]; then + echo -e "\n\t\033[33m\033[1mPasswortwiederholung erforderlich!\033[m\n" + continue + fi + if [ "$_LIST_MAILMAN_PASS_1" != "$_LIST_MAILMAN_PASS_2" ];then + echo -e "\n\t\033[33m\033[1mPassworteingaben sind nicht identisch!\033[m\n" + else + LIST_MAILMAN_PASS=$_LIST_MAILMAN_PASS_2 + fi +done +echo +echononl "Zeige Passworte im Ausgabefenster [yes/no]: " +read OK +while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ] +do + echononl "falsche Angabe! [yes/no] :" + read OK +done +if [ "$OK" = "Yes" -o $OK = "yes" ]; then + SHOW_PASS=true +else + SHOW_PASS=false +fi + + + +_MAILMAN_DOMAINS="" +for _val in $_DOMAINS ; do + _MAILMAN_DOMAINS="$_MAILMAN_DOMAINS `echo $_val | cut -d'|' -f1`" +done + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Gib die Namen der Domains an, die von Mailmn verwaltet werden sollen." +echo "" +echo "Defaultwert ist: \"$_MAILMAN_DOMAINS\"" +echo "" +MAILMAN_DOMAINS= +while [ "X$MAILMAN_DOMAINS" = "X" ] +do + echononl "Blank (Leerstellen) separierte Liste: " + read MAILMAN_DOMAINS + if [ "X$MAILMAN_DOMAINS" = "X" ]; then + MAILMAN_DOMAINS=$_MAILMAN_DOMAINS + fi +done + + +clear + + +APACHE_INSTALL_METHOD= +echo "" +echo -e "\033[21G\033[32mApache Webserver Einstellungen\033[m" +echo "" +echo "Gib die Installationsmethode des Apache Webservers an?" +echo "" +echo "[1] Debian Paket System" +echo "[2] Quellcode Installation" +echo "" +echononl "Eingabe: " + +while [ "$APACHE_INSTALL_METHOD" != "Debian" -a "$APACHE_INSTALL_METHOD" != "Sourcecode" ];do + read OPTION + case $OPTION in + 1) APACHE_INSTALL_METHOD="Debian" + ;; + 2) APACHE_INSTALL_METHOD="Sourcecode" + ;; + *) echo "" + echo -e "\tFalsche Eingabe ! [ 1 = Debian ; 2 = Quellcode ]" + echo "" + echononl "Eingabe: " + ;; + esac +done + +if [ "$APACHE_INSTALL_METHOD" = "Debian" ]; then + if [ ! -d "/etc/apache2/sites_available" ]; then + fatal Kann Apache Installation nicht finden + fi +fi + +echo "" +echo "" +echo -e "\033[32m-- Apache Webserver User / Gruppe / Admin E-Mail\033[m" +echo "" +echo "Gib den Namen des Benutzers und der Gruppe an, unter dem/der" +echo "der Webserver Prozess läuft an.." +echo "" +WEBSERVER_USER= +while [ "X$WEBSERVER_USER" = "X" ] +do + echononl "Webserver-User [${_WEBSERVER_USER}]: " + read WEBSERVER_USER + if [ "X$WEBSERVER_USER" = "X" ]; then + WEBSERVER_USER=$_WEBSERVER_USER + fi +done +WEBSERVER_GROUP= +while [ "X$WEBSERVER_GROUP" = "X" ] +do + echononl "Webserver-Gruppe [$WEBSERVER_USER]: " + read WEBSERVER_GROUP + if [ "X$WEBSERVER_GROUP" = "X" ]; then + WEBSERVER_GROUP=$WEBSERVER_USER + fi +done + +echo +WEBSERVER_ADMIN_EMAIL= +while [ "X$WEBSERVER_ADMIN_EMAIL" = "X" ] +do + echononl "Webserver Admin E-Mail [$_WEBSERVER_ADMIN_EMAIL]: " + read WEBSERVER_ADMIN_EMAIL + if [ "X$WEBSERVER_ADMIN_EMAIL" = "X" ]; then + WEBSERVER_ADMIN_EMAIL=$_WEBSERVER_ADMIN_EMAIL + fi +done + + +WEBSERVER_DOMAINS="" +if [ "$MAILMAN_DOMAINS" = "$_MAILMAN_DOMAINS" ]; then + + for _val in $_DOMAINS ; do + + _domain=`echo $_val | cut -d'|' -f1` + _ipv4=`echo $_val | cut -d'|' -f2` + _ipv6=`echo $_val | cut -d'|' -f3` + _vhost_dir=`echo $_val | cut -d'|' -f4` + + echo "" + echo "" + echo -e "\033[32m-- Webinterface \033[m$_domain\033[32m" + if [ "$APACHE_INSTALL_METHOD" != "Debian" ]; then + echo -e "\tIPv4 Adresse / IPv6 Adresse / VHOST Verzeichnis\033[m" + else + echo -e "\tIPv4 Adresse / IPv6 Adresse\033[m" + fi + echo "" + echononl "IPv4 Adresse Webinterface \"$_domain\" [$_ipv4]: " + read ipv4 + if [ "X$ipv4" = "X" ]; then + ipv4=$_ipv4 + fi + + echononl "IPv6 Adresse Webinterface \"$_domain\" [$_ipv6]: " + read ipv6 + if [ "X$ipv6" = "X" ]; then + ipv6=$_ipv6 + fi + + if [ "$APACHE_INSTALL_METHOD" != "Debian" ]; then + echononl "VHOST Verzeichnis \"$_domain\" [$_vhost_dir]: " + read vhost_dir + if [ "X$vhost_dir" = "X" ]; then + vhost_dir=$_vhost_dir + fi + + if [ ! -d $vhost_dir ]; then + fatal Kann Apache VHost Konfigurationsverzeichnis nicht finden + fi + + else + vhost_dir="/etc/apache2/sites-available" + fi + + WEBSERVER_DOMAINS="$WEBSERVER_DOMAINS ${_domain}|${ipv4}|${ipv6}|${vhost_dir}" + + done + +else + + for _val in $MAILMAN_DOMAINS; do + + echo "" + echo "" + echo -e "\033[32m-- Webinterface \033[m$_val\033[32m" + if [ "$APACHE_INSTALL_METHOD" != "Debian" ]; then + echo -e "\tIPv4 Adresse / IPv6 Adresse / VHOST Verzeichnis\033[m" + else + echo -e "\tIPv4 Adresse / IPv6 Adresse\033[m" + fi + echo "" + echononl "IPv4 Adresse Webinterface \"$_val\": " + read ipv4 + while [ "X$ipv4" = "X" ]; do + echo "" + echo "!! Ungültige Eingabe - nochmal.." + echononl "IPv4 Adresse Webinterface \"$_val\": " + read ipv4 + done + + echononl "IPv6 Adresse Webinterface \"$_val\": " + read ipv6 + while [ "X$ipv6" = "X" ]; do + echo "" + echo "!! Ungültige Eingabe - nochmal.." + echononl "IPv6 Adresse Webinterface \"$_val\": " + read ipv6 + done + + if [ "$APACHE_INSTALL_METHOD" != "Debian" ]; then + _vhost_dir="/usr/local/apache2/conf/vhosts" + echononl "VHOST Verzeichnis \"$_domain\" [$_vhost_dir]: " + read vhost_dir + if [ "X$vhost_dir" = "X" ]; then + vhost_dir=$_vhost_dir + fi + + if [ ! -d $vhost_dir ]; then + fatal Kann Apache VHost Konfigurationsverzeichnis nicht finden + fi + + else + vhost_dir="/etc/apache2/sites-available" + fi + + WEBSERVER_DOMAINS="$WEBSERVER_DOMAINS ${_val}|${ipv4}|${ipv6}|${vhost_dir}" + + done + +fi +unset ipv4 +unset ipv6 +unset vhost_dir + + +POSTFIX_INSTALL_METHOD= +clear +echo "" +echo -e "\033[21G\033[32mPostfix Mailserver Einstellungen\033[m" +echo "" +echo "Gib die Installationsmethode des Postfix Mailservers an" +echo "" +echo "[1] Debian Paket System" +echo "[2] Quellcode Installation" +echo "" +echononl "Eingabe: " + +while [ "$POSTFIX_INSTALL_METHOD" != "Debian" -a "$POSTFIX_INSTALL_METHOD" != "Sourcecode" ];do + read OPTION + case $OPTION in + 1) POSTFIX_INSTALL_METHOD="Debian" + ;; + 2) POSTFIX_INSTALL_METHOD="Sourcecode" + ;; + *) echo "" + echo -e "\tFalsche Eingabe ! [ 1 = Debian ; 2 = Quellcode ]" + echo "" + echononl "Eingabe: " + ;; + esac +done + +if [ "$POSTFIX_INSTALL_METHOD" = "Debian" ];then + POSTFIX_CONFIGURATION="/etc/postfix/main.cf" +fi + +if [ "$POSTFIX_INSTALL_METHOD" != "Debian" ];then + + echo "" + echo -e "\033[32m--\033[m" + echo "" + echo "Gib den Namen des Verzeichnisses an, indem sich die Konfigurationsdatei \"main.cf\" befindet" + echo "" + POSTFIX_CONFIGURATION= + _POSTFIX_CONFIGURATION="/usr/local/postfix/etc/main.cf" + while [ "X$POSTFIX_CONFIGURATION" = "X" ] + do + echononl "Pfad zur Konfigurationsdatei \"main.cf\" [${_POSTFIX_CONFIGURATION}]: " + read POSTFIX_CONFIGURATION + if [ "X$POSTFIX_CONFIGURATION" = "X" ]; then + POSTFIX_CONFIGURATION=$_POSTFIX_CONFIGURATION + fi + + done +fi + +if [ ! -f "$POSTFIX_CONFIGURATION" ];then + fatal "Kann Postfix Konfigurationsdatei \"$POSTFIX_CONFIGURATION\" nicht finden" +fi + + + +echo "" +clear +echo -e "\033[21G\033[32mStarte Installation mit folgenden Parametern:\033[m" +echo "" +echo -e "Linuxdistribution...............: \033[33m$DISTRIBUTION\033[m" +echo -e "Mailman Versionsnummer..........: \033[33m$MAILMAN_VERSION\033[m" +echo -e "Installationsverzeichnis........: \033[33m$MAILMAN_INSTALL_DIR\033[m" +echo -e "Mailman User....................: \033[33m$MAILMAN_USER\033[m" +echo -e "Mailman Gruppe..................: \033[33m$MAILMAN_GROUP\033[m" +echo -e "Mailman Admin E-Mail............: \033[33m$MAILMAN_ADMIN_EMAIL\033[m" +echo "" +echo -e "Liste der Mailman Domains.......:\033[33m$MAILMAN_DOMAINS\033[m" +echo "" +if $SHOW_PASS ; then + echo -e "Mailman Master Passwort.........: \033[33m$MAILMAN_MASTER_PASS\033[m" + echo -e "Mailman Administrator Passwort..: \033[33m$MAILMAN_ADMIN_PASS\033[m" + echo -e "Passwort Liste \"mailman\"........: \033[33m$LIST_MAILMAN_PASS\033[m" +else + echo -e "Mailman Master Passwort.........: \033[33m**********\033[m" + echo -e "Mailman Administrator Passwort..: \033[33m**********\033[m" + echo -e "Passwort Liste \"mailman\"........: \033[33m**********\033[m" +fi +echo "" +if [ "$APACHE_INSTALL_METHOD" = "Debian" ]; then + echo -e "Webserver Installationsmethode..: \033[33mDebian Paket System\033[m" +else + echo -e "Webserver Installationsmethode..: \033[33mQuellcodeinstallation\033[m" +fi +echo -e "Webserver User..................: \033[33m$WEBSERVER_USER\033[m" +echo -e "Webserver Gruppe................: \033[33m$WEBSERVER_GROUP\033[m" +echo -e "Webserver Admin E-Mail..........: \033[33m$WEBSERVER_ADMIN_EMAIL\033[m" +for domain in $WEBSERVER_DOMAINS ; do + hostname="`echo $domain | cut -d '|' -f1`" + ipv4="`echo $domain | cut -d '|' -f2`" + ipv6="`echo $domain | cut -d '|' -f3`" + vhost_dir="`echo $domain | cut -d '|' -f4`" + + echo "" + echo -e "Webservereinstellungen \033[1;34m$hostname\033[m:" + echo -e " Hostname..............: \033[33m$hostname\033[m" + echo -e " IPv4..................: \033[33m$ipv4\033[m" + echo -e " IPv6..................: \033[33m$ipv6\033[m" + echo -e " VHOST Verzeichnis:....: \033[33m$vhost_dir\033[m" + +done +echo "" +if [ "$POSTFIX_INSTALL_METHOD" = "Debian" ]; then + echo -e "Postfix Installationsmethode....: \033[33mDebian Paket System\033[m" +else + echo -e "Postfix Installationsmethode....: \033[33mQuellcodeinstallation\033[m" +fi +echo -e "Postfix Konfigurationsdatei.....: \033[33m$POSTFIX_CONFIGURATION\033[m" +echo "" +echononl "einverstanden [yes/no]: " +read OK +while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ] +do + echononl "falsche Angabe! [yes/no] :" + read OK +done +[ $OK = "Yes" -o $OK = "yes" ] || fatal wiederhole Installation zur Eingabe anderer Parameter + +echo "" + + +## - Sorcecode Verzeichnis vorhanden? +## - +if [ ! -d $_MAILMAN_SRC_BASE_DIR ];then + MAILMAN_SRC_BASE_DIR=/usr/local/src/mailman + + if [ ! -d $MAILMAN_SRC_BASE_DIR ] ; then + mkdir -p MAILMAN_SRC_BASE_DIR + fi +else + MAILMAN_SRC_BASE_DIR=$_MAILMAN_SRC_BASE_DIR +fi + +logdir=${MAILMAN_SRC_BASE_DIR}/log_mailman-$MAILMAN_VERSION + +## - Erstelle Logverzeichnis +## - +if [ -d $logdir ]; then + echononl "Verschiebe exitierendes Logverzeichnis ..." + mv $logdir $logdir.`date +"%Y%m%d-%H%M"` > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Kann Logverzeichnis \"${logdir}\" nicht verschieben.. + fi +fi + +echononl "Erstelle Logverzeichnis ${logdir}.." +mkdir -p $logdir > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal Kann Logverzeichnis \"${logdir}\" nicht erstellen.. +fi + +touch ${logdir}/main.log +echo -e "## - Starte Installation mit folgenden Parametern:" >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log +echo "## - Linuxdistribution...............: $DISTRIBUTION" >> ${logdir}/main.log +echo "## - Mailman Versionsnummer..........: $MAILMAN_VERSION" >> ${logdir}/main.log +echo "## - Installationsverzeichnis........: $MAILMAN_INSTALL_DIR" >> ${logdir}/main.log +echo "## - Mailman User....................: $MAILMAN_USER" >> ${logdir}/main.log +echo "## - Mailman Gruppe..................: $MAILMAN_GROUP" >> ${logdir}/main.log +echo "## - Mailman Administrator E-Mail....: $MAILMAN_ADMIN_EMAIL" >> ${logdir}/main.log +echo "## - Liste der Mailman Domains.......:$MAILMAN_DOMAINS" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +if $SHOW_PASS ; then + echo -e "## - Mailman Master Passwort.........: $MAILMAN_MASTER_PASS" >> ${logdir}/main.log + echo -e "## - Mailman Administrator Passwort..: $MAILMAN_ADMIN_PASS" >> ${logdir}/main.log + echo -e "## - Passwort Liste \"mailman\"........: $LIST_MAILMAN_PASS" >> ${logdir}/main.log +else + echo -e "## - Mailman Master Passwort.........: **********" >> ${logdir}/main.log + echo -e "## - Mailman Administrator Passwort..: **********" >> ${logdir}/main.log + echo -e "## - Passwort Liste \"mailman\"........: **********" >> ${logdir}/main.log +fi +echo "## - " >> ${logdir}/main.log +if [ "$APACHE_INSTALL_METHOD" = "Debian" ]; then + echo "## - Webserver-Installationsmethode..: Debian Paket System" >> ${logdir}/main.log +else + echo "## - Webserver-Installationsmethode..: Quellcodeinstallation" >> ${logdir}/main.log +fi +echo "## - Webserver User..................: $WEBSERVER_USER" >> ${logdir}/main.log +echo "## - Webserver Gruppe................: $WEBSERVER_GROUP" >> ${logdir}/main.log +echo "## - Webserver Admin E-Mail..........: $WEBSERVER_ADMIN_EMAIL" >> ${logdir}/main.log +for domain in $WEBSERVER_DOMAINS ; do + hostname="`echo $domain | cut -d '|' -f1`" + ipv4="`echo $domain | cut -d '|' -f2`" + ipv6="`echo $domain | cut -d '|' -f3`" + vhost_dir="`echo $domain | cut -d '|' -f4`" + + echo "" + echo "## - Webservereinstellungen $hostname:" >> ${logdir}/main.log + echo "## - Hostname..............: $hostname" >> ${logdir}/main.log + echo "## - IPv4..................: $ipv4" >> ${logdir}/main.log + echo "## - IPv6..................: $ipv6" >> ${logdir}/main.log + echo "## - VHOST Verzeichnis:....: $vhost_dir" >> ${logdir}/main.log + +done +echo "## -" >> ${logdir}/main.log +if [ "$POSTFIX_INSTALL_METHOD" = "Debian" ]; then + echo "## - Postfix Installationsmethode....: Debian Paket System" >> ${logdir}/main.log +else + echo "## - Postfix Installationsmethode....: Quellcodeinstallation" >> ${logdir}/main.log +fi +echo "## - Postfix Konfigurationsdatei.....: $POSTFIX_CONFIGURATION" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "" >> ${logdir}/main.log +echo "" >> ${logdir}/main.log + + +## - Erstelle Logverzeichnis +## - +if [ ! -d ${MAILMAN_SRC_BASE_DIR}/tarballs ];then + + echononl "Erstelle Verzeichnis ${MAILMAN_SRC_BASE_DIR}/tarballs.." + echo "" >> ${logdir}/main.log + echo "## - Erstelle Verzeichnis ${MAILMAN_SRC_BASE_DIR}/tarballs.." >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mkdir -p ${MAILMAN_SRC_BASE_DIR}/tarballs" >> ${logdir}/main.log + + mkdir ${MAILMAN_SRC_BASE_DIR}/tarballs > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Kann Verzeichnis \"${MAILMAN_SRC_BASE_DIR}/tarball\" nicht erstellen.. + fi +fi + + +## *********************** +## --- Konfiguriere System + + +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "## ***********************" >> ${logdir}/main.log 2>&1 +echo "## --- Konfiguriere System" >> ${logdir}/main.log 2>&1 + +_MAILMAN_INITSCRIPT=mailman +if [ -f /etc/init.d/$_MAILMAN_INITSCRIPT ];then + + PID=`ps aux | grep "/bin/mailmanctl" | grep -v grep | awk '{print$2}'` + if [ "X${PID}X" != "XX" ];then + echononl "Stoppe Mailman Service.." + echo "" >> ${logdir}/main.log + echo "/etc/init.d/$_MAILMAN_INITSCRIPT stop" >> ${logdir}/main.log + /etc/init.d/$_MAILMAN_INITSCRIPT stop > /dev/null 2>&1 + sleep 5 + PID=`ps aux | grep "/bin/mailmanctl" | grep -v grep | awk '{print$2}'` + if [ "X${PID}X" = "XX" ]; then + echo_ok + else + echo_failed + + _failed=false + + PID=`ps aux | grep "/bin/mailman/" | grep -v grep | awk '{print$2}'` + echononl "Abbruch (kill -9) aller Malman Prozesse.." + echo "" >> ${logdir}/main.log + echo "## - Abruch mailmanctl Prozess(e)" >> ${logdir}/main.log + echo "kill -9 $PID" >> ${logdir}/main.log 2>&1 + kill -9 $PID + if [ "$?" != "0" ]; then + _failed=true + fi + echo "" >> ${logdir}/main.log + echo "## - Abruch qrunner Prozesse" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + PID=`ps aux | grep "bin/qrunner" | grep -v grep | awk '{print$2}'` + echo "kill -9 $PID" >> ${logdir}/main.log 2>&1 + if [ "$?" = "0" ] && ! $_failed ; then + echo_ok + else + echo_failed + fi + fi + + fi + + ## - Entferne symbolische Links aus den Run Level Verzeichnissen + ## - + + if [ "$DISTRIBUTION" = "Debian" ]; then + echononl "Entferne symbolische Links aus den Run Level Verzeichnissen.." + echo "" >> ${logdir}/main.log + echo "## - Entferne symbolische Links aus den Run Level Verzeichnissen" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "update-rc.d -f $_MAILMAN_INITSCRIPT remove" >> ${logdir}/main.log + + update-rc.d -f /etc/init.d/$_MAILMAN_INITSCRIPT remove > /dev/null 2>&1 + if [ "$?" = 0 ]; then + echo_ok + else + echo_failed + fi + + echo "" >> ${logdir}/main.log + echononl "Enferne Mailmans init Skript.." + echo "## - Enferne Mailmans init Skript" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "rm -f /etc/init.d/$_MAILMAN_INITSCRIPT" >> ${logdir}/main.log + + rm -f /etc/init.d/$_MAILMAN_INITSCRIPT >> ${logdir}/main.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Kann Mailman Pakete nicht deinstallieren.. + fi + fi +fi + + +echo "" +## - Uninstall debian mailman packages if installed +## - +if [ "$DISTRIBUTION" = "Debian" ]; then + echononl "Deinstalliere Debian Mailman Pakete.." + _INSTALLED_MAILMAN_DEB=`dpkg -l | grep mailman | grep -e "^i" | awk '{print$2}'` + INSTALLED_MAILMAN_DEB= + for deb in $_INSTALLED_MAILMAN_DEB ; do + INSTALLED_MAILMAN_DEB="$INSTALLED_MAILMAN_DEB $deb" + done + if [ -n "$INSTALLED_MAILMAN_DEB" ]; then + echo "" >> ${logdir}/main.log + echo "## - Deinstalliere Debian Mailman Pakete" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "apt-get remove --purge -q -y $INSTALLED_MAILMAN_DEB" >> ${logdir}/main.log + + apt-get remove --purge -q -y $INSTALLED_MAILMAN_DEB >> ${logdir}/main.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Kann Mailman Pakete nicht deinstallieren.. + fi + else + echo_skipped + fi +fi + +## - Install fehlende Debian Pakete +## - +if [ "$DISTRIBUTION" = "Debian" ]; then + + echononl "Installiere fehlende Debian Pakete .." + + REQUIRED_DEB_PACKAGES="" + for deb in $_REQUIRED_DEB_PACKAGES ; do + if ! dpkg -l | grep -e "^ii" | grep $deb > /dev/null 2>&1 ; then + REQUIRED_DEB_PACKAGES="$REQUIRED_DEB_PACKAGES $deb" + fi + done + + if [ -n "$REQUIRED_DEB_PACKAGES" ] ; then + + echo "" >> ${logdir}/main.log + echo "## - Folgende Debian Pakete müssen nachinstalliert werden:" >> ${logdir}/main.log + for deb in $REQUIRED_DEB_PACKAGES ; do + echo "## - $deb" >> ${logdir}/main.log + done + echo "## -" >> ${logdir}/main.log + echo "## - Installiere fehlende Debian Pakete.." >> ${logdir}/main.log + echo "## - " >> ${logdir}/main.log + echo "apt-get -q -y install $REQUIRED_DEB_PACKAGES > ${logdir}/debian-install.log 2>&1" >> ${logdir}/main.log + + apt-get -q -y install $REQUIRED_DEB_PACKAGES > ${logdir}/debian-install.log 2>&1 + if [ "$?" = 0 ]; then + echo_ok + else + echo_failed + fatal "Kann fehlende Debian Pakete nicht nachinstallieren\n\n\tSiehe: ${logdir}/debian-install.log" + fi + else + echo_skipped + fi +fi + +echo "" +## - Erstelle User/group für mailman +## - +echononl "Adding Group \"$MAILMAN_GROUP\".." + +if cat /etc/group | grep -e "^${MAILMAN_GROUP}:" > /dev/null 2>&1 ; then + echo_skipped +else + + echo "" >> ${logdir}/main.log + echo "## - Erstelle System Gruppe \"$MAILMAN_GROUP\"" >> ${logdir}/main.log + echo "## - " >> ${logdir}/main.log + echo "groupadd -r $MAILMAN_GROUP > ${logdir}/groupadd.log 2>&1" >> ${logdir}/main.log + + groupadd -r $MAILMAN_GROUP > ${logdir}/groupadd.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann Gruppe \"${MAILMAN_GROUP}\" nicht erstellen..\n\tSiehe: ${logdir}/groupadd.log" + fi +fi + +echononl "Adding User \"$MAILMAN_USER\".." +if id -u $MAILMAN_USER > /dev/null 2>&1; then + echo_skipped +else + + echo "" >> ${logdir}/main.log + echo "## - Erstelle System Benutzer \"$MAILMAN_GROUP\"" >> ${logdir}/main.log + echo "## - " >> ${logdir}/main.log + echo "useradd -r -M -c 'GNU Mailman' -d /noexistent -s /bin/false -g $MAILMAN_GROUP $MAILMAN_USER > ${logdir}/useradd.log 2>&1" >> ${logdir}/main.log + + useradd -r -M -c 'GNU Mailman' -d /noexistent -s /bin/false -g $MAILMAN_GROUP $MAILMAN_USER > ${logdir}/useradd.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann Benutzer \"${MAILMAN_USER}\" nicht erstellen..\n\n\tSiehe: ${logdir}/useradd.log" + fi +fi + + + +## *********************** +## --- Installiere Mailman +echo "" + + +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "## ***********************" >> ${logdir}/main.log 2>&1 +echo "## --- Installiere Mailman" >> ${logdir}/main.log 2>&1 + + +if [ -d ${MAILMAN_INSTALL_DIR} ];then + + echononl "Verschiebe exitierendes Installationsverzeichnis.." + echo "" >> ${logdir}/main.log + echo "## - Verschiebe exitierendes Installationsverzeichnis" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mv $MAILMAN_INSTALL_DIR $MAILMAN_INSTALL_DIR.`date +\"%Y%m%d-%H%M\"`" >> ${logdir}/main.log + + mv $MAILMAN_INSTALL_DIR $MAILMAN_INSTALL_DIR.`date +"%Y%m%d-%H%M"` >> ${logdir}/main.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Kann Installationsverzeichnis \"${MAILMAN_INSTALL_DIR}\" nicht verschieben.. + fi +fi + + +echononl "Erstelle Installationsverzeichnis.." +echo "" >> ${logdir}/main.log +echo "## - Erstelle Installationsverzeichnis" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "mkdir $MAILMAN_INSTALL_DIR" >> ${logdir}/main.log + +mkdir $MAILMAN_INSTALL_DIR >> ${logdir}/main.log 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal Kann Installationsverzeichnis \"${MAILMAN_INSTALL_DIR}\" nicht erstellen.. +fi + +echononl "Setze Verzeichnisberechtigungen.." +echo "" >> ${logdir}/main.log +echo "## - Setze Verzeichnisberechtigungen" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "chmod 02775 $MAILMAN_INSTALL_DIR" >> ${logdir}/main.log + +chmod 02775 $MAILMAN_INSTALL_DIR > /dev/null 2>&1 +if [ "$?" != "0" ]; then + echo_failed + fatal Kann Vrezeichnisberechtigungen \(chmod\) für \"${MAILMAN_INSTALL_DIR}\" nicht setzen.. +fi + +echo "chown $MAILMAN_USER:$MAILMAN_GROUP $MAILMAN_INSTALL_DIR" >> ${logdir}/main.log + +chown $MAILMAN_USER:$MAILMAN_GROUP $MAILMAN_INSTALL_DIR > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal Kann Verzeichnisberechtigungen \(chmod\) für \"${MAILMAN_INSTALL_DIR}\" nicht setzen.. +fi + + +## - Download Mailman +## - +if [ ! -f "${MAILMAN_SRC_BASE_DIR}/tarballs/mailman-${MAILMAN_VERSION}.tgz" ];then + + echo "" >> ${logdir}/main.log + echo "cd ${MAILMAN_SRC_BASE_DIR}/tarballs" >> ${logdir}/main.log + cd ${MAILMAN_SRC_BASE_DIR}/tarballs > /dev/null 2>&1 + + echononl "Download mailman-${MAILMAN_VERSION}.tgz.." + echo "" >> ${logdir}/main.log + echo "## - Download mailman-${MAILMAN_VERSION}.tgz.." >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "wget http://ftp.gnu.org/gnu/mailman/mailman-${MAILMAN_VERSION}.tgz" >> ${logdir}/main.log + + wget http://ftp.gnu.org/gnu/mailman/mailman-${MAILMAN_VERSION}.tgz > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Download mailman-${MAILMAN_VERSION}.tgz fehgeschlagen.. + fi +fi + + +## - Entpacke mailman Source-Archiv +## - +echo "" >> ${logdir}/main.log +echo "cd ${MAILMAN_SRC_BASE_DIR}" >> ${logdir}/main.log +cd ${MAILMAN_SRC_BASE_DIR} > /dev/null 2>&1 + +if [ -d "${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION}" ];then + + echononl "Verchiebe existierendes Sourcverzeichnis.." + echo "" >> ${logdir}/main.log + echo "## - Verchiebe existierendes Sourcveverzeichnis \"${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION}\"" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mv ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION} ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION}.`date +%Y%m%d-%H%M`" >> ${logdir}/main.log + + mv ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION} \ + ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION}.`date +%Y%m%d-%H%M` + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal Kann ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION} nicht verchieben.. + fi +fi + +echononl "Entpacke Archiv mailman-${MAILMAN_VERSION}.tgz.." +echo "" >> ${logdir}/main.log +echo "## - Entpacke Archiv mailman-${MAILMAN_VERSION}.tgz" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "gunzip < tarballs/mailman-${MAILMAN_VERSION}.tgz | tar -xf -" >> ${logdir}/main.log + +gunzip < tarballs/mailman-${MAILMAN_VERSION}.tgz | tar -xf - > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal Entpacken des Archivs \"mailman-${MAILMAN_VERSION}.tgz\" fehlgeschlagen.. +fi + + +## - Konfiguriere mailman +## - + +echo "" >> ${logdir}/main.log +echo "cd ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION}" >> ${logdir}/main.log +cd ${MAILMAN_SRC_BASE_DIR}/mailman-${MAILMAN_VERSION} > /dev/null 2>&1 + +echononl "Konfiguriere Mailman ${MAILMAN_VERSION}.." +echo "" >> ${logdir}/main.log +echo "## - Konfiguriere Mailman ${MAILMAN_VERSION}" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - !! Noticei (from mailmans's official documentation):" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - When you configure Mailman, use the --with-mail-gid=mailman switch; this " >> ${logdir}/main.log +echo "## - will be the default if you configured Mailman after adding the mailman " >> ${logdir}/main.log +echo "## - owner. Because the owner of the aliases.db file is mailman, Postfix will " >> ${logdir}/main.log +echo "## - execute Mailman's wrapper program as uid and gid mailman. " >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "./configure \\" >> ${logdir}/main.log +echo " --prefix=/usr/local/mailman-${MAILMAN_VERSION} \\" >> ${logdir}/main.log +echo " --with-username=$MAILMAN_USER \\" >> ${logdir}/main.log +echo " --with-groupname=$MAILMAN_GROUP \\" >> ${logdir}/main.log +echo " --with-mail-gid=$MAILMAN_GROUP \\" >> ${logdir}/main.log +echo " --with-cgi-gid=$WEBSERVER_GROUP \\" >> ${logdir}/main.log +echo " > ${logdir}/mailman-configure.log 2>&1" >> ${logdir}/main.log + +./configure \ + --prefix=/usr/local/mailman-${MAILMAN_VERSION} \ + --with-username=$MAILMAN_USER \ + --with-groupname=$MAILMAN_GROUP \ + --with-mail-gid=$MAILMAN_GROUP \ + --with-cgi-gid=$WEBSERVER_GROUP \ + > ${logdir}/mailman-configure.log 2>&1 + +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Konfigurieren vom Mailman ${MAILMAN_VERSION} fehlgeschlagen..\n\n\tsiehe: ${logdir}/mailman-configure.log" +fi + + +## - Compiliere mailman +## - +echononl "Compiliere Mailman ${MAILMAN_VERSION}.." +echo "" >> ${logdir}/main.log +echo "## - Compiliere Mailman ${MAILMAN_VERSION}" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "make > ${logdir}/mailman-make.log 2>&1" >> ${logdir}/main.log + +make > ${logdir}/mailman-make.log 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Compilieren vom Mailman ${MAILMAN_VERSION} fehlgeschlagen..\n\n\tsiehe: ${logdir}/mailman-make.log 2>&1" +fi + + +## - Installiere mailman +## - +echononl "Installiere Mailman ${MAILMAN_VERSION}.." +echo "" >> ${logdir}/main.log +echo "## - Installiere Mailman ${MAILMAN_VERSION}" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "make install > ${logdir}/mailman-install.log 2>&1" >> ${logdir}/main.log + +make install > ${logdir}/mailman-install.log 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Installieren vom Mailman ${MAILMAN_VERSION} fehlgeschlagen..\n\n\tsiehe: ${logdir}/mailman-install.log 2>&1" +fi + +_link="`dirname $MAILMAN_INSTALL_DIR`/mailman" +if [ -a "$_link" ];then + if [ -h "$_link" ]; then + echononl "Entferne existierenden Symlink ${_link}.." + echo "" >> ${logdir}/main.log + echo "## - Entferne existierenden Symlink ${_link}" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "rm $_link" >> ${logdir}/main.log + + rm $_link + if [ $? = 0 ]; then + echo_ok + else + echo_failed + fatal "Kann Symlink $_link nicht entfernen.." + fi + elif [ -d "$_link" ]; then + echononl "Verschiebe existierendes Verzeichnis ${_link}.." + echo "" >> ${logdir}/main.log + echo "## - Verschiebe existierendes Verzeichnis ${_link}" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mv $_link $_link.`date +%Y%m%d-%H%M`" >> ${logdir}/main.log + + mv $_link $_link.`date +%Y%m%d-%H%M` + if [ $? = 0 ]; then + echo_ok + else + echo_failed + fatal "Kann Verzeichnis $_link nicht verschieben.." + fi + elif [ -f "$_link" ]; then + echononl "Verschiebe existierendes Datei ${_link}.." + echo "" >> ${logdir}/main.log + echo "## - Verschiebe existierende Datei ${_link}" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mv $_link $_link.`date +%Y%m%d-%H%M`" >> ${logdir}/main.log + + mv $_link $_link.`date +%Y%m%d-%H%M` + if [ $? = 0 ]; then + echo_ok + else + echo_failed + fatal "Kann Datei $_link nicht verschieben.." + fi + fi +fi + +if [ -a "$_link" ];then + fatal $_link exists, but is not a directory, nor a regular file, nor a symbolic link +fi + +echononl "Setze Symlink $_link -> ${MAILMAN_INSTALL_DIR}.." +echo "" >> ${logdir}/main.log +echo "## - Setze Symlink $_link -> $MAILMAN_INSTALL_DIR" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "ln -s `basename $MAILMAN_INSTALL_DIR` `dirname ${MAILMAN_INSTALL_DIR}`/mailman" >> ${logdir}/main.log + +ln -s `basename $MAILMAN_INSTALL_DIR` `dirname ${MAILMAN_INSTALL_DIR}`/mailman +if [ $? = 0 ]; then + echo_ok +else + echo_failed + fatal "Kann Symlink $_link -> $MAILMAN_INSTALL_DIR nicht setzen.." +fi + + + +## ************************************ +## --- Instalation Prüfen / Korrigieren +echo "" + + +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "## ************************************" >> ${logdir}/main.log 2>&1 +echo "## --- Instalation Prüfen / Korrigieren" >> ${logdir}/main.log 2>&1 + + +## - Teste Installation +## - +echo "" >> ${logdir}/main.log +echo "## - From official mailman documentation:" >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log +echo "## - Warning: If you're running Mailman on a shared multiuser system, and you " >> ${logdir}/main.log +echo "## - have mailing lists with private archives, you may want to hide the " >> ${logdir}/main.log +echo "## - private archive directory from other users on your system. In that case, " >> ${logdir}/main.log +echo "## - you should drop the other execute permission (o-x) from the " >> ${logdir}/main.log +echo "## - archives/private directory. However, the web server process must be able " >> ${logdir}/main.log +echo "## - to follow the symbolic link in public directory, otherwise your public " >> ${logdir}/main.log +echo "## - Pipermail archives will not work. To set this up, become root and run the " >> ${logdir}/main.log +echo "## - following commands:" >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log +echo "## - # cd /archives" >> ${logdir}/main.log +echo "## - # chown private" >> ${logdir}/main.log +echo "## - # chmod o-x private" >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log +echo "## - You need to know what user your web server runs as. It may be www, apache, " >> ${logdir}/main.log +echo "## - httpd or nobody, depending on your server's configuration. " >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log + +echononl "Verzeichnisberechtigungen archives/private ändern.." +echo "chown $WEBSERVER_USER ${MAILMAN_INSTALL_DIR}/archives/private" >> ${logdir}/main.log +chown $WEBSERVER_USER ${MAILMAN_INSTALL_DIR}/archives/private > /dev/null 2>&1 + +if [ "$?" != "0" ]; then + echo_failed + fatal "Kann Berechtigungen für \"${MAILMAN_INSTALL_DIR}/archives/private\" nicht ändern" +fi + +echo "chmod o-x ${MAILMAN_INSTALL_DIR}/archives/private" >> ${logdir}/main.log +chmod o-x ${MAILMAN_INSTALL_DIR}/archives/private > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Kann Berechtigungen für \"${MAILMAN_INSTALL_DIR}/archives/private\" nicht ändern" +fi + +echo "" >> ${logdir}/main.log +echo "cd ${MAILMAN_INSTALL_DIR}" >> ${logdir}/main.log +cd ${MAILMAN_INSTALL_DIR} > /dev/null 2>&1 + +echononl "Korrigiere Berechtigungen der Mailmaninstallation..." +echo "" >> ${logdir}/main.log +echo "## - Korrigiere Berechtigungen der Mailmaninstallation" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Notice:" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - You can do that manually, by executing the following commands" >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log +echo "## - cd ${MAILMAN_INSTALL_DIR}" >> ${logdir}/main.log +echo "## - chgrp -R mailman ${MAILMAN_INSTALL_DIR}/*" >> ${logdir}/main.log +echo "## - find ${MAILMAN_INSTALL_DIR}/cgi-bin -type f -executable -exec chmod g+s {} \;" >> ${logdir}/main.log +echo "## - chmod g+s ${MAILMAN_INSTALL_DIR}/mail/mailman" >> ${logdir}/main.log +echo "## - find ${MAILMAN_INSTALL_DIR}/messages -type d -exec chmod 02775 {} \;" >> ${logdir}/main.log +echo "## - find ${MAILMAN_INSTALL_DIR}/templates -type d -exec chmod 02775 {} \;" >> ${logdir}/main.log +echo "## - chmod o-x ${MAILMAN_INSTALL_DIR}/archives/private" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - But we will use mailmans \"check_perm\" script with flag \"-f\" (fix)" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log + + +echo "declare -i _count=0" >> ${logdir}/main.log +echo "while [ \`bin/check_perms | wc -l\` -gt 1 -a $_count -lt 5 ];do" >> ${logdir}/main.log +echo " bin/check_perms -f > /dev/null 2>&1" >> ${logdir}/main.log +echo " let count++" >> ${logdir}/main.log +echo "done" >> ${logdir}/main.log + + +declare -i _count=0 +while [ `bin/check_perms | wc -l` -gt 1 -a $_count -lt 5 ];do + _retval=0 + bin/check_perms -f > /dev/null 2>&1 + if [ $? != 0 ]; then + _retval=$? + break + fi + let _count++ +done +if [ "$_retval" = "0" -o $_count -gt 4 ]; then + echo_ok +else + echo_failed + fatal "Kann Berechtigungen der Mailmaninstallation nicht korrigieren" +fi + + + +## ********************************** +## --- Konfiguration Apache Webserver +echo "" + + +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "## **********************************" >> ${logdir}/main.log 2>&1 +echo "## --- Konfiguration Apache Webserver" >> ${logdir}/main.log 2>&1 + + +for domain in $WEBSERVER_DOMAINS ; do + hostname="`echo $domain | cut -d '|' -f1`" + ipv4="`echo $domain | cut -d '|' -f2`" + ipv6="`echo $domain | cut -d '|' -f3`" + vhost_dir="`echo $domain | cut -d '|' -f4`" + + if apachectl -v | grep version | grep -e "Apache/2.4" > /dev/null 2>1 ; then + _allow_from="Require all granted" + else + _allow_from=`echo -e "Order allow,deny\n Allow from all"` + fi + + if [ -f "${vhost_dir}/${hostname}.conf" ];then + echononl "Sichere bestehende Virtual Host Konfiguration.." + echo "" >> ${logdir}/main.log 2>&1 + echo "## - Sichere bestehende Virtual Host Konfiguration \"${vhost_dir}/${hostname}.conf\"" >> ${logdir}/main.log 2>&1 + echo "## -" >> ${logdir}/main.log 2>&1 + echo "mv ${vhost_dir}/${hostname}.conf ${vhost_dir}/${hostname}.conf.`date +%Y%m%d-%H%M`" >> ${logdir}/main.log 2>&1 + mv ${vhost_dir}/${hostname}.conf ${vhost_dir}/${hostname}.conf.`date +%Y%m%d-%H%M` + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann bestehende Virtual Host Konfiguration \"${vhost_dir}/${hostname}.conf\" nicht sichern" + fi + + fi + + echononl "Erstelle Virtual Host Konfiguration \"$hostname\".." + + cat < ${vhost_dir}/${hostname}.conf + +# -- $hostname -- # + + + + ServerAdmin $WEBSERVER_ADMIN_EMAIL + + ServerName $hostname + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] + + + + + + ServerAdmin $WEBSERVER_ADMIN_EMAIL + + ServerName $hostname + + RewriteEngine on + RewriteCond %{HTTPS} =on + RewriteRule ^/$ https://%{SERVER_NAME}/mailman/listinfo [R=301,L] + + + AddDefaultCharset Off + + + Alias /pipermail/ $_link/archives/public/ + + Alias /icons/ $_link/icons/ + + $_allow_from + + + ScriptAlias /mailman/ $_link/cgi-bin/ + + Options ExecCGI + $_allow_from + + + SSLEngine on + + ## - don't support weak ciphers + SSLProtocol ALL -SSLv2 + SSLHonorCipherOrder On + SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH + #SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:RC4-SHA:HIGH:!MD5:!aNULL:!EDH + + SSLCertificateFile /usr/local/apache2/conf/lists.aktionsbuendnis-brandenburg.crt + SSLCertificateKeyFile /usr/local/apache2/conf/lists.aktionsbuendnis-brandenburg.key + SSLCertificateChainFile /usr/local/apache2/conf/SSL123_CA_Bundle.pem + + ErrorLog /var/log/apache2/$hostname-error.log + CustomLog /var/log/apache2/$hostname-access.log combined + + + + +## ------ +## - IPv6 +## ------ + + + + ServerAdmin $WEBSERVER_ADMIN_EMAIL + + ServerName $hostname + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] + + + + + + ServerAdmin $WEBSERVER_ADMIN_EMAIL + + ServerName $hostname + + RewriteEngine on + RewriteCond %{HTTPS} =on + RewriteRule ^/$ https://%{SERVER_NAME}/mailman/listinfo [R=301,L] + + + AddDefaultCharset Off + + + Alias /pipermail/ $_link/archives/public/ + + Alias /icons/ $_link/icons/ + + $_allow_from + + + ScriptAlias /mailman/ $_link/cgi-bin/ + + Options ExecCGI + $_allow_from + + + SSLEngine on + + ## - don't support weak ciphers + SSLProtocol ALL -SSLv2 + SSLHonorCipherOrder On + SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH + #SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:RC4-SHA:HIGH:!MD5:!aNULL:!EDH + + SSLCertificateFile /usr/local/apache2/conf/lists.aktionsbuendnis-brandenburg.crt + SSLCertificateKeyFile /usr/local/apache2/conf/lists.aktionsbuendnis-brandenburg.key + SSLCertificateChainFile /usr/local/apache2/conf/SSL123_CA_Bundle.pem + + ErrorLog /var/log/apache2/$hostname-error.log + CustomLog /var/log/apache2/$hostname-access.log combined + + +EOF + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann Virtual Host Konfiguration \"${vhost_dir}/${hostname}.conf\" nicht erstellen" + fi + + echo "" >> ${logdir}/main.log + echo "## - Erstelle Virtual Host Konfiguration \"$hostname\"" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "cat < ${vhost_dir}/${hostname}.conf" >> ${logdir}/main.log + cat ${vhost_dir}/${hostname}.conf >> ${logdir}/main.log + echo "EOF" >> ${logdir}/main.log + + if [ "$APACHE_INSTALL_METHOD" = "Debian" ]; then + echononl "Aktiviere VHOST \"$hostname\".." + echo "" >> ${logdir}/main.log + echo "## - Aktiviere VHOST \"$hostname\"" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "a2ensite ${hostname}.conf" >> ${logdir}/main.log + + a2ensite ${hostname}.conf + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann Virtual Host \"${hostname}\" nicht aktivieren" + fi + fi + +done + +echononl "Passe Maiilman Konfiguration (mm_cfg.py) an.." +echo_skipped +echo "" >> ${logdir}/main.log +echo "## - Bemerkung:" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Anpassen der Mailman Konfiguration \"mm_cfg.py\" ist nicht" >> ${logdir}/main.log +echo "## - notwendig. Die Einstellungen in den VHost Konfigurationsdateien" >> ${logdir}/main.log +echo "## - benutzen Standardeinstellungen und Standart Pfade der Mailman" >> ${logdir}/main.log +echo "## - Installation (${MAILMAN_INSTALL_DIR}/Mailman/Default.py)" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log + + +echononl "Reload Apache Webserver.." +echo "" >> ${logdir}/main.log +echo "## - Reload Apache Webserver" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "apachectl graceful" >> ${logdir}/main.log + +apachectl graceful +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Das Restarten des Apache Webservers ist fehlgeschlagen" +fi + + + +## ************************************ +## --- Konfiguration Postfix Mailserver +echo "" + + +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "## ************************************" >> ${logdir}/main.log 2>&1 +echo "## --- Konfiguration Postfix Mailserver" >> ${logdir}/main.log 2>&1 + +if ! grep -e "\s*recipient_delimiter\s*=\s*+" $POSTFIX_CONFIGURATION > /dev/null ; then + + if grep -e "\s*recipient_delimiter" $POSTFIX_CONFIGURATION > /dev/null ; then + + echononl "[ \033[1;33mWarnung\033[m ]: Ersetze \"recipient_delimiter\" (Postfix)\n Setze Parameter Wert auf \"+\".." + echo "" >> ${logdir}/main.log + echo "## - Warnung:" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "## - Ersetze \"recipient_delimiter\" in der Postfix Konfiguration mit dem Wert \"+\"." \ + >> ${logdir}/main.log + echo "## - Dieser Wert funktioniert gut mit den Mailman Voreinstellungen" >> ${logdir}/main.log + echo "## - (\"VERP_FORMAT\" and \"VERP_REGEXP\") in Defaults.py." >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "perl -i -n -p -e \"s#^(\s*recipient_delimiter.*)#\#\1\nrecipient_delimiter = +#\" $POSTFIX_CONFIGURATION" \ + >> ${logdir}/main.log + + + perl -i -n -p -e "s#^(\s*recipient_delimiter.*)#\#\1\nrecipient_delimiter = +#" $POSTFIX_CONFIGURATION + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Ersetzen des Parameters \"recipient_delimiter\" in der Postfix Konfigurationsdatei fehlgeschlagen" + fi + + else + echononl "Ergänze Postfix Konfigurationsdatei.\n Setze Parameter \"recipient_delimiter\".." + echo "" >> ${logdir}/main.log + echo "## - Ergänze Postfix Konfigurationsdatei mit Parameter \"recipient_delimiter\" auf den Wert \"+\" " \ + >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"recipient_delimiter = +\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + + echo "" >> $POSTFIX_CONFIGURATION + echo "recipient_delimiter = +" >> $POSTFIX_CONFIGURATION + echo "" >> $POSTFIX_CONFIGURATION + echo_ok + fi + +fi + +if ! grep -e "\s*unknown_local_recipient_reject_code\s*=\s*550" $POSTFIX_CONFIGURATION > /dev/null ; then + + if grep -e "\s*unknown_local_recipient_reject_code" $POSTFIX_CONFIGURATION > /dev/null ; then + + echononl "[ \033[1;33mWarnung\033[m ]: Ersetze \"unknown_local_recipient_reject_code (Postfix).\"\n Setze Parameter Wert auf \"550\".." + echo "" >> ${logdir}/main.log + echo "## - Warnung:" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "## - Ersetze \"unknown_local_recipient_reject_code\" in der Postfix Konfiguration mit dem Wert \"550\"." \ + >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "perl -i -n -p -e \"s#^(\s*unknown_local_recipient_reject_code.*)#\#\1\nunknown_local_recipient_reject_code = 550#\" $POSTFIX_CONFIGURATION" \ + >> ${logdir}/main.log + + + perl -i -n -p -e "s#^(\s*unknown_local_recipient_reject_code.*)#\#\1\nunknown_local_recipient_reject_code = 550#" $POSTFIX_CONFIGURATION + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Ersetzen des Parameters \"unknown_local_recipient_reject_code\" in der Postfix Konfigurationsdatei fehlgeschlagen" + fi + + else + echononl "Ergänze Postfix Konfigurationsdatei\n Setze Parameter \"unknown_local_recipient_reject_code\"auf Wert \"550\".." + echo "" >> ${logdir}/main.log + echo "## - Ergänze Postfix Konfigurationsdatei mit Parameter \"unknown_local_recipient_reject_code\"" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"unknown_local_recipient_reject_code = 550\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + + echo "" >> $POSTFIX_CONFIGURATION + echo "unknown_local_recipient_reject_code = 550" >> $POSTFIX_CONFIGURATION + echo "" >> $POSTFIX_CONFIGURATION + echo_ok + fi + +fi + + +## - Virtual Domains +## - +echo "" >> ${logdir}/main.log +echo "## - Konfiguriere Virtual Domains in Postfix" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log + + +if ! grep -e "hash:$_link/data/aliases" $POSTFIX_CONFIGURATION > /dev/null ; then + + ## - alias_maps + ## - + echononl "Konfiguriere Postfix Alias Maps (alias_maps).." + echo "" >> ${logdir}/main.log + echo "## - Konfiguriere Postfix Alias Maps (alias_maps).." >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + + if grep -e "^\s*alias_maps" $POSTFIX_CONFIGURATION > /dev/null ; then + + echo " echo \"perl -i -n -p -e \\\"s#^(\s*alias_maps\s*=.*)#\1\n hash:$_link/data/aliases#\\\" $POSTFIX_CONFIGURATION\" >> ${logdir}/main.log" >> ${logdir}/main.log + + echo "perl -i -n -p -e \"s#^(\s*alias_maps\s*=.*)#\1\n hash:$_link/data/aliases#\" $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + + perl -i -n -p -e "s#^(\s*alias_maps\s*=.*)#\1\n hash:$_link/data/aliases#" $POSTFIX_CONFIGURATION + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Konfiguration Postfix \"alias_maps\" (${domain}) ist fehlgeschlagen" + fi + else + + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"alias_maps = \" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \" hash:$_link/data/aliases\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"\"" >> ${logdir}/main.log + + echo "" >> $POSTFIX_CONFIGURATION + echo "alias_maps = " >> $POSTFIX_CONFIGURATION + echo " hash:$_link/data/aliases" >> $POSTFIX_CONFIGURATION + echo "" >> $POSTFIX_CONFIGURATION + echo_ok + fi +fi + +## - virtual_alias_domains +## - +for domain in $MAILMAN_DOMAINS ; do + if ! grep -e "$domain" $POSTFIX_CONFIGURATION > /dev/null ; then + echononl "Konfiguriere Postfix Virtual Domains: \"virtual_alias_domains\"\n Maildomain: ${domain}.." + echo "" >> ${logdir}/main.log + echo "## - Konfigurere Postfix Virtual Domains: \"virtual_alias_domains\"" >> ${logdir}/main.log + echo "## - Maildomain: $domain" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + + if grep -e "^\s*virtual_alias_domains" $POSTFIX_CONFIGURATION > /dev/null ; then + + echo "perl -i -n -p -e \"s#^(\s*virtual_alias_domains\s*=.*)#\1\n $domain#\" $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + + perl -i -n -p -e "s#^(\s*virtual_alias_domains\s*=.*)#\1\n $domain#" $POSTFIX_CONFIGURATION + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Konfiguration Postfix \"virtual_alias_domains\" (${domain}) ist fehlgeschlagen" + fi + else + + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"virtual_alias_domains = \" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \" $domain\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"\"" >> ${logdir}/main.log + + echo "" >> $POSTFIX_CONFIGURATION + echo "virtual_alias_domains = " >> $POSTFIX_CONFIGURATION + echo " $domain" >> $POSTFIX_CONFIGURATION + echo "" >> $POSTFIX_CONFIGURATION + echo_ok + fi + fi +done + + +## - virtual_alias_maps +## - +if ! grep -e "hash:$_link/data/virtual-mailman" $POSTFIX_CONFIGURATION > /dev/null ; then + echononl "Konfiguriere Postfix Virtual Domains: \"virtual_alias_maps\".." + echo "" >> ${logdir}/main.log + echo "## - Konfiguriere Postfix Virtual Domains: \"virtual_alias_maps\"" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + + if grep -e "\s*virtual_alias_maps" $POSTFIX_CONFIGURATION > /dev/null ; then + + echo "perl -i -n -p -e \"s#^(\s*virtual_alias_maps\s*=.*)#\1\n \#\# - Mailman\n hash:$_link/data/virtual-mailman#\" $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + + perl -i -n -p -e "s#^(\s*virtual_alias_maps\s*=.*)#\1\n \#\# - Mailman\n hash:$_link/data/virtual-mailman #" $POSTFIX_CONFIGURATION + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Konfiguration Postfix \"virtual_alias_maps\" ist fehlgeschlagen" + fi + else + + echo "echo \"\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"virtual_alias_maps = \" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \" hash:$_link/data/virtual-mailman\" >> $POSTFIX_CONFIGURATION" >> ${logdir}/main.log + echo "echo \"\"" >> ${logdir}/main.log + + echo "" >> $POSTFIX_CONFIGURATION + echo "virtual_alias_maps = " >> $POSTFIX_CONFIGURATION + echo " hash:$_link/data/virtual-mailman" >> $POSTFIX_CONFIGURATION + echo "" >> $POSTFIX_CONFIGURATION + echo_ok + fi +fi + + +echononl "Reload Postfix Mailserver.." +echo "" >> ${logdir}/main.log +echo "## - Reload Postfix Mailserver" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "/etc/init.d/postfix reload" >> ${logdir}/main.log + +/etc/init.d/postfix reload > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Das Restarten des Postfix Mailservers ist fehlgeschlagen" +fi + +echo "" >> ${logdir}/main.log +echo "## - !! Bemerkung !!" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Pruefe die Postfix Konfigurationsdatei $POSTFIX_CONFIGURATION" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Es müssen die folgenden Einträge vorhanden sein:" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - recipient_delimiter = +" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - virtual_alias_maps =" >> ${logdir}/main.log +echo "## - hash:$_link/data/virtual-mailman" >> ${logdir}/main.log +echo "## - .." >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - virtual_alias_maps =" >> ${logdir}/main.log +echo "## - hash:/usr/local/mailman/data/virtual-mailman" >> ${logdir}/main.log +echo "## - .." >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log +echo "## - virtual_alias_domains =" >> ${logdir}/main.log +for domain in $MAILMAN_DOMAINS ; do + echo "## - $domain" >> ${logdir}/main.log +done +echo "## - " >> ${logdir}/main.log +echo "## - optional:" >> ${logdir}/main.log +echo "## - unknown_local_recipient_reject_code = 550" >> ${logdir}/main.log +echo "## - " >> ${logdir}/main.log + +domain="" +DEFAULT_EMAIL_HOST="" +DEFAULT_URL_HOST="" +POSTFIX_STYLE_VIRTUAL_DOMAINS="[" +ADD_VIRTUALHOST="" +_ADD_VIRTUALHOST="" +declare -i _count=1 +for domain in $MAILMAN_DOMAINS ; do + if [ $_count -eq 1 ]; then + DEFAULT_EMAIL_HOST=$domain + DEFAULT_URL_HOST=$domain + POSTFIX_STYLE_VIRTUAL_DOMAINS="${POSTFIX_STYLE_VIRTUAL_DOMAINS}'$domain'" + elif [ $_count -eq 2 ];then + POSTFIX_STYLE_VIRTUAL_DOMAINS="${POSTFIX_STYLE_VIRTUAL_DOMAINS}, '$domain'" + ADD_VIRTUALHOST="add_virtualhost('$domain', '$domain')" + _ADD_VIRTUALHOST="add_virtualhost('$domain', '$domain')" + else + POSTFIX_STYLE_VIRTUAL_DOMAINS="${POSTFIX_STYLE_VIRTUAL_DOMAINS}, '$domain'" + ADD_VIRTUALHOST="$ADD_VIRTUALHOST +add_virtualhost('$domain', '$domain')" + _ADD_VIRTUALHOST="$_ADD_VIRTUALHOST +## - add_virtualhost('$domain', '$domain')" + fi + let _count++ +done +POSTFIX_STYLE_VIRTUAL_DOMAINS="${POSTFIX_STYLE_VIRTUAL_DOMAINS}]" +POSTFIX_ALIAS_CMD=`which postalias` +POSTFIX_MAP_CMD=`which postmap` + +echononl "Passe Mailman Konfiguration an (mm_cfg.py).." +cat <> ${MAILMAN_INSTALL_DIR}/Mailman/mm_cfg.py +##### +# General system-wide Parameters +##### + +# The default language for this server. Whenever we can't figure out the list +# context or user context, we'll fall back to using this language. See +# LC_DESCRIPTIONS below for legal values. +DEFAULT_SERVER_LANGUAGE = 'de' + +# Mailman needs to know about (at least) two fully-qualified domain names +# (fqdn); 1) the hostname used in your urls, and 2) the hostname used in email +# addresses for your domain. For example, if people visit your Mailman system +# with "http://www.dom.ain/mailman" then your url fqdn is "www.dom.ain", and +# if people send mail to your system via "yourlist@dom.ain" then your email +# fqdn is "dom.ain". DEFAULT_URL_HOST controls the former, and +# DEFAULT_EMAIL_HOST controls the latter. Mailman also needs to know how to +# map from one to the other (this is especially important if you're running +# with virtual domains). You use "add_virtualhost(urlfqdn, emailfqdn)" to add +# new mappings. +# +# If you don't need to change DEFAULT_EMAIL_HOST and DEFAULT_URL_HOST in your +# mm_cfg.py, then you're done; the default mapping is added automatically. If +# however you change either variable in your mm_cfg.py, then be sure to also +# include the following: +# +# add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) +# +# because otherwise the default mappings won't be correct. +DEFAULT_EMAIL_HOST = '$DEFAULT_EMAIL_HOST' +DEFAULT_URL_HOST = '$DEFAULT_URL_HOST' + +DEFAULT_URL_PATTERN = 'https://%s/mailman/' +PUBLIC_ARCHIVE_URL = 'https://%(hostname)s/pipermail/%(listname)s' + + + +##### +# Virtual domains +##### + +# If any of the values DEFAULT_URL_HOST or DEFAULT_EMAIL_HOST was changed, +# you had to set also: +# add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) +add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) + +# Use "add_virtualhost(urlfqdn, emailfqdn)" to add more mappings +$ADD_VIRTUALHOST + + + +##### +# Delivery Parameters +##### + +# Final delivery module for outgoing mail. This handler is used for message +# delivery to the list via the smtpd, and to an individual user. This value +# must be a string naming a module in the Mailman.Handlers package. +# +# WARNING: Sendmail has security holes and should be avoided. In fact, you +# must read the Mailman/Handlers/Sendmail.py file before it will work for +# you. +# +#DELIVERY_MODULE = 'Sendmail' +DELIVERY_MODULE = 'SMTPDirect' + +# MTA should name a module in Mailman/MTA which provides the MTA specific +# functionality for creating and removing lists. Some MTAs like Exim can be +# configured to automatically recognize new lists, in which case the MTA +# variable should be set to None. Use 'Manual' to print new aliases to +# standard out (or send an email to the site list owner) for manual twiddling +# of an /etc/aliases style file. Use 'Postfix' if you are using the Postfix +# MTA -- but then also see POSTFIX_STYLE_VIRTUAL_DOMAINS. +MTA = 'Postfix' + +# If you set MTA='Postfix', then you also want to set the following variable, +# depending on whether you're using virtual domains in Postfix, and which +# style of virtual domain you're using. Set this to the empty list if you're +# not using virtual domains in Postfix, or if you're using Sendmail-style +# virtual domains (where all addresses are visible in all domains). If you're +# using Postfix-style virtual domains, where aliases should only show up in +# the virtual domain, set this variable to the list of host_name values to +# write separate virtual entries for. I.e. if you run dom1.ain, dom2.ain, and +# dom3.ain, but only dom2 and dom3 are virtual, set this variable to the list +# ['dom2.ain', 'dom3.ain']. Matches are done against the host_name attribute +# of the mailing lists. See the Postfix section of the installation manual +# for details. +POSTFIX_STYLE_VIRTUAL_DOMAINS = $POSTFIX_STYLE_VIRTUAL_DOMAINS + +# These variables describe the program to use for regenerating the aliases.db +# and virtual-mailman.db files, respectively, from the associated plain text +# files. The file being updated will be appended to this string (with a +# separating space), so it must be appropriate for os.system(). +POSTFIX_ALIAS_CMD = '$POSTFIX_ALIAS_CMD' +POSTFIX_MAP_CMD = '$POSTFIX_MAP_CMD' + +# SMTP host and port, when DELIVERY_MODULE is 'SMTPDirect'. Make sure the +# host exists and is resolvable (i.e., if it's the default of "localhost" be +# sure there's a localhost entry in your /etc/hosts file!) +SMTPHOST = 'localhost' +# Mmails are already checked, so we push them through smtp listen +# on localhost port 10025 +SMTPPORT = 10025 + +# Set this variable to Yes to allow list owners to delete their own mailing +# lists. You may not want to give them this power, in which case, setting +# this variable to No instead requires list removal to be done by the site +# administrator, via the command line script bin/rmlist. +OWNERS_CAN_DELETE_THEIR_OWN_LISTS = Yes + +EOF + +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Kann Mailman Konfigurationsdatei \" ${MAILMAN_INSTALL_DIR}/Mailman/mm_cfg.py\" nicht anpassen" +fi + +echo "" >> ${logdir}/main.log +echo "## - Passe Mailman Konfiguration an" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Benutzerspezifische Einstellungen in Datei ${MAILMAN_INSTALL_DIR}/Mailman/mm_cfg.py" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "cat < ${MAILMAN_INSTALL_DIR}/Mailman/mm_cfg.py" >> ${logdir}/main.log +cat ${MAILMAN_INSTALL_DIR}/Mailman/mm_cfg.py >> ${logdir}/main.log +echo "EOF" >> ${logdir}/main.log + + + +echo "" >> ${logdir}/main.log +echo "## - !! Bemerkung !!" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Pruefe die Mailman Konfigurationsdatei ${MAILMAN_INSTALL_DIR}/Mailman/mm_cfg.py" >> ${logdir}/main.log +echo "## - Alle notwendigen Änderungen sollten in der Datei \"mm_cfg.py\" vorgenommen werden," >> ${logdir}/main.log +echo "## - Nicht in \"Defaults.py\"" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Es müssen die folgenden Einträge vorhanden sein:" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - DEFAULT_SERVER_LANGUAGE = 'de'" >> ${logdir}/main.log +echo "## - DEFAULT_EMAIL_HOST = '$DEFAULT_EMAIL_HOST'" >> ${logdir}/main.log +echo "## - DEFAULT_URL_HOST = '$DEFAULT_URL_HOST'" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - ## - Falls https" >> ${logdir}/main.log +echo "## - DEFAULT_URL_PATTERN = 'https://%s/mailman/'" >> ${logdir}/main.log +echo "## - PUBLIC_ARCHIVE_URL = 'https://%(hostname)s/pipermail/%(listname)s'" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" >> ${logdir}/main.log +echo "## - $_ADD_VIRTUALHOST" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - DELIVERY_MODULE = 'SMTPDirect'" >> ${logdir}/main.log +echo "## - MTA = 'Postfix'" >> ${logdir}/main.log +echo "## - POSTFIX_STYLE_VIRTUAL_DOMAINS = $POSTFIX_STYLE_VIRTUAL_DOMAINS" >> ${logdir}/main.log +echo "## - POSTFIX_ALIAS_CMD = '$POSTFIX_ALIAS_CMD'" >> ${logdir}/main.log +echo "## - POSTFIX_MAP_CMD = '$POSTFIX_MAP_CMD'" >> ${logdir}/main.log +echo "## - SMTPHOST = 'localhost'" >> ${logdir}/main.log +echo "## - SMTPPORT = 10025" >> ${logdir}/main.log +echo "## - OWNERS_CAN_DELETE_THEIR_OWN_LISTS = Yes" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log + + +echo "" +echo "" >> ${logdir}/main.log +echo "cd ${MAILMAN_INSTALL_DIR}" >> ${logdir}/main.log +cd ${MAILMAN_INSTALL_DIR} > /dev/null 2>&1 + +echononl "Initialisiere Mailman alias Datei (data/aliases*).." +echo "" >> ${logdir}/main.log +echo "## - Initialisiere Mailman alias Datei (data/aliases*)" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "bin/genaliases" >> ${logdir}/main.log + +bin/genaliases +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Initialiasierung der Mailman alias Datei \"data/aliases*\" fehlgeschlagen" +fi + + +echononl "Setze Dateiberechtigungen \"${MAILMAN_INSTALL_DIR}/data/aliases*\".." +echo "" >> ${logdir}/main.log +echo "## - Setze Verzeichnisberechtigungen" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "chown $MAILMAN_USER:$MAILMAN_GROUP ${MAILMAN_INSTALL_DIR}/data/aliases*" >> ${logdir}/main.log + +chown $MAILMAN_USER:$MAILMAN_GROUP ${MAILMAN_INSTALL_DIR}/data/aliases* > /dev/null 2>&1 +if [ "$?" != "0" ]; then + echo_failed + fatal "Kann Dateiberechtigungen für \"${MAILMAN_INSTALL_DIR}/data/aliases\" nicht setzen.." +fi + +echo "chmod g+w ${MAILMAN_INSTALL_DIR}/data/aliases*" >> ${logdir}/main.log + +chmod g+w ${MAILMAN_INSTALL_DIR}/data/aliases* > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Kann Dateiberechtigungen für \"${MAILMAN_INSTALL_DIR}/data/aliases\" nicht setzen.." +fi + + +if [ -f ${MAILMAN_INSTALL_DIR}/data/virtual-mailman ]; then + + echononl "Setze Dateiberechtigungen \"${MAILMAN_INSTALL_DIR}/data/virtual-mailman*\".." + echo "" >> ${logdir}/main.log + echo "## - Setze Verzeichnisberechtigungen" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "chown $MAILMAN_USER:$MAILMAN_GROUP ${MAILMAN_INSTALL_DIR}/data/virtual-mailman*" >> ${logdir}/main.log + + chown $MAILMAN_USER:$MAILMAN_GROUP ${MAILMAN_INSTALL_DIR}/data/virtual-mailman* > /dev/null 2>&1 + if [ "$?" != "0" ]; then + echo_failed + fatal "Kann Dateiberechtigungen für \"${MAILMAN_INSTALL_DIR}/data/virtual-mailman*\" nicht setzen.." + fi + + echo "chmod g+w ${MAILMAN_INSTALL_DIR}/data/virtual-mailman*" >> ${logdir}/main.log + + chmod g+w ${MAILMAN_INSTALL_DIR}/data/virtual-mailman* > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann Dateiberechtigungen für \"${MAILMAN_INSTALL_DIR}/data/virtual-mailman\" nicht setzen.." + fi + +fi + +## ***************************** +## --- Abschlussarbeiten Mailman +echo "" +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "" >> ${logdir}/main.log 2>&1 +echo "## ************************************" >> ${logdir}/main.log 2>&1 +echo "## --- Abschlussarbeiten Mailman" >> ${logdir}/main.log 2>&1 + + +echononl "Erstelle Systemweite Maillingliste \"mailman\".." +echo "" >> ${logdir}/main.log +echo "## - Erstelle Systemweite Maillingliste \"mailman\"" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - Liste: mailman@$DEFAULT_EMAIL_HOST" >> ${logdir}/main.log +if $SHOW_PASS ; then + echo "## - Passwort: $LIST_MAILMAN_PASS" >> ${logdir}/main.log +else + echo "## - Passwort: **********" >> ${logdir}/main.log +fi +echo "## -" >> ${logdir}/main.log +echo "bin/newlist -q mailman $MAILMAN_ADMIN_EMAIL $LIST_MAILMAN_PASS" >> ${logdir}/main.log + +bin/newlist -q mailman $MAILMAN_ADMIN_EMAIL $LIST_MAILMAN_PASS > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Kann Systemweite Maillingliste \"mailman\" nicht erstellen" +fi + + +echononl "Kopiere Mailman Startscript nach /etc/init.d/.." +echo "" >> ${logdir}/main.log +echo "## - Kopiere Mailman Startscript nach /etc/init.d/" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "cp ${MAILMAN_INSTALL_DIR}/scripts/mailman /etc/init.d/mailman" >> ${logdir}/main.log + +cp ${MAILMAN_INSTALL_DIR}/scripts/mailman /etc/init.d/mailman +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Kann Startsrkript \"${MAILMAN_INSTALL_DIR}/scripts/mailman\" nicht nach /etc/init.d/mailman kopieren" +fi + +if [ "$DISTRIBUTION" = "Debian" ];then + + echononl "Starte Mailman beim booten.." + echo "" >> ${logdir}/main.log + echo "## - Starte Mailman beim booten" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "update-rc.d mailman defaults" >> ${logdir}/main.log + + update-rc.d mailman defaults > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Erstellen der Symlinks (update-rc.d mailman defaults) in den Runlevel Verzeichnissen fehlgeschlagen" + fi +else + + _failed=false + echononl "Erstelle Symlinks in den Runlevel Verzeichnissen (start at boot time).." + echo "## - Erstelle Symlinks in den Runlevel Verzeichnissen (start at boot time)" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "ln -s ../init.d/mailman /etc/rc.d/rc0.d/K12mailman" + + if [ -d /etc/rc.d/rc0.d ]; then + ln -s ../init.d/mailman /etc/rc.d/rc0.d/K12mailman + elif [ -d /etc/rc0.d ];then + ln -s ../init.d/mailman /etc/rc0.d/K12mailman + else + echo_failed + _failed=true + fi + + if ! $_failed ; then + if [ -d /etc/rc.d/rc1.d ]; then + echo "ln -s ../init.d/mailman /etc/rc.d/rc1.d/K12mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc.d/rc1.d/K12mailman + elif [ -d /etc/rc1.d ];then + echo "ln -s ../init.d/mailman /etc/rc1.d/K12mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc1.d/K12mailman + else + echo_failed + _failed=true + fi + fi + + if ! $_failed ; then + if [ -d /etc/rc.d/rc2.d ]; then + echo "ln -s ../init.d/mailman /etc/rc.d/rc2.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc.d/rc2.d/S98mailman + elif [ -d /etc/rc2.d ];then + echo "ln -s ../init.d/mailman /etc/rc2.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc2.d/S98mailman + else + echo_failed + _failed=true + fi + fi + + if ! $_failed ; then + if [ -d /etc/rc.d/rc3.d ]; then + echo "ln -s ../init.d/mailman /etc/rc.d/rc3.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc.d/rc3.d/S98mailman + elif [ -d /etc/rc3.d ];then + echo "ln -s ../init.d/mailman /etc/rc3.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc3.d/S98mailman + else + echo_failed + _failed=true + fi + fi + + if ! $_failed ; then + if [ -d /etc/rc.d/rc4.d ]; then + echo "ln -s ../init.d/mailman /etc/rc.d/rc4.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc.d/rc4.d/S98mailman + elif [ -d /etc/rc4.d ];then + echo "ln -s ../init.d/mailman /etc/rc4.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc4.d/S98mailman + else + echo_failed + _failed=true + fi + fi + + if ! $_failed ; then + if [ -d /etc/rc.d/rc5.d ]; then + echo "ln -s ../init.d/mailman /etc/rc.d/rc5.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc.d/rc5.d/S98mailman + elif [ -d /etc/rc5.d ];then + echo "ln -s ../init.d/mailman /etc/rc5.d/S98mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc5.d/S98mailman + else + echo_failed + _failed=true + fi + fi + + if ! $_failed ; then + if [ -d /etc/rc.d/rc6.d ]; then + echo "ln -s ../init.d/mailman /etc/rc.d/rc6.d/K12mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc.d/rc6.d/K12mailman + elif [ -d /etc/rc6.d ];then + echo "ln -s ../init.d/mailman /etc/rc6.d/K12mailman" >> ${logdir}/main.log + ln -s ../init.d/mailman /etc/rc6.d/K12mailman + else + echo_failed + _failed=true + fi + fi + + if ! $_failed ; then + echo_ok + else + echo_failed + fatal "Kann Symlinks in den Runlevel Verzeichnissen nicht erstellen (start at boot time)" + fi +fi + + +echononl "Starte Mailman qrunner" +echo "" >> ${logdir}/main.log +echo "## - Starte Mailman qrunner" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "/etc/init.d/mailman start" >> ${logdir}/main.log + +/etc/init.d/mailman start +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Starten von Mailman qrunner fehlgeschlagen" +fi + + +echononl "Erstelle Masterpasswort für Mailman.." +echo "" >> ${logdir}/main.log +echo "## - Erstelle Masterpasswort für Mailman" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## - "Das Masterpasswort kann an allen Stellen benutzt werden, an denen nach >> ${logdir}/main.log +echo "## - "dem Passwort eines Listenadministrators gefragt wird. Dieses wiederrum kann >> ${logdir}/main.log +echo "## - "an fast allen Stellen benutzt werden, an denen nach dem Passwort eines Listen- >> ${logdir}/main.log +echo "## - "Mitgliedes verlangt wird. >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +if $SHOW_PASS ; then + echo "## - Mailman Master Passwort: $MAILMAN_MASTER_PASS" >> ${logdir}/main.log +else + echo "## - Mailman Master Passwort: **********" >> ${logdir}/main.log +fi +echo "## -" >> ${logdir}/main.log +echo "${MAILMAN_INSTALL_DIR}/bin/mmsitepass $MAILMAN_MASTER_PASS" >> ${logdir}/main.log + +${MAILMAN_INSTALL_DIR}/bin/mmsitepass $MAILMAN_MASTER_PASS > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Erstellen Masterpassworts für Mailman fehlgeschlagen" +fi + + + + +echononl "Erstelle Administrator Passwort (zur Erstellung von Listen).." +echo "" >> ${logdir}/main.log +echo "## - Erstelle Administrator Passwort (zur Erstellung von Listen)" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log +if $SHOW_PASS ; then + echo "## - Passwort Listenadministrator: $MAILMAN_ADMIN_PASS" >> ${logdir}/main.log +else + echo "## - Passwort Listenadministrator: **********" >> ${logdir}/main.log +fi +echo "## -" >> ${logdir}/main.log +echo "${MAILMAN_INSTALL_DIR}/bin/mmsitepass -c $MAILMAN_ADMIN_PASS" >> ${logdir}/main.log + +${MAILMAN_INSTALL_DIR}/bin/mmsitepass -c $MAILMAN_ADMIN_PASS > /dev/null 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Erstellen des Passworts für den Listenadministrator fehlgeschlagen" +fi + + +if [ -f ${MAILMAN_INSTALL_DIR}/data/virtual-mailman ]; then + + echononl "Setze Dateiberechtigungen \"${MAILMAN_INSTALL_DIR}/data/virtual-mailman*\".." + echo "" >> ${logdir}/main.log + echo "## - Setze Verzeichnisberechtigungen" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "chown $MAILMAN_USER:$MAILMAN_GROUP ${MAILMAN_INSTALL_DIR}/data/virtual-mailman*" >> ${logdir}/main.log + + chown $MAILMAN_USER:$MAILMAN_GROUP ${MAILMAN_INSTALL_DIR}/data/virtual-mailman* > /dev/null 2>&1 + if [ "$?" != "0" ]; then + echo_failed + fatal "Kann Dateiberechtigungen für \"${MAILMAN_INSTALL_DIR}/data/virtual-mailman*\" nicht setzen.." + fi + + echo "chmod g+w ${MAILMAN_INSTALL_DIR}/data/virtual-mailman*" >> ${logdir}/main.log + + chmod g+w ${MAILMAN_INSTALL_DIR}/data/virtual-mailman* > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fatal "Kann Dateiberechtigungen für \"${MAILMAN_INSTALL_DIR}/data/virtual-mailman\" nicht setzen.." + fi + +fi + +echononl "Erstelle Mailman Cron Jobs.." +echo "" >> ${logdir}/main.log +echo "## - Erstelle Mailman Cron Jobs" >> ${logdir}/main.log +echo "## -" >> ${logdir}/main.log + +echo "echo \"MAILTO=$MAILMAN_ADMIN_EMAIL\" > /tmp/crontab.mailman" >> ${logdir}/main.log +echo "MAILTO=$MAILMAN_ADMIN_EMAIL" > /tmp/crontab.mailman +if [ "$?" != "0" ]; then + echo_failed + fatal "Kann Mailman Cron Jobs nicht einrichten.\n\n\techo \"MAILTO=$MAILMAN_ADMIN_EMAIL\" > /tmp/crontab.mailman failed" +fi + +echo "cat ${MAILMAN_INSTALL_DIR}/cron/crontab.in >> /tmp/crontab.mailman" >> ${logdir}/main.log +cat ${MAILMAN_INSTALL_DIR}/cron/crontab.in >> /tmp/crontab.mailman +if [ "$?" != "0" ]; then + echo_failed + fatal "Kann Mailman Cron Jobs nicht einrichten.\n\n\tcat ${MAILMAN_INSTALL_DIR}/cron/crontab.in >> /tmp/crontab.mailman failed" +fi + +echo "crontab -u $MAILMAN_USER /tmp/crontab.mailman" >> ${logdir}/main.log +crontab -u $MAILMAN_USER /tmp/crontab.mailman +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed + fatal "Kann Mailman Cron Jobs nicht einrichten.\n\n\tcrontab -u $MAILMAN_USER /tmp/crontab.mailman failed" +fi + +echo "rm /tmp/crontab.mailman" >> ${logdir}/main.log +rm /tmp/crontab.mailman + + +echo "" >> ${logdir}/main.log +echo "" +exit 0 +