Compare commits

...

9 Commits

13 changed files with 279 additions and 126 deletions

View File

@@ -165,8 +165,16 @@ max_userip_connections=24
#auth_mechanisms="plain login digest-md5 cram-md5"
auth_mechanisms="plain login"
# ---
# - Settings for quota warning sript
# -
# ---
# msg_language
#
# possible Vallues are 'en' or 'de'
#
msg_language=de
from_address="o.open <oo@oopen.de>"
reply_to="oo@oopen.de"
webmailer="https://webmail.oopen.de"

View File

@@ -115,9 +115,11 @@ DEFAULT_ADMIN_EMAIL="argus@oopen.de"
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
systemd_exists=false
else
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi

View File

@@ -154,9 +154,11 @@ QUARANTINE_ADMIN=$DEFAULT_QUARANTINE_ADMIN
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
systemd_exists=false
else
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi
@@ -4315,6 +4317,23 @@ if (-r \$policy_banks_file) {
\$final_bad_header_destiny = D_PASS;
# ----------------------------------------------------------
# Admin E-Mails / Warnungen direct von AMaViS (nicht DSN- oder Bounce-Mails)
# ----------------------------------------------------------
# Bemerkung:
# *nochmal*: das hat nichts mit den eigentlichen DSN-/Bounce-Mails zu tun.
\$virus_admin = undef;
\$spam_admin = undef;
\$warnvirusrecip = 0;
\$warnbannedrecip = 0;
\$warnbannedsender = 0;
\$warnbadhrecip = 0;
\$warn_offsite = 0;
# Bypass spam checking for trusted networks using mynetworks
#
@@ -4989,19 +5008,6 @@ EOF
EOF
fi
if ${listen_on_additional_smtp_port} ; then
cat >> $postfix_master_cf << EOF
${additional_smtp_port} inet n - y - - smtpd
-o smtpd_proxy_filter=127.0.0.1:10024
-o content_filter=
EOF
if [[ "$SASL_AUTH_ENABLED" = "no" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_sasl_auth_enable=no
EOF
fi
fi
if ! $submission_present && ! $smtps_present && ! $localhost_10025_present ; then
cat >> $postfix_master_cf << EOF
localhost:10025 inet n - y - - smtpd
@@ -5016,13 +5022,9 @@ localhost:10025 inet n - y - - smtpd
-o mynetworks=127.0.0.0/8,[::1]/128
-o receive_override_options=no_unknown_recipient_checks
EOF
if [[ -n "$(which opendkim)" && -n "$(which opendmarc)" ]] ; then
if [[-n "$(which opendmarc)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock,local:/opendmarc/opendmarc.sock
EOF
elif [[ -n "$(which opendkim)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock
-o smtpd_milters=local:/opendmarc/opendmarc.sock
EOF
fi
cat >> $postfix_master_cf << EOF
@@ -5033,8 +5035,26 @@ EOF
continue
fi
if ${listen_on_additional_smtp_port} \
&& echo "$_line" | grep -i -E "^\s*${additional_smtp_port}\s+inet" > /dev/null 2>&1 ; then
_found=true
cat >> $postfix_master_cf << EOF
${additional_smtp_port} inet n - y - - smtpd
-o smtpd_proxy_filter=127.0.0.1:10024
-o content_filter=
EOF
if [[ "$SASL_AUTH_ENABLED" = "no" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_sasl_auth_enable=no
EOF
fi
if $submission_present && echo "$_line" | grep -i -E "^^submission\s+" > /dev/null 2>&1 ; then
continue
fi
if $submission_present && echo "$_line" | grep -i -E "^submission\s+" > /dev/null 2>&1 ; then
_found=true
cat >> $postfix_master_cf << EOF
submission inet n - y - 20 smtpd
@@ -5042,6 +5062,13 @@ submission inet n - y - 20 smtpd
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
EOF
if [[ -n "$(which opendkim)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock
EOF
fi
cat >> $postfix_master_cf << EOF
#-o milter_macro_daemon_name=ORIGINATING
EOF
if ! $smtps_present ; then
@@ -5059,13 +5086,9 @@ localhost:10025 inet n - y - - smtpd
-o mynetworks=127.0.0.0/8,[::1]/128
-o receive_override_options=no_unknown_recipient_checks
EOF
if [[ -n "$(which opendkim)" && -n "$(which opendmarc)" ]] ; then
if [[ -n "$(which opendmarc)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock,local:/opendmarc/opendmarc.sock
EOF
elif [[ -n "$(which opendkim)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock
-o smtpd_milters=local:/opendmarc/opendmarc.sock
EOF
fi
cat >> $postfix_master_cf << EOF
@@ -5096,6 +5119,13 @@ smtps inet n - y - - smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
EOF
if [[ -n "$(which opendkim)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock
EOF
fi
cat >> $postfix_master_cf << EOF
#-o milter_macro_daemon_name=ORIGINATING
EOF
@@ -5113,13 +5143,9 @@ localhost:10025 inet n - y - - smtpd
-o mynetworks=127.0.0.0/8,[::1]/128
-o receive_override_options=no_unknown_recipient_checks
EOF
if [[ -n "$(which opendkim)" && -n "$(which opendmarc)" ]] ; then
if [[ -n "$(which opendmarc)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock,local:/opendmarc/opendmarc.sock
EOF
elif [[ -n "$(which opendkim)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock
-o smtpd_milters=local:/opendmarc/opendmarc.sock
EOF
fi
cat >> $postfix_master_cf << EOF
@@ -5156,13 +5182,9 @@ localhost:10025 inet n - y - - smtpd
-o mynetworks=127.0.0.0/8,[::1]/128
-o receive_override_options=no_unknown_recipient_checks
EOF
if [[ -n "$(which opendkim)" && -n "$(which opendmarc)" ]] ; then
if [[ -n "$(which opendmarc)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock,local:/opendmarc/opendmarc.sock
EOF
elif [[ -n "$(which opendkim)" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_milters=local:/opendkim/opendkim.sock
-o smtpd_milters=local:/opendmarc/opendmarc.sock
EOF
fi
cat >> $postfix_master_cf << EOF

View File

@@ -94,9 +94,11 @@ echo_skipped() {
# - Is 'systemd' supported on this system
# -
if [ "X`which systemd`" = "X" ]; then
SYSTEMD_EXISTS=false
else
SYSTEMD_EXISTS=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
SYSTEMD_EXISTS=true
fi

View File

@@ -116,9 +116,11 @@ echo_skipped() {
# - Is 'systemd' supported on this system
# -
if [ "X`which systemd`" = "X" ]; then
SYSTEMD_EXISTS=false
else
SYSTEMD_EXISTS=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
SYSTEMD_EXISTS=true
fi

View File

@@ -136,9 +136,11 @@ DEFAULT_INSTALL_DMARC_REPORT_SUPPORT=false
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
systemd_exists=false
else
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi

View File

@@ -136,9 +136,11 @@ DEFAULT_REWRITE_SENDER_DOMAIN=None
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
systemd_exists=false
else
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi

View File

@@ -65,6 +65,14 @@ echo_skipped() {
echo -e "\033[80G[ \033[33m\033[1mskipped\033[m ]"
}
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi
## - Install Postfix Firewall Daemon from debian packages system
## -
echononl " Install Postfix Firewall Daemon from debian packages system"

View File

@@ -964,9 +964,11 @@ delete_variable_with_comments() {
# - Support systemd ?
# -
if [[ "X$(which systemd)" = "X" ]]; then
SYSTEMD_EXISTS=false
else
SYSTEMD_EXISTS=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
SYSTEMD_EXISTS=true
fi
@@ -1024,6 +1026,13 @@ if [[ "$database" != "postgres" ]] && [[ "$database" != "mysql" ]] ; then
fi
[[ -n "$dbpassword" ]] || fatal "Parameter "dbpassword" not set."
lang="${msg_language,,}"
if [[ "$lang" =~ ^(en|us|en_us)$ ]]; then
msg_language="en"
else
msg_language="de"
fi
[[ -n "$from_address" ]] || fatal ""Parameter "from_address" not set.""
[[ -n "$reply_to" ]] || fatal ""Parameter "reply_to" not set.""
[[ -n "$webmailer" ]] || fatal ""Parameter "webmailer" not set.""
@@ -2790,11 +2799,12 @@ fi
## - Compile dovecot
## -
echononl " Compile Dovecot Sources.."
make > ${_log_dir}/dovecot-${_version}-make.log 2>&1 || clean_up 1
make > ${_log_dir}/dovecot-${_version}-make.log 2>&1
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
echo -e "$rc_failed"
echo -e "\n See file \033[1m${_log_dir}/dovecot-${_version}-make.log\033[m for more details."
fatal Compiling dovecot failed
fi
@@ -7586,6 +7596,7 @@ if [[ $dovecot_major_version -gt 2 ]] \
read -r -d '' NEW_BLOCK <<EOF
sieve_script personal {
type = personal # kann man schreiben, ist aber Default
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
@@ -7603,6 +7614,8 @@ EOF
# personal
# --------
#
# ** Used by both the Sieve plugin and the ManageSieve protocol **
#
# The personal storage serves as the user's main personal storage. Although more than a single
# personal storage can be defined, only the first one listed in the configuration is used.
#
@@ -7625,6 +7638,7 @@ EOF
# no default script is executed.
sieve_script personal {
type = personal # kann man schreiben, ist aber Default
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
@@ -7637,16 +7651,17 @@ EOF
fi
if grep -qE "^\s*sieve_script\s+before\s*{" "${_conf_file}"; then
if grep -qE "^\s*sieve_script\s+before_spam\s*{" "${_conf_file}"; then
read -r -d '' NEW_BLOCK <<EOF
sieve_script before {
sieve_script before_spam {
type = before
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/
}
EOF
replace_or_append_code_block "sieve_script before" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
replace_or_append_code_block "sieve_script before_spam" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
if [[ $? -gt 0 ]]; then
_failed=true
fi
@@ -7675,7 +7690,8 @@ EOF
# A before storage behaves identical to an after storage, except the contained script or
# scripts are run before user's personal script (instead of after).
sieve_script before {
sieve_script before_spam {
type = before
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/
}
@@ -7687,16 +7703,17 @@ EOF
fi
if grep -qE "^\s*sieve_script\s+global\s*{" "${_conf_file}"; then
if grep -qE "^\s*sieve_script\s+global_includes\s*{" "${_conf_file}"; then
read -r -d '' NEW_BLOCK <<EOF
sieve_script global {
sieve_script global_includes {
type = global
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/global/
}
EOF
replace_or_append_code_block "sieve_script global" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
replace_or_append_code_block "sieve_script global_includes" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
if [[ $? -gt 0 ]]; then
_failed=true
fi
@@ -7745,7 +7762,8 @@ EOF
# storages are defined in the configuration until the script is found. The order can be
# overridden by the sieve_script_precedence setting.
sieve_script global {
sieve_script global_includes {
type = global
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/global/
}
@@ -9901,6 +9919,46 @@ if [[ $dovecot_major_version -gt 2 ]] \
echononl " Create quota warning script.."
## - create the user-warning script
## -
if [[ "${msg_language}" == "en" ]] ; then
cat <<EOF >/usr/local/bin/quota-warning.sh
#!/usr/bin/env bash
# author: zhang huangbin <michaelbibby (at) gmail.com>
# purpose: send mail to notify user when his mailbox quota exceeds a
# specified limit.
# project: iredmail (http://www.iredmail.org/)
LANG=en_US.UTF-8
percent=\$1
user=\$2
cat << EOF | /usr/local/dovecot/libexec/dovecot/dovecot-lda -d \${user} -o quota_enforce=no
Date: `date +"%a, %e %b %Y %H:%M:%S %z"`
From: $from_address
Reply-to: $reply_to
To:\${user}
Subject: Quota warning - mailbox is ${percent}% full
content-type: text/plain;
charset=utf-8
Hello!
Your email inbox
\${user}
is over \${percent}% full. To continue receiving emails, please delete emails from your inbox on the server.
You can also use the webmail service:
$webmailer
After deleting emails, please remember to empty the trash folder as well.
Best regards
$salutation
${_EOF:-EOF}
EOF
else
cat <<EOF >/usr/local/bin/quota-warning.sh
#!/usr/bin/env bash
@@ -9940,6 +9998,7 @@ Viele Grüße
$salutation
${_EOF:-EOF}
EOF
fi
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@@ -9952,6 +10011,32 @@ EOF
echononl " Create quota warn-under script.."
## - create the user-warning script
## -
if [[ "${msg_language}" == "en" ]] ; then
cat <<EOF >/usr/local/bin/quota-warn-under.sh
cat << EOF | /usr/local/dovecot/libexec/dovecot/dovecot-lda -d \${user} -o quota_enforce=no
Date: \`date +"%a, %e %b %Y %H:%M:%S %z"\`
From: $from_address
Reply-to: $reply_to
To:\${user}
Subject: Mailbox quota: less than ${percent}% used
content-type: text/plain;
charset=utf-8
Your mailbox
\${user}
can now receive e-mail again.
Please note that, depending on how much space you have freed, your available storage may fill up again quickly.
You can check the current usage in your mail client or via the webmailer here:
$webmailer
Best regards
$salutation
${_EOF:-EOF}
EOF
else
cat <<EOF >/usr/local/bin/quota-warn-under.sh
#!/usr/bin/env bash
@@ -9984,6 +10069,7 @@ Viele Grüße
$salutation
${_EOF:-EOF}
EOF
fi
if [ "$?" = 0 ]; then
echo -e "$rc_done"
else
@@ -10870,24 +10956,27 @@ EOF
replace_or_append_code_block "protocol sieve" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
read -r -d '' NEW_BLOCK <<'EOF'
sieve_script personal {
path = ~/sieve
active_path = ~/.dovecot.sieve
}
EOF
if grep -qE "^\s*sieve_script\s+personal\s+{" "${_conf_file}"; then
replace_code_block "sieve_script personal" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
else
cat <<EOF >> "${_conf_file}" || _failed=true
# Used by both the Sieve plugin and the ManageSieve protocol
${NEW_BLOCK}
EOF
fi
# read -r -d '' NEW_BLOCK <<'EOF'
#sieve_script personal {
# type = personal # kann man schreiben, ist aber Default
# type = personal
# driver = file
# path = ~/sieve
# active_path = ~/.dovecot.sieve
#}
#EOF
# if grep -qE "^\s*sieve_script\s+personal\s+{" "${_conf_file}"; then
#
# replace_code_block "sieve_script personal" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
#
# else
#
# cat <<EOF >> "${_conf_file}" || _failed=true
#
## Used by both the Sieve plugin and the ManageSieve protocol
#${NEW_BLOCK}
#EOF
# fi
if ! $_failed ; then

View File

@@ -148,9 +148,11 @@ detect_os_1 () {
# - Support systemd ?
# -
if [[ "X$(which systemd)" = "X" ]]; then
SYSTEMD_EXISTS=false
else
SYSTEMD_EXISTS=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
SYSTEMD_EXISTS=true
fi

View File

@@ -95,6 +95,16 @@ echo_skipped() {
echo -e "\033[75G[ \033[30m\033[1mskipped\033[m ]"
}
# -Is systemd supported on this system?
# -
systemd_supported=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_supported=true
fi
if [ "$POSTFIX_DB_TYPE" = "postgres" -o "$POSTFIX_DB_TYPE" = "postgresql" -o "$POSTFIX_DB_TYPE" = "pgsql" -o "$POSTFIX_DB_TYPE" = "psql" ];then
POSTFIX_DB_TYPE=pgsql

View File

@@ -182,9 +182,11 @@ fi
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
systemd_exists=false
else
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi

View File

@@ -126,9 +126,11 @@ DEFAULT_SASL_AUTH=false
# - Is this a systemd system?
# -
if [[ "X`which systemd`" = "X" ]]; then
systemd_exists=false
else
systemd_exists=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_exists=true
fi