Used sequpgrade.sh to upgrade existing seqs

This commit is contained in:
2022-05-29 20:58:23 +02:00
parent 10ee4198f0
commit 6214493c18
57 changed files with 802 additions and 806 deletions

View File

@@ -24,23 +24,23 @@ CONFIG=0
CONFIG_FILE_NAME="${toolName}.cfg"
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
step_config() {
seq_config() {
if [ $(id -u) -ne 0 ] ; then
endReturn -o 1 "No root"
fi
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
if [ $? -eq 0 ] ; then
CONFIG=1
echoseq " Domain: $MAS_DOMAIN"
info " Domain: $MAS_DOMAIN"
elif [ $? -eq 1 ] ; then
# Config $CONFIG_FILE_NAME created. Needs modification first
[ $DRY -eq 0 ] && return -1
dry || return -1
fi
return 0
}
step_1_info() { echo "Update apt repositories"; }
step_1_alias() { ALIAS="install"; }
step_1_alias() { echo "install"; }
step_1() {
exe apt update
}
@@ -48,7 +48,7 @@ step_1() {
step_2_info() { echo "Install $mtaName"; }
step_2() {
local aptOpt=
if [ $QUIET -ne 0 ];then
if quiet;then
aptOpt="-y"
else
read -p "In the following dialog chose \"Internet site\" and enter $MAS_DOMAIN as your domain. Enter to continue..."
@@ -74,11 +74,11 @@ step_4() {
step_5_info() { echo "$mtaName enable submission service"; }
step_5() {
echoseq -e " [I] Copy following lines...\n"
info -e " [I] Copy following lines...\n"
exe cat "$mtaConfSubmission"
exe read -rep $'\nPress Enter to open the '$mtaConfLoc'/master.cf'
exe vi $mtaConfLoc/master.cf
exe echoseq
exe info
exe cat "$mtaConfSmtps"
exe read -rep $'\nPress Enter to open the '$mtaConfLoc'/master.cf'
exe vi $mtaConfLoc/master.cf
@@ -97,7 +97,7 @@ step_6() {
exe postconf "smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1"
exe postconf "smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1"
echoseq " [I] Restarting $mtaName"
info "Restarting $mtaName"
exe service $mtaName restart
}
@@ -112,14 +112,14 @@ step_7() {
step_8_info() { echo "Install $mdaName"; }
step_8() {
exe apt install $mdaDeps
echoseq -e "\n [I] Installed version: $(dovecot --version)"
info -e "\n [I] Installed version: $(dovecot --version)"
}
step_9_info() {
echo "Configure $mdaName"
}
step_9() {
outColor green
color green
cat <<MDA_EOF
# Configuring Mailbox Location
[/etc/dovecot/conf.d/10-mail.conf]
@@ -205,10 +205,10 @@ step_20_info() {
echo "Install postfixadmin and create mysql database"
echoinfo "Virtualize mailboxes, domains and aliases by using a mysql database"
}
step_20_alias() { ALIAS="virtual"; }
step_20_alias() { echo "virtual"; }
step_20() {
local qOpt=
if [ $QUIET -ne 0 ] ; then
if quiet ; then
qOpt="-q"
fi
exe $WDIR/postfixadmin.sh ${qOpt} install
@@ -235,7 +235,7 @@ step_21() {
for mtaFile in ${mtaMysqlFiles[@]}
do
eval 'mtaVar=$MAS_'${mtaFile}
echoseq " [I] creating ${mtaFile}.cf"
info "creating ${mtaFile}.cf"
exe echo -e "$localMysqlUser\n$mtaVar" > "$mtaMysqlConfLoc/${mtaFile}.cf"
done
@@ -259,7 +259,7 @@ step_22() {
exe postconf -e "virtual_gid_maps = static:$MAS_VIRTUAL_USER_ID"
}
step_23_info() { echo "Create virtual user $MAS_VIRTUAL_USER and folder $MAS_VIRTUAL_FOLDER_BASE"; }
step_23_info() { echo "Create virtual user ${MAS_VIRTUAL_USER:-} and folder ${MAS_VIRTUAL_FOLDER_BASE:-}"; }
step_23() {
exe mkdir -p "$MAS_VIRTUAL_FOLDER_BASE"
exe groupadd --gid $MAS_VIRTUAL_USER_ID $MAS_VIRTUAL_USER
@@ -267,7 +267,7 @@ step_23() {
exe chown -R ${MAS_VIRTUAL_USER}: "$MAS_VIRTUAL_FOLDER_BASE"
exe chmod -R 770 "$MAS_VIRTUAL_FOLDER_BASE"
echoseq " [I] Restarting $mtaName"
info "Restarting $mtaName"
exe service $mtaName restart
}
@@ -335,7 +335,7 @@ step_25() {
}
step_50_info() { echo "Adding default relay host for sending mails"; }
step_50_alias() { ALIAS="default_relay"; }
step_50_alias() { echo "default_relay"; }
step_50() {
if [ ! -f "$saslPassFile" ] ; then
exe postconf -e "relayhost = $MAS_RELAYHOST"
@@ -343,7 +343,7 @@ step_50() {
exe postconf -e "smtp_sasl_password_maps = hash:$saslPassFile"
addConf -s "$MAS_RELAYHOST $MAS_RELAYUSER:$MAS_RELAYPASS" "$saslPassFile"
fi
echoseq " [I] Updating $saslPassFile"
info "Updating $saslPassFile"
exe postmap "$saslPassFile"
}
saslPassFile="$mtaConfLoc/sasl_password"
@@ -352,7 +352,7 @@ step_52_info() {
echo "Grant access for specific (local) hostnames"
echoinfo "Workaround when local clients connect to 25 with different ips (v6)"
}
step_52_alias() { ALIAS="client_access"; }
step_52_alias() { echo "client_access"; }
step_52() {
if [ ! -f "$mtaClientAccessLoc" ] ; then
echo " [I] Generating $mtaClientAccessLoc"
@@ -362,7 +362,7 @@ step_52() {
echo " smtpd_relay_restrictions ="
echo " check_client_access hash:$mtaClientAccessLoc"
fi
echoseq " [I] Updating $mtaClientAccessLoc"
info "Updating $mtaClientAccessLoc"
exe postmap "$mtaClientAccessLoc"
}
mtaClientAccessLoc="$mtaConfLoc/client_access"
@@ -370,26 +370,26 @@ mtaClientAccessLoc="$mtaConfLoc/client_access"
step_54_info() {
echo "Deny recipient access for listed mail addresses"
}
step_54_alias() { ALIAS="recipient_access"; }
step_54_alias() { echo "recipient_access"; }
step_54() {
if [ ! -f "$mtaRecipientAccessLoc" ] ; then
echoseq " [I] Generating $mtaRecipientAccessLoc"
info "Generating $mtaRecipientAccessLoc"
exep "echo \"# unwanted@${MAS_DOMAIN} 550 No mailbox. Nothing to see here.\" > \"$mtaRecipientAccessLoc\""
echo " [I] Don't forget to add the following"
echo " [$mtaConfLoc/main.cf]"
echo " smtpd_recipient_restrictions ="
echo " check_recipient_access hash:$mtaRecipientAccessLoc"
fi
echoseq " [I] Updating $mtaRecipientAccessLoc"
info "Updating $mtaRecipientAccessLoc"
exe postmap "$mtaRecipientAccessLoc"
}
mtaRecipientAccessLoc="$mtaConfLoc/recipient_access"
step_56_info() { echo "Add sender dependant relay with authentication"; }
step_56_alias() { ALIAS="sender_relay"; }
step_56_alias() { echo "sender_relay"; }
step_56() {
if [ ! -f "$mtaSenderRelayLoc" ] ; then
echoseq " [I] Generating $mtaSenderRelayLoc"
info "Generating $mtaSenderRelayLoc"
exep "echo \"# user@extern.com smtp:[mail.extern.com]:587\" > \"$mtaSenderRelayLoc\""
exe postconf -e "smtp_sender_dependent_authentication = yes"
exe postconf -e "sender_dependent_relayhost_maps = hash:$mtaSenderRelayLoc"
@@ -402,7 +402,7 @@ step_56() {
echo " user@extern.com username:passwort"
echo " postmap $saslPassFile"
fi
echoseq " [I] Updating $mtaSenderRelayLoc"
info "Updating $mtaSenderRelayLoc"
exe postmap "$mtaSenderRelayLoc"
exe postmap "$saslPassFile"
}
@@ -412,7 +412,7 @@ step_100_info() {
echo "Send testmail [-u SYSTEMUSER | -f FROM] [TO]"
echoinfo "Send as current user to postmaster@\$MAS_DOMAIN by default"
}
step_100_alias() { ALIAS="test"; }
step_100_alias() { echo "test"; }
step_100() {
shift
local arg
@@ -443,7 +443,7 @@ step_100() {
}
step_102_info() { echo "Show mail queue"; }
step_102_alias() { ALIAS="showqueue"; }
step_102_alias() { echo "showqueue"; }
step_102() {
exe sendmail -bp
}
@@ -452,7 +452,7 @@ step_104_info() {
echo "Delete mail queue [ID]"
echoinfo "Delete all queued mails if [ID] is empty"
}
step_104_alias() { ALIAS="delqueue"; }
step_104_alias() { echo "delqueue"; }
step_104() {
shift
local msgId="ALL"
@@ -462,5 +462,5 @@ step_104() {
exe postsuper -d "$msgId"
}
VERSION_SEQREV=12
readonly sqr_minVersion=16
. /usr/local/bin/sequencer.sh