install_update_dovecot-2.4.sh: another intermediate version.
This commit is contained in:
@ -3095,6 +3095,120 @@ EOF
|
|||||||
echo -e "$rc_skipped"
|
echo -e "$rc_skipped"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/90-sieve.conf"
|
||||||
|
echononl " Create empty file '$(basename "${_conf_file}")'.."
|
||||||
|
if [[ ! -f "${_conf_file}" ]] ; then
|
||||||
|
_failed=false
|
||||||
|
cat <<'EOF' > "${_conf_file}" 2> "${log_file}"
|
||||||
|
##
|
||||||
|
## Settings for the Sieve interpreter
|
||||||
|
##
|
||||||
|
|
||||||
|
# see also: https://doc.dovecot.org/2.4.1/core/plugins/sieve.html
|
||||||
|
|
||||||
|
# To use Sieve, you will first need to make sure you are using Dovecot LDA or LMTP Server
|
||||||
|
# for delivering incoming mail to users' mailboxes.
|
||||||
|
#
|
||||||
|
# Then, you need to enable the Sieve plugin in your configuration:
|
||||||
|
#
|
||||||
|
# protocol lda {
|
||||||
|
# mail_plugins {
|
||||||
|
# sieve = yes
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# protocol lmtp {
|
||||||
|
# mail_plugins {
|
||||||
|
# sieve = yes
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Script storage
|
||||||
|
# ==============
|
||||||
|
#
|
||||||
|
# Sieve scripts are retrieved from a script storage. This can currently be the local
|
||||||
|
# filesystem, an LDAP database or any dict storage. Depending on the storage
|
||||||
|
# implementation, its type and its configuration, storages can contain one script,
|
||||||
|
# several scripts identified by name, and a series of scripts in a well-defined order
|
||||||
|
# to be executed in sequence.
|
||||||
|
#
|
||||||
|
# Script storages are configured in a named sieve_script block:
|
||||||
|
#
|
||||||
|
# sieve_script personal {
|
||||||
|
# path = ~/.dovecot.sieve
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# The storage name (personal in the example) is used internally within configurations,
|
||||||
|
# as an identifier for logging, and as an identifier for command line tools. It also
|
||||||
|
# allows updating a storage that was defined earlier - by repeating the sieve_script
|
||||||
|
# block and adding additional configuration settings - or it allows userdb to override
|
||||||
|
# storage settings for specific users.
|
||||||
|
#
|
||||||
|
# Script storage types
|
||||||
|
# --------------------
|
||||||
|
#
|
||||||
|
# Sieve scripts can be evaluated at various stages in message delivery and for stored
|
||||||
|
# messages. The type of the Sieve script storage determines where it is applicable,
|
||||||
|
# how the storage is accessed and how the retrieved Sieve script is evaluated.
|
||||||
|
#
|
||||||
|
# The type of the Sieve script storage is configured using the sieve_script_type setting.
|
||||||
|
# The following types are currently recognized (others are defined by the sieve-imapsieve
|
||||||
|
# plugin):
|
||||||
|
EOF
|
||||||
|
if [ "$?" = 0 ]; then
|
||||||
|
echo -e "$rc_done"
|
||||||
|
else
|
||||||
|
echo -e "$rc_failed"
|
||||||
|
error "Creating file '${_conf_file}' failed!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "$rc_skipped"
|
||||||
|
fi
|
||||||
|
|
||||||
|
_conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/95-sieve-vacation.conf"
|
||||||
|
echononl " Create empty file '$(basename "${_conf_file}")'.."
|
||||||
|
if [[ ! -f "${_conf_file}" ]] ; then
|
||||||
|
_failed=false
|
||||||
|
cat <<'EOF' > "${_conf_file}" 2> "${log_file}"
|
||||||
|
##
|
||||||
|
## Settings for the Sieve Vacation Extension
|
||||||
|
##
|
||||||
|
|
||||||
|
# see also: https://doc.dovecot.org/2.4.1/core/config/sieve/extensions/vacation.html
|
||||||
|
|
||||||
|
# The Sieve vacation extension (RFC 5230) defines a mechanism to generate automatic
|
||||||
|
# replies to incoming email messages. It takes various precautions to make sure replies
|
||||||
|
# are only sent when appropriate.
|
||||||
|
#
|
||||||
|
# Script authors can specify how often replies can be sent to a particular contact.
|
||||||
|
# In the original vacation extension, this interval is specified in days with a minimum
|
||||||
|
# of one day. When more granularity is necessary and particularly when replies must be
|
||||||
|
# sent more frequently than one day, the vacation-seconds extension (RFC 6131) can be
|
||||||
|
# used. This allows specifying the minimum reply interval in seconds with a minimum of
|
||||||
|
# zero (a reply is then always sent), depending on administrator configuration.
|
||||||
|
#
|
||||||
|
# Configuration
|
||||||
|
# =============
|
||||||
|
#
|
||||||
|
# The vacation extension is available by default.
|
||||||
|
#
|
||||||
|
# In contrast, the vacation-seconds extension - which implies the vacation extension
|
||||||
|
# when used - is not available by default and needs to be enabled explicitly by adding
|
||||||
|
# it to sieve_extensions.
|
||||||
|
#
|
||||||
|
# The configuration also needs to be adjusted accordingly to allow a non-reply period of
|
||||||
|
# less than a day.
|
||||||
|
EOF
|
||||||
|
if [ "$?" = 0 ]; then
|
||||||
|
echo -e "$rc_done"
|
||||||
|
else
|
||||||
|
echo -e "$rc_failed"
|
||||||
|
error "Creating file '${_conf_file}' failed!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "$rc_skipped"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
blank_line
|
blank_line
|
||||||
|
|
||||||
@ -3202,7 +3316,7 @@ if [[ ${dovecot_major_version} -eq 2 ]] && [[ ${dovecot_minor_version} -lt 4 ]]
|
|||||||
echo -e "$rc_done"
|
echo -e "$rc_done"
|
||||||
else
|
else
|
||||||
echo -e "$rc_failed"
|
echo -e "$rc_failed"
|
||||||
error Compiling Pigeonhole ManageSieve failed
|
error Copying thr sample config files to the configuration directory failed.
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "$rc_skipped"
|
echo -e "$rc_skipped"
|
||||||
@ -3217,7 +3331,7 @@ if [[ -f "/usr/local/dovecot-${_version}/etc/dovecot/dovecot.conf" ]] ; then
|
|||||||
echo -e "$rc_done"
|
echo -e "$rc_done"
|
||||||
else
|
else
|
||||||
echo -e "$rc_failed"
|
echo -e "$rc_failed"
|
||||||
error Compiling Pigeonhole ManageSieve failed
|
error The backup of the main configuration file failed.
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "$rc_skipped"
|
echo -e "$rc_skipped"
|
||||||
@ -6142,11 +6256,8 @@ passdb sql {
|
|||||||
# Load SQL connection data
|
# Load SQL connection data
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
query = SELECT username AS user, password \\
|
||||||
FROM mailbox \
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT '/var/vmail/' || maildir AS home, \
|
|
||||||
'5000' AS uid, '5000' AS gid \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -6184,11 +6295,9 @@ userdb sql {
|
|||||||
# Load SQL connection data
|
# Load SQL connection data
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
query = SELECT '/var/vmail/' || maildir AS home, \\
|
||||||
FROM mailbox \
|
'5000' AS uid, '5000' AS gid \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT '/var/vmail/' || maildir AS home, \
|
FROM mailbox \\
|
||||||
'5000' AS uid, '5000' AS gid \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
iterate_query = SELECT username AS user FROM mailbox
|
iterate_query = SELECT username AS user FROM mailbox
|
||||||
@ -6235,11 +6344,8 @@ passdb sql {
|
|||||||
# Load SQL connection data
|
# Load SQL connection data
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
query = SELECT username AS user, password \\
|
||||||
FROM mailbox \
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \
|
|
||||||
'5000' AS uid, '5000' AS gid \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -6276,11 +6382,9 @@ userdb sql {
|
|||||||
# Load SQL connection data
|
# Load SQL connection data
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
query = SELECT CONCAT('/var/vmail/',maildir) AS home, \\
|
||||||
FROM mailbox \
|
'5000' AS uid, '5000' AS gid \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \
|
FROM mailbox \\
|
||||||
'5000' AS uid, '5000' AS gid \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
iterate_query = SELECT username AS user FROM mailbox
|
iterate_query = SELECT username AS user FROM mailbox
|
||||||
@ -6480,7 +6584,9 @@ connect = host=$dbhost user=$dbuser password=$dbpassword dbname=$dbname
|
|||||||
default_pass_scheme = $default_pass_scheme
|
default_pass_scheme = $default_pass_scheme
|
||||||
password_query = SELECT username AS user, password \\
|
password_query = SELECT username AS user, password \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT '/var/vmail/' || maildir AS home, \\
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
|
user_query = SELECT '/var/vmail/' || maildir AS home, \\
|
||||||
'5000' AS uid, '5000' AS gid \\
|
'5000' AS uid, '5000' AS gid \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
@ -6506,7 +6612,9 @@ connect = host=$dbhost user=$dbuser password=$dbpassword dbname=$dbname
|
|||||||
default_pass_scheme = $default_pass_scheme
|
default_pass_scheme = $default_pass_scheme
|
||||||
password_query = SELECT username AS user, password \\
|
password_query = SELECT username AS user, password \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \\
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
|
user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \\
|
||||||
'5000' AS uid, '5000' AS gid \\
|
'5000' AS uid, '5000' AS gid \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
@ -6921,15 +7029,17 @@ if [[ $dovecot_major_version -gt 2 ]] \
|
|||||||
# lmtp_save_to_detail_mailbox = no
|
# lmtp_save_to_detail_mailbox = no
|
||||||
#
|
#
|
||||||
# protocol lmtp {
|
# protocol lmtp {
|
||||||
|
# postmaster_address = $postmaster_address
|
||||||
# mail_plugins = $mail_plugins sieve
|
# mail_plugins = $mail_plugins sieve
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
|
|
||||||
|
: > "${log_file}"
|
||||||
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
||||||
|
|
||||||
if grep -qE "^\s*lmtp_save_to_detail_mailbox\s*=" "${_conf_file}"; then
|
if grep -qE "^\s*lmtp_save_to_detail_mailbox\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
replace_variable "lmtp_save_to_detail_mailbox" "no" "${_conf_file}" || _failed=true
|
replace_variable "lmtp_save_to_detail_mailbox" "no" "${_conf_file}" 2> "${log_file}" || _failed=true
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -6944,6 +7054,15 @@ EOF
|
|||||||
read -r -d '' NEW_BLOCK <<'EOF'
|
read -r -d '' NEW_BLOCK <<'EOF'
|
||||||
protocol lmtp {
|
protocol lmtp {
|
||||||
|
|
||||||
|
# The From address from which email rejection messages (bounces) are sent.
|
||||||
|
#
|
||||||
|
# Default postmaster@%{user|domain|default(hostname)}
|
||||||
|
#
|
||||||
|
# As used here, %{user | domain} expands to the domain of the local user. Other Mail user
|
||||||
|
# variables can be used as well.
|
||||||
|
# see: https://doc.dovecot.org/2.4.1/core/settings/variables.html#mail-user-variables
|
||||||
|
postmaster_address = ${postmaster_address}
|
||||||
|
|
||||||
# A list of mail plugins to load.
|
# A list of mail plugins to load.
|
||||||
#
|
#
|
||||||
# The boolean list can be configured as a space or comma-separated list, which replaces
|
# The boolean list can be configured as a space or comma-separated list, which replaces
|
||||||
@ -6952,7 +7071,7 @@ protocol lmtp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
replace_or_append_code_block "protocol lda" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
|
replace_or_append_code_block "protocol lda" "${NEW_BLOCK}" "${_conf_file}" 2> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
|
||||||
if ! $_failed ; then
|
if ! $_failed ; then
|
||||||
@ -7004,8 +7123,102 @@ _conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/20-imap.conf"
|
|||||||
if [[ $dovecot_major_version -gt 2 ]] \
|
if [[ $dovecot_major_version -gt 2 ]] \
|
||||||
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
||||||
|
|
||||||
|
# edit /usr/local/dovecot/etc/dovecot/conf.d/20-imap.conf
|
||||||
|
#
|
||||||
|
# imap_client_workarounds = delay-newmail
|
||||||
|
#
|
||||||
|
# protocol imap {
|
||||||
|
#
|
||||||
|
# mail_plugins = $mail_plugins imap_quota
|
||||||
|
# mail_max_userip_connections = $max_userip_connections
|
||||||
|
#
|
||||||
|
# ssl_client {
|
||||||
|
# cert_file = $imap_cert
|
||||||
|
# key_file = $imap_key
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# }
|
||||||
|
|
||||||
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
||||||
echo -e "$rc_not_yet_implemented"
|
|
||||||
|
if grep -qE "^\s*imap_client_workarounds\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
|
replace_variable "imap_client_workarounds" "delay-newmail" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
# Workarounds for various IMAP client bugs can be enabled here.
|
||||||
|
#
|
||||||
|
# The following values are currently supported:
|
||||||
|
#
|
||||||
|
# delay-newmail
|
||||||
|
# EXISTS/RECENT new-mail notifications are sent only in replies to NOOP and CHECK
|
||||||
|
# commands. Some clients, such as pre-2.1 versions of Mac OS X Mail, ignore them
|
||||||
|
# otherwise, and, worse, Outlook Express may report that the message is no longer
|
||||||
|
# on the server (note that the workaround does not help for OE6 if synchronization
|
||||||
|
# is set to Headers Only).
|
||||||
|
# tb-extra-mailbox-sep
|
||||||
|
# Because mailbox_list_layout = fs (mbox and dbox) confuses Thunderbird, causing
|
||||||
|
# extra / suffixes to mailbox names, Dovecot can be told to ignore the superfluous
|
||||||
|
# character instead of judging the mailbox name to be invalid.
|
||||||
|
# tb-lsub-flags
|
||||||
|
# Without this workaround, Thunderbird doesn't immediately recognize that LSUB
|
||||||
|
# replies with mailbox_list_layout = fs aren't selectable, and users may receive
|
||||||
|
# pop-ups with not selectable errors. Showing \Noselect flags for these replies
|
||||||
|
# (e.g., in mbox use) causes them to be grayed out.
|
||||||
|
imap_client_workarounds = delay-newmail
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
read -r -d '' NEW_BLOCK <<EOF
|
||||||
|
protocol imap {
|
||||||
|
|
||||||
|
# The maximum number of IMAP connections allowed for a user from each IP address.
|
||||||
|
#
|
||||||
|
# This setting is checked only by backends, not proxies.
|
||||||
|
#
|
||||||
|
# Note that for this to work, any username changes must be done already by
|
||||||
|
# passdb lookup (not by userdb lookup).
|
||||||
|
#
|
||||||
|
# Unique users are identified via case-sensitive comparison.
|
||||||
|
mail_max_userip_connections = $max_userip_connections
|
||||||
|
|
||||||
|
# A list of mail plugins to load.
|
||||||
|
mail_plugins = \$mail_plugins imap_quota
|
||||||
|
|
||||||
|
ssl_client {
|
||||||
|
cert_file = $imap_cert
|
||||||
|
key_file = $imap_key
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
replace_or_append_code_block "protocol imap" "${NEW_BLOCK}" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
|
||||||
|
if ! $_failed ; then
|
||||||
|
echo -e "$rc_done"
|
||||||
|
else
|
||||||
|
echo -e "$rc_failed"
|
||||||
|
error "Adjusting Adjusting file ${_conf_file} failed"
|
||||||
|
error "$(cat "${log_file}")"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interupted by user"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -7045,7 +7258,77 @@ if [[ $dovecot_major_version -gt 2 ]] \
|
|||||||
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
||||||
|
|
||||||
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
||||||
echo -e "$rc_not_yet_implemented"
|
|
||||||
|
# edit /usr/local/dovecot/etc/dovecot/conf.d/20-pop3.conf
|
||||||
|
#
|
||||||
|
# pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
|
||||||
|
#
|
||||||
|
# protocol pop3 {
|
||||||
|
# ssl_client {
|
||||||
|
# cert_file = $imap_cert
|
||||||
|
# key_file = $imap_key
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
if grep -qE "^\s*pop3_client_workarounds\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
|
replace_variable "pop3_client_workarounds" "outlook-no-nuls oe-ns-eoh" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
# Workarounds for various POP3 client bugs can be enabled here.
|
||||||
|
#
|
||||||
|
# The following values are currently supported:
|
||||||
|
#
|
||||||
|
# oe-ns-eoh
|
||||||
|
# Because Outlook Express and Netscape Mail expect an end-of-headers line,
|
||||||
|
# this option sends one explicitly if none has been sent.
|
||||||
|
# outlook-no-nuls
|
||||||
|
# Because Outlook and Outlook Express hang if messages contain NUL characters,
|
||||||
|
# this setting replaces each of them with a 0x80 character.
|
||||||
|
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
read -r -d '' NEW_BLOCK <<EOF
|
||||||
|
protocol pop3 {
|
||||||
|
|
||||||
|
# A list of mail plugins to load.
|
||||||
|
mail_plugins = \$mail_plugins
|
||||||
|
|
||||||
|
ssl_client {
|
||||||
|
cert_file = $pop_cert
|
||||||
|
key_file = $pop_key
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
replace_or_append_code_block "protocol pop3" "${NEW_BLOCK}" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
|
||||||
|
if ! $_failed ; then
|
||||||
|
echo -e "$rc_done"
|
||||||
|
else
|
||||||
|
echo -e "$rc_failed"
|
||||||
|
error "Adjusting Adjusting file ${_conf_file} failed"
|
||||||
|
error "$(cat "${log_file}")"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interupted by user"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -7130,7 +7413,203 @@ if [[ $dovecot_major_version -gt 2 ]] \
|
|||||||
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
||||||
|
|
||||||
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
echononl " Adjusting file '$(basename "${_conf_file}")'.."
|
||||||
echo -e "$rc_not_yet_implemented"
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*sieve_script\s+personal\s*{" "${_conf_file}"; then
|
||||||
|
|
||||||
|
read -r -d '' NEW_BLOCK <<EOF
|
||||||
|
|
||||||
|
sieve_script personal {
|
||||||
|
driver = file
|
||||||
|
path = ~/sieve
|
||||||
|
active_path = ~/.dovecot.sieve
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
replace_or_append_code_block "sieve_script personal" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2> "${log_file}"
|
||||||
|
|
||||||
|
# personal
|
||||||
|
# --------
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# The LDA Sieve plugin uses the personal storage to find the active script for Sieve filtering
|
||||||
|
# at delivery. If the storage supports storing more than a single script (e.g. the file
|
||||||
|
# storage does), personal scripts can also be retrieved by name. The Sieve include extension
|
||||||
|
# will then use this storage for retrieving :personal scripts and the ManageSieve service will
|
||||||
|
# be able to store the user's scripts there.
|
||||||
|
#
|
||||||
|
# If the storage supports storing more than a single script, only one of those scripts will be
|
||||||
|
# the active script used at delivery. The active script can be managed by the user through the
|
||||||
|
# ManageSieve service. If the personal storage has no active script, the default script will
|
||||||
|
# be executed if configured.
|
||||||
|
#
|
||||||
|
# If no personal storage is defined explicitly, auto-detection will be attempted. This is
|
||||||
|
# currently only trying the [[link,sieve_storage_file,file storage driver], which looks for
|
||||||
|
# a ~/.dovecot.sieve script file or a directory at ~/sieve/ containing script files. In the
|
||||||
|
# latter case ~/.dovecot.sieve is expected to be a symbolic link pointing to the active script
|
||||||
|
# file. If auto-detection also finds no personal storage, Sieve processing will be skipped and
|
||||||
|
# no default script is executed.
|
||||||
|
|
||||||
|
sieve_script personal {
|
||||||
|
driver = file
|
||||||
|
path = ~/sieve
|
||||||
|
active_path = ~/.dovecot.sieve
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*sieve_script\s+before\s*{" "${_conf_file}"; then
|
||||||
|
|
||||||
|
read -r -d '' NEW_BLOCK <<EOF
|
||||||
|
|
||||||
|
sieve_script 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
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2> "${log_file}"
|
||||||
|
|
||||||
|
# after
|
||||||
|
# -----
|
||||||
|
#
|
||||||
|
# An after storage is the source of one script or several scripts that are to be executed after
|
||||||
|
# the user's personal script. If the storage supports storing more than a single script, these
|
||||||
|
# scripts will be executed in a well-defined order defined by the storage driver. Multiple after
|
||||||
|
# storages can be configured and each storage will be accessed in sequence to retrieve scripts
|
||||||
|
# for execution after the personal script. The storages will be accessed in the order these
|
||||||
|
# storages are defined in the configuration, unless the order is overridden by the
|
||||||
|
# sieve_script_precedence setting.
|
||||||
|
#
|
||||||
|
# This is usually a global script, so be sure to pre-compile the specified script manually in
|
||||||
|
# that case using the sievec command line tool, as explained by sievec(1).
|
||||||
|
#
|
||||||
|
# before
|
||||||
|
# ------
|
||||||
|
#
|
||||||
|
# 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 {
|
||||||
|
driver = file
|
||||||
|
path = /usr/local/dovecot/etc/dovecot/sieve/
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*sieve_script\s+global\s*{" "${_conf_file}"; then
|
||||||
|
|
||||||
|
read -r -d '' NEW_BLOCK <<EOF
|
||||||
|
|
||||||
|
sieve_script 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
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2> "${log_file}"
|
||||||
|
|
||||||
|
# default
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# The default storage yields the sieve script that gets executed only if the user's personal
|
||||||
|
# Sieve script does not exist. Although more than a single default storage can be defined,
|
||||||
|
# only the first one listed in the configuration is used.
|
||||||
|
#
|
||||||
|
# If sieve_script_name is set for this script storage, the default script can be seen and
|
||||||
|
# accessed by this name through ManageSieve (and doveadm sieve). See below (Sieve visible
|
||||||
|
# default script).
|
||||||
|
#
|
||||||
|
# This is usually a global script, so be sure to pre-compile the specified script manually in
|
||||||
|
# that case using the sievec command line tool, as explained by sievec(1).
|
||||||
|
#
|
||||||
|
# discard
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# The discard storage yields the sieve script that gets executed for any message that is about
|
||||||
|
# to be discarded; i.e., it is not delivered anywhere by the normal Sieve execution. Although
|
||||||
|
# more than a single discard storage can be defined, only the first one listed in the
|
||||||
|
# configuration is used. The discard storage is currently only applicable for message delivery.
|
||||||
|
#
|
||||||
|
# The script from the discard storage is only executed when the "implicit keep" is canceled,
|
||||||
|
# by e.g. the "discard" action, and no actions that deliver the message are executed. Delivery
|
||||||
|
# in this case means both local delivery to a mailbox and redirection to a remote recipient.
|
||||||
|
# This "discard script" can prevent discarding the message, by executing alternative actions.
|
||||||
|
# If the discard script does nothing, the message is still discarded as it would be when no
|
||||||
|
# scard script is configured.
|
||||||
|
#
|
||||||
|
# global
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# A global storage is the source of :global include scripts for the Sieve include extension.
|
||||||
|
# Scripts are accessed by name, so if the storage yields only one script, a name must be
|
||||||
|
# defined for it; either implicitly by the storage driver or explicitly using sieve_script_name.
|
||||||
|
# Multiple global storages can be configured and each storage will be queried in sequence to
|
||||||
|
# retrieve the requested script by name. The storages will be queried in the order these
|
||||||
|
# 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 {
|
||||||
|
driver = file
|
||||||
|
path = /usr/local/dovecot/etc/dovecot/sieve/global/
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if ! $_failed ; then
|
||||||
|
echo -e "$rc_done"
|
||||||
|
else
|
||||||
|
echo -e "$rc_failed"
|
||||||
|
error "Adjusting Adjusting file ${_conf_file} failed"
|
||||||
|
error "$(cat "${log_file}")"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interupted by user"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -7170,20 +7649,193 @@ fi # edit /usr/local/dovecot/etc/dovecot/conf.d/90-sieve.conf
|
|||||||
# Add Setting for included Pigeonhole Sieve: Vacation Extension
|
# Add Setting for included Pigeonhole Sieve: Vacation Extension
|
||||||
#
|
#
|
||||||
_failed=false
|
_failed=false
|
||||||
_conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/90-sieve.conf"
|
|
||||||
if [[ $dovecot_major_version -gt 2 ]] \
|
if [[ $dovecot_major_version -gt 2 ]] \
|
||||||
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
|| ( [[ $dovecot_major_version -eq 2 ]] && [[ $dovecot_minor_version -gt 3 ]] ); then
|
||||||
|
|
||||||
|
_conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/95-sieve-vacation.conf"
|
||||||
|
|
||||||
|
# edit /usr/local/dovecot/etc/dovecot/conf.d/95-sieve-vacation.conf
|
||||||
|
#
|
||||||
|
# sieve_extensions {
|
||||||
|
# vacation-seconds = yes
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# # One hour at minimum
|
||||||
|
# sieve_vacation_min_period = 1h
|
||||||
|
#
|
||||||
|
# # Ten days default
|
||||||
|
# sieve_vacation_default_period = 10d
|
||||||
|
#
|
||||||
|
# # Thirty days at maximum
|
||||||
|
# sieve_vacation_max_period = 30d
|
||||||
|
|
||||||
echononl " Add Setting for included Pigeonhole Sieve: Vacation Extension'.."
|
echononl " Add Setting for included Pigeonhole Sieve: Vacation Extension'.."
|
||||||
echo -e "$rc_not_yet_implemented"
|
|
||||||
|
read -r -d '' NEW_BLOCK <<EOF
|
||||||
|
|
||||||
|
sieve_extensions {
|
||||||
|
vacation-seconds = yes
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
replace_or_append_code_block "sieve_extensions" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
|
||||||
|
if [[ $? -gt 0 ]]; then
|
||||||
|
_failed=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
_replace_key="sieve_vacation_min_period"
|
||||||
|
_replace_val="1h"
|
||||||
|
|
||||||
|
read -r -d '' COMMENT_BLOCK <<EOF
|
||||||
|
# sieve_vacation_min_period
|
||||||
|
#
|
||||||
|
# Default 1d
|
||||||
|
# Value time
|
||||||
|
#
|
||||||
|
# Specifies the minimum period that can be specified for the :days and :seconds
|
||||||
|
# tags of the vacation command.
|
||||||
|
#
|
||||||
|
# A minimum of 0 indicates that users are allowed to make the Sieve interpreter send
|
||||||
|
# a vacation response message for every incoming message that meets the other reply
|
||||||
|
# criteria (refer to RFC 5230). A value of zero is not recommended.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*${_replace_key}\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
|
replace_variable "${_replace_key}" "${_replace_val}" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
${COMMENT_BLOCK}
|
||||||
|
${_replace_key} = ${_replace_val}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
_replace_key="sieve_vacation_default_period"
|
||||||
|
_replace_val="10d"
|
||||||
|
|
||||||
|
read -r -d '' COMMENT_BLOCK <<EOF
|
||||||
|
# sieve_vacation_min_period
|
||||||
|
#
|
||||||
|
# Default 7d
|
||||||
|
# Value time
|
||||||
|
#
|
||||||
|
# Specifies the default period that is used when no :days or :seconds tag is specified.
|
||||||
|
#
|
||||||
|
# The configured value must lie between sieve_vacation_min_period and
|
||||||
|
# sieve_vacation_max_period.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*${_replace_key}\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
|
replace_variable "${_replace_key}" "${_replace_val}" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
${COMMENT_BLOCK}
|
||||||
|
${_replace_key} = ${_replace_val}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
_replace_key="sieve_vacation_max_period"
|
||||||
|
_replace_val="60d"
|
||||||
|
|
||||||
|
read -r -d '' COMMENT_BLOCK <<EOF
|
||||||
|
# sieve_vacation_min_period
|
||||||
|
#
|
||||||
|
# Default 60d
|
||||||
|
# Value time
|
||||||
|
#
|
||||||
|
# Specifies the maximum period that can be specified for the :days tag of the
|
||||||
|
# vacation command.
|
||||||
|
#
|
||||||
|
# The configured value must be larger than sieve_vacation_min_period.
|
||||||
|
#
|
||||||
|
# A value of 0 has a special meaning: it indicates that there is no upper limit.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*${_replace_key}\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
|
replace_variable "${_replace_key}" "${_replace_val}" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
${COMMENT_BLOCK}
|
||||||
|
${_replace_key} = ${_replace_val}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
_replace_key="sieve_vacation_send_from_recipient"
|
||||||
|
_replace_val="yes"
|
||||||
|
|
||||||
|
read -r -d '' COMMENT_BLOCK <<EOF
|
||||||
|
# sieve_vacation_min_period
|
||||||
|
#
|
||||||
|
# Default no
|
||||||
|
# Value boolean
|
||||||
|
#
|
||||||
|
# This setting determines whether vacation messages are sent with the SMTP MAIL FROM
|
||||||
|
# envelope address set to the recipient address of the Sieve script owner.
|
||||||
|
#
|
||||||
|
# Normally this is set to <>, which is the default as recommended in the specification.
|
||||||
|
# This is meant to prevent mail loops. However, there are situations for which a valid
|
||||||
|
# sender address is required and this setting can be used to accommodate for those.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
if grep -qE "^\s*${_replace_key}\s*=" "${_conf_file}"; then
|
||||||
|
|
||||||
|
replace_variable "${_replace_key}" "${_replace_val}" "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
cat <<EOF >> "${_conf_file}" 2>> "${log_file}" || _failed=true
|
||||||
|
|
||||||
|
${COMMENT_BLOCK}
|
||||||
|
${_replace_key} = ${_replace_val}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if ! $_failed ; then
|
||||||
|
echo -e "$rc_done"
|
||||||
|
else
|
||||||
|
echo -e "$rc_failed"
|
||||||
|
error "Adjusting Adjusting file ${_conf_file} failed"
|
||||||
|
error "$(cat "${log_file}")"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interupted by user"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
_conf_file="/usr/local/dovecot-${_version}/etc/dovecot/conf.d/90-sieve.conf"
|
||||||
|
|
||||||
# - Add Setting from Pigeonhole Sieve: Vacation Extension
|
# - Add Setting from Pigeonhole Sieve: Vacation Extension
|
||||||
# -
|
# -
|
||||||
echononl " Add Setting for included Pigeonhole Sieve: Vacation Extension"
|
echononl " Add Setting for included Pigeonhole Sieve: Vacation Extension"
|
||||||
|
|
||||||
|
_found=false
|
||||||
_tmp_file="/tmp/dovecot_conf_90-sieve.conf"
|
_tmp_file="/tmp/dovecot_conf_90-sieve.conf"
|
||||||
cp -a "/usr/local/dovecot-${_version}/etc/dovecot/conf.d/90-sieve.conf" "$_tmp_file" > /dev/null 2>&1
|
#cp -a "/usr/local/dovecot-${_version}/etc/dovecot/conf.d/90-sieve.conf" "$_tmp_file" > /dev/null 2>&1
|
||||||
:> $_tmp_file
|
:> $_tmp_file
|
||||||
while IFS='' read -r _line || [[ -n $_line ]] ; do
|
while IFS='' read -r _line || [[ -n $_line ]] ; do
|
||||||
|
|
||||||
@ -8305,61 +8957,16 @@ if [[ $dovecot_major_version -gt 2 ]] \
|
|||||||
|
|
||||||
if [[ "$db_driver" = "pgsql" ]]; then
|
if [[ "$db_driver" = "pgsql" ]]; then
|
||||||
|
|
||||||
read -r -d '' NEW_BLOCK <<'EOF'
|
|
||||||
passdb sql {
|
|
||||||
|
|
||||||
# Load SQL connection data
|
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT '/var/vmail/' || maildir AS home, \
|
|
||||||
'5000' AS uid, '5000' AS gid \
|
|
||||||
'*:bytes=' || quota AS quota_rule \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
if grep -qE "^\s*passdb\s+sql\s+{" "${_conf_file}"; then
|
|
||||||
|
|
||||||
replace_code_block "passdb" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
|
|
||||||
|
|
||||||
else
|
|
||||||
cat <<EOF >> "${_conf_file}" || _failed=true
|
|
||||||
|
|
||||||
# Dovecot uses passdb and userdb as part of the authentication process.
|
|
||||||
#
|
|
||||||
# passdb authenticates the user. It also provides any other pre-login information
|
|
||||||
# needed for users, such as:
|
|
||||||
#
|
|
||||||
# - Which server user is proxied to.
|
|
||||||
# - If user should be allowed to log in at all (temporarily or permanently).
|
|
||||||
#
|
|
||||||
# Passdb Lookups Dovecot Proxy Dovecot Backend
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
# IMAP & POP3 logins YES YES
|
|
||||||
# LMTP mail delivery YES YES
|
|
||||||
# doveadm commands YES YES
|
|
||||||
#
|
|
||||||
# see also: https://doc.dovecot.org/2.4.1/core/config/auth/passdb.html
|
|
||||||
#
|
|
||||||
$(echo -e "${NEW_BLOCK}")
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
read -r -d '' NEW_BLOCK <<'EOF'
|
read -r -d '' NEW_BLOCK <<'EOF'
|
||||||
userdb sql {
|
userdb sql {
|
||||||
|
|
||||||
# Load SQL connection data
|
# Load SQL connection data
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
query = SELECT '/var/vmail/' || maildir AS home, \\
|
||||||
FROM mailbox \
|
'5000' AS uid, '5000' AS gid, \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT '/var/vmail/' || maildir AS home, \
|
'*:bytes=' || quota AS quota_rule \\
|
||||||
'5000' AS uid, '5000' AS gid, \
|
FROM mailbox \\
|
||||||
'*:bytes=' || quota AS quota_rule \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
iterate_query = SELECT username AS user FROM mailbox
|
iterate_query = SELECT username AS user FROM mailbox
|
||||||
@ -8368,7 +8975,7 @@ userdb sql {
|
|||||||
EOF
|
EOF
|
||||||
if grep -qE "^\s*userdb sql\s+{" "${_conf_file}"; then
|
if grep -qE "^\s*userdb sql\s+{" "${_conf_file}"; then
|
||||||
|
|
||||||
replace_code_block "userdb" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
|
replace_code_block "userdb sql" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
|
||||||
|
|
||||||
else
|
else
|
||||||
cat <<EOF >> "${_conf_file}" || _failed=true
|
cat <<EOF >> "${_conf_file}" || _failed=true
|
||||||
@ -8394,64 +9001,19 @@ EOF
|
|||||||
#
|
#
|
||||||
# see: https://doc.dovecot.org/2.4.1/core/config/auth/userdb.html
|
# see: https://doc.dovecot.org/2.4.1/core/config/auth/userdb.html
|
||||||
#
|
#
|
||||||
$(echo -e "${NEW_BLOCK}")
|
${NEW_BLOCK}
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [[ "$db_driver" = "mysql" ]]; then
|
elif [[ "$db_driver" = "mysql" ]]; then
|
||||||
|
|
||||||
read -r -d '' NEW_BLOCK <<'EOF'
|
|
||||||
passdb sql {
|
|
||||||
|
|
||||||
# Load SQL connection data
|
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \
|
|
||||||
'5000' AS uid, '5000' AS gid, \
|
|
||||||
CONCAT('*:bytes=',quota) AS quota_rule \
|
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
if grep -qE "^\s*passdb\s+sql\s+{" "${_conf_file}"; then
|
|
||||||
|
|
||||||
replace_code_block "passdb sql" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
|
|
||||||
|
|
||||||
else
|
|
||||||
cat <<EOF >> "${_conf_file}" || _failed=true
|
|
||||||
|
|
||||||
# Dovecot uses passdb and userdb as part of the authentication process.
|
|
||||||
#
|
|
||||||
# passdb authenticates the user. It also provides any other pre-login information
|
|
||||||
# needed for users, such as:
|
|
||||||
#
|
|
||||||
# - Which server user is proxied to.
|
|
||||||
# - If user should be allowed to log in at all (temporarily or permanently).
|
|
||||||
#
|
|
||||||
# Passdb Lookups Dovecot Proxy Dovecot Backend
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
# IMAP & POP3 logins YES YES
|
|
||||||
# LMTP mail delivery YES YES
|
|
||||||
# doveadm commands YES YES
|
|
||||||
#
|
|
||||||
# see also: https://doc.dovecot.org/2.4.1/core/config/auth/passdb.html
|
|
||||||
#
|
|
||||||
$(echo -e "${NEW_BLOCK}")
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
read -r -d '' NEW_BLOCK <<'EOF'
|
read -r -d '' NEW_BLOCK <<'EOF'
|
||||||
userdb sql {
|
userdb sql {
|
||||||
|
|
||||||
# Load SQL connection data
|
# Load SQL connection data
|
||||||
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
!include /usr/local/dovecot-2.4.1-4/etc/dovecot/sql-connect.conf.ext
|
||||||
|
|
||||||
query = SELECT username AS user, password \
|
query = SELECT CONCAT('/var/vmail/',maildir) AS home, \
|
||||||
FROM mailbox \
|
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \
|
|
||||||
'5000' AS uid, '5000' AS gid, \
|
'5000' AS uid, '5000' AS gid, \
|
||||||
CONCAT('*:bytes=',quota) AS quota_rule \
|
CONCAT('*:bytes=',quota) AS quota_rule \
|
||||||
FROM mailbox \
|
FROM mailbox \
|
||||||
@ -8536,7 +9098,9 @@ connect = host=$dbhost user=$dbuser password=$dbpassword dbname=$dbname
|
|||||||
default_pass_scheme = $default_pass_scheme
|
default_pass_scheme = $default_pass_scheme
|
||||||
password_query = SELECT username AS user, password \\
|
password_query = SELECT username AS user, password \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT '/var/vmail/' || maildir AS home, \\
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
|
user_query = SELECT '/var/vmail/' || maildir AS home, \\
|
||||||
'5000' AS uid, '5000' AS gid, \\
|
'5000' AS uid, '5000' AS gid, \\
|
||||||
'*:bytes=' || quota AS quota_rule \\
|
'*:bytes=' || quota AS quota_rule \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
@ -8562,7 +9126,9 @@ connect = host=$dbhost user=$dbuser password=$dbpassword dbname=$dbname
|
|||||||
default_pass_scheme = $default_pass_scheme
|
default_pass_scheme = $default_pass_scheme
|
||||||
password_query = SELECT username AS user, password \\
|
password_query = SELECT username AS user, password \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
WHERE username = '%u' AND active = true user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \\
|
WHERE username = '%u' AND active = true
|
||||||
|
|
||||||
|
user_query = SELECT CONCAT('/var/vmail/',maildir) AS home, \\
|
||||||
'5000' AS uid, '5000' AS gid, \\
|
'5000' AS uid, '5000' AS gid, \\
|
||||||
CONCAT('*:bytes=',quota) AS quota_rule \\
|
CONCAT('*:bytes=',quota) AS quota_rule \\
|
||||||
FROM mailbox \\
|
FROM mailbox \\
|
||||||
|
Reference in New Issue
Block a user