From 9b65e911a1d6d09fa977507f30b89c0b51694e9f Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 19 Feb 2017 15:55:57 +0100 Subject: [PATCH] Add script create_sympa_listdomain.sh --- create_sympa_listdomain.sh | 1433 ++++++++++++++++++++++++++++++++++++ install_sympa.sh | 2 +- 2 files changed, 1434 insertions(+), 1 deletion(-) create mode 100755 create_sympa_listdomain.sh diff --git a/create_sympa_listdomain.sh b/create_sympa_listdomain.sh new file mode 100755 index 0000000..bd98615 --- /dev/null +++ b/create_sympa_listdomain.sh @@ -0,0 +1,1433 @@ +#!/usr/bin/env bash +# +## --- +## --- Sympa Multidomain Setup +## --- +if [ -n "$1" ]; then + SYMPA_LIST_DOMAIN=$1 +else + SYMPA_LIST_DOMAIN= +fi + +_VSERVER_GUEST=yes + + + +## --- 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 "[ \033[31m\033[1mError\033[m ]: $*" + echo "" + echo -e "\t\033[31m\033[1mInstalllation is canceled\033[m\033[m" + echo "" + exit 1 +} + +warn (){ + echo "" + echo -e "\t[ \033[33m\033[1mWarning\033[m ]: $*" + echo "" +} + +info (){ + echo "" + echo -e "\t[ \033[33m\033[1mInfo\033[m ]: $*" + echo "" +} + +error(){ + echo "" + echo -e "\t[ \033[31m\033[1mFehler\033[m ]: $*" + echo "" +} + +echo_ok() { + echo -e "\033[75G[ \033[32mok\033[m ]" +} +echo_failed(){ + echo -e "\033[75G[ \033[1;31mfailed\033[m ]" +} +echo_skipped() { + echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]" +} +## --- +## --- END: functions + + +## - Determin Sympa Home Directory +## - +SYMPA_HOME=`echo ~sympa` +if [ ! -d "$SYMPA_HOME" ]; then + fatal "Cannot find Sympas Home (Installation) Directory" +fi +SYMPA_USER=`stat -c '%U' $SYMPA_HOME` +SYMPA_GROUP=`stat -c '%G' $SYMPA_HOME` + + +## - Determin the IP-Addresses +## - +__ipv4="`ifconfig | grep -e \"^\s*inet Adresse\" | grep -v \"127.0.0.1\" | awk '{print$2}' | cut -d\":\" -f2 | sort | head -1`" +__ipv6="`ifconfig | grep -e \"^\s*inet6-Adresse\" | awk '{print$2}' | grep -v -e \"^::1/\" | grep -v -e \"^fe80\" | cut -d\"/\" -f1 | sort | head -1`" + + +_debian_apache_installation=false +_base_webserver_info_needed=false +_apache_vhost_dir="" +apache_log_dir="" +apache_conf_dir="" +apache_vhost_dir="" +## - Determin VHost Configuration Directory +## - +if dpkg -l apache2 2> /dev/null | grep -e "^ii" > /dev/null 2>&1 ; then + + _debian_apache_installation=true + + if [ -d "/etc/apache2" -a -d "/etc/apache2/sites-available" ]; then + apache_vhost_dir=/etc/apache2/sites-available + apache_conf_dir=/etc/apache2 + if [ -d "/var/log/apache2" ]; then + apache_log_dir=/var/log/apache2 + else + error "Found Debian Apache Installation, but no Log Directory found!" + fatal "Something went wron with your Apache Installation" + fi + else + error "Found Debian Apache Installation, but no Configuration Directory for vhosts!" + fatal "Something went wron with your Apache Installation" + fi + +else + + ## - Determin httpd binary + ## - + _httpd_binary="`which httpd`" + if [ -z "$_httpd_binary" ]; then + _httpd_binary="`ps -C httpd -f | grep -e \"^root\" | awk '{print$8}'`" + if [ -z "$_httpd_binary" ]; then + if [ -x "/usr/local/apache2/bin/httpd" ]; then + _httpd_binary="/usr/local/apache2/bin/httpd" + fi + fi + fi + ## - Determin ServerRoot Directory + ## - + apache_base_dir_found=false + _pass_apache_base_dir=false + apache_base_dir=`$_httpd_binary -t -D DUMP_RUN_CFG | grep ServerRoot | awk '{print$2}' | tr -d '"'` + if [ "`realpath /usr/local/apache2`" = "$apache_base_dir" ]; then + apache_base_dir="/usr/local/apache2" + _apache_base_dir_realpath="`realpath $apache_base_dir`" + elif [ -z "$apache_base_dir" ]; then + if [ -d "`realpath /usr/local/apache2`" ];then + apache_base_dir="/usr/local/apache2" + _apache_base_dir_realpath="`realpath $apache_base_dir`" + fi + else + _apache_base_dir_realpath=$apache_base_dir + fi + if [ -z "$apache_base_dir" ];then + _base_webserver_info_needed=true + apache_base_dir_found=true + else + _pass_apache_base_dir=true + fi + + ## - Determin Apache Configuration Directory + ## - + apache_conf_dir_found=false + if [ -n "$apache_base_dir" ];then + if [ -d "${apache_base_dir}/conf" ]; then + apache_conf_dir=${apache_base_dir}/conf + apache_conf_dir_found=true + else + _base_webserver_info_needed=true + fi + else + _base_webserver_info_needed=true + fi + + ## - Determin Apache Log Directory + ## - + _apache_errorlog_dir=`$_httpd_binary -t -D DUMP_RUN_CFG | grep "Main ErrorLog:" | awk '{print$3}' | tr -d '"'` + if [ -d "`dirname $_apache_errorlog_dir`" ]; then + apache_log_dir=`dirname $_apache_errorlog_dir` + fi + + ## - Determin VHost Configuration Directory + ## - + if [ -d "${apache_conf_dir}/vhosts" ]; then + _apache_vhost_dir=${apache_conf_dir}/vhosts + fi +fi + +if $_base_webserver_info_needed ; then + fatal "Apache Webserver not found!" +fi + +_postfix_info_needed=false +if [ -f "/etc/postfix/sympa_domains" ]; then + POSTFIX_RELAY_DOMAIN_FILE=/etc/postfix/sympa_domains +else + _postfix_info_needed=true +fi +if [ -f "/etc/postfix/sympa_transport" ];then + POSTFIX_TRANSPORT_FILE=/etc/postfix/sympa_transport +else + _postfix_info_needed=true +fi +#if [ -f "/etc/postfix/sympa_recipient_canonical_maps" ];then +# POSTFIX_CANONICAL_MAPS=/etc/postfix/sympa_recipient_canonical_maps +#else +# _postfix_info_needed=true +#fi +if [ -f "/etc/postfix/sympa_virtual_aliases" ];then + POSTFIX_VIRTUAL_ALIAS_MAPS=/etc/postfix/sympa_virtual_aliases +else + _postfix_info_needed=true +fi + + +clear +echo +echo +echo -e "\033[21G\033[32mCreate new domain for Sympa mailing list manager \"`hostname -f`\"..\033[m" + +echo "" +echo "" +echo -e "\033[32m--\033[m" +echo "" +if [ -z "$SYMPA_LIST_DOMAIN" ]; then + echo "Insert the Name for new domain (i.e. lists.oopen.de)." + echo "" + echo "" + SYMPA_LIST_DOMAIN= + echononl "Name of the new domain: " + read SYMPA_LIST_DOMAIN + while [ "X$SYMPA_LIST_DOMAIN" = "X" ] ; do + echo -e "\n\t\033[33m\033[1mDomain name is madatory. retry..\033[m\n" + echononl "Name of the new domain: " + read SYMPA_LIST_DOMAIN + done +else + echo "Create Configuration for domain \"$SYMPA_LIST_DOMAIN\".." +fi + + +## - Try to find Sympa's main configuration file +## - +if [ -f "/etc/sympa/sympa.conf" ];then + _SYMPA_MAIN_CONF_FILE=/etc/sympa/sympa.conf +elif [ -f "${SYMPA_HOME}/etc/sympa.conf" ];then + _SYMPA_MAIN_CONF_FILE=${SYMPA_HOME}/etc/sympa.conf +else + _SYMPA_MAIN_CONF_FILE= +fi +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Insert Main Configuration File for Sympa Installation. " +echo "" +SYMPA_MAIN_CONF_FILE= +if [ -n "$_SYMPA_MAIN_CONF_FILE" ]; then + echononl "Sympa's main configuration file [${_SYMPA_MAIN_CONF_FILE}]: " + read SYMPA_MAIN_CONF_FILE + if [ "X$SYMPA_MAIN_CONF_FILE" = "X" ]; then + SYMPA_MAIN_CONF_FILE=$_SYMPA_MAIN_CONF_FILE + fi +else + while [ "X$SYMPA_MAIN_CONF_FILE" = "X" ]; do + echononl "Sympa's main configuration file: " + read SYMPA_MAIN_CONF_FILE + if [ -z "$SYMPA_MAIN_CONF_FILE" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + fi + done +fi +if [ ! -f "$SYMPA_MAIN_CONF_FILE" ]; then + fatal "Sympa's main configuration file (${SYMPA_MAIN_CONF_FILE}) not found" +fi + +## - Base List Data Directory +## - +if grep -e "^\s*home" $SYMPA_MAIN_CONF_FILE > /dev/null 2>&1 ; then + _SYMPA_LIST_DATA_DIR=`grep -e "^\s*home" $SYMPA_MAIN_CONF_FILE 2> /dev/null | awk '{print$2}'` +elif grep -e "^\s*#\s*home" $SYMPA_MAIN_CONF_FILE > /dev/null 2>&1 ; then + _SYMPA_LIST_DATA_DIR=`grep -e "^\s*#\s*home" $SYMPA_MAIN_CONF_FILE 2> /dev/null | awk '{print$2}'` +fi + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Insert Base Directory containing Lists Data Directories. " +echo "" +SYMPA_LIST_DATA_DIR= +if [ -n "$_SYMPA_LIST_DATA_DIR" ]; then + echononl "Sympa's base lists data directory [${_SYMPA_LIST_DATA_DIR}]: " + read SYMPA_LIST_DATA_DIR + if [ "X$SYMPA_LIST_DATA_DIR" = "X" ]; then + SYMPA_LIST_DATA_DIR=$_SYMPA_LIST_DATA_DIR + fi +else + while [ "X$SYMPA_LIST_DATA_DIR" = "X" ]; do + echononl "Sympa's base lists data directory: " + read SYMPA_LIST_DATA_DIR + if [ -z "$SYMPA_LIST_DATA_DIR" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + fi + done +fi +if [ ! -d "$SYMPA_LIST_DATA_DIR" ]; then + fatal "Base Directory for List Data (${SYMPA_LIST_DATA_DIR}) not found" +fi + + +#_main_domain=`echo $SYMPA_LIST_DOMAIN | grep -o '[^.]*\.[^.]*$'` +_SYMPA_LISTMASTER="postmaster@`echo $SYMPA_LIST_DOMAIN | grep -o '[^.]*\.[^.]*$'`" +_SYMPA_WEBINTERFACE_TITLE="Mailing Lists `echo $SYMPA_LIST_DOMAIN | grep -o '[^.]*\.[^.]*$'`" + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Insert E-Mail Address of Listmaster(s) for \"$SYMPA_LIST_DOMAIN\". " +echo "" +echo " - COMMA seperated list of email addresses" +echo "" +SYMPA_LISTMASTER= +if [ -n "$_SYMPA_LISTMASTER" ]; then + echononl "listmaster [${_SYMPA_LISTMASTER}]: " + read SYMPA_LISTMASTER + if [ "X$SYMPA_LISTMASTER" = "X" ]; then + SYMPA_LISTMASTER=$_SYMPA_LISTMASTER + fi +else + while [ "X$SYMPA_LISTMASTER" = "X" ]; do + echononl "listmaster: " + read SYMPA_LISTMASTER + if [ -z "$SYMPA_LISTMASTER" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + fi + done +fi + +if grep -e "^\s*listmaster" $SYMPA_MAIN_CONF_FILE > /dev/null 2>&1 ; then + _POSTMASTER_ABUSE_ADDRESS=`grep -e "^\s*listmaster" $SYMPA_MAIN_CONF_FILE 2> /dev/null | awk '{print$2}'` +elif grep -e "^\s*#\s*listmaster" $SYMPA_MAIN_CONF_FILE > /dev/null 2>&1 ; then + _POSTMASTER_ABUSE_ADDRESS=`grep -e "^\s*#\s*listmaster" $SYMPA_MAIN_CONF_FILE 2> /dev/null | awk '{print$2}'` +fi +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Insert E-Mail Address(es) to which e-mails to (postmaster|abuse)@$SYMPA_LIST_DOMAIN. " +echo "should be forwarded" +echo "" +echo " - BLANK seperated list of email addresses" +echo "" +POSTMASTER_ABUSE_ADDRESS= +if [ -n "$_POSTMASTER_ABUSE_ADDRESS" ]; then + echononl "forward adress(es) [${_POSTMASTER_ABUSE_ADDRESS}]: " + read POSTMASTER_ABUSE_ADDRESS + if [ "X$POSTMASTER_ABUSE_ADDRESS" = "X" ]; then + POSTMASTER_ABUSE_ADDRESS=$_POSTMASTER_ABUSE_ADDRESS + fi +else + while [ "X$POSTMASTER_ABUSE_ADDRESS" = "X" ]; do + echononl "forward adress(es): " + read POSTMASTER_ABUSE_ADDRESS + if [ -z "$POSTMASTER_ABUSE_ADDRESS" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + fi + done +fi + +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Insert title for the Webinterface." +echo "" +SYMPA_WEBINTERFACE_TITLE= +if [ -n "$_SYMPA_WEBINTERFACE_TITLE" ]; then + echononl "Title for webinterface [${_SYMPA_WEBINTERFACE_TITLE}]: " + read SYMPA_WEBINTERFACE_TITLE + if [ "X$SYMPA_WEBINTERFACE_TITLE" = "X" ]; then + SYMPA_WEBINTERFACE_TITLE=$_SYMPA_WEBINTERFACE_TITLE + fi +else + while [ "X$SYMPA_WEBINTERFACE_TITLE" = "X" ]; do + echononl "Title for webinterface: " + read SYMPA_WEBINTERFACE_TITLE + if [ -z "$SYMPA_WEBINTERFACE_TITLE" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + fi + done +fi + +if $_postfix_info_needed ; then + echo "" + echo "" + echo -e "\033[32m-- Postfix SMTP Server related\033[m" + echo "" + echo "Insert filename includes the relay domain declarations (for sympa lists)" + echo "" + POSTFIX_RELAY_DOMAIN_FILE= + while [ "X$POSTFIX_RELAY_DOMAIN_FILE" = "X" ] ; do + echononl "Filename for relay domain declarations: " + read POSTFIX_RELAY_DOMAIN_FILE + if [ -z "$POSTFIX_RELAY_DOMAIN_FILE" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + elif [ ! -f "$POSTFIX_RELAY_DOMAIN_FILE" ];then + echo -e "\n\t\033[1;33mFile \"${POSTFIX_RELAY_DOMAIN_FILE}\" not found!\033[m Try again..\n" + POSTFIX_RELAY_DOMAIN_FILE="" + fi + done + + + echo "" + echo -e "\033[32m--\033[m" + echo "" + echo "Insert filename includes the (postfix) transport declarations (for sympa lists)" + echo "" + POSTFIX_TRANSPORT_FILE= + while [ "X$POSTFIX_TRANSPORT_FILE" = "X" ] ; do + echononl "Filename for relay domain declarations: " + read POSTFIX_TRANSPORT_FILE + if [ -z "$POSTFIX_TRANSPORT_FILE" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + elif [ ! -f "$POSTFIX_TRANSPORT_FILE" ];then + echo -e "\n\t\033[1;33mFile \"${POSTFIX_TRANSPORT_FILE}\" not found!\033[m Try again..\n" + POSTFIX_TRANSPORT_FILE="" + fi + done + + + echo "" + echo -e "\033[32m--\033[m" + echo "" + echo "Insert the aliases map file, which includes the forward address(es) for" + echo "(postmaste|abuse)@lists.domain.tld (using virtual_alias_maps)" + echo "" + POSTFIX_VIRTUAL_ALIAS_MAPS= + while [ "X$POSTFIX_VIRTUAL_ALIAS_MAPS" = "X" ] ; do + echononl "Filename for map declarations: " + read POSTFIX_VIRTUAL_ALIAS_MAPS + if [ -z "$POSTFIX_VIRTUAL_ALIAS_MAPS" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + elif [ ! -f "$POSTFIX_VIRTUAL_ALIAS_MAPS" ];then + echo -e "\n\t\033[1;33mFile \"${POSTFIX_VIRTUAL_ALIAS_MAPS}\" not found!\033[m Try again..\n" + POSTFIX_VIRTUAL_ALIAS_MAPS="" + fi + done + + + #echo "" + #echo -e "\033[32m--\033[m" + #echo "" + #echo "Insert filename includes the (postfix) address rewriting to support" + #echo "addresse like (postmaste|abuse)@lists.domain.tld (using canonical maps)" + #echo "" + #POSTFIX_CANONICAL_MAPS= + #while [ "X$POSTFIX_CANONICAL_MAPS" = "X" ] ; do + # echononl "Filename for map declarations: " + # read POSTFIX_CANONICAL_MAPS + # if [ -z "$POSTFIX_CANONICAL_MAPS" ]; then + # echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + # elif [ ! -f "$POSTFIX_CANONICAL_MAPS" ];then + # echo -e "\n\t\033[1;33mFile \"${POSTFIX_CANONICAL_MAPS}\" not found!\033[m Try again..\n" + # POSTFIX_CANONICAL_MAPS="" + # fi + #done + +fi + +if ! $_debian_apache_installation ; then + echo "" + echo "" + echo -e "\033[32m-- Apache Webserver related\033[m" + echo "" + echo "Insert Directory where the vhost configuration file should stay.." + echo "" + apache_vhost_dir= + while [ "X$apache_vhost_dir" = "X" ] ; do + if [ -n "$_apache_vhost_dir" ];then + echononl "VHost Base Directory [$_apache_vhost_dir]: " + read apache_vhost_dir + if [ "X$apache_vhost_dir" = "X" ]; then + apache_vhost_dir=$_apache_vhost_dir + fi + else + echononl "VHost Base Directory: " + read apache_vhost_dir + if [ ! -d "$read apache_vhost_dir" ];then + echo -e "\n\t\033[1;33mDirectory \"${apache_vhost_dir}\" not found! Try again..\033[m\n" + apache_vhost_dir="" + fi + fi + done + + if [ -z "$apache_log_dir" ]; then + + echo "" + echo "" + echo -e "\033[32m--\033[m" + echo "" + echo "Insert Directory where the log files should stay.." + echo "" + while [ "X$apache_log_dir" = "X" ] ; do + echononl "Apache Log Directory: " + read apache_log_dir + if [ -z "$apache_log_dir" ]; then + echo -e "\n\t\033[1;33mDeclaration is mandatory!\033[m Try again..\n" + elif [ ! -d "$apache_log_dir" ];then + echo -e "\n\t\033[1;33mDirectory \"${apache_log_dir}\" not found!\033[m Try again..\n" + apache_log_dir="" + fi + done + fi +fi + +echo "" +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Insert the IP-Addresses where the webserver should listen for that site." +echo "" +IPv4= +while [ "X$IPv4" = "X" ];do + if [ -z "$__ipv4" ]; then + echononl "IPv4 address: " + read IPv4 + if [ "X$IPv4" = "X" ]; then + echo -e "\n\t\033[33m\033[1mEingabe erforderlich!\033[m\n" + fi + else + echononl "IPv4 address [$__ipv4]: " + read IPv4 + if [ "X$IPv4" = "X" ]; then + IPv4=$__ipv4 + fi + fi +done +IPv6= +while [ "X$IPv6" = "X" ];do + if [ -z "$__ipv6" ]; then + echononl "IPv6 address: " + read IPv6 + if [ "X$IPv6" = "X" ]; then + echo -e "\n\t\033[33m\033[1mEingabe erforderlich!\033[m\n" + fi + else + echononl "IPv6 address [$__ipv6]: " + read IPv6 + if [ "X$IPv6" = "X" ]; then + IPv6=$__ipv6 + fi + fi +done + + +_wwsympa_url=`grep -e "^\s*wwsympa_url" $SYMPA_MAIN_CONF_FILE | awk '{print$2}'` +_wwsympa_dir="$(echo $_wwsympa_url | grep / | cut -d/ -f4-)" +SYMPA_WEB_URL=https://${SYMPA_LIST_DOMAIN}/$_wwsympa_dir + + +OK= +echo "" +echo -e "\033[32m--\033[m" +echo "" +echo "Are you installing on a VServer guest system?" +echo "" +echononl "VServer Gastsystem (yes/no) [$_VSERVER_GUEST]: " +read OK +if [ "X$OK" = "X" ]; then + OK=$_VSERVER_GUEST +fi +OK=`echo "$OK" | tr '[:upper:]' '[:lower:]'` +while [ "X$OK" != "Xyes" -a "X$OK" != "Xno" ]; do + echo "" + echononl "\twrong entry! [yes/no]: " + read OK + OK=`echo "$OK" | tr '[:upper:]' '[:lower:]'` +done +if [ "$OK" = "yes" ]; then + SYSTEMD_EXISTS=false +else + if [ "X`which systemd`" = "X" ]; then + SYSTEMD_EXISTS=false + else + SYSTEMD_EXISTS=true + fi +fi + + +clear +echo "" +echo -e "\033[15G\033[32mSetup new Sympa Domain \033[37m\033[1m$SYMPA_LIST_DOMAIN\033[0;32m using the following Parameters \033[m" +echo "" +echo "Sympa Installation Directory.............: $SYMPA_HOME" +echo "Sympa main configuration file............: $SYMPA_MAIN_CONF_FILE" +echo "Sympa User...............................: $SYMPA_USER" +echo "Sympa Group..............................: $SYMPA_GROUP" +echo "" +echo "Sympa List Domain........................: $SYMPA_LIST_DOMAIN" +echo "Sympa List Data Directory................: $SYMPA_LIST_DATA_DIR" +echo "Listmaster...............................: $SYMPA_LISTMASTER" +echo "URL of the Webinterface..................: $SYMPA_WEB_URL" +echo "Title for the Webinterface...............: $SYMPA_WEBINTERFACE_TITLE" +echo "" +echo "Postfix related:" +echo " relay domain file for sympa domains..: $POSTFIX_RELAY_DOMAIN_FILE" +echo " transport file for sympa domains......: $POSTFIX_TRANSPORT_FILE" +#echo " canonical maps (postmaster|abuse)@....: $POSTFIX_CANONICAL_MAPS" +echo " virtual maps file (postmaster|abuse)@.: $POSTFIX_VIRTUAL_ALIAS_MAPS" +echo " virtual maps forward address(es)......: $POSTMASTER_ABUSE_ADDRESS" +echo "" +echo "Apache Webserver related:" +echo " IPv4 Address (Sympa Webinterface).....: $IPv4" +echo " IPv6 Address (Sympa Webinterface).....: $IPv6" +echo "" +echo " Apache Configuration Directory........: $apache_conf_dir" +echo " Apache VHost Directory................: $apache_vhost_dir" +echo " Apache Log Directory..................: $apache_log_dir" +echo "" + +echononl "Start with that configuration? [yes/no]: " +read OK +while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ] +do + echononl "wrong entry! [yes/no] :" + read OK +done +[ $OK = "Yes" -o $OK = "yes" ] || fatal "Change parameters and restart script: `basename $0`" + +echo "" +echo "" + + +_log_file=create-sympa-domain_$SYMPA_LIST_DOMAIN.log +if [ -f "$_log_file" ];then + mv $_log_file $_log_file.`date +%Y%m%d-%H%M` +fi +touch ${_logdir}/main.log + +echo "## -----------" >> $_log_file +echo "## - Setup new Sympa Domain \"$SYMPA_LIST_DOMAIN\" using the following Parameters" >> $_log_file +echo "## -----------" >> $_log_file +echo "## -" >> $_log_file +echo "## - Sympa Installation Directory.............: $SYMPA_HOME" >> $_log_file +echo "## - Sympa main configuration file............: $SYMPA_MAIN_CONF_FILE" >> $_log_file +echo "## - Sympa User...............................: $SYMPA_USER" >> $_log_file +echo "## - Sympa Group..............................: $SYMPA_GROUP" >> $_log_file +echo "## -" >> $_log_file +echo "## - Sympa List Domain........................: $SYMPA_LIST_DOMAIN" >> $_log_file +echo "## - Sympa List Data Directory................: $SYMPA_LIST_DATA_DIR" >> $_log_file +echo "## - Listmaster...............................: $SYMPA_LISTMASTER" >> $_log_file +echo "## - URL of the Webinterface..................: $SYMPA_WEB_URL" >> $_log_file +echo "## - Title for the Webinterface...............: $SYMPA_WEBINTERFACE_TITLE" >> $_log_file +echo "## -" >> $_log_file +echo "## - Postfix related:" >> $_log_file +echo "## - relay domain file for sympa domains...: $POSTFIX_RELAY_DOMAIN_FILE" >> $_log_file +echo "## - transport file for sympa domains......: $POSTFIX_TRANSPORT_FILE" >> $_log_file +#echo "## - canonical maps (postmaster|abuse)@....: $POSTFIX_CANONICAL_MAPS" >> $_log_file +echo "## - virtual maps file (postmaster|abuse)@.: $POSTFIX_VIRTUAL_ALIAS_MAPS" >> $_log_file +echo "## - virtual maps forward address(es)......: $POSTMASTER_ABUSE_ADDRESS" >> $_log_file +echo "## -" >> $_log_file +echo "## - Apache Webserver related:" >> $_log_file +echo "## - IPv4 Address (Sympa Webinterface).....: $IPv4" >> $_log_file +echo "## - IPv6 Address (Sympa Webinterface).....: $IPv6" >> $_log_file +echo "## -" >> $_log_file +echo "## - Apache Configuration Directory........: $apache_conf_dir" >> $_log_file +echo "## - Apache VHost Directory................: $apache_vhost_dir" >> $_log_file +echo "## - Apache Log Directory..................: $apache_log_dir" >> $_log_file +echo "## -" >> $_log_file +echo "" >> $_log_file + +echo "SYMPA_HOME=$SYMPA_HOME" >> $_log_file +echo "SYMPA_MAIN_CONF_FILE=$SYMPA_MAIN_CONF_FILE" >> $_log_file +echo "SYMPA_USER=$SYMPA_USER" >> $_log_file +echo "SYMPA_GROUP=$SYMPA_GROUP" >> $_log_file +echo "" >> $_log_file +echo "SYMPA_LIST_DOMAIN=$SYMPA_LIST_DOMAIN" >> $_log_file +echo "SYMPA_LIST_DATA_DIR=$SYMPA_LIST_DATA_DIR" >> $_log_file +echo "SYMPA_LISTMASTER=$SYMPA_LISTMASTER" >> $_log_file +echo "SYMPA_WEB_URL=$SYMPA_WEB_URL" >> $_log_file +echo "SYMPA_WEBINTERFACE_TITLE=$SYMPA_WEBINTERFACE_TITLE" >> $_log_file +echo "" >> $_log_file +echo "POSTFIX_RELAY_DOMAIN_FILE=$POSTFIX_RELAY_DOMAIN_FILE" >> $_log_file +echo "POSTFIX_TRANSPORT_FILE=$POSTFIX_TRANSPORT_FILE" >> $_log_file +echo "POSTFIX_CANONICAL_MAPS=$POSTFIX_CANONICAL_MAPS" >> $_log_file +echo "POSTFIX_VIRTUAL_ALIAS_MAPS=$POSTFIX_VIRTUAL_ALIAS_MAPS" >> $_log_file +echo "POSTMASTER_ABUSE_ADDRESS=$POSTMASTER_ABUSE_ADDRESS" >> $_log_file +echo "" >> $_log_file +echo "IPv4=$IPv4" >> $_log_file +echo "IPv6=$IPv6" >> $_log_file +echo "apache_conf_dir=$apache_conf_dir" >> $_log_file +echo "apache_vhost_dir=$apache_vhost_dir" >> $_log_file +echo "apache_log_dir=$apache_log_dir" >> $_log_file + +echo "" >> $_log_file + +## - Create Configuration Directory +## - +if [ -d "${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN" ]; then + warn "Configuration Directory ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN\" aready exists" + echononl "Continue anyway? [yes/no]: " + read OK + while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ]; do + echononl "wrong entry! [yes/no] :" + read OK + done + [ $OK = "Yes" -o $OK = "yes" ] || fatal "Abortion by user.." + echo "" +else + echononl "\tCreate Configuration Directory for domain \"$SYMPA_LIST_DOMAIN\".." >> $_log_file + echo "" >> $_log_file + echo "## - Create Configuration Directory for domain \"$SYMPA_LIST_DOMAIN\".." >> $_log_file + echo "## -" >> $_log_file + echo "mkdir ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN" >> $_log_file + mkdir ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi +fi + +## - Set owner/group to Domains Configuration Directory +## - +echononl "\tSet owner/group for dir \"${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}\".." +echo "" >> $_log_file +echo "## - Set owner/group for directory \"${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}\".." >> $_log_file +echo "## -" >> $_log_file +echo "chown ${SYMPA_USER}:$SYMPA_GROUP ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN" >> $_log_file +chown ${SYMPA_USER}:$SYMPA_GROUP ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN >> $_log_file 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +## - Set Permissions to Domains Configuration Directory +## - +echononl "\tSet Permissions for dir \"${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}\".." +echo "" >> $_log_file +echo "## - Set Permissions for directory \"${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}\".." >> $_log_file +echo "## -" >> $_log_file +echo "chmod 750 ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN" >> $_log_file +chmod 750 ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN >> $_log_file 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +echo "" + +## - Create "robot.conf" +## - +if [ -f "${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN/robot.conf" ]; then + warn "Configuration file ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN/robot.conf already exists" + echononl "Continue anyway? [yes/no]: " + read OK + while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ]; do + echononl "wrong entry! [yes/no] :" + read OK + done + [ $OK = "Yes" -o $OK = "yes" ] || fatal "Abortion by user.." + _date=`date +%Y%m%d-%H%M` + echo "" >> $_log_file + echo "## - Backup existing configuration file" >> $_log_file + echo "## -" >> $_log_file + echo "cp -a ${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}/robot.conf \\" >> $_log_file + echo " ${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}/robot.conf.$_date" >> $_log_file + cp -a ${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}/robot.conf \ + ${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}/robot.conf.$_date + info "Old Configuration file was saved to file \"robot.$_date\"." +fi +echononl "\tCreate Configuration \"robot.conf\" for domain \"$SYMPA_LIST_DOMAIN\".." +echo "" >> $_log_file +echo "## - Create Configuration \"robot.conf\" for domain \"$SYMPA_LIST_DOMAIN\".." >> $_log_file +echo "## -" >> $_log_file +echo "cat < ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN/robot.conf +## This is a sample Virtual Host definition for Sympa +## Once adapted, this file should installed in vhost +## subdirectory in Sympa configuration directory. You'll +## have to create a corresponding vhost subdirectory in +## Sympa state directory. + +## Check the documentation related to virtual hosting on http://www.sympa.org + + +## This hostname will be compared with 'SERVER_NAME' ENV var in wwsympa.fcgi +## To deduce which Virtual Robot is being queried +http_host $SYMPA_LIST_DOMAIN + +## URL of the Webinterface +wwsympa_url $SYMPA_WEB_URL + +## Listmasters email addresses +listmaster $SYMPA_LISTMASTER + +## Title for the ML service +## It is displayed as a title in the web interface +title $SYMPA_WEBINTERFACE_TITLE + +create_list listmaster + +## The default action when entering the web interface +## Can be 'lists', 'home' or 'which' +default_home lists + +## lang +## Standardsprache (eine der unterstützen Sprachen) +## Dies ist die Standardsprache, die von Sympa verwendet wird +#lang en-US +lang de + +## You can define custom colors for the Virtual Robot's +## Web interface +dark_color #00aa00 +light_color #ddffdd +selected_color #0099cc +EOF" >> $_log_file +cat < ${SYMPA_HOME}/etc/$SYMPA_LIST_DOMAIN/robot.conf 2>> $_log_file +## This is a sample Virtual Host definition for Sympa +## Once adapted, this file should installed in vhost +## subdirectory in Sympa configuration directory. You'll +## have to create a corresponding vhost subdirectory in +## Sympa state directory. + +## Check the documentation related to virtual hosting on http://www.sympa.org + + +## This hostname will be compared with 'SERVER_NAME' ENV var in wwsympa.fcgi +## To deduce which Virtual Robot is being queried +http_host $SYMPA_LIST_DOMAIN + +## URL of the Webinterface +wwsympa_url $SYMPA_WEB_URL + +## Listmasters email addresses +listmaster $SYMPA_LISTMASTER + +## Title for the ML service +## It is displayed as a title in the web interface +title $SYMPA_WEBINTERFACE_TITLE + +create_list listmaster + +## The default action when entering the web interface +## Can be 'lists', 'home' or 'which' +default_home home + +## You can define custom colors for the Virtual Robot's +## Web interface +dark_color #00aa00 +light_color #ddffdd +selected_color #0099cc +EOF +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +## - Set owner/group for \"robot.conf\".. +## - +echononl "\tSet owner/group for \"robot.conf\".." +echo "" >> $_log_file +echo "## - Set owner/group for \"robot.conf\".." >> $_log_file +echo "## -" >> $_log_file +echo "chown ${SYMPA_USER}:$SYMPA_GROUP ${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}/robot.conf" >> $_log_file +chown ${SYMPA_USER}:$SYMPA_GROUP ${SYMPA_HOME}/etc/${SYMPA_LIST_DOMAIN}/robot.conf >> $_log_file 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +echo "" + +## - Create Listdata Directory +## - +if [ -d "${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN" ]; then + warn "List Data Directory \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\" aready exists" + echononl "Continue anyway? [yes/no]: " + read OK + while [ "X$OK" != "Xyes" -a "X$OK" != "XYes" -a "X$OK" != "XNo" -a "X$OK" != "Xno" ]; do + echononl "wrong entry! [yes/no] :" + read OK + done + [ $OK = "Yes" -o $OK = "yes" ] || fatal "Abortion by user.." + echo "" +else + echononl "\tCreate List Data Directory \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\".." + echo "" >> $_log_file + echo "## - Create List Data Directory \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\".." >> $_log_file + echo "## -" >> $_log_file + echo "mkdir ${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN" >> $_log_file + mkdir ${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi +fi + +## - Set owner/group to List Data Directory +## - +echononl "\tSet owner/group for dir \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\".." +echo "" >> $_log_file +echo "## - Set owner/group for directory \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\".." >> $_log_file +echo "## -" >> $_log_file +echo "chown ${SYMPA_USER}:$SYMPA_GROUP ${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN" >> $_log_file +chown ${SYMPA_USER}:$SYMPA_GROUP ${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN >> $_log_file 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +## - Set Permissions to List Data Directory +## - +echononl "\tSet Permissions for dir \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\".." +echo "" >> $_log_file +echo "## - Set Permissions for directory \"${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN\".." >> $_log_file +echo "## -" >> $_log_file +echo "chmod 750 ${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN" >> $_log_file +chmod 750 ${SYMPA_LIST_DATA_DIR}/$SYMPA_LIST_DOMAIN >> $_log_file 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +echo "" + +## - Get escaped string for new list domain +## - +echononl "\tGet escaped string for new list domain.." +echo "" >> $_log_file +echo "## - Get escaped string for new list domain" >> $_log_file +echo "## -" >> $_log_file +echo "SYMPA_LIST_DOMAIN_ESCAPED=\${SYMPA_LIST_DOMAIN//\\./\\\\.}" >> $_log_file +SYMPA_LIST_DOMAIN_ESCAPED=${SYMPA_LIST_DOMAIN//\./\\.} +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +## - Add entries for postfix transport to file $POSTFIX_TRANSPORT_FILE +## - +_tmp=$(echo $SYMPA_LIST_DOMAIN_ESCAPED | sed 's/\\/\\\\\\/g') +echononl "\tAdd entries for postfix transport ($POSTFIX_TRANSPORT_FILE).." +if grep $_tmp $POSTFIX_TRANSPORT_FILE > /dev/null 2>&1 ; then + echo_skipped + warn "Entries for \"$SYMPA_LIST_DOMAIN\" in $POSTFIX_TRANSPORT_FILE exist already." +else + echo "" >> $_log_file + echo "## - Add entries for postfix transport ($POSTFIX_TRANSPORT_FILE).." >> $_log_file + echo "## -" >> $_log_file + echo "cat <> $POSTFIX_TRANSPORT_FILE + +/^.*+owner\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ sympabounce: +/^.*\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ sympa: +EOF" >> $_log_file + + cat <> $POSTFIX_TRANSPORT_FILE + +/^.*+owner\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ sympabounce: +/^.*\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ sympa: +EOF + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi +fi + +## - Add entries for address forwarding using virtual_alias_maps +## - +_tmp=$(echo $SYMPA_LIST_DOMAIN_ESCAPED | sed 's/\\/\\\\\\/g') +echononl "\tAdd entries for address forwarding ($POSTFIX_VIRTUAL_ALIAS_MAPS).." +if grep $_tmp $POSTFIX_VIRTUAL_ALIAS_MAPS > /dev/null 2>&1 ; then + echo_skipped + warn "Entries for \"$SYMPA_LIST_DOMAIN\" in $POSTFIX_VIRTUAL_ALIAS_MAPS exist already." +else + echo "" >> $_log_file + echo "## - Add entries for address rewriting ($POSTFIX_VIRTUAL_ALIAS_MAPS)...." >> $_log_file + echo "## -" >> $_log_file + echo "cat <> $POSTFIX_VIRTUAL_ALIAS_MAPS + +/^(postmaster|abuse)\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ $POSTMASTER_ABUSE_ADDRESS +EOF" >> $_log_file + + cat <> $POSTFIX_VIRTUAL_ALIAS_MAPS + +/^(postmaster|abuse)\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ $POSTMASTER_ABUSE_ADDRESS +EOF + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi +fi + +### - Add entries for addressrewriting using cononical_recipient_maps +### - +#_tmp=$(echo $SYMPA_LIST_DOMAIN_ESCAPED | sed 's/\\/\\\\\\/g') +#echononl "\tAdd entries for address rewriting ($POSTFIX_CANONICAL_MAPS).." +#if grep $_tmp $POSTFIX_CANONICAL_MAPS > /dev/null 2>&1 ; then +# echo_skipped +# warn "Entries for \"$SYMPA_LIST_DOMAIN\" in $POSTFIX_CANONICAL_MAPS exist already." +#else +# echo "" >> $_log_file +# echo "## - Add entries for address rewriting ($POSTFIX_CANONICAL_MAPS)...." >> $_log_file +# echo "## -" >> $_log_file +# echo "cat <> $POSTFIX_CANONICAL_MAPS +# +#/^(postmaster|abuse)\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ $POSTMASTER_ABUSE_ADDRESS +#EOF" >> $_log_file +# +# cat <> $POSTFIX_CANONICAL_MAPS +# +#/^(postmaster|abuse)\@${SYMPA_LIST_DOMAIN_ESCAPED}\$/ $POSTMASTER_ABUSE_ADDRESS +#EOF +# if [ "$?" = "0" ]; then +# echo_ok +# else +# echo_failed +# fi +#fi + + +## - Add entries for postfix relay domains to file $POSTFIX_RELAY_DOMAIN_FILE +## - +echononl "\tAdd entries for postfix relay domains ($POSTFIX_RELAY_DOMAIN_FILE).." +if grep $SYMPA_LIST_DOMAIN $POSTFIX_RELAY_DOMAIN_FILE > /dev/null 2>&1 ; then + echo_skipped + warn "Entries for \"$SYMPA_LIST_DOMAIN\" in $POSTFIX_RELAY_DOMAIN_FILE exist already." +else + echo "" >> $_log_file + echo "## - Add entries for postfix transport ($POSTFIX_RELAY_DOMAIN_FILE).." >> $_log_file + echo "## -" >> $_log_file + echo "cat <> $POSTFIX_RELAY_DOMAIN_FILE +$SYMPA_LIST_DOMAIN XXXX +EOF" >> $_log_file + + cat <> $POSTFIX_RELAY_DOMAIN_FILE +$SYMPA_LIST_DOMAIN XXXX +EOF + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + + echononl "\tUpdate db file ${POSTFIX_RELAY_DOMAIN_FILE}.db.." + echo "" >> $_log_file + echo "## - Update db file ${POSTFIX_RELAY_DOMAIN_FILE}.db.." >> $_log_file + echo "## -" >> $_log_file + echo "postmap btree:${POSTFIX_RELAY_DOMAIN_FILE}" >> $_log_file + postmap btree:${POSTFIX_RELAY_DOMAIN_FILE} >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + fi + +fi + +echo "" + +echononl "\tReload Postfix Configuration.." +echo "" >> $_log_file +echo "## - Reload Postfix Configuration.." >> $_log_file +echo "## -" >> $_log_file +echo "/etc/init.d/postfix reload" >> $_log_file +/etc/init.d/postfix reload >> $_log_file 2>&1 +if [ "$?" = "0" ]; then + echo_ok +else + echo_failed +fi + +echo "" + +_apache_vhost_added=false +## - Add VHost Configuration to Apache Webserver +## - +echononl "\tAdd VHost Configuration for Apache Webserver.." +if grep -r $SYMPA_LIST_DOMAIN $apache_vhost_dir/* 2>/dev/null |\ + grep -q -i -E "(ServerAlias| ServerName)" 2> /dev/null ; then + echo_skipped + warn "Apache VHost Configuration for \"$SYMPA_LIST_DOMAIN\" already exists." +else + echo "" >> $_log_file + echo "## - Add VHost Configuration for Apache Webserver...." >> $_log_file + echo "## -" >> $_log_file + echo "cat < $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf +# - $SYMPA_LIST_DOMAIN -# + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteRule ^/\\\$ /$_wwsympa_dir/ [R] + + + AllowOverride none + Require all granted + + + + AllowOverride none + Require all granted + + + Alias /static-sympa ${SYMPA_HOME}/static_content + ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi + + + SetHandler fcgid-script + + + SSLEngine on + + ## - HTTP Strict Transport Security (HSTS) + ## - + ## - HSTS tells a browser that the website should only be accessed through + ## - a secure connection. The HSTS header will be remembered by a standard + ## compliant browser for max-age seconds. + ## - + ## - Remember this settings for 1/2 year + ## - + #Header add Strict-Transport-Security \"max-age=15768000\" + Header always set Strict-Transport-Security \"max-age=31536000; includeSubDomains\" + + ## - don't support weak ciphers + SSLHonorCipherOrder On + SSLCompression Off + SSLProtocol ALL -SSLv2 -SSLv3 + + SSLCertificateFile ${apache_conf_dir}/server-bundle.crt + SSLCertificateKeyFile ${apache_conf_dir}/server.key + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + + + +## --- +## --- IPv6 +## --- + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteRule ^/\\\$ /$_wwsympa_dir/ [R] + + + AllowOverride none + Require all granted + + + + AllowOverride none + Require all granted + + + Alias /static-sympa ${SYMPA_HOME}/static_content + ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi + + + SetHandler fcgid-script + + + SSLEngine on + + ## - HTTP Strict Transport Security (HSTS) + ## - + ## - HSTS tells a browser that the website should only be accessed through + ## - a secure connection. The HSTS header will be remembered by a standard + ## compliant browser for max-age seconds. + ## - + ## - Remember this settings for 1/2 year + ## - + #Header add Strict-Transport-Security \"max-age=15768000\" + Header always set Strict-Transport-Security \"max-age=31536000; includeSubDomains\" + + ## - don't support weak ciphers + SSLHonorCipherOrder On + SSLCompression Off + SSLProtocol ALL -SSLv2 -SSLv3 + + SSLCertificateFile ${apache_conf_dir}/server-bundle.crt + SSLCertificateKeyFile ${apache_conf_dir}/server.key + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + +EOF" >> $_log_file + + cat < $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf +# - $SYMPA_LIST_DOMAIN -# + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteRule ^/\$ /$_wwsympa_dir/ [R] + + + AllowOverride none + Require all granted + + + + AllowOverride none + Require all granted + + + Alias /static-sympa ${SYMPA_HOME}/static_content + ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi + + + SetHandler fcgid-script + + + SSLEngine on + + ## - HTTP Strict Transport Security (HSTS) + ## - + ## - HSTS tells a browser that the website should only be accessed through + ## - a secure connection. The HSTS header will be remembered by a standard + ## compliant browser for max-age seconds. + ## - + ## - Remember this settings for 1/2 year + ## - + #Header add Strict-Transport-Security "max-age=15768000" + Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" + + ## - don't support weak ciphers + SSLHonorCipherOrder On + SSLCompression Off + SSLProtocol ALL -SSLv2 -SSLv3 + + SSLCertificateFile ${apache_conf_dir}/server-bundle.crt + SSLCertificateKeyFile ${apache_conf_dir}/server.key + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + + + +## --- +## --- IPv6 +## --- + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteCond %{HTTPS} !=on + RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + + + + + ServerAdmin admin@oopen.de + + ServerName $SYMPA_LIST_DOMAIN + + RewriteEngine on + RewriteRule ^/\$ /$_wwsympa_dir/ [R] + + + AllowOverride none + Require all granted + + + + AllowOverride none + Require all granted + + + Alias /static-sympa ${SYMPA_HOME}/static_content + ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi + + + SetHandler fcgid-script + + + SSLEngine on + + ## - HTTP Strict Transport Security (HSTS) + ## - + ## - HSTS tells a browser that the website should only be accessed through + ## - a secure connection. The HSTS header will be remembered by a standard + ## compliant browser for max-age seconds. + ## - + ## - Remember this settings for 1/2 year + ## - + #Header add Strict-Transport-Security "max-age=15768000" + Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" + + ## - don't support weak ciphers + SSLHonorCipherOrder On + SSLCompression Off + SSLProtocol ALL -SSLv2 -SSLv3 + + SSLCertificateFile ${apache_conf_dir}/server-bundle.crt + SSLCertificateKeyFile ${apache_conf_dir}/server.key + + CustomLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-access.log combined + ErrorLog ${apache_log_dir}/${SYMPA_LIST_DOMAIN}-error.log + + +EOF + if [ "$?" = "0" ]; then + echo_ok + apache_vhost_added=true + else + echo_failed + fi +fi + +if $apache_vhost_added ; then + _apache_configtest=false + echononl "\tCheck Apache Configuration" + echo "" >> $_log_file + echo "## - Check Apache Configuration" >> $_log_file + echo "## -" >> $_log_file + echo "apachectl configtest" >> $_log_file + apachectl configtest >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + _apache_configtest=true + else + echo_failed + fi + + echononl "\tGraceful Restart Apache Webserver.." + if $_apache_configtest ; then + echo "" >> $_log_file + echo "## - Graceful Restart Apache Webserver.." >> $_log_file + echo "## -" >> $_log_file + echo "apachectl graceful" >> $_log_file + apachectl graceful >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + _apache_configtest=true + else + echo_failed + fi + else + echo_skipped + fi +fi + +echo "" +echononl "\tRestart Sympa Mailing List Manager.." +echo "" >> $_log_file +echo "## - Check Apache Configuration" >> $_log_file +echo "## -" >> $_log_file +if $SYSTEMD_EXISTS ; then + echo "systemctl restart sympa" >> $_log_file + systemctl restart sympa >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + _apache_configtest=true + else + echo_failed + fi +else + echo "/etc/init.d/sympa restart" >> $_log_file + /etc/init.d/sympa restart >> $_log_file 2>&1 + if [ "$?" = "0" ]; then + echo_ok + _apache_configtest=true + else + echo_failed + fi +fi + + + +echo "" +exit 0 diff --git a/install_sympa.sh b/install_sympa.sh index 36b8513..0de1d6a 100755 --- a/install_sympa.sh +++ b/install_sympa.sh @@ -4,7 +4,7 @@ ## - _VSERVER_GUEST=no -_SYMPA_VERSION=6.2.15 +_SYMPA_VERSION=6.2.16 _SYMPA_USER=sympa