|
|
|
@ -8,6 +8,8 @@ DB_NAME=sympa |
|
|
|
DB_USER="$DB_NAME" |
|
|
|
DB_PASS="$DB_NAME" |
|
|
|
|
|
|
|
SYMPA_DOMAIN='' |
|
|
|
|
|
|
|
## functions |
|
|
|
|
|
|
|
function usage { |
|
|
|
@ -61,6 +63,13 @@ function import_files_etc_sympa { |
|
|
|
replace_conf_entry_from_export wwsympa_url |
|
|
|
replace_conf_entry_from_export listmaster |
|
|
|
replace_conf_entry_from_export lang |
|
|
|
|
|
|
|
/opt/miaou-bash/tools/append_or_replace "^aliases_program.*$" "aliases_program postalias" /etc/sympa/sympa/sympa.conf |
|
|
|
} |
|
|
|
|
|
|
|
function import_files_etc_mail_sympa_aliases { |
|
|
|
mv etc/mail/sympa/aliases{,.db} /etc/mail/sympa/ |
|
|
|
chown sympa:sympa /etc/mail/sympa/aliases{,.db} |
|
|
|
} |
|
|
|
|
|
|
|
function import_files_etc_dkimkeys { |
|
|
|
@ -86,8 +95,11 @@ function import_files { |
|
|
|
cd "$files_temp" |
|
|
|
|
|
|
|
tar -xf "$export_tmp/files.tar.gz" |
|
|
|
|
|
|
|
import_files_etc_sympa |
|
|
|
import_files_etc_mail_sympa_aliases |
|
|
|
[[ -d etc/dkimkeys ]] && import_files_etc_dkimkeys |
|
|
|
|
|
|
|
import_files_lib |
|
|
|
import_files_spool |
|
|
|
|
|
|
|
@ -96,7 +108,7 @@ function import_files { |
|
|
|
|
|
|
|
function import_certbot { |
|
|
|
|
|
|
|
local sympa_domain=$(grep '^domain' /etc/sympa/sympa/sympa.conf | cut -f2) |
|
|
|
SYMPA_DOMAIN=$(grep '^domain' /etc/sympa/sympa/sympa.conf | cut -f2) |
|
|
|
|
|
|
|
if [[ -f "$export_tmp/certbot.tar" ]]; then |
|
|
|
echo -n "import certbot..." |
|
|
|
@ -156,10 +168,10 @@ server { |
|
|
|
|
|
|
|
server { |
|
|
|
listen 443 ssl; |
|
|
|
server_name $sympa_domain; |
|
|
|
server_name $SYMPA_DOMAIN; |
|
|
|
|
|
|
|
ssl_certificate /etc/letsencrypt/live/$sympa_domain/fullchain.pem; |
|
|
|
ssl_certificate_key /etc/letsencrypt/live/$sympa_domain/privkey.pem; |
|
|
|
ssl_certificate /etc/letsencrypt/live/$SYMPA_DOMAIN/fullchain.pem; |
|
|
|
ssl_certificate_key /etc/letsencrypt/live/$SYMPA_DOMAIN/privkey.pem; |
|
|
|
include /etc/letsencrypt/options-ssl-nginx.conf; |
|
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; |
|
|
|
|
|
|
|
@ -200,15 +212,17 @@ function migrate_sympa { |
|
|
|
|
|
|
|
function stop_services { |
|
|
|
echo -n "stop services..." |
|
|
|
sudo systemctl stop sympa.service |
|
|
|
sudo systemctl stop wwsympa.socket |
|
|
|
systemctl stop sympa.service |
|
|
|
systemctl stop wwsympa.socket |
|
|
|
systemctl stop postfix.service |
|
|
|
echo OK |
|
|
|
} |
|
|
|
|
|
|
|
function start_services { |
|
|
|
echo -n "start services..." |
|
|
|
sudo systemctl start sympa.service |
|
|
|
sudo systemctl start wwsympa.socket |
|
|
|
systemctl start sympa.service |
|
|
|
systemctl start wwsympa.socket |
|
|
|
systemctl start postfix.service |
|
|
|
echo OK |
|
|
|
} |
|
|
|
|
|
|
|
@ -218,6 +232,14 @@ function remove_temp { |
|
|
|
echo OK |
|
|
|
} |
|
|
|
|
|
|
|
function configure_postfix { |
|
|
|
echo "$SYMPA_DOMAIN" > /etc/mailname |
|
|
|
|
|
|
|
/opt/miaou-bash/tools/append_or_replace "^myhostname =.*$" "myhostname = $SYMPA_DOMAIN" /etc/postfix/main.cf |
|
|
|
/opt/miaou-bash/tools/append_or_replace "^alias_maps =.*$" "alias_maps = hash:/etc/aliases, hash:/etc/mail/sympa/aliases" /etc/postfix/main.cf |
|
|
|
/opt/miaou-bash/tools/append_or_replace "^alias_database =.*$" "alias_database = hash:/etc/aliases, hash:/etc/mail/sympa/aliases" /etc/postfix/main.cf |
|
|
|
} |
|
|
|
|
|
|
|
function import { |
|
|
|
create_temp |
|
|
|
|
|
|
|
@ -225,7 +247,9 @@ function import { |
|
|
|
stop_services |
|
|
|
import_database |
|
|
|
import_files |
|
|
|
import_certbot |
|
|
|
import_certbot # SYMPA_DOMAIN got populated! |
|
|
|
configure_postfix |
|
|
|
|
|
|
|
start_services |
|
|
|
migrate_sympa |
|
|
|
|
|
|
|
|