Relaunch scripts.

This commit is contained in:
Christoph 2018-10-29 01:55:35 +01:00
parent d82fb132e5
commit 5b4b05cef8
5 changed files with 7175 additions and 780 deletions

1423
OLD/create_sympa_listdomain.sh.00 Executable file

File diff suppressed because it is too large Load Diff

4206
OLD/install_sympa.sh.00 Executable file

File diff suppressed because it is too large Load Diff

View File

@ -29,13 +29,16 @@
#SYMPA_MAIN_CONF_DIR="/etc/sympa"
# - SYMPA_LIST_DATA_DIR
# - SYMPA_LIST_DATA_ROOT_DIR
# -
# - Data directory for sympa lists
# - Root Path containing Sympa's list data directories
# -
# - defaults to: "/data/sympa/list_data"
# - Note:
# - the real list data directory becomes: ${SYMPA_LIST_DATA_ROOT_DIR}/sympa-$SYMPA_VERSION/list_data
# -
#SYMPA_LIST_DATA_DIR=/data/sympa/list_data
# - Defaults to: "/data"
# -
#SYMPA_LIST_DATA_ROOT_DIR="/data"
# - SYMPA_DOMAIN
@ -43,7 +46,7 @@
# - Note: if sympa will be configured to support multidomains
# - this (SYMPA_DOMAIN) should not contain list definitions
# -
SYMPA_DOMAIN=""
#SYMPA_DOMAIN=""
# - START_AT_BOOTTIME

View File

@ -1,14 +1,29 @@
#!/usr/bin/env bash
#
script_name="$(basename $(realpath $0))"
working_dir="$(dirname $(realpath $0))"
backup_date="$(date +%Y-%m-%d-%H%M)"
## ---
## --- Sympa Multidomain Setup
## ---
## ---
## --- Variable settings
## ---
if [ -n "$1" ]; then
SYMPA_LIST_DOMAIN=$1
else
SYMPA_LIST_DOMAIN=
fi
conf_file_installation="${working_dir}/conf/install_sympa.conf"
_VSERVER_GUEST=no
@ -67,18 +82,73 @@ echo_skipped() {
## - Determin Sympa Home Directory
## -
SYMPA_HOME=`echo ~sympa`
SYMPA_HOME="$(realpath "$(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 Sympa's PID directory
## -
if [[ -f "/etc/systemd/system/sympa.service" ]]; then
SYMPA_PID_DIR="$(dirname "$(grep -E "^\s*PIDFile" /etc/systemd/system/sympa.service | cut -d'=' -f2)")"
elif [[ -f "/lib/systemd/system/sympa.service" ]]; then
SYMPA_PID_DIR="$(dirname "$(grep -E "^\s*PIDFile" /lib/systemd/system/sympa.service | cut -d'=' -f2)")"
elif [[ -f "/etc/init.d/sympa" ]] ; then
if $(grep -E -q "\s*^sympapiddir=\"" /etc/init.d/sympa | cut -d'"' -f2) ; then
SYMPA_PID_DIR="$(grep -E "\s*^sympapiddir=" /etc/init.d/sympa | cut -d'"' -f2)"
else
SYMPA_PID_DIR="$(grep -E "\s*^sympapiddir=" /etc/init.d/sympa | cut -d'=' -f2)"
fi
fi
if [[ -z "$SYMPA_PID_DIR" ]]; then
fatal "Cannot determin variable 'SYMPA_PID_DIR'..!"
fi
## - Determin Sympa's static directory
## -
if [[ -d "/usr/local/sympa/static_content" ]]; then
SYMPA_STATIC_DIR="/usr/local/sympa/static_content"
elif [[ -d "/var/lib/sympa/static_content" ]]; then
SYMPA_STATIC_DIR="/var/lib/sympa/static_content"
elif [[ -d "/usr/local/sympa/var/lib/sympa/static_content" ]]; then
SYMPA_STATIC_DIR="/usr/local/sympa/var/lib/sympa/static_content"
fi
if [[ -z "$SYMPA_STATIC_DIR" ]]; then
fatal "Cannot determin variable 'SYMPA_STATIC_DIR'..!"
fi
## - Determin Sympa's cgi (script) directory
## -
if [[ -f "/usr/local/sympa/bin/wwsympa-wrapper.fcgi" ]]; then
SYMPA_CGI_DIR="/usr/local/sympa/bin"
elif [[ -f "/usr/local/sympa/lib/sympa/cgi/wwsympa-wrapper.fcgi" ]]; then
SYMPA_CGI_DIR="/usr/local/sympa/lib/sympa/cgi"
fi
if [[ -z "$SYMPA_STATIC_DIR" ]]; then
fatal "Cannot determin variable 'SYMPA_STATIC_DIR'..!"
fi
## - Determin Sympa's systemd directory
## -
if [[ -f "/etc/systemd/system/sympa.service" ]]; then
SYMPA_SYSTEMD_DIR="/etc/systemd/system"
elif [[ -f "/lib/systemd/system/sympa.service" ]]; then
SYMPA_SYSTEMD_DIR="/lib/systemd/system"
fi
## - 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`"
#__ipv4="`ifconfig | grep -e \"^\s*inet \" | grep -v \"127.0.0.1\" | awk '{print$2}' | cut -d\":\" -f2 | sort | head -1`"
#__ipv6="`ifconfig | grep -e \"^\s*inet6 \" | awk '{print$2}' | grep -v -e \"^::1/\" | grep -v -e \"^fe80\" | cut -d\"/\" -f1 | sort | head -1`"
_hostname="$(hostname -f)"
if [[ -n "$_hostname" ]] ; then
__ipv4="$(dig +short "$_hostname")"
__ipv6="$(dig +short "$_hostname" AAAA)"
fi
_debian_apache_installation=false
@ -580,12 +650,16 @@ echo "Sympa Group..............................: $SYMPA_GROUP"
echo ""
echo "Sympa List Domain........................: $SYMPA_LIST_DOMAIN"
echo "Sympa List Data Directory................: $SYMPA_LIST_DATA_DIR"
echo "Sympa's PID Directory....................: $SYMPA_PID_DIR"
echo "Sympa's CGI Directory....................: $SYMPA_CGI_DIR"
echo "Sympa's Staic Directory..,...............: $SYMPA_STATIC_DIR"
echo "Sympa's Systemd Directory................: $SYMPA_SYSTEMD_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 " 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"
@ -630,6 +704,10 @@ echo "## - Sympa Group..............................: $SYMPA_GROUP" >> $_log_fil
echo "## -" >> $_log_file
echo "## - Sympa List Domain........................: $SYMPA_LIST_DOMAIN" >> $_log_file
echo "## - Sympa List Data Directory................: $SYMPA_LIST_DATA_DIR" >> $_log_file
echo "## - Sympa's PID Directory....................: $SYMPA_PID_DIR" >> $_log_file
echo "## - Sympa's CGI Directory....................: $SYMPA_CGI_DIR" >> $_log_file
echo "## - Sympa's Staic Directory..,...............: $SYMPA_STATIC_DIR" >> $_log_file
echo "## - Sympa's Systemd Directory................: $SYMPA_SYSTEMD_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
@ -658,6 +736,10 @@ 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_PID_DIR=$SYMPA_PID_DIR" >> $_log_file
echo "SYMPA_CGI_DIR=$SYMPA_CGI_DIR" >> $_log_file
echo "SYMPA_STATIC_DIR=$SYMPA_STATIC_DIR" >> $_log_file
echo "SYMPA_SYSTEMD_DIR=$SYMPA_SYSTEMD_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
@ -1066,22 +1148,33 @@ fi
echo ""
_apache_vhost_added=false
## - Backup existing VHost Configuration
## -
if [[ -f "$apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf" ]] ; then
echononl "\tBackup VHost Configuration for '$SYMPA_LIST_DOMAIN'.."
echo "" >> $_log_file
echo "## - Backup VHost Configuration for '$SYMPA_LIST_DOMAIN'.." >> $_log_file
echo "## -" >> $_log_file
echo "mv \"$apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf\" \"$apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf.$backup_date\"" >> $_log_file
mv "$apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf" "$apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf.$backup_date"
if [[ $? = 0 ]]; then
echo_ok
else
echo_failed
fi
fi
## - Add VHost Configuration to Apache Webserver
## -
_apache_vhost_added=false
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 <<EOF > $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
echo "" >> $_log_file
echo "## - Add VHost Configuration for Apache Webserver...." >> $_log_file
echo "## -" >> $_log_file
echo "cat <<EOF > $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
# - $SYMPA_LIST_DOMAIN -#
<VirtualHost ${IPv4}:80>
<VirtualHost ${IPv4}:80 [${IPv6}]:80>
ServerAdmin admin@oopen.de
@ -1096,7 +1189,7 @@ else
</VirtualHost>
<VirtualHost ${IPv4}:443>
<VirtualHost ${IPv4}:443 [${IPv6}]:443>
ServerAdmin admin@oopen.de
@ -1104,96 +1197,41 @@ else
RewriteEngine on
RewriteRule ^/\\\$ /$_wwsympa_dir/ [R]
<Directory \"${SYMPA_HOME}/bin\">
AllowOverride none
Require all granted
</Directory>
<Directory \"${SYMPA_HOME}/static_content\">
AllowOverride none
Require all granted
</Directory>
Alias /static-sympa ${SYMPA_HOME}/static_content
ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi
<Location /$_wwsympa_dir>
SetHandler fcgid-script
" >> $_log_file
if [[ -f "${SYMPA_SYSTEMD_DIR}/wwsympa.service" ]]; then
echo "
<Location /$(basename \"$_wwsympa_dir\")>
SetHandler \"proxy:unix:${SYMPA_PID_DIR}/wwsympa.socket|fcgi://\"
</Location>
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
</VirtualHost>
## ---
## --- IPv6
## ---
<VirtualHost [${IPv6}]:80>
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
</VirtualHost>
<VirtualHost [${IPv6}]:443>
ServerAdmin admin@oopen.de
ServerName $SYMPA_LIST_DOMAIN
RewriteEngine on
RewriteRule ^/\\\$ /$_wwsympa_dir/ [R]
<Directory \"${SYMPA_HOME}/bin\">
AllowOverride none
<Location /static-sympa>
Require all granted
</Directory>
<Directory \"${SYMPA_HOME}/static_content\">
AllowOverride none
Require all granted
</Directory>
Alias /static-sympa ${SYMPA_HOME}/static_content
ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi
<Location /$_wwsympa_dir>
SetHandler fcgid-script
</Location>
Alias /static-sympa ${SYMPA_STATIC_DIR}
" >> $_log_file
else
echo "
<Directory \"$SYMPA_CGI_DIR\">
AllowOverride none
Require all granted
</Directory>
<Directory \"$SYMPA_STATIC_DIR\">
AllowOverride none
Require all granted
</Directory>
Alias /static-sympa ${SYMPA_STATIC_DIR}
ScriptAlias /$_wwsympa_dir ${SYMPA_CGI_DIR}/wwsympa-wrapper.fcgi
<Location /${_wwsympa_dir}>
SetHandler fcgid-script
</Location>
" >> $_log_file
fi
echo "
SSLEngine on
## - HTTP Strict Transport Security (HSTS)
@ -1221,10 +1259,10 @@ else
</VirtualHost>
EOF" >> $_log_file
cat <<EOF > $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
cat <<EOF > $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
# - $SYMPA_LIST_DOMAIN -#
<VirtualHost ${IPv4}:80>
<VirtualHost ${IPv4}:80 [${IPv6}]:80>
ServerAdmin admin@oopen.de
@ -1239,7 +1277,7 @@ EOF" >> $_log_file
</VirtualHost>
<VirtualHost ${IPv4}:443>
<VirtualHost ${IPv4}:443 [${IPv6}]:443>
ServerAdmin admin@oopen.de
@ -1248,94 +1286,45 @@ EOF" >> $_log_file
RewriteEngine on
RewriteRule ^/\$ /$_wwsympa_dir/ [R]
<Directory "${SYMPA_HOME}/bin">
AllowOverride none
Require all granted
</Directory>
EOF
<Directory "${SYMPA_HOME}/static_content">
AllowOverride none
Require all granted
</Directory>
if [[ -f "${SYMPA_SYSTEMD_DIR}/wwsympa.service" ]]; then
Alias /static-sympa ${SYMPA_HOME}/static_content
ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi
cat <<EOF >> $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
<Location /$_wwsympa_dir>
SetHandler fcgid-script
<Location /$(basename "$_wwsympa_dir")>
SetHandler "proxy:unix:${SYMPA_PID_DIR}/wwsympa.socket|fcgi://"
</Location>
SSLEngine on
<Location /static-sympa>
Require all granted
</Location>
## - 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"
Alias /static-sympa ${SYMPA_STATIC_DIR}
EOF
else
cat <<EOF >> $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
## - 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
</VirtualHost>
## ---
## --- IPv6
## ---
<VirtualHost [${IPv6}]:80>
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
</VirtualHost>
<VirtualHost [${IPv6}]:443>
ServerAdmin admin@oopen.de
ServerName $SYMPA_LIST_DOMAIN
RewriteEngine on
RewriteRule ^/\$ /$_wwsympa_dir/ [R]
<Directory "${SYMPA_HOME}/bin">
<Directory "$SYMPA_CGI_DIR">
AllowOverride none
Require all granted
</Directory>
<Directory "${SYMPA_HOME}/static_content">
<Directory "$SYMPA_STATIC_DIR">
AllowOverride none
Require all granted
</Directory>
Alias /static-sympa ${SYMPA_HOME}/static_content
ScriptAlias /wws ${SYMPA_HOME}/bin/wwsympa-wrapper.fcgi
Alias /static-sympa ${SYMPA_STATIC_DIR}
ScriptAlias /$_wwsympa_dir ${SYMPA_CGI_DIR}/wwsympa-wrapper.fcgi
<Location /$_wwsympa_dir>
<Location /${_wwsympa_dir}>
SetHandler fcgid-script
</Location>
EOF
fi
cat <<EOF >> $apache_vhost_dir/${SYMPA_LIST_DOMAIN}.conf
SSLEngine on
@ -1363,12 +1352,11 @@ EOF" >> $_log_file
</VirtualHost>
EOF
if [ "$?" = "0" ]; then
if [ "$?" = "0" ]; then
echo_ok
apache_vhost_added=true
else
else
echo_failed
fi
fi
if $apache_vhost_added ; then

File diff suppressed because it is too large Load Diff